File tree 6 files changed +30
-9
lines changed
6 files changed +30
-9
lines changed Original file line number Diff line number Diff line change @@ -810,15 +810,21 @@ pub trait DiscriminantKind {
810
810
type Discriminant : Clone + Copy + Debug + Eq + PartialEq + Hash + Send + Sync + Unpin ;
811
811
}
812
812
813
- /// Compiler-internal trait used to determine whether a type contains
813
+ /// Used to determine whether a type contains
814
814
/// any `UnsafeCell` internally, but not through an indirection.
815
815
/// This affects, for example, whether a `static` of that type is
816
816
/// 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.
817
820
#[ lang = "freeze" ]
818
- pub ( crate ) unsafe auto trait Freeze { }
821
+ #[ unstable( feature = "freeze" , issue = "60715" ) ]
822
+ pub unsafe auto trait Freeze { }
819
823
824
+ #[ unstable( feature = "freeze" , issue = "60715" ) ]
820
825
impl < T : ?Sized > !Freeze for UnsafeCell < T > { }
821
826
marker_impls ! {
827
+ #[ unstable( feature = "freeze" , issue = "60715" ) ]
822
828
unsafe Freeze for
823
829
{ T : ?Sized } PhantomData <T >,
824
830
{ T : ?Sized } * const T ,
Original file line number Diff line number Diff line change 1
1
// https://github.com/rust-lang/rust/issues/50159
2
- #![ crate_name= "foo" ]
2
+ #![ crate_name = "foo" ]
3
3
4
4
pub trait Signal {
5
5
type Item ;
@@ -9,15 +9,18 @@ pub trait Signal2 {
9
9
type Item2 ;
10
10
}
11
11
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
+ {
13
16
type Item2 = C ;
14
17
}
15
18
16
19
// @has foo/struct.Switch.html
17
20
// @has - '//h3[@class="code-header"]' 'impl<B> Send for Switch<B>where <B as Signal>::Item: Send'
18
21
// @has - '//h3[@class="code-header"]' 'impl<B> Sync for Switch<B>where <B as Signal>::Item: Sync'
19
22
// @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
21
24
pub struct Switch < B : Signal > {
22
25
pub inner : <B as Signal2 >:: Item2 ,
23
26
}
Original file line number Diff line number Diff line change 1
1
#![ crate_name = "foo" ]
2
-
3
- #![ feature( negative_impls) ]
2
+ #![ feature( negative_impls, freeze_impls, freeze) ]
4
3
5
4
pub struct Foo ;
6
5
7
6
// @has foo/struct.Foo.html
8
7
// @!hasraw - 'Auto Trait Implementations'
9
8
impl !Send for Foo { }
10
9
impl !Sync for Foo { }
10
+ impl !std:: marker:: Freeze for Foo { }
11
11
impl !std:: marker:: Unpin for Foo { }
12
12
impl !std:: panic:: RefUnwindSafe for Foo { }
13
13
impl !std:: panic:: UnwindSafe for Foo { }
Original file line number Diff line number Diff line change 2
2
// @has - '//h3[@class="code-header"]' 'impl<T> Send for Foo<T>where T: Send'
3
3
// @has - '//h3[@class="code-header"]' 'impl<T> Sync for Foo<T>where T: Sync'
4
4
// @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
6
6
pub struct Foo < T > {
7
7
field : T ,
8
8
}
Original file line number Diff line number Diff line change 6
6
// 'impl<T> Send for Foo<T>'
7
7
//
8
8
// @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
10
10
pub struct Foo < T > {
11
11
field : T ,
12
12
}
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