about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-09-05 20:50:10 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-09-11 00:13:41 -0700
commit11e9c48353a6fcbfd036e5ee58b1d4b5f572d7eb (patch)
tree0fe567f92d372b3d756a9e935ca35a82fee514bb /src/libsyntax
parent19a6fabad8e43a81617182eba24fb80e33da8e52 (diff)
downloadrust-11e9c48353a6fcbfd036e5ee58b1d4b5f572d7eb.tar.gz
rust-11e9c48353a6fcbfd036e5ee58b1d4b5f572d7eb.zip
Flag unsafe blocks from format! as compiler-generated
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs8
-rw-r--r--src/libsyntax/ext/ifmt.rs2
-rw-r--r--src/libsyntax/parse/parser.rs2
3 files changed, 9 insertions, 3 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 63a6e936550..ef2e557b6ea 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -479,7 +479,13 @@ pub struct Field {
 #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
 pub enum BlockCheckMode {
     DefaultBlock,
-    UnsafeBlock(/* generated internally */ bool),
+    UnsafeBlock(UnsafeSource),
+}
+
+#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
+pub enum UnsafeSource {
+    CompilerGenerated,
+    UserProvided,
 }
 
 #[deriving(Clone, Eq, Encodable, Decodable,IterBytes)]
diff --git a/src/libsyntax/ext/ifmt.rs b/src/libsyntax/ext/ifmt.rs
index b7722ffc297..486069db4f0 100644
--- a/src/libsyntax/ext/ifmt.rs
+++ b/src/libsyntax/ext/ifmt.rs
@@ -632,7 +632,7 @@ impl Context {
            stmts: ~[],
            expr: Some(result),
            id: ast::DUMMY_NODE_ID,
-           rules: ast::UnsafeBlock,
+           rules: ast::UnsafeBlock(ast::CompilerGenerated),
            span: self.fmtsp,
         });
 
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index b0bcc91f962..b5772a9eede 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1792,7 +1792,7 @@ impl Parser {
         } else if self.eat_keyword(keywords::Match) {
             return self.parse_match_expr();
         } else if self.eat_keyword(keywords::Unsafe) {
-            return self.parse_block_expr(lo, UnsafeBlock(false));
+            return self.parse_block_expr(lo, UnsafeBlock(ast::UserProvided));
         } else if *self.token == token::LBRACKET {
             self.bump();
             let mutbl = self.parse_mutability();