File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
tests/ui/const-generics/adt_const_params Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ // issue: rust-lang/rust/#83993
2+
3+ #![ feature( adt_const_params) ]
4+ //~^ WARN the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
5+ fn bug < ' a > ( )
6+ where
7+ for < ' b > [ ( ) ; {
8+ let x: & ' b ( ) ;
9+ //~^ ERROR generic parameters may not be used in const operations
10+ 0
11+ } ] :
12+ { }
13+
14+ fn bad ( ) where for < ' b > [ ( ) ; { let _: & ' b ( ) ; 0 } ] : Sized { }
15+ //~^ ERROR generic parameters may not be used in const operations
16+ fn good ( ) where for < ' b > [ ( ) ; { 0 } ] : Sized { }
17+
18+ pub fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error: generic parameters may not be used in const operations
2+ --> $DIR/index-oob-ice-83993.rs:8:17
3+ |
4+ LL | let x: &'b ();
5+ | ^^ cannot perform const operation using `'b`
6+ |
7+ = note: lifetime parameters may not be used in const expressions
8+ = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
9+
10+ error: generic parameters may not be used in const operations
11+ --> $DIR/index-oob-ice-83993.rs:14:36
12+ |
13+ LL | fn bad() where for<'b> [();{let _:&'b (); 0}]: Sized { }
14+ | ^^ cannot perform const operation using `'b`
15+ |
16+ = note: lifetime parameters may not be used in const expressions
17+ = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
18+
19+ warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
20+ --> $DIR/index-oob-ice-83993.rs:3:12
21+ |
22+ LL | #![feature(adt_const_params)]
23+ | ^^^^^^^^^^^^^^^^
24+ |
25+ = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
26+ = note: `#[warn(incomplete_features)]` on by default
27+
28+ error: aborting due to 2 previous errors; 1 warning emitted
29+
You can’t perform that action at this time.
0 commit comments