File tree 5 files changed +29
-3
lines changed
rustc_codegen_cranelift/example
rustc_codegen_gcc/example 5 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,6 @@ unsafe impl Sync for [u8; 16] {}
95
95
#[ lang = "freeze" ]
96
96
unsafe auto trait Freeze { }
97
97
98
- unsafe impl < T : ?Sized > Freeze for PhantomData < T > { }
99
98
unsafe impl < T : ?Sized > Freeze for * const T { }
100
99
unsafe impl < T : ?Sized > Freeze for * mut T { }
101
100
unsafe impl < T : ?Sized > Freeze for & T { }
Original file line number Diff line number Diff line change @@ -91,7 +91,6 @@ unsafe impl Sync for [u8; 16] {}
91
91
#[ lang = "freeze" ]
92
92
unsafe auto trait Freeze { }
93
93
94
- unsafe impl < T : ?Sized > Freeze for PhantomData < T > { }
95
94
unsafe impl < T : ?Sized > Freeze for * const T { }
96
95
unsafe impl < T : ?Sized > Freeze for * mut T { }
97
96
unsafe impl < T : ?Sized > Freeze for & T { }
Original file line number Diff line number Diff line change @@ -872,7 +872,6 @@ pub(crate) unsafe auto trait Freeze {}
872
872
impl < T : ?Sized > !Freeze for UnsafeCell < T > { }
873
873
marker_impls ! {
874
874
unsafe Freeze for
875
- { T : ?Sized } PhantomData <T >,
876
875
{ T : ?Sized } * const T ,
877
876
{ T : ?Sized } * mut T ,
878
877
{ T : ?Sized } & T ,
Original file line number Diff line number Diff line change
1
+ use std:: cell:: UnsafeCell ;
2
+ use std:: marker:: PhantomData ;
3
+
4
+ // This checks that `PhantomData` does not entirely mask interior mutability.
5
+
6
+ trait Trait {
7
+ const C : ( u32 , PhantomData < UnsafeCell < u32 > > ) ;
8
+ }
9
+
10
+ fn bar < T : Trait > ( ) {
11
+ let x: & ' static ( u32 , PhantomData < UnsafeCell < u32 > > ) = & T :: C ;
12
+ //~^ ERROR: dropped while borrowed
13
+ }
14
+
15
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0716]: temporary value dropped while borrowed
2
+ --> $DIR/phantom-data-not-freeze.rs:11:60
3
+ |
4
+ LL | let x: &'static (u32, PhantomData<UnsafeCell<u32>>) = &T::C;
5
+ | -------------------------------------------- ^^^^ creates a temporary value which is freed while still in use
6
+ | |
7
+ | type annotation requires that borrow lasts for `'static`
8
+ LL |
9
+ LL | }
10
+ | - temporary value is freed at the end of this statement
11
+
12
+ error: aborting due to previous error
13
+
14
+ For more information about this error, try `rustc --explain E0716`.
You can’t perform that action at this time.
0 commit comments