Skip to content

Commit 41e5f9c

Browse files
committed
---
yaml --- r: 144939 b: refs/heads/try2 c: 19a6fab h: refs/heads/master i: 144937: f1a4604 144935: 764119b v: v3
1 parent 743911f commit 41e5f9c

File tree

7 files changed

+12
-8
lines changed

7 files changed

+12
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: ba9fa89bfb4aae53db93e9ecac31807af96356fc
8+
refs/heads/try2: 19a6fabad8e43a81617182eba24fb80e33da8e52
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/effect.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ impl Visitor<()> for EffectCheckVisitor {
102102
fn visit_block(&mut self, block:&Block, _:()) {
103103

104104
let old_unsafe_context = self.context.unsafe_context;
105-
if block.rules == ast::UnsafeBlock &&
106-
self.context.unsafe_context == SafeContext {
105+
let is_unsafe = match block.rules {
106+
ast::UnsafeBlock(*) => true, ast::DefaultBlock => false
107+
};
108+
if is_unsafe && self.context.unsafe_context == SafeContext {
107109
self.context.unsafe_context = UnsafeBlock(block.id)
108110
}
109111

branches/try2/src/librustc/middle/lint.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,9 @@ impl Visitor<@mut Context> for UnusedUnsafeLintVisitor {
11311131
fn visit_expr(&mut self, e:@ast::Expr, cx:@mut Context) {
11321132

11331133
match e.node {
1134-
ast::ExprBlock(ref blk) if blk.rules == ast::UnsafeBlock => {
1134+
// Don't warn about generated blocks, that'll just pollute the
1135+
// output.
1136+
ast::ExprBlock(ref blk) if blk.rules == ast::UnsafeBlock(false) => {
11351137
if !cx.tcx.used_unsafe.contains(&blk.id) {
11361138
cx.span_lint(unused_unsafe, blk.span,
11371139
"unnecessary `unsafe` block");

branches/try2/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl PurityState {
200200

201201
purity => {
202202
let (purity, def) = match blk.rules {
203-
ast::UnsafeBlock => (ast::unsafe_fn, blk.id),
203+
ast::UnsafeBlock(*) => (ast::unsafe_fn, blk.id),
204204
ast::DefaultBlock => (purity, self.def),
205205
};
206206
PurityState{ def: def,

branches/try2/src/libsyntax/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ pub struct Field {
479479
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
480480
pub enum BlockCheckMode {
481481
DefaultBlock,
482-
UnsafeBlock,
482+
UnsafeBlock(/* generated internally */ bool),
483483
}
484484

485485
#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)]

branches/try2/src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,7 @@ impl Parser {
17921792
} else if self.eat_keyword(keywords::Match) {
17931793
return self.parse_match_expr();
17941794
} else if self.eat_keyword(keywords::Unsafe) {
1795-
return self.parse_block_expr(lo, UnsafeBlock);
1795+
return self.parse_block_expr(lo, UnsafeBlock(false));
17961796
} else if *self.token == token::LBRACKET {
17971797
self.bump();
17981798
let mutbl = self.parse_mutability();

branches/try2/src/libsyntax/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ pub fn print_possibly_embedded_block_(s: @ps,
951951
attrs: &[ast::Attribute],
952952
close_box: bool) {
953953
match blk.rules {
954-
ast::UnsafeBlock => word_space(s, "unsafe"),
954+
ast::UnsafeBlock(*) => word_space(s, "unsafe"),
955955
ast::DefaultBlock => ()
956956
}
957957
maybe_print_comment(s, blk.span.lo);

0 commit comments

Comments
 (0)