File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ // ignore-test
2
+
3
+ #![ allow( incomplete_features) ]
4
+ #![ feature( const_mut_refs) ]
5
+ #![ feature( inline_const) ]
6
+
7
+ use std:: marker:: PhantomData ;
8
+
9
+ #[ derive( PartialEq , Eq ) ]
10
+ pub struct InvariantRef < ' a , T : ?Sized > ( & ' a T , PhantomData < & ' a mut & ' a T > ) ;
11
+
12
+ impl < ' a , T : ?Sized > InvariantRef < ' a , T > {
13
+ pub const fn new ( r : & ' a T ) -> Self {
14
+ InvariantRef ( r, PhantomData )
15
+ }
16
+ }
17
+
18
+ impl < ' a > InvariantRef < ' a , ( ) > {
19
+ pub const NEW : Self = InvariantRef :: new ( & ( ) ) ;
20
+ }
21
+
22
+ fn match_invariant_ref < ' a > ( ) {
23
+ let y = ( ) ;
24
+ match InvariantRef :: new ( & y) {
25
+ //~^ ERROR `y` does not live long enough [E0597]
26
+ // FIXME(nbdd0121): This should give the same error as `InvariantRef::<'a>::NEW` (without
27
+ // const block)
28
+ const { InvariantRef :: < ' a > :: NEW } => ( ) ,
29
+ }
30
+ }
31
+
32
+ fn main ( ) {
33
+ match_invariant_ref ( ) ;
34
+ }
You can’t perform that action at this time.
0 commit comments