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] 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()