File tree Expand file tree Collapse file tree 6 files changed +30
-9
lines changed Expand file tree Collapse file tree 6 files changed +30
-9
lines changed Original file line number Diff line number Diff line change @@ -810,15 +810,21 @@ pub trait DiscriminantKind {
810810 type Discriminant : Clone + Copy + Debug + Eq + PartialEq + Hash + Send + Sync + Unpin ;
811811}
812812
813- /// Compiler-internal trait used to determine whether a type contains
813+ /// Used to determine whether a type contains
814814/// any `UnsafeCell` internally, but not through an indirection.
815815/// This affects, for example, whether a `static` of that type is
816816/// placed in read-only static memory or writable static memory.
817+ /// This can be used to declare that a constant with a generic type
818+ /// will not contain interior mutability, and subsequently allow
819+ /// placing the constant behind references.
817820#[ lang = "freeze" ]
818- pub ( crate ) unsafe auto trait Freeze { }
821+ #[ unstable( feature = "freeze" , issue = "60715" ) ]
822+ pub unsafe auto trait Freeze { }
819823
824+ #[ unstable( feature = "freeze" , issue = "60715" ) ]
820825impl < T : ?Sized > !Freeze for UnsafeCell < T > { }
821826marker_impls ! {
827+ #[ unstable( feature = "freeze" , issue = "60715" ) ]
822828 unsafe Freeze for
823829 { T : ?Sized } PhantomData <T >,
824830 { T : ?Sized } * const T ,
Original file line number Diff line number Diff line change 11// https://github.com/rust-lang/rust/issues/50159
2- #![ crate_name= "foo" ]
2+ #![ crate_name = "foo" ]
33
44pub trait Signal {
55 type Item ;
@@ -9,15 +9,18 @@ pub trait Signal2 {
99 type Item2 ;
1010}
1111
12- impl < B , C > Signal2 for B where B : Signal < Item = C > {
12+ impl < B , C > Signal2 for B
13+ where
14+ B : Signal < Item = C > ,
15+ {
1316 type Item2 = C ;
1417}
1518
1619// @has foo/struct.Switch.html
1720// @has - '//h3[@class="code-header"]' 'impl<B> Send for Switch<B>where <B as Signal>::Item: Send'
1821// @has - '//h3[@class="code-header"]' 'impl<B> Sync for Switch<B>where <B as Signal>::Item: Sync'
1922// @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0
20- // @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 5
23+ // @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 6
2124pub struct Switch < B : Signal > {
2225 pub inner : <B as Signal2 >:: Item2 ,
2326}
Original file line number Diff line number Diff line change 11#![ crate_name = "foo" ]
2-
3- #![ feature( negative_impls) ]
2+ #![ feature( negative_impls, freeze_impls, freeze) ]
43
54pub struct Foo ;
65
76// @has foo/struct.Foo.html
87// @!hasraw - 'Auto Trait Implementations'
98impl !Send for Foo { }
109impl !Sync for Foo { }
10+ impl !std:: marker:: Freeze for Foo { }
1111impl !std:: marker:: Unpin for Foo { }
1212impl !std:: panic:: RefUnwindSafe for Foo { }
1313impl !std:: panic:: UnwindSafe for Foo { }
Original file line number Diff line number Diff line change 22// @has - '//h3[@class="code-header"]' 'impl<T> Send for Foo<T>where T: Send'
33// @has - '//h3[@class="code-header"]' 'impl<T> Sync for Foo<T>where T: Sync'
44// @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0
5- // @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 5
5+ // @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 6
66pub struct Foo < T > {
77 field : T ,
88}
Original file line number Diff line number Diff line change 66// 'impl<T> Send for Foo<T>'
77//
88// @count - '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1
9- // @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 4
9+ // @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 5
1010pub struct Foo < T > {
1111 field : T ,
1212}
Original file line number Diff line number Diff line change 1+ #![ feature( freeze) ]
2+
3+ //@ check-pass
4+
5+ use std:: marker:: Freeze ;
6+
7+ trait Trait < T : Freeze + ' static > {
8+ const VALUE : T ;
9+ const VALUE_REF : & ' static T = & Self :: VALUE ;
10+ }
11+
12+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments