From bd2d70dd0a0756027724da853784a0f4cf30d926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 08:44:01 +0100 Subject: [PATCH] add test for ice #119275 "no entry found for key" in predicates_of.rs fixes #119275 --- ...icates-of-no-entry-found-for-key-119275.rs | 18 ++++++++ ...es-of-no-entry-found-for-key-119275.stderr | 46 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.stderr diff --git a/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.rs b/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.rs new file mode 100644 index 0000000000000..4ba696f4ae080 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.rs @@ -0,0 +1,18 @@ +// test for ICE #119275 "no entry found for key" in predicates_of.rs + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +fn bug(&self) +//~^ ERROR `self` parameter is only allowed in associated functions +//~^^ ERROR cannot find type `Nat` in this scope +where + for [(); COT::BYTES]:, + //~^ ERROR only lifetime parameters can be used in this context + //~^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders + //~^^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders + //~^^^^ ERROR failed to resolve: use of undeclared type `COT` +{ +} + +pub fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.stderr b/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.stderr new file mode 100644 index 0000000000000..ee0ec38ab0631 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.stderr @@ -0,0 +1,46 @@ +error: `self` parameter is only allowed in associated functions + --> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:6:22 + | +LL | fn bug(&self) + | ^^^^^ not semantically valid as function parameter + | + = note: associated functions are those in `impl` or `trait` definitions + +error[E0412]: cannot find type `Nat` in this scope + --> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:6:17 + | +LL | fn bug(&self) + | ^^^ not found in this scope + +error[E0658]: only lifetime parameters can be used in this context + --> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:15 + | +LL | for [(); COT::BYTES]:, + | ^ ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: defaults for generic parameters are not allowed in `for<...>` binders + --> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:9 + | +LL | for [(); COT::BYTES]:, + | ^^^^^^^^^^^^^^^^^^ + +error: defaults for generic parameters are not allowed in `for<...>` binders + --> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:29 + | +LL | for [(); COT::BYTES]:, + | ^^^^^^^ + +error[E0433]: failed to resolve: use of undeclared type `COT` + --> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:43 + | +LL | for [(); COT::BYTES]:, + | ^^^ use of undeclared type `COT` + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0412, E0433, E0658. +For more information about an error, try `rustc --explain E0412`.