File tree Expand file tree Collapse file tree 2 files changed +71
-2
lines changed Expand file tree Collapse file tree 2 files changed +71
-2
lines changed Original file line number Diff line number Diff line change @@ -665,8 +665,6 @@ impl<'tcx> TyCtxt<'tcx> {
665665
666666 if self . is_mutable_static ( def_id) {
667667 self . mk_mut_ptr ( static_ty)
668- } else if self . is_foreign_item ( def_id) {
669- self . mk_imm_ptr ( static_ty)
670668 } else {
671669 self . mk_imm_ref ( self . lifetimes . re_erased , static_ty)
672670 }
Original file line number Diff line number Diff line change 1+ extern "C" {
2+ static X : i32 ;
3+ }
4+
5+ static Y : i32 = 42 ;
6+
7+ static mut BAR : * const & ' static i32 = [ & Y ] . as_ptr ( ) ;
8+
9+ static mut FOO : * const & ' static i32 = [ unsafe { & X } ] . as_ptr ( ) ;
10+
11+ fn main ( ) { }
12+
13+ // END RUST SOURCE
14+ // START rustc.FOO.PromoteTemps.before.mir
15+ // bb0: {
16+ // ...
17+ // _5 = const Scalar(AllocId(1).0x0) : &i32;
18+ // _4 = &(*_5);
19+ // _3 = [move _4];
20+ // _2 = &_3;
21+ // _1 = move _2 as &[&'static i32] (Pointer(Unsize));
22+ // _0 = const core::slice::<impl [&'static i32]>::as_ptr(move _1) -> [return: bb2, unwind: bb1];
23+ // }
24+ // ...
25+ // bb2: {
26+ // StorageDead(_5);
27+ // StorageDead(_3);
28+ // return;
29+ // }
30+ // END rustc.FOO.PromoteTemps.before.mir
31+ // START rustc.BAR.PromoteTemps.before.mir
32+ // bb0: {
33+ // ...
34+ // _5 = const Scalar(AllocId(0).0x0) : &i32;
35+ // _4 = &(*_5);
36+ // _3 = [move _4];
37+ // _2 = &_3;
38+ // _1 = move _2 as &[&'static i32] (Pointer(Unsize));
39+ // _0 = const core::slice::<impl [&'static i32]>::as_ptr(move _1) -> [return: bb2, unwind: bb1];
40+ // }
41+ // ...
42+ // bb2: {
43+ // StorageDead(_5);
44+ // StorageDead(_3);
45+ // return;
46+ // }
47+ // END rustc.BAR.PromoteTemps.before.mir
48+ // START rustc.BAR.PromoteTemps.after.mir
49+ // bb0: {
50+ // ...
51+ // _2 = &(promoted[0]: [&'static i32; 1]);
52+ // _1 = move _2 as &[&'static i32] (Pointer(Unsize));
53+ // _0 = const core::slice::<impl [&'static i32]>::as_ptr(move _1) -> [return: bb2, unwind: bb1];
54+ // }
55+ // ...
56+ // bb2: {
57+ // return;
58+ // }
59+ // END rustc.BAR.PromoteTemps.after.mir
60+ // START rustc.FOO.PromoteTemps.after.mir
61+ // bb0: {
62+ // ...
63+ // _2 = &(promoted[0]: [&'static i32; 1]);
64+ // _1 = move _2 as &[&'static i32] (Pointer(Unsize));
65+ // _0 = const core::slice::<impl [&'static i32]>::as_ptr(move _1) -> [return: bb2, unwind: bb1];
66+ // }
67+ // ...
68+ // bb2: {
69+ // return;
70+ // }
71+ // END rustc.FOO.PromoteTemps.after.mir
You can’t perform that action at this time.
0 commit comments