Skip to content

Commit e33cb9f

Browse files
committed
Update MIR opt and incremental tests for THIR unsafeck
1 parent 77b19d9 commit e33cb9f

File tree

133 files changed

+329
-666
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+329
-666
lines changed

compiler/rustc_mir_build/src/check_unsafety.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_session::lint::builtin::{UNSAFE_OP_IN_UNSAFE_FN, UNUSED_UNSAFE};
1111
use rustc_session::lint::Level;
1212
use rustc_span::def_id::{DefId, LocalDefId};
1313
use rustc_span::symbol::Symbol;
14-
use rustc_span::Span;
14+
use rustc_span::{sym, Span};
1515

1616
use std::mem;
1717
use std::ops::Bound;
@@ -841,7 +841,8 @@ impl UnsafeOpKind {
841841

842842
pub fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) {
843843
// Closures and inline consts are handled by their owner, if it has a body
844-
if tcx.is_typeck_child(def.to_def_id()) {
844+
// Don't safety check custom MIR
845+
if tcx.is_typeck_child(def.to_def_id()) || tcx.has_attr(def, sym::custom_mir) {
845846
return;
846847
}
847848

tests/incremental/hashes/function_interfaces.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub fn make_unsafe() {}
109109
#[cfg(not(any(cfail1,cfail4)))]
110110
#[rustc_clean(
111111
cfg = "cfail2",
112-
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
112+
except = "hir_owner, hir_owner_nodes, typeck, fn_sig"
113113
)]
114114
#[rustc_clean(cfg = "cfail3")]
115115
#[rustc_clean(

tests/incremental/hashes/inherent_impls.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ impl Foo {
348348
// Make method unsafe ----------------------------------------------------------
349349
#[cfg(any(cfail1,cfail4))]
350350
impl Foo {
351-
//------------------------------------------------------------------------------------------
351+
//----------------------------------------------------------------------------
352352
//--------------------------
353-
//------------------------------------------------------------------------------------------
353+
//----------------------------------------------------------------------------
354354
//--------------------------
355355
pub fn make_method_unsafe(&self) { }
356356
}
@@ -361,9 +361,9 @@ impl Foo {
361361
#[rustc_clean(cfg="cfail5")]
362362
#[rustc_clean(cfg="cfail6")]
363363
impl Foo {
364-
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
364+
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck")]
365365
#[rustc_clean(cfg="cfail3")]
366-
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
366+
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,typeck")]
367367
#[rustc_clean(cfg="cfail6")]
368368
pub unsafe fn make_method_unsafe(&self) { }
369369
}

tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ fn main() -> () {
1717
let _3: *mut usize;
1818
scope 3 {
1919
debug z => _3;
20-
scope 4 {
21-
}
2220
}
2321
}
2422
}

tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ fn main() -> () {
1717
let _3: *mut usize;
1818
scope 3 {
1919
debug z => _3;
20-
scope 4 {
21-
}
2220
}
2321
}
2422
}

tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
fn main() -> () {
44
let mut _0: ();
55
let _1: ();
6-
scope 1 {
7-
}
86

97
bb0: {
108
StorageLive(_1);

tests/mir-opt/box_expr.main.ElaborateDrops.diff

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
scope 1 {
1616
debug x => _1;
1717
}
18-
scope 2 {
19-
}
2018

2119
bb0: {
2220
StorageLive(_1);

tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,13 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>,
9393
debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16});
9494
let _17: ();
9595
scope 2 {
96-
}
97-
scope 3 {
9896
debug result => _17;
9997
}
10098
}
101-
scope 4 {
99+
scope 3 {
102100
debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16});
103101
let _33: ();
104-
scope 5 {
105-
}
106-
scope 6 {
102+
scope 4 {
107103
debug result => _33;
108104
}
109105
}

tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@ fn move_out_by_subslice() -> () {
1616
scope 1 {
1717
debug a => _1;
1818
let _12: [std::boxed::Box<i32>; 2];
19-
scope 4 {
19+
scope 2 {
2020
debug _y => _12;
2121
}
2222
}
23-
scope 2 {
24-
}
25-
scope 3 {
26-
}
2723

2824
bb0: {
2925
StorageLive(_1);

tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@ fn move_out_from_end() -> () {
1616
scope 1 {
1717
debug a => _1;
1818
let _12: std::boxed::Box<i32>;
19-
scope 4 {
19+
scope 2 {
2020
debug _y => _12;
2121
}
2222
}
23-
scope 2 {
24-
}
25-
scope 3 {
26-
}
2723

2824
bb0: {
2925
StorageLive(_1);

0 commit comments

Comments
 (0)