From d067cb4105e7f135b00698c3350e9eb44eb61e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Thu, 30 Jun 2022 16:42:39 +0200 Subject: [PATCH] add ice test for #97047 Fixes #97047 --- .../generic_const_exprs/issue-97047-ice-1.rs | 25 +++++++++++++++++++ .../issue-97047-ice-1.stderr | 19 ++++++++++++++ .../generic_const_exprs/issue-97047-ice-2.rs | 23 +++++++++++++++++ .../issue-97047-ice-2.stderr | 19 ++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs new file mode 100644 index 0000000000000..67e30232e2fbb --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs @@ -0,0 +1,25 @@ +// check-pass + +#![feature(adt_const_params, generic_const_exprs)] +//~^ WARN the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] +//~^^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] + +pub struct Changes +where + [(); CHANGES.len()]:, +{ + changes: [usize; CHANGES.len()], +} + +impl Changes +where + [(); CHANGES.len()]:, +{ + pub const fn new() -> Self { + Self { + changes: [0; CHANGES.len()], + } + } +} + +pub fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr new file mode 100644 index 0000000000000..b5b2b0e405a26 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr @@ -0,0 +1,19 @@ +warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-97047-ice-1.rs:3:12 + | +LL | #![feature(adt_const_params, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #95174 for more information + +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-97047-ice-1.rs:3:30 + | +LL | #![feature(adt_const_params, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 for more information + +warning: 2 warnings emitted + diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs new file mode 100644 index 0000000000000..00568a0894465 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs @@ -0,0 +1,23 @@ +// check-pass + +#![feature(adt_const_params, generic_const_exprs)] +//~^ WARN the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] +//~^^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] + +pub struct Changes +where + [(); CHANGES.len()]:, +{ + changes: [usize; CHANGES.len()], +} + +impl Changes +where + [(); CHANGES.len()]:, +{ + pub fn combine(&mut self, other: &Self) { + for _change in &self.changes {} + } +} + +pub fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr new file mode 100644 index 0000000000000..5dfbd87ccd480 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr @@ -0,0 +1,19 @@ +warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-97047-ice-2.rs:3:12 + | +LL | #![feature(adt_const_params, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #95174 for more information + +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-97047-ice-2.rs:3:30 + | +LL | #![feature(adt_const_params, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 for more information + +warning: 2 warnings emitted +