Skip to content

Commit e0586a6

Browse files
committed
add test for #83993
Fixes #83993
1 parent 07d0d7c commit e0586a6

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+

0 commit comments

Comments
 (0)