File tree 1 file changed +31
-0
lines changed
src/test/ui/consts/const-eval
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Several variants of #64945.
2
+
3
+ // This struct is not important, we just use it to put `T` and `'a` in scope for our associated
4
+ // consts.
5
+ struct Generic < ' a , T > ( std:: marker:: PhantomData < & ' a T > ) ;
6
+
7
+ impl < ' a , T : ' static > Generic < ' a , T > {
8
+ const EMPTY_SLICE : & ' a [ T ] = {
9
+ let x: & ' a [ T ] = & [ ] ;
10
+ x
11
+ } ;
12
+
13
+ const EMPTY_SLICE_REF : & ' a & ' static [ T ] = {
14
+ let x: & ' static [ T ] = & [ ] ;
15
+ & x
16
+ //~^ ERROR `x` does not live long enough
17
+ } ;
18
+ }
19
+
20
+ static mut INTERIOR_MUT_AND_DROP : & ' static [ std:: cell:: RefCell < Vec < i32 > > ] = {
21
+ let x: & [ _ ] = & [ ] ;
22
+ x
23
+ } ;
24
+
25
+ static mut INTERIOR_MUT_AND_DROP_REF : & ' static & ' static [ std:: cell:: RefCell < Vec < i32 > > ] = {
26
+ let x: & [ _ ] = & [ ] ;
27
+ & x
28
+ //~^ ERROR `x` does not live long enough
29
+ } ;
30
+
31
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments