Auto merge of #45985 - arielb1:unsafe-dedup, r=eddyb

check_unsafety: fix unused unsafe block duplication

The duplicate error message is later removed by error message
deduplication, but it still appears on beta and is still a bug.

r? @eddyb
This commit is contained in:
bors 2017-11-16 08:31:59 +00:00
commit edd9dbcdbb
2 changed files with 9 additions and 9 deletions

View File

@ -127,7 +127,6 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
let UnsafetyCheckResult {
violations, unsafe_blocks
} = self.tcx.unsafety_check_result(def_id);
self.inherited_blocks.extend(unsafe_blocks.iter().cloned());
self.register_violations(&violations, &unsafe_blocks);
}
}

View File

@ -36,15 +36,16 @@ error: unnecessary `unsafe` block
| |_________________^ unnecessary `unsafe` block
|
note: because it's nested under this `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:17:13
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:15:5
|
17 | / unsafe {
15 | / unsafe {
16 | | let f = |v: &mut Vec<_>| {
17 | | unsafe {
18 | | v.set_len(24);
19 | | |w: &mut Vec<u32>| { unsafe {
20 | | w.set_len(32);
21 | | } };
22 | | }
| |_____________^
... |
29 | | f(&mut v);
30 | | }
| |_____^
error: unnecessary `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:23:34
@ -67,5 +68,5 @@ note: because it's nested under this `unsafe` block
30 | | }
| |_____^
error: aborting due to 6 previous errors
error: aborting due to 3 previous errors