diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-08-28 23:47:26 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-09-11 00:13:22 -0700 |
| commit | 19a6fabad8e43a81617182eba24fb80e33da8e52 (patch) | |
| tree | 25ff3085a8f251bc1298aecca1d3bb9c247d8237 /src/libsyntax | |
| parent | ba9fa89bfb4aae53db93e9ecac31807af96356fc (diff) | |
| download | rust-19a6fabad8e43a81617182eba24fb80e33da8e52.tar.gz rust-19a6fabad8e43a81617182eba24fb80e33da8e52.zip | |
Implement the notion of a "generated unsafe block"
This way syntax extensions can generate unsafe blocks without worrying about them generating unnecessary unsafe warnings. Perhaps a special keyword could be added to be used in macros, but I don't think that's the best solution.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 8d557125d37..63a6e936550 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -479,7 +479,7 @@ pub struct Field { #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub enum BlockCheckMode { DefaultBlock, - UnsafeBlock, + UnsafeBlock(/* generated internally */ bool), } #[deriving(Clone, Eq, Encodable, Decodable,IterBytes)] diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 4adc34d75a7..b0bcc91f962 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); + return self.parse_block_expr(lo, UnsafeBlock(false)); } else if *self.token == token::LBRACKET { self.bump(); let mutbl = self.parse_mutability(); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 55f052d769d..9b9b157c9d8 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -951,7 +951,7 @@ pub fn print_possibly_embedded_block_(s: @ps, attrs: &[ast::Attribute], close_box: bool) { match blk.rules { - ast::UnsafeBlock => word_space(s, "unsafe"), + ast::UnsafeBlock(*) => word_space(s, "unsafe"), ast::DefaultBlock => () } maybe_print_comment(s, blk.span.lo); |
