From 1bcbed19d1629d8a67f322c76b8fc4a29e51539f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 08:13:54 +0100 Subject: [PATCH 1/7] add test for #110696 Fixes #110696 --- ...e-failed-to-resolve-instance-for-110696.rs | 52 +++++++++++++++++++ ...iled-to-resolve-instance-for-110696.stderr | 9 ++++ 2 files changed, 61 insertions(+) create mode 100644 tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs create mode 100644 tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr diff --git a/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs b/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs new file mode 100644 index 0000000000000..840be25dd2e02 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs @@ -0,0 +1,52 @@ +// test for #110696 +// failed to resolve instance for as MyIndex<()>>::my_index +// ignore-tidy-linelength + +#![feature(type_alias_impl_trait)] + +use std::marker::PhantomData; + + +trait MyIndex { + type O; + fn my_index(self) -> Self::O; +} +trait MyFrom: Sized { + type Error; + fn my_from(value: T) -> Result; +} + + +trait F {} +impl F for () {} +type DummyT = impl F; +fn _dummy_t() -> DummyT {} + +struct Phantom1(PhantomData); +struct Phantom2(PhantomData); +struct Scope(Phantom2>); + +impl Scope { + fn new() -> Self { + unimplemented!() + } +} + +impl MyFrom> for Phantom1 { + type Error = (); + fn my_from(_: Phantom2) -> Result { + unimplemented!() + } +} + +impl>>, U> MyIndex> for Scope { + //~^ ERROR the type parameter `T` is not constrained by the impl trait, self type, or predicates + type O = T; + fn my_index(self) -> Self::O { + MyFrom::my_from(self.0).ok().unwrap() + } +} + +fn main() { + let _pos: Phantom1> = Scope::new().my_index(); +} diff --git a/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr b/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr new file mode 100644 index 0000000000000..a39f77ce17f61 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr @@ -0,0 +1,9 @@ +error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates + --> $DIR/ice-failed-to-resolve-instance-for-110696.rs:42:6 + | +LL | impl>>, U> MyIndex> for Scope { + | ^ unconstrained type parameter + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0207`. From 4d9ce7a1a2f78e26b58c4464f43aab21100ea1f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 08:19:44 +0100 Subject: [PATCH 2/7] add test for ice #121472 Fixes #121472 --- .../underef-index-out-of-bounds-121472.rs | 16 +++++++++++++ .../underef-index-out-of-bounds-121472.stderr | 23 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs create mode 100644 tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr diff --git a/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs b/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs new file mode 100644 index 0000000000000..37e0d89efc752 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.rs @@ -0,0 +1,16 @@ +// test for ICE #121472 index out of bounds un_derefer.rs +#![feature(type_alias_impl_trait)] + +trait T {} + +type Alias<'a> = impl T; + +struct S; +impl<'a> T for &'a S {} + +fn with_positive(fun: impl Fn(Alias<'_>)) {} + +fn main() { + with_positive(|&n| ()); + //~^ ERROR mismatched types +} diff --git a/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr b/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr new file mode 100644 index 0000000000000..a224bab0705ef --- /dev/null +++ b/tests/ui/type-alias-impl-trait/underef-index-out-of-bounds-121472.stderr @@ -0,0 +1,23 @@ +error[E0308]: mismatched types + --> $DIR/underef-index-out-of-bounds-121472.rs:14:20 + | +LL | type Alias<'a> = impl T; + | ------ the expected opaque type +... +LL | with_positive(|&n| ()); + | ^^ + | | + | expected opaque type, found `&_` + | expected due to this + | + = note: expected opaque type `Alias<'_>` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - with_positive(|&n| ()); +LL + with_positive(|n| ()); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. From 2b5740371c42c632efb3dbe46150798baf56a8d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 08:27:14 +0100 Subject: [PATCH 3/7] add test for https://github.com/rust-lang/rust/issues/112823 Fixes #112823 --- ...-type-whensubstituting-in-region-112823.rs | 30 ++++++++++++++++++ ...e-whensubstituting-in-region-112823.stderr | 31 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs create mode 100644 tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.stderr diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs new file mode 100644 index 0000000000000..d6fa56663a3f0 --- /dev/null +++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs @@ -0,0 +1,30 @@ +// test for ICE #112823 +// Unexpected parameter Type(Repr) when substituting in region + +#![feature(impl_trait_in_assoc_type)] + +use std::future::Future; + +trait Stream {} + +trait X { + type LineStream<'a, Repr> + where + Self: 'a; + type LineStreamFut<'a, Repr> + where + Self: 'a; +} + +struct Y; + +impl X for Y { + type LineStream<'c, 'd> = impl Stream; + //~^ ERROR type `LineStream` has 0 type parameters but its trait declaration has 1 type parameter + type LineStreamFut<'a, Repr> = impl Future>; + fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} + //~^ ERROR `()` is not a future + //~^^ method `line_stream` is not a member of trait `X` +} + +pub fn main() {} diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.stderr b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.stderr new file mode 100644 index 0000000000000..28a0f7461e2d5 --- /dev/null +++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.stderr @@ -0,0 +1,31 @@ +error[E0407]: method `line_stream` is not a member of trait `X` + --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:25:5 + | +LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `X` + +error[E0049]: type `LineStream` has 0 type parameters but its trait declaration has 1 type parameter + --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:22:21 + | +LL | type LineStream<'a, Repr> + | -- ---- + | | + | expected 1 type parameter +... +LL | type LineStream<'c, 'd> = impl Stream; + | ^^ ^^ + | | + | found 0 type parameters + +error[E0277]: `()` is not a future + --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:25:43 + | +LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future + | + = help: the trait `Future` is not implemented for `()` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0049, E0277, E0407. +For more information about an error, try `rustc --explain E0049`. From d7e166d408c6c9f86ef2087c5a013c1600ca94f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 08:31:01 +0100 Subject: [PATCH 4/7] add test for ice "type mismatching when copying!" Fixes #112824 --- .../ice-type-mismatch-when-copying-112824.rs | 20 +++++++++++++ ...e-type-mismatch-when-copying-112824.stderr | 29 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 tests/ui/const_prop/ice-type-mismatch-when-copying-112824.rs create mode 100644 tests/ui/const_prop/ice-type-mismatch-when-copying-112824.stderr diff --git a/tests/ui/const_prop/ice-type-mismatch-when-copying-112824.rs b/tests/ui/const_prop/ice-type-mismatch-when-copying-112824.rs new file mode 100644 index 0000000000000..dc9782295c136 --- /dev/null +++ b/tests/ui/const_prop/ice-type-mismatch-when-copying-112824.rs @@ -0,0 +1,20 @@ +// test for #112824 ICE type mismatching when copying! + +pub struct Opcode(pub u8); + +pub struct Opcode2(&'a S); +//~^ ERROR use of undeclared lifetime name `'a` +//~^^ ERROR cannot find type `S` in this scope + +impl Opcode2 { + pub const OP2: Opcode2 = Opcode2(Opcode(0x1)); +} + +pub fn example2(msg_type: Opcode2) -> impl FnMut(&[u8]) { + move |i| match msg_type { + Opcode2::OP2 => unimplemented!(), + //~^ ERROR could not evaluate constant pattern + } +} + +pub fn main() {} diff --git a/tests/ui/const_prop/ice-type-mismatch-when-copying-112824.stderr b/tests/ui/const_prop/ice-type-mismatch-when-copying-112824.stderr new file mode 100644 index 0000000000000..9442eac0cf54a --- /dev/null +++ b/tests/ui/const_prop/ice-type-mismatch-when-copying-112824.stderr @@ -0,0 +1,29 @@ +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ice-type-mismatch-when-copying-112824.rs:5:21 + | +LL | pub struct Opcode2(&'a S); + | - ^^ undeclared lifetime + | | + | help: consider introducing lifetime `'a` here: `<'a>` + +error[E0412]: cannot find type `S` in this scope + --> $DIR/ice-type-mismatch-when-copying-112824.rs:5:24 + | +LL | pub struct Opcode2(&'a S); + | ^ not found in this scope + | +help: you might be missing a type parameter + | +LL | pub struct Opcode2(&'a S); + | +++ + +error: could not evaluate constant pattern + --> $DIR/ice-type-mismatch-when-copying-112824.rs:15:9 + | +LL | Opcode2::OP2 => unimplemented!(), + | ^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0261, E0412. +For more information about an error, try `rustc --explain E0261`. From b0e10083f3f0300fda3cce292edd7b3cce5f7284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 08:38:26 +0100 Subject: [PATCH 5/7] add test for ice #113017 no entry found for key in generics_of.rs Fixes #113017 --- ...nerics_of-no-entry-found-for-key-113017.rs | 20 ++++ ...cs_of-no-entry-found-for-key-113017.stderr | 92 +++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.stderr diff --git a/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.rs b/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.rs new file mode 100644 index 0000000000000..36e552ed88d1a --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.rs @@ -0,0 +1,20 @@ +// test for ICE "no entry found for key" in generics_of.rs #113017 + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +pub fn String(elem) +//~^ ERROR expected one of `:`, `@`, or `|`, found `)` +where + V: 'a, + //~^ ERROR use of undeclared lifetime name `'a` + for V: 'a, + //~^ ERROR use of undeclared lifetime name `'a` + //~^^ ERROR only lifetime parameters can be used in this context + //~^^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders + for <&str as IntoIterator>::Item: 'static, + //~^ ERROR `&` without an explicit lifetime name cannot be used here + //~^^ ERROR only lifetime parameters can be used in this context +{} + +pub fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.stderr b/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.stderr new file mode 100644 index 0000000000000..54794022ebdb8 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.stderr @@ -0,0 +1,92 @@ +error: expected one of `:`, `@`, or `|`, found `)` + --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:6:22 + | +LL | pub fn String(elem) + | ^ expected one of `:`, `@`, or `|` + | + = note: anonymous parameters are removed in the 2018 edition (see RFC 1685) +help: if this is a `self` type, give it a parameter name + | +LL | pub fn String(self: elem) + | +++++ +help: if this is a parameter name, give it a type + | +LL | pub fn String(elem: TypeName) + | ++++++++++ +help: if this is a type, explicitly ignore the parameter name + | +LL | pub fn String(_: elem) + | ++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:9:8 + | +LL | V: 'a, + | ^^ undeclared lifetime + | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider making the bound lifetime-generic with a new `'a` lifetime + | +LL | for<'a> V: 'a, + | +++++++ +help: consider introducing lifetime `'a` here + | +LL | pub fn String<'a, V>(elem) + | +++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:11:39 + | +LL | for V: 'a, + | ^^ undeclared lifetime + | +help: consider making the bound lifetime-generic with a new `'a` lifetime + | +LL | for<'a, const N: usize = { || {}}> V: 'a, + | +++ +help: consider introducing lifetime `'a` here + | +LL | pub fn String<'a, V>(elem) + | +++ + +error[E0637]: `&` without an explicit lifetime name cannot be used here + --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:15:26 + | +LL | for <&str as IntoIterator>::Item: 'static, + | ^ explicit lifetime name needed here + | +help: consider introducing a higher-ranked lifetime here + | +LL | for<'a> for <&'a str as IntoIterator>::Item: 'static, + | +++++++ ++ + +error[E0658]: only lifetime parameters can be used in this context + --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:11:15 + | +LL | for V: 'a, + | ^ + | + = 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[E0658]: only lifetime parameters can be used in this context + --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:15:9 + | +LL | for <&str as IntoIterator>::Item: 'static, + | ^^ ^^ ^^ + | + = 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-generics_of-no-entry-found-for-key-113017.rs:11:9 + | +LL | for V: 'a, + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 7 previous errors + +Some errors have detailed explanations: E0261, E0637, E0658. +For more information about an error, try `rustc --explain E0261`. 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 6/7] 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`. From e68cb00fb272fd9a45cc6c4ec4b2ed14e7ba0bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 11:35:31 +0100 Subject: [PATCH 7/7] address review comments --- ...nerics_of-no-entry-found-for-key-113017.rs | 15 +--- ...cs_of-no-entry-found-for-key-113017.stderr | 87 ++----------------- ...e-failed-to-resolve-instance-for-110696.rs | 2 +- 3 files changed, 12 insertions(+), 92 deletions(-) diff --git a/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.rs b/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.rs index 36e552ed88d1a..a2f8c876b5e4d 100644 --- a/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.rs +++ b/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.rs @@ -3,18 +3,11 @@ #![feature(generic_const_exprs)] #![allow(incomplete_features)] -pub fn String(elem) -//~^ ERROR expected one of `:`, `@`, or `|`, found `)` +pub fn foo() where - V: 'a, - //~^ ERROR use of undeclared lifetime name `'a` - for V: 'a, - //~^ ERROR use of undeclared lifetime name `'a` - //~^^ ERROR only lifetime parameters can be used in this context - //~^^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders - for <&str as IntoIterator>::Item: 'static, - //~^ ERROR `&` without an explicit lifetime name cannot be used here - //~^^ ERROR only lifetime parameters can be used in this context + for ():, + //~^ ERROR only lifetime parameters can be used in this context + //~^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders {} pub fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.stderr b/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.stderr index 54794022ebdb8..edf27f58efd56 100644 --- a/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.stderr +++ b/tests/ui/const-generics/generic_const_exprs/ice-generics_of-no-entry-found-for-key-113017.stderr @@ -1,92 +1,19 @@ -error: expected one of `:`, `@`, or `|`, found `)` - --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:6:22 - | -LL | pub fn String(elem) - | ^ expected one of `:`, `@`, or `|` - | - = note: anonymous parameters are removed in the 2018 edition (see RFC 1685) -help: if this is a `self` type, give it a parameter name - | -LL | pub fn String(self: elem) - | +++++ -help: if this is a parameter name, give it a type - | -LL | pub fn String(elem: TypeName) - | ++++++++++ -help: if this is a type, explicitly ignore the parameter name - | -LL | pub fn String(_: elem) - | ++ - -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:9:8 - | -LL | V: 'a, - | ^^ undeclared lifetime - | - = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html -help: consider making the bound lifetime-generic with a new `'a` lifetime - | -LL | for<'a> V: 'a, - | +++++++ -help: consider introducing lifetime `'a` here - | -LL | pub fn String<'a, V>(elem) - | +++ - -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:11:39 - | -LL | for V: 'a, - | ^^ undeclared lifetime - | -help: consider making the bound lifetime-generic with a new `'a` lifetime - | -LL | for<'a, const N: usize = { || {}}> V: 'a, - | +++ -help: consider introducing lifetime `'a` here - | -LL | pub fn String<'a, V>(elem) - | +++ - -error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:15:26 - | -LL | for <&str as IntoIterator>::Item: 'static, - | ^ explicit lifetime name needed here - | -help: consider introducing a higher-ranked lifetime here - | -LL | for<'a> for <&'a str as IntoIterator>::Item: 'static, - | +++++++ ++ - error[E0658]: only lifetime parameters can be used in this context - --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:11:15 + --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:8:15 | -LL | for V: 'a, +LL | for ():, | ^ | = 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[E0658]: only lifetime parameters can be used in this context - --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:15:9 - | -LL | for <&str as IntoIterator>::Item: 'static, - | ^^ ^^ ^^ - | - = 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-generics_of-no-entry-found-for-key-113017.rs:11:9 + --> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:8:9 | -LL | for V: 'a, - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | for ():, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 7 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0261, E0637, E0658. -For more information about an error, try `rustc --explain E0261`. +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs b/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs index 840be25dd2e02..fc71d0d61ff14 100644 --- a/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs +++ b/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.rs @@ -40,7 +40,7 @@ impl MyFrom> for Phantom1 { } impl>>, U> MyIndex> for Scope { - //~^ ERROR the type parameter `T` is not constrained by the impl trait, self type, or predicates + //~^ ERROR the type parameter `T` is not constrained by the impl type O = T; fn my_index(self) -> Self::O { MyFrom::my_from(self.0).ok().unwrap()