]> git.lizzy.rs Git - rust.git/commit
Support unchecked blocks
authorTim Chevalier <chevalier@alum.wellesley.edu>
Fri, 26 Aug 2011 00:42:38 +0000 (17:42 -0700)
committerTim Chevalier <chevalier@alum.wellesley.edu>
Fri, 26 Aug 2011 01:28:23 +0000 (18:28 -0700)
commitf841e894437843c142ebd7e0b0a18ed00ed52457
treefac7eed5de504e4246754bd7eea9a2e25c055090
parentd9bc3cb10c4d1e856998c8e35ce7d89e0d74f4d6
Support unchecked blocks

This patch supports the syntax

    unchecked {
      ...
    }

    to disable purity checking within a block. Presumably it will only be
    used within a declared "pure fn". However, there is no checking that it
    doesn't occur elsewhere, and it would be harmless for it to do so.

    I went with Lindsey's suggestion for the syntax, but it's subject to
    change.

    This allows you to write code that uses predicates that call arbitrary
    Rust functions, but you must declare your intentions by wrapping it in
    an unchecked { ... } block. The test case run-pass/unchecked-predicates.rs
    demonstrates how to do that.
src/comp/front/config.rs
src/comp/front/test.rs
src/comp/middle/typeck.rs
src/comp/syntax/ast.rs
src/comp/syntax/ast_util.rs
src/comp/syntax/fold.rs
src/comp/syntax/parse/parser.rs
src/comp/syntax/print/pprust.rs