diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-04-19 18:27:25 +0200 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2024-04-19 23:09:37 +0200 |
| commit | e0586a6e1a013c99cee2ad63a915b85ff716af0a (patch) | |
| tree | 83092b636312654814596d69128045b6c25fd641 | |
| parent | 07d0d7ce3fd22e4fadd61206034af6fadcdb3e4f (diff) | |
| download | rust-e0586a6e1a013c99cee2ad63a915b85ff716af0a.tar.gz rust-e0586a6e1a013c99cee2ad63a915b85ff716af0a.zip | |
add test for #83993
Fixes #83993
| -rw-r--r-- | tests/ui/const-generics/adt_const_params/index-oob-ice-83993.rs | 18 | ||||
| -rw-r--r-- | tests/ui/const-generics/adt_const_params/index-oob-ice-83993.stderr | 29 |
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/ui/const-generics/adt_const_params/index-oob-ice-83993.rs b/tests/ui/const-generics/adt_const_params/index-oob-ice-83993.rs new file mode 100644 index 00000000000..0d1f023d565 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/index-oob-ice-83993.rs @@ -0,0 +1,18 @@ +// issue: rust-lang/rust/#83993 + +#![feature(adt_const_params)] +//~^ WARN the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes +fn bug<'a>() +where + for<'b> [(); { + let x: &'b (); + //~^ ERROR generic parameters may not be used in const operations + 0 + }]: +{} + +fn bad() where for<'b> [();{let _:&'b (); 0}]: Sized { } +//~^ ERROR generic parameters may not be used in const operations +fn good() where for<'b> [();{0}]: Sized { } + +pub fn main() {} diff --git a/tests/ui/const-generics/adt_const_params/index-oob-ice-83993.stderr b/tests/ui/const-generics/adt_const_params/index-oob-ice-83993.stderr new file mode 100644 index 00000000000..a49dfc31916 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/index-oob-ice-83993.stderr @@ -0,0 +1,29 @@ +error: generic parameters may not be used in const operations + --> $DIR/index-oob-ice-83993.rs:8:17 + | +LL | let x: &'b (); + | ^^ cannot perform const operation using `'b` + | + = note: lifetime parameters may not be used in const expressions + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: generic parameters may not be used in const operations + --> $DIR/index-oob-ice-83993.rs:14:36 + | +LL | fn bad() where for<'b> [();{let _:&'b (); 0}]: Sized { } + | ^^ cannot perform const operation using `'b` + | + = note: lifetime parameters may not be used in const expressions + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions + +warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/index-oob-ice-83993.rs:3:12 + | +LL | #![feature(adt_const_params)] + | ^^^^^^^^^^^^^^^^ + | + = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information + = note: `#[warn(incomplete_features)]` on by default + +error: aborting due to 2 previous errors; 1 warning emitted + |
