From ce5f8c93fa28ef0a56531f8b43296b1779d49240 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 20 Mar 2024 12:52:54 -0400 Subject: [PATCH] Bless test fallout (duplicate diagnostics) --- .../clippy_lints/src/future_not_send.rs | 2 +- src/tools/clippy/clippy_utils/src/ty.rs | 8 +- tests/rustdoc-ui/invalid_associated_const.rs | 1 + .../invalid_associated_const.stderr | 10 +- tests/rustdoc-ui/issue-102467.rs | 1 + tests/rustdoc-ui/issue-102467.stderr | 10 +- tests/rustdoc-ui/issues/issue-96287.rs | 1 + tests/rustdoc-ui/issues/issue-96287.stderr | 14 +- .../assoc-const-eq-param-in-ty.rs | 14 ++ .../assoc-const-eq-param-in-ty.stderr | 42 +++- .../associated-consts/issue-102335-const.rs | 1 + .../issue-102335-const.stderr | 10 +- .../issue-109299-1.rs | 6 +- .../issue-109299-1.stderr | 15 +- tests/ui/associated-type-bounds/duplicate.rs | 9 + .../associated-type-bounds/duplicate.stderr | 186 +++++++++++++----- .../associated-type-bounds/issue-102335-ty.rs | 1 + .../issue-102335-ty.stderr | 10 +- .../ui/associated-type-bounds/issue-99828.rs | 1 + .../associated-type-bounds/issue-99828.stderr | 14 +- tests/ui/async-await/issues/issue-65159.rs | 1 + .../ui/async-await/issues/issue-65159.stderr | 16 +- .../issue-82126-mismatched-subst-and-hir.rs | 4 +- ...ssue-82126-mismatched-subst-and-hir.stderr | 38 +++- .../min_const_generics/macro-fail.rs | 1 + .../min_const_generics/macro-fail.stderr | 24 ++- .../issue-102335-gat.rs | 1 + .../issue-102335-gat.stderr | 10 +- .../issue-81712-cyclic-traits.rs | 1 + .../issue-81712-cyclic-traits.stderr | 19 +- ...esh-lifetime-from-bare-trait-obj-114664.rs | 2 + ...lifetime-from-bare-trait-obj-114664.stderr | 16 +- .../in-trait/span-bug-issue-121457.rs | 1 + .../in-trait/span-bug-issue-121457.stderr | 10 +- tests/ui/impl-trait/issues/issue-92305.rs | 1 + tests/ui/impl-trait/issues/issue-92305.stderr | 14 +- .../opaque-used-in-extraneous-argument.rs | 1 + .../opaque-used-in-extraneous-argument.stderr | 19 +- tests/ui/impl-trait/stranded-opaque.rs | 1 + tests/ui/impl-trait/stranded-opaque.stderr | 10 +- tests/ui/issues/issue-87199.rs | 1 + tests/ui/issues/issue-87199.stderr | 12 +- tests/ui/nll/issue-54189.rs | 1 + tests/ui/nll/issue-54189.stderr | 10 +- .../const-closure-parse-not-item.stderr | 10 +- .../ice-112822-expected-type-for-param.rs | 6 +- .../ice-112822-expected-type-for-param.stderr | 14 +- tests/ui/suggestions/issue-85347.rs | 3 + tests/ui/suggestions/issue-85347.stderr | 27 ++- ...lid-assoc-type-suggestion-in-trait-impl.rs | 1 + ...assoc-type-suggestion-in-trait-impl.stderr | 29 ++- .../not_well_formed.fixed | 19 -- .../type-alias-impl-trait/not_well_formed.rs | 6 +- .../not_well_formed.stderr | 14 +- 54 files changed, 571 insertions(+), 128 deletions(-) delete mode 100644 tests/ui/type-alias-impl-trait/not_well_formed.fixed diff --git a/src/tools/clippy/clippy_lints/src/future_not_send.rs b/src/tools/clippy/clippy_lints/src/future_not_send.rs index 9fb59a320d488..18f4e51ebd663 100644 --- a/src/tools/clippy/clippy_lints/src/future_not_send.rs +++ b/src/tools/clippy/clippy_lints/src/future_not_send.rs @@ -64,7 +64,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend { } let ret_ty = return_ty(cx, cx.tcx.local_def_id_to_hir_id(fn_def_id).expect_owner()); if let ty::Alias(ty::Opaque, AliasTy { def_id, args, .. }) = *ret_ty.kind() { - let preds = cx.tcx.explicit_item_bounds(def_id); + let preds = cx.tcx.explicit_item_super_predicates(def_id); let mut is_future = false; for (p, _span) in preds.iter_instantiated_copied(cx.tcx, args) { if let Some(trait_pred) = p.as_trait_clause() { diff --git a/src/tools/clippy/clippy_utils/src/ty.rs b/src/tools/clippy/clippy_utils/src/ty.rs index 6e011a28bb7bc..801452e444c6a 100644 --- a/src/tools/clippy/clippy_utils/src/ty.rs +++ b/src/tools/clippy/clippy_utils/src/ty.rs @@ -96,7 +96,7 @@ pub fn contains_ty_adt_constructor_opaque<'tcx>(cx: &LateContext<'tcx>, ty: Ty<' return false; } - for (predicate, _span) in cx.tcx.explicit_item_bounds(def_id).instantiate_identity_iter_copied() { + for (predicate, _span) in cx.tcx.explicit_item_super_predicates(def_id).instantiate_identity_iter_copied() { match predicate.kind().skip_binder() { // For `impl Trait`, it will register a predicate of `T: Trait`, so we go through // and check substitutions to find `U`. @@ -328,7 +328,7 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool { }, ty::Tuple(args) => args.iter().any(|ty| is_must_use_ty(cx, ty)), ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) => { - for (predicate, _) in cx.tcx.explicit_item_bounds(def_id).skip_binder() { + for (predicate, _) in cx.tcx.explicit_item_super_predicates(def_id).skip_binder() { if let ty::ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder() { if cx.tcx.has_attr(trait_predicate.trait_ref.def_id, sym::must_use) { return true; @@ -729,7 +729,7 @@ pub fn ty_sig<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option sig_from_bounds( cx, ty, - cx.tcx.item_bounds(def_id).iter_instantiated(cx.tcx, args), + cx.tcx.item_super_predicates(def_id).iter_instantiated(cx.tcx, args), cx.tcx.opt_parent(def_id), ), ty::FnPtr(sig) => Some(ExprFnSig::Sig(sig, None)), @@ -807,7 +807,7 @@ fn sig_for_projection<'tcx>(cx: &LateContext<'tcx>, ty: AliasTy<'tcx>) -> Option for (pred, _) in cx .tcx - .explicit_item_bounds(ty.def_id) + .explicit_item_super_predicates(ty.def_id) .iter_instantiated_copied(cx.tcx, ty.args) { match pred.kind().skip_binder() { diff --git a/tests/rustdoc-ui/invalid_associated_const.rs b/tests/rustdoc-ui/invalid_associated_const.rs index 6ab8c36f74041..6f211a383a6fa 100644 --- a/tests/rustdoc-ui/invalid_associated_const.rs +++ b/tests/rustdoc-ui/invalid_associated_const.rs @@ -3,6 +3,7 @@ trait T { type A: S = 34>; //~^ ERROR associated type bindings are not allowed here + //~| ERROR associated type bindings are not allowed here } trait S { diff --git a/tests/rustdoc-ui/invalid_associated_const.stderr b/tests/rustdoc-ui/invalid_associated_const.stderr index 9c6ae0f76c6e0..1eb6d2714e31b 100644 --- a/tests/rustdoc-ui/invalid_associated_const.stderr +++ b/tests/rustdoc-ui/invalid_associated_const.stderr @@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here LL | type A: S = 34>; | ^^^^^^^^ associated type not allowed here -error: aborting due to 1 previous error +error[E0229]: associated type bindings are not allowed here + --> $DIR/invalid_associated_const.rs:4:17 + | +LL | type A: S = 34>; + | ^^^^^^^^ associated type not allowed here + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0229`. diff --git a/tests/rustdoc-ui/issue-102467.rs b/tests/rustdoc-ui/issue-102467.rs index bff876e41d66a..a27e61569794e 100644 --- a/tests/rustdoc-ui/issue-102467.rs +++ b/tests/rustdoc-ui/issue-102467.rs @@ -6,6 +6,7 @@ trait T { type A: S = 34>; //~^ ERROR associated type bindings are not allowed here + //~| ERROR associated type bindings are not allowed here } trait S { diff --git a/tests/rustdoc-ui/issue-102467.stderr b/tests/rustdoc-ui/issue-102467.stderr index 4a769f94cf265..f54a50a4e1952 100644 --- a/tests/rustdoc-ui/issue-102467.stderr +++ b/tests/rustdoc-ui/issue-102467.stderr @@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here LL | type A: S = 34>; | ^^^^^^^^ associated type not allowed here -error: aborting due to 1 previous error +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-102467.rs:7:17 + | +LL | type A: S = 34>; + | ^^^^^^^^ associated type not allowed here + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0229`. diff --git a/tests/rustdoc-ui/issues/issue-96287.rs b/tests/rustdoc-ui/issues/issue-96287.rs index 08cc7ef4c902c..b490c2fc03f86 100644 --- a/tests/rustdoc-ui/issues/issue-96287.rs +++ b/tests/rustdoc-ui/issues/issue-96287.rs @@ -6,6 +6,7 @@ pub trait TraitWithAssoc { pub type Foo = impl Trait; //~^ ERROR +//~| ERROR pub trait Trait {} diff --git a/tests/rustdoc-ui/issues/issue-96287.stderr b/tests/rustdoc-ui/issues/issue-96287.stderr index 62d81534a9875..9aba033216484 100644 --- a/tests/rustdoc-ui/issues/issue-96287.stderr +++ b/tests/rustdoc-ui/issues/issue-96287.stderr @@ -9,6 +9,18 @@ help: consider restricting type parameter `V` LL | pub type Foo = impl Trait; | ++++++++++++++++ -error: aborting due to 1 previous error +error[E0220]: associated type `Assoc` not found for `V` + --> $DIR/issue-96287.rs:7:33 + | +LL | pub type Foo = impl Trait; + | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider restricting type parameter `V` + | +LL | pub type Foo = impl Trait; + | ++++++++++++++++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0220`. diff --git a/tests/ui/associated-consts/assoc-const-eq-param-in-ty.rs b/tests/ui/associated-consts/assoc-const-eq-param-in-ty.rs index aaf16181030b8..06fd0a024f006 100644 --- a/tests/ui/associated-consts/assoc-const-eq-param-in-ty.rs +++ b/tests/ui/associated-consts/assoc-const-eq-param-in-ty.rs @@ -37,8 +37,19 @@ fn take2>(_: P) {} trait Iface<'r> { //~^ NOTE the lifetime parameter `'r` is defined here + //~| NOTE the lifetime parameter `'r` is defined here type Assoc: Trait<'r, Self, Q, K = { loop {} }> //~^ ERROR the type of the associated constant `K` must not depend on generic parameters + //~| ERROR the type of the associated constant `K` must not depend on generic parameters + //~| NOTE its type must not depend on the lifetime parameter `'r` + //~| NOTE `K` has type `&'r [Self; Q]` + //~| ERROR the type of the associated constant `K` must not depend on `Self` + //~| NOTE its type must not depend on `Self` + //~| NOTE `K` has type `&'r [Self; Q]` + //~| ERROR the type of the associated constant `K` must not depend on generic parameters + //~| NOTE its type must not depend on the const parameter `Q` + //~| NOTE the const parameter `Q` is defined here + //~| NOTE `K` has type `&'r [Self; Q]` //~| NOTE its type must not depend on the lifetime parameter `'r` //~| NOTE `K` has type `&'r [Self; Q]` //~| ERROR the type of the associated constant `K` must not depend on `Self` @@ -48,6 +59,9 @@ trait Iface<'r> { //~| NOTE its type must not depend on the const parameter `Q` //~| NOTE the const parameter `Q` is defined here //~| NOTE `K` has type `&'r [Self; Q]` + //~| NOTE duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + //~| NOTE duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + //~| NOTE duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` where Self: Sized + 'r; } diff --git a/tests/ui/associated-consts/assoc-const-eq-param-in-ty.stderr b/tests/ui/associated-consts/assoc-const-eq-param-in-ty.stderr index 077ac6e7f9358..6b7b714fff10a 100644 --- a/tests/ui/associated-consts/assoc-const-eq-param-in-ty.stderr +++ b/tests/ui/associated-consts/assoc-const-eq-param-in-ty.stderr @@ -44,18 +44,18 @@ LL | fn take2>(_: P) {} = note: `SELF` has type `P` error: the type of the associated constant `K` must not depend on generic parameters - --> $DIR/assoc-const-eq-param-in-ty.rs:40:52 + --> $DIR/assoc-const-eq-param-in-ty.rs:41:52 | LL | trait Iface<'r> { | -- the lifetime parameter `'r` is defined here -LL | +... LL | type Assoc: Trait<'r, Self, Q, K = { loop {} }> | ^ its type must not depend on the lifetime parameter `'r` | = note: `K` has type `&'r [Self; Q]` error: the type of the associated constant `K` must not depend on `Self` - --> $DIR/assoc-const-eq-param-in-ty.rs:40:52 + --> $DIR/assoc-const-eq-param-in-ty.rs:41:52 | LL | type Assoc: Trait<'r, Self, Q, K = { loop {} }> | ^ its type must not depend on `Self` @@ -63,7 +63,7 @@ LL | type Assoc: Trait<'r, Self, Q, K = { loop {} }> = note: `K` has type `&'r [Self; Q]` error: the type of the associated constant `K` must not depend on generic parameters - --> $DIR/assoc-const-eq-param-in-ty.rs:40:52 + --> $DIR/assoc-const-eq-param-in-ty.rs:41:52 | LL | type Assoc: Trait<'r, Self, Q, K = { loop {} }> | - ^ its type must not depend on the const parameter `Q` @@ -72,5 +72,37 @@ LL | type Assoc: Trait<'r, Self, Q, K = { loop {} }> | = note: `K` has type `&'r [Self; Q]` -error: aborting due to 8 previous errors +error: the type of the associated constant `K` must not depend on generic parameters + --> $DIR/assoc-const-eq-param-in-ty.rs:41:52 + | +LL | trait Iface<'r> { + | -- the lifetime parameter `'r` is defined here +... +LL | type Assoc: Trait<'r, Self, Q, K = { loop {} }> + | ^ its type must not depend on the lifetime parameter `'r` + | + = note: `K` has type `&'r [Self; Q]` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: the type of the associated constant `K` must not depend on `Self` + --> $DIR/assoc-const-eq-param-in-ty.rs:41:52 + | +LL | type Assoc: Trait<'r, Self, Q, K = { loop {} }> + | ^ its type must not depend on `Self` + | + = note: `K` has type `&'r [Self; Q]` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: the type of the associated constant `K` must not depend on generic parameters + --> $DIR/assoc-const-eq-param-in-ty.rs:41:52 + | +LL | type Assoc: Trait<'r, Self, Q, K = { loop {} }> + | - ^ its type must not depend on the const parameter `Q` + | | + | the const parameter `Q` is defined here + | + = note: `K` has type `&'r [Self; Q]` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 11 previous errors diff --git a/tests/ui/associated-consts/issue-102335-const.rs b/tests/ui/associated-consts/issue-102335-const.rs index f60cb92da7f6b..969c2c43b7163 100644 --- a/tests/ui/associated-consts/issue-102335-const.rs +++ b/tests/ui/associated-consts/issue-102335-const.rs @@ -3,6 +3,7 @@ trait T { type A: S = 34>; //~^ ERROR associated type bindings are not allowed here + //~| ERROR associated type bindings are not allowed here } trait S { diff --git a/tests/ui/associated-consts/issue-102335-const.stderr b/tests/ui/associated-consts/issue-102335-const.stderr index b69dfd51ea8c1..2a70425a3cc87 100644 --- a/tests/ui/associated-consts/issue-102335-const.stderr +++ b/tests/ui/associated-consts/issue-102335-const.stderr @@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here LL | type A: S = 34>; | ^^^^^^^^ associated type not allowed here -error: aborting due to 1 previous error +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-102335-const.rs:4:17 + | +LL | type A: S = 34>; + | ^^^^^^^^ associated type not allowed here + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0229`. diff --git a/tests/ui/associated-inherent-types/issue-109299-1.rs b/tests/ui/associated-inherent-types/issue-109299-1.rs index b86e2e31e0643..4546785f0b1c4 100644 --- a/tests/ui/associated-inherent-types/issue-109299-1.rs +++ b/tests/ui/associated-inherent-types/issue-109299-1.rs @@ -7,7 +7,9 @@ impl Lexer { type Cursor = (); } -type X = impl for Fn() -> Lexer::Cursor; //~ ERROR associated type `Cursor` not found for `Lexer` in the current scope -//~^ ERROR: unconstrained opaque type +type X = impl for Fn() -> Lexer::Cursor; +//~^ ERROR associated type `Cursor` not found for `Lexer` in the current scope +//~| ERROR associated type `Cursor` not found for `Lexer` in the current scope +//~| ERROR: unconstrained opaque type fn main() {} diff --git a/tests/ui/associated-inherent-types/issue-109299-1.stderr b/tests/ui/associated-inherent-types/issue-109299-1.stderr index 5848fa4087da0..07a00b6b9a95f 100644 --- a/tests/ui/associated-inherent-types/issue-109299-1.stderr +++ b/tests/ui/associated-inherent-types/issue-109299-1.stderr @@ -10,6 +10,19 @@ LL | type X = impl for Fn() -> Lexer::Cursor; = note: the associated type was found for - `Lexer` +error[E0220]: associated type `Cursor` not found for `Lexer` in the current scope + --> $DIR/issue-109299-1.rs:10:40 + | +LL | struct Lexer(T); + | --------------- associated item `Cursor` not found for this struct +... +LL | type X = impl for Fn() -> Lexer::Cursor; + | ^^^^^^ associated item not found in `Lexer` + | + = note: the associated type was found for + - `Lexer` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error: unconstrained opaque type --> $DIR/issue-109299-1.rs:10:10 | @@ -18,6 +31,6 @@ LL | type X = impl for Fn() -> Lexer::Cursor; | = note: `X` must be used in combination with a concrete type within the same module -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0220`. diff --git a/tests/ui/associated-type-bounds/duplicate.rs b/tests/ui/associated-type-bounds/duplicate.rs index 06a1993da7272..2b4a01376d779 100644 --- a/tests/ui/associated-type-bounds/duplicate.rs +++ b/tests/ui/associated-type-bounds/duplicate.rs @@ -132,16 +132,19 @@ where fn FRPIT1() -> impl Iterator { //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] + //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] iter::empty() //~^ ERROR type annotations needed } fn FRPIT2() -> impl Iterator { //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] + //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] iter::empty() //~^ ERROR type annotations needed } fn FRPIT3() -> impl Iterator { //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] + //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] iter::empty() //~^ ERROR type annotations needed } @@ -182,10 +185,13 @@ type ETAI3> = impl Copy; //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] type ETAI4 = impl Iterator; //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] +//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] type ETAI5 = impl Iterator; //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] +//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] type ETAI6 = impl Iterator; //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] +//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] trait TRI1> {} //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] @@ -250,14 +256,17 @@ where trait TRA1 { type A: Iterator; //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] + //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] } trait TRA2 { type A: Iterator; //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] + //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] } trait TRA3 { type A: Iterator; //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] + //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] } fn main() {} diff --git a/tests/ui/associated-type-bounds/duplicate.stderr b/tests/ui/associated-type-bounds/duplicate.stderr index 2d298f0a013a5..cf4809991c370 100644 --- a/tests/ui/associated-type-bounds/duplicate.stderr +++ b/tests/ui/associated-type-bounds/duplicate.stderr @@ -198,8 +198,18 @@ LL | fn FRPIT1() -> impl Iterator { | | | `Item` bound here first +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:133:42 + | +LL | fn FRPIT1() -> impl Iterator { + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0282]: type annotations needed - --> $DIR/duplicate.rs:135:5 + --> $DIR/duplicate.rs:136:5 | LL | iter::empty() | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` @@ -210,15 +220,25 @@ LL | iter::empty::() | +++++ error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:138:42 + --> $DIR/duplicate.rs:139:42 + | +LL | fn FRPIT2() -> impl Iterator { + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:139:42 | LL | fn FRPIT2() -> impl Iterator { | ---------- ^^^^^^^^^^ re-bound here | | | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0282]: type annotations needed - --> $DIR/duplicate.rs:140:5 + --> $DIR/duplicate.rs:142:5 | LL | iter::empty() | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` @@ -229,15 +249,25 @@ LL | iter::empty::() | +++++ error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:143:45 + --> $DIR/duplicate.rs:145:45 + | +LL | fn FRPIT3() -> impl Iterator { + | ------------- ^^^^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:145:45 | LL | fn FRPIT3() -> impl Iterator { | ------------- ^^^^^^^^^^^^^ re-bound here | | | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0282]: type annotations needed - --> $DIR/duplicate.rs:145:5 + --> $DIR/duplicate.rs:148:5 | LL | iter::empty() | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` @@ -248,7 +278,7 @@ LL | iter::empty::() | +++++ error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:148:40 + --> $DIR/duplicate.rs:151:40 | LL | fn FAPIT1(_: impl Iterator) {} | ---------- ^^^^^^^^^^ re-bound here @@ -256,7 +286,7 @@ LL | fn FAPIT1(_: impl Iterator) {} | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:150:40 + --> $DIR/duplicate.rs:153:40 | LL | fn FAPIT2(_: impl Iterator) {} | ---------- ^^^^^^^^^^ re-bound here @@ -264,7 +294,7 @@ LL | fn FAPIT2(_: impl Iterator) {} | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:152:43 + --> $DIR/duplicate.rs:155:43 | LL | fn FAPIT3(_: impl Iterator) {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -272,7 +302,7 @@ LL | fn FAPIT3(_: impl Iterator) {} | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:155:35 + --> $DIR/duplicate.rs:158:35 | LL | type TAI1> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -280,7 +310,7 @@ LL | type TAI1> = T; | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:157:35 + --> $DIR/duplicate.rs:160:35 | LL | type TAI2> = T; | ---------- ^^^^^^^^^^ re-bound here @@ -288,7 +318,7 @@ LL | type TAI2> = T; | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:159:38 + --> $DIR/duplicate.rs:162:38 | LL | type TAI3> = T; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -296,7 +326,7 @@ LL | type TAI3> = T; | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:163:29 + --> $DIR/duplicate.rs:166:29 | LL | T: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -304,7 +334,7 @@ LL | T: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:168:29 + --> $DIR/duplicate.rs:171:29 | LL | T: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -312,7 +342,7 @@ LL | T: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:173:32 + --> $DIR/duplicate.rs:176:32 | LL | T: Iterator, | ------------- ^^^^^^^^^^^^^ re-bound here @@ -320,7 +350,7 @@ LL | T: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:177:36 + --> $DIR/duplicate.rs:180:36 | LL | type ETAI1> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -328,7 +358,7 @@ LL | type ETAI1> = impl Copy; | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:179:36 + --> $DIR/duplicate.rs:182:36 | LL | type ETAI2> = impl Copy; | ---------- ^^^^^^^^^^ re-bound here @@ -336,7 +366,7 @@ LL | type ETAI2> = impl Copy; | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:181:39 + --> $DIR/duplicate.rs:184:39 | LL | type ETAI3> = impl Copy; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -344,23 +374,43 @@ LL | type ETAI3> = impl Copy; | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:183:40 + --> $DIR/duplicate.rs:186:40 + | +LL | type ETAI4 = impl Iterator; + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:186:40 | LL | type ETAI4 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here | | | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:189:40 + | +LL | type ETAI5 = impl Iterator; + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:185:40 + --> $DIR/duplicate.rs:189:40 | LL | type ETAI5 = impl Iterator; | ---------- ^^^^^^^^^^ re-bound here | | | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:187:43 + --> $DIR/duplicate.rs:192:43 | LL | type ETAI6 = impl Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -368,7 +418,17 @@ LL | type ETAI6 = impl Iterator; | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:190:36 + --> $DIR/duplicate.rs:192:43 + | +LL | type ETAI6 = impl Iterator; + | ------------- ^^^^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:196:36 | LL | trait TRI1> {} | ---------- ^^^^^^^^^^ re-bound here @@ -376,7 +436,7 @@ LL | trait TRI1> {} | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:192:36 + --> $DIR/duplicate.rs:198:36 | LL | trait TRI2> {} | ---------- ^^^^^^^^^^ re-bound here @@ -384,7 +444,7 @@ LL | trait TRI2> {} | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:194:39 + --> $DIR/duplicate.rs:200:39 | LL | trait TRI3> {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -392,7 +452,7 @@ LL | trait TRI3> {} | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:196:34 + --> $DIR/duplicate.rs:202:34 | LL | trait TRS1: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -400,7 +460,7 @@ LL | trait TRS1: Iterator {} | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:196:34 + --> $DIR/duplicate.rs:202:34 | LL | trait TRS1: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -410,7 +470,7 @@ LL | trait TRS1: Iterator {} = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:196:34 + --> $DIR/duplicate.rs:202:34 | LL | trait TRS1: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -420,7 +480,7 @@ LL | trait TRS1: Iterator {} = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:200:34 + --> $DIR/duplicate.rs:206:34 | LL | trait TRS2: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -428,7 +488,7 @@ LL | trait TRS2: Iterator {} | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:200:34 + --> $DIR/duplicate.rs:206:34 | LL | trait TRS2: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -438,7 +498,7 @@ LL | trait TRS2: Iterator {} = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:200:34 + --> $DIR/duplicate.rs:206:34 | LL | trait TRS2: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -448,7 +508,7 @@ LL | trait TRS2: Iterator {} = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:204:37 + --> $DIR/duplicate.rs:210:37 | LL | trait TRS3: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -456,7 +516,7 @@ LL | trait TRS3: Iterator {} | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:204:37 + --> $DIR/duplicate.rs:210:37 | LL | trait TRS3: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -466,7 +526,7 @@ LL | trait TRS3: Iterator {} = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:204:37 + --> $DIR/duplicate.rs:210:37 | LL | trait TRS3: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -476,7 +536,7 @@ LL | trait TRS3: Iterator {} = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:210:29 + --> $DIR/duplicate.rs:216:29 | LL | T: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -484,7 +544,7 @@ LL | T: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:216:29 + --> $DIR/duplicate.rs:222:29 | LL | T: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -492,7 +552,7 @@ LL | T: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:222:32 + --> $DIR/duplicate.rs:228:32 | LL | T: Iterator, | ------------- ^^^^^^^^^^^^^ re-bound here @@ -500,7 +560,7 @@ LL | T: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:228:32 + --> $DIR/duplicate.rs:234:32 | LL | Self: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -508,7 +568,7 @@ LL | Self: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:228:32 + --> $DIR/duplicate.rs:234:32 | LL | Self: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -518,7 +578,7 @@ LL | Self: Iterator, = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:228:32 + --> $DIR/duplicate.rs:234:32 | LL | Self: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -528,7 +588,7 @@ LL | Self: Iterator, = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:236:32 + --> $DIR/duplicate.rs:242:32 | LL | Self: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -536,7 +596,7 @@ LL | Self: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:236:32 + --> $DIR/duplicate.rs:242:32 | LL | Self: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -546,7 +606,7 @@ LL | Self: Iterator, = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:236:32 + --> $DIR/duplicate.rs:242:32 | LL | Self: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -556,7 +616,7 @@ LL | Self: Iterator, = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:244:35 + --> $DIR/duplicate.rs:250:35 | LL | Self: Iterator, | ------------- ^^^^^^^^^^^^^ re-bound here @@ -564,7 +624,7 @@ LL | Self: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:244:35 + --> $DIR/duplicate.rs:250:35 | LL | Self: Iterator, | ------------- ^^^^^^^^^^^^^ re-bound here @@ -574,7 +634,7 @@ LL | Self: Iterator, = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:244:35 + --> $DIR/duplicate.rs:250:35 | LL | Self: Iterator, | ------------- ^^^^^^^^^^^^^ re-bound here @@ -584,30 +644,60 @@ LL | Self: Iterator, = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:251:34 + --> $DIR/duplicate.rs:257:34 + | +LL | type A: Iterator; + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:257:34 | LL | type A: Iterator; | ---------- ^^^^^^^^^^ re-bound here | | | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:262:34 + | +LL | type A: Iterator; + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:255:34 + --> $DIR/duplicate.rs:262:34 | LL | type A: Iterator; | ---------- ^^^^^^^^^^ re-bound here | | | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:259:37 + --> $DIR/duplicate.rs:267:37 | LL | type A: Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here | | | `Item` bound here first -error: aborting due to 72 previous errors +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:267:37 + | +LL | type A: Iterator; + | ------------- ^^^^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 81 previous errors Some errors have detailed explanations: E0282, E0719. For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/associated-type-bounds/issue-102335-ty.rs b/tests/ui/associated-type-bounds/issue-102335-ty.rs index 363df73c1ffd7..5fd8b71e679b2 100644 --- a/tests/ui/associated-type-bounds/issue-102335-ty.rs +++ b/tests/ui/associated-type-bounds/issue-102335-ty.rs @@ -1,6 +1,7 @@ trait T { type A: S = ()>; //~^ ERROR associated type bindings are not allowed here + //~| ERROR associated type bindings are not allowed here } trait Q {} diff --git a/tests/ui/associated-type-bounds/issue-102335-ty.stderr b/tests/ui/associated-type-bounds/issue-102335-ty.stderr index 561ca15ab0d05..3bd7566ad1e0a 100644 --- a/tests/ui/associated-type-bounds/issue-102335-ty.stderr +++ b/tests/ui/associated-type-bounds/issue-102335-ty.stderr @@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here LL | type A: S = ()>; | ^^^^^^^^^ associated type not allowed here -error: aborting due to 1 previous error +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-102335-ty.rs:2:17 + | +LL | type A: S = ()>; + | ^^^^^^^^^ associated type not allowed here + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0229`. diff --git a/tests/ui/associated-type-bounds/issue-99828.rs b/tests/ui/associated-type-bounds/issue-99828.rs index 67ba50f3cbce6..ab3654131f1d9 100644 --- a/tests/ui/associated-type-bounds/issue-99828.rs +++ b/tests/ui/associated-type-bounds/issue-99828.rs @@ -1,5 +1,6 @@ fn get_iter(vec: &[i32]) -> impl Iterator + '_ { //~^ ERROR expected type, found constant + //~| ERROR expected type, found constant //~| ERROR associated const equality is incomplete vec.iter() } diff --git a/tests/ui/associated-type-bounds/issue-99828.stderr b/tests/ui/associated-type-bounds/issue-99828.stderr index 911f3ff0f5ed5..132d5251987b7 100644 --- a/tests/ui/associated-type-bounds/issue-99828.stderr +++ b/tests/ui/associated-type-bounds/issue-99828.stderr @@ -19,6 +19,18 @@ LL | fn get_iter(vec: &[i32]) -> impl Iterator + '_ { note: the associated type is defined here --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -error: aborting due to 2 previous errors +error: expected type, found constant + --> $DIR/issue-99828.rs:1:50 + | +LL | fn get_iter(vec: &[i32]) -> impl Iterator + '_ { + | ---- ^^ unexpected constant + | | + | expected a type because of this associated type + | +note: the associated type is defined here + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/async-await/issues/issue-65159.rs b/tests/ui/async-await/issues/issue-65159.rs index 781f8fe88d4d1..78492d55fdaa5 100644 --- a/tests/ui/async-await/issues/issue-65159.rs +++ b/tests/ui/async-await/issues/issue-65159.rs @@ -4,6 +4,7 @@ async fn copy() -> Result<()> //~^ ERROR enum takes 2 generic arguments +//~| ERROR enum takes 2 generic arguments { Ok(()) } diff --git a/tests/ui/async-await/issues/issue-65159.stderr b/tests/ui/async-await/issues/issue-65159.stderr index 19512116a66cd..834927060b113 100644 --- a/tests/ui/async-await/issues/issue-65159.stderr +++ b/tests/ui/async-await/issues/issue-65159.stderr @@ -11,6 +11,20 @@ help: add missing generic argument LL | async fn copy() -> Result<(), E> | +++ -error: aborting due to 1 previous error +error[E0107]: enum takes 2 generic arguments but 1 generic argument was supplied + --> $DIR/issue-65159.rs:5:20 + | +LL | async fn copy() -> Result<()> + | ^^^^^^ -- supplied 1 generic argument + | | + | expected 2 generic arguments + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | async fn copy() -> Result<(), E> + | +++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs index 15be5fb3fac05..ebffa237f9643 100644 --- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs +++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs @@ -15,7 +15,9 @@ impl MarketMultiplier { async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied - //~^^ ERROR struct takes 1 generic argument but 0 generic arguments were supplied + //~| ERROR struct takes 1 generic argument but 0 generic arguments were supplied + //~| ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR struct takes 1 generic argument but 0 generic arguments were supplied LockedMarket(coroutine.lock().unwrap().buy()) } diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr index 516c1d065e670..c0b6dcd1512f7 100644 --- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr +++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr @@ -7,7 +7,7 @@ LL | async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> | expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters - --> $DIR/issue-82126-mismatched-subst-and-hir.rs:22:8 + --> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8 | LL | struct LockedMarket(T); | ^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> | ^^^^^^^^^^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` - --> $DIR/issue-82126-mismatched-subst-and-hir.rs:22:8 + --> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8 | LL | struct LockedMarket(T); | ^^^^^^^^^^^^ - @@ -28,6 +28,38 @@ help: add missing generic argument LL | async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_, T> { | +++ -error: aborting due to 2 previous errors +error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied + --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 + | +LL | async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { + | ^^^^^^^^^^^^---- help: remove these generics + | | + | expected 0 lifetime arguments + | +note: struct defined here, with 0 lifetime parameters + --> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8 + | +LL | struct LockedMarket(T); + | ^^^^^^^^^^^^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied + --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 + | +LL | async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { + | ^^^^^^^^^^^^ expected 1 generic argument + | +note: struct defined here, with 1 generic parameter: `T` + --> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8 + | +LL | struct LockedMarket(T); + | ^^^^^^^^^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_, T> { + | +++ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/const-generics/min_const_generics/macro-fail.rs b/tests/ui/const-generics/min_const_generics/macro-fail.rs index f3df96d468c35..2f101ecfb1f7a 100644 --- a/tests/ui/const-generics/min_const_generics/macro-fail.rs +++ b/tests/ui/const-generics/min_const_generics/macro-fail.rs @@ -13,6 +13,7 @@ impl Marker for Example {} fn make_marker() -> impl Marker { //~^ ERROR: type provided when a constant was expected + //~| ERROR: type provided when a constant was expected Example:: //~^ ERROR: type provided when a constant was expected } diff --git a/tests/ui/const-generics/min_const_generics/macro-fail.stderr b/tests/ui/const-generics/min_const_generics/macro-fail.stderr index 06a111008a30f..34764982bb046 100644 --- a/tests/ui/const-generics/min_const_generics/macro-fail.stderr +++ b/tests/ui/const-generics/min_const_generics/macro-fail.stderr @@ -1,5 +1,5 @@ error: expected type, found `{` - --> $DIR/macro-fail.rs:29:27 + --> $DIR/macro-fail.rs:30:27 | LL | fn make_marker() -> impl Marker { | ---------------------- @@ -13,7 +13,7 @@ LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} = note: this error originates in the macro `gimme_a_const` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected type, found `{` - --> $DIR/macro-fail.rs:29:27 + --> $DIR/macro-fail.rs:30:27 | LL | Example:: | ---------------------- @@ -41,7 +41,7 @@ LL | let _fail = Example::; = note: this error originates in the macro `external_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: unexpected end of macro invocation - --> $DIR/macro-fail.rs:39:25 + --> $DIR/macro-fail.rs:40:25 | LL | macro_rules! gimme_a_const { | -------------------------- when calling this macro @@ -50,7 +50,7 @@ LL | let _fail = Example::; | ^^^^^^^^^^^^^^^^ missing tokens in macro arguments | note: while trying to match meta-variable `$rusty:ident` - --> $DIR/macro-fail.rs:29:8 + --> $DIR/macro-fail.rs:30:8 | LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} | ^^^^^^^^^^^^^ @@ -62,23 +62,31 @@ LL | fn make_marker() -> impl Marker { | ^^^^^^^^^^^^^^^^^^^^^^ error[E0747]: type provided when a constant was expected - --> $DIR/macro-fail.rs:16:13 + --> $DIR/macro-fail.rs:14:33 + | +LL | fn make_marker() -> impl Marker { + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0747]: type provided when a constant was expected + --> $DIR/macro-fail.rs:17:13 | LL | Example:: | ^^^^^^^^^^^^^^^^^^^^^^ error[E0747]: type provided when a constant was expected - --> $DIR/macro-fail.rs:36:25 + --> $DIR/macro-fail.rs:37:25 | LL | let _fail = Example::; | ^^^^^^^^^^^^^^^^^ error[E0747]: type provided when a constant was expected - --> $DIR/macro-fail.rs:39:25 + --> $DIR/macro-fail.rs:40:25 | LL | let _fail = Example::; | ^^^^^^^^^^^^^^^^ -error: aborting due to 8 previous errors +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0747`. diff --git a/tests/ui/generic-associated-types/issue-102335-gat.rs b/tests/ui/generic-associated-types/issue-102335-gat.rs index a7255fdcbf5e1..3a4a0c107715b 100644 --- a/tests/ui/generic-associated-types/issue-102335-gat.rs +++ b/tests/ui/generic-associated-types/issue-102335-gat.rs @@ -1,6 +1,7 @@ trait T { type A: S = ()>; //~^ ERROR associated type bindings are not allowed here + //~| ERROR associated type bindings are not allowed here } trait Q {} diff --git a/tests/ui/generic-associated-types/issue-102335-gat.stderr b/tests/ui/generic-associated-types/issue-102335-gat.stderr index 39ca7954edef1..f5e782e92fc6a 100644 --- a/tests/ui/generic-associated-types/issue-102335-gat.stderr +++ b/tests/ui/generic-associated-types/issue-102335-gat.stderr @@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here LL | type A: S = ()>; | ^^^^^^^^ associated type not allowed here -error: aborting due to 1 previous error +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-102335-gat.rs:2:21 + | +LL | type A: S = ()>; + | ^^^^^^^^ associated type not allowed here + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0229`. diff --git a/tests/ui/generic-associated-types/issue-81712-cyclic-traits.rs b/tests/ui/generic-associated-types/issue-81712-cyclic-traits.rs index a7cc9a6053e49..412eeb6e29ae4 100644 --- a/tests/ui/generic-associated-types/issue-81712-cyclic-traits.rs +++ b/tests/ui/generic-associated-types/issue-81712-cyclic-traits.rs @@ -13,6 +13,7 @@ trait C { trait D { type CType: C; //~^ ERROR missing generics for associated type + //~| ERROR missing generics for associated type } fn main() {} diff --git a/tests/ui/generic-associated-types/issue-81712-cyclic-traits.stderr b/tests/ui/generic-associated-types/issue-81712-cyclic-traits.stderr index 5eb988ea042aa..33c40f88f8728 100644 --- a/tests/ui/generic-associated-types/issue-81712-cyclic-traits.stderr +++ b/tests/ui/generic-associated-types/issue-81712-cyclic-traits.stderr @@ -14,6 +14,23 @@ help: add missing generic argument LL | type CType: C = Self>; | +++ -error: aborting due to 1 previous error +error[E0107]: missing generics for associated type `C::DType` + --> $DIR/issue-81712-cyclic-traits.rs:14:19 + | +LL | type CType: C; + | ^^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-81712-cyclic-traits.rs:11:10 + | +LL | type DType: D; + | ^^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | type CType: C = Self>; + | +++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.rs b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.rs index 41c5b9f5074de..e75cfc88ef45c 100644 --- a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.rs +++ b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.rs @@ -5,6 +5,8 @@ fn ice() -> impl AsRef { //~^ WARN trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + //~| WARN trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! Foo } diff --git a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr index 3cb3af89bfc25..d82b2c0f6066a 100644 --- a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr +++ b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr @@ -12,5 +12,19 @@ help: if this is an object-safe trait, use `dyn` LL | fn ice() -> impl AsRef { | +++ -warning: 1 warning emitted +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/fresh-lifetime-from-bare-trait-obj-114664.rs:5:24 + | +LL | fn ice() -> impl AsRef { + | ^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: if this is an object-safe trait, use `dyn` + | +LL | fn ice() -> impl AsRef { + | +++ + +warning: 2 warnings emitted diff --git a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs index 10167ee935262..ab21dae7dc50d 100644 --- a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs +++ b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs @@ -12,6 +12,7 @@ impl<'a, I: 'a + Iterable> Iterable for &'a I { fn iter(&self) -> impl for<'missing> Iterator> {} //~^ ERROR binding for associated type `Item` references lifetime `'missing` + //~| ERROR binding for associated type `Item` references lifetime `'missing` //~| ERROR `()` is not an iterator } diff --git a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr index 96c3644f89348..d8a2eef94a180 100644 --- a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr +++ b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr @@ -4,6 +4,14 @@ error[E0582]: binding for associated type `Item` references lifetime `'missing`, LL | fn iter(&self) -> impl for<'missing> Iterator> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error[E0582]: binding for associated type `Item` references lifetime `'missing`, which does not appear in the trait input types + --> $DIR/span-bug-issue-121457.rs:13:51 + | +LL | fn iter(&self) -> impl for<'missing> Iterator> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0195]: lifetime parameters or bounds on type `Item` do not match the trait declaration --> $DIR/span-bug-issue-121457.rs:10:14 | @@ -24,7 +32,7 @@ LL | fn iter(&self) -> impl for<'missing> Iterator(data: &[T]) -> impl Iterator { //~^ ERROR: missing generics for struct `Vec` [E0107] + //~| ERROR: missing generics for struct `Vec` [E0107] iter::empty() } diff --git a/tests/ui/impl-trait/issues/issue-92305.stderr b/tests/ui/impl-trait/issues/issue-92305.stderr index 88fb1fb27070e..4591d2c53f730 100644 --- a/tests/ui/impl-trait/issues/issue-92305.stderr +++ b/tests/ui/impl-trait/issues/issue-92305.stderr @@ -9,6 +9,18 @@ help: add missing generic argument LL | fn f(data: &[T]) -> impl Iterator> { | +++ -error: aborting due to 1 previous error +error[E0107]: missing generics for struct `Vec` + --> $DIR/issue-92305.rs:5:45 + | +LL | fn f(data: &[T]) -> impl Iterator { + | ^^^ expected at least 1 generic argument + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | fn f(data: &[T]) -> impl Iterator> { + | +++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.rs b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.rs index 529913479ef4b..8d4855c101c7c 100644 --- a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.rs +++ b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.rs @@ -7,6 +7,7 @@ fn frob() -> impl Fn + '_ {} //~| ERROR cannot find type `P` //~| ERROR cannot find type `T` //~| ERROR `Fn`-family traits' type parameters is subject to change +//~| ERROR `Fn`-family traits' type parameters is subject to change fn open_parent<'path>() { todo!() diff --git a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr index b54b9f908b2a4..6d41748853332 100644 --- a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr +++ b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr @@ -42,8 +42,19 @@ LL | fn frob() -> impl Fn + '_ {} = help: add `#![feature(unboxed_closures)]` 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]: the precise format of `Fn`-family traits' type parameters is subject to change + --> $DIR/opaque-used-in-extraneous-argument.rs:5:19 + | +LL | fn frob() -> impl Fn + '_ {} + | ^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn(P) -> T` + | + = note: see issue #29625 for more information + = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0061]: this function takes 0 arguments but 1 argument was supplied - --> $DIR/opaque-used-in-extraneous-argument.rs:16:20 + --> $DIR/opaque-used-in-extraneous-argument.rs:17:20 | LL | let old_path = frob("hello"); | ^^^^ ------- @@ -58,7 +69,7 @@ LL | fn frob() -> impl Fn + '_ {} | ^^^^ error[E0061]: this function takes 0 arguments but 1 argument was supplied - --> $DIR/opaque-used-in-extraneous-argument.rs:19:5 + --> $DIR/opaque-used-in-extraneous-argument.rs:20:5 | LL | open_parent(&old_path) | ^^^^^^^^^^^ --------- @@ -67,12 +78,12 @@ LL | open_parent(&old_path) | help: remove the extra argument | note: function defined here - --> $DIR/opaque-used-in-extraneous-argument.rs:11:4 + --> $DIR/opaque-used-in-extraneous-argument.rs:12:4 | LL | fn open_parent<'path>() { | ^^^^^^^^^^^ -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors Some errors have detailed explanations: E0061, E0106, E0412, E0658. For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/impl-trait/stranded-opaque.rs b/tests/ui/impl-trait/stranded-opaque.rs index c7ab390e1fd0c..6ce5cbd3b555a 100644 --- a/tests/ui/impl-trait/stranded-opaque.rs +++ b/tests/ui/impl-trait/stranded-opaque.rs @@ -7,6 +7,7 @@ impl Trait for i32 {} // ICE in this case. fn produce() -> impl Trait { //~^ ERROR associated type `Assoc` not found for `Trait` + //~| ERROR associated type `Assoc` not found for `Trait` 16 } diff --git a/tests/ui/impl-trait/stranded-opaque.stderr b/tests/ui/impl-trait/stranded-opaque.stderr index 75f5480bc8b81..5bea3e2af6b30 100644 --- a/tests/ui/impl-trait/stranded-opaque.stderr +++ b/tests/ui/impl-trait/stranded-opaque.stderr @@ -4,6 +4,14 @@ error[E0220]: associated type `Assoc` not found for `Trait` LL | fn produce() -> impl Trait { | ^^^^^ associated type `Assoc` not found -error: aborting due to 1 previous error +error[E0220]: associated type `Assoc` not found for `Trait` + --> $DIR/stranded-opaque.rs:8:31 + | +LL | fn produce() -> impl Trait { + | ^^^^^ associated type `Assoc` not found + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0220`. diff --git a/tests/ui/issues/issue-87199.rs b/tests/ui/issues/issue-87199.rs index 081c45d6151dd..34879c5a7ca3b 100644 --- a/tests/ui/issues/issue-87199.rs +++ b/tests/ui/issues/issue-87199.rs @@ -11,6 +11,7 @@ fn ref_arg(_: &T) {} //~^ warning: relaxing a default bound only does something for `?Sized` fn ret() -> impl Iterator + ?Send { std::iter::empty() } //~^ warning: relaxing a default bound only does something for `?Sized` +//~| warning: relaxing a default bound only does something for `?Sized` // Check that there's no `?Sized` relaxation! fn main() { diff --git a/tests/ui/issues/issue-87199.stderr b/tests/ui/issues/issue-87199.stderr index 34433eef5c70b..a0ed2946fb4af 100644 --- a/tests/ui/issues/issue-87199.stderr +++ b/tests/ui/issues/issue-87199.stderr @@ -16,8 +16,16 @@ warning: relaxing a default bound only does something for `?Sized`; all other tr LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } | ^^^^^ +warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/issue-87199.rs:12:40 + | +LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } + | ^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0277]: the size for values of type `[i32]` cannot be known at compilation time - --> $DIR/issue-87199.rs:18:15 + --> $DIR/issue-87199.rs:19:15 | LL | ref_arg::<[i32]>(&[5]); | ^^^^^ doesn't have a size known at compile-time @@ -33,6 +41,6 @@ help: consider relaxing the implicit `Sized` restriction LL | fn ref_arg(_: &T) {} | ++++++++ -error: aborting due to 1 previous error; 3 warnings emitted +error: aborting due to 1 previous error; 4 warnings emitted For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/nll/issue-54189.rs b/tests/ui/nll/issue-54189.rs index 70aecc384effe..2339a722a7b7a 100644 --- a/tests/ui/nll/issue-54189.rs +++ b/tests/ui/nll/issue-54189.rs @@ -1,5 +1,6 @@ fn bug() -> impl for <'r> Fn() -> &'r () { || { &() } } //~^ ERROR binding for associated type `Output` references lifetime `'r` +//~| ERROR binding for associated type `Output` references lifetime `'r` fn main() { let f = bug(); diff --git a/tests/ui/nll/issue-54189.stderr b/tests/ui/nll/issue-54189.stderr index 14ed2bb222d74..ce756a91f563d 100644 --- a/tests/ui/nll/issue-54189.stderr +++ b/tests/ui/nll/issue-54189.stderr @@ -4,6 +4,14 @@ error[E0582]: binding for associated type `Output` references lifetime `'r`, whi LL | fn bug() -> impl for <'r> Fn() -> &'r () { || { &() } } | ^^^^^^ -error: aborting due to 1 previous error +error[E0582]: binding for associated type `Output` references lifetime `'r`, which does not appear in the trait input types + --> $DIR/issue-54189.rs:1:35 + | +LL | fn bug() -> impl for <'r> Fn() -> &'r () { || { &() } } + | ^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0582`. diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr index ace2e7e46c4e8..12cc79f5961d3 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr @@ -4,5 +4,13 @@ error: `~const` can only be applied to `#[const_trait]` traits LL | const fn test() -> impl ~const Fn() { | ^^^^ -error: aborting due to 1 previous error +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-closure-parse-not-item.rs:7:32 + | +LL | const fn test() -> impl ~const Fn() { + | ^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.rs index 7d817d09c7f0b..21197fcaa273a 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.rs @@ -1,7 +1,9 @@ #![feature(const_trait_impl, effects)] -const fn test() -> impl ~const Fn() { //~ ERROR `~const` can only be applied to `#[const_trait]` traits - //~^ ERROR cycle detected +const fn test() -> impl ~const Fn() { + //~^ ERROR `~const` can only be applied to `#[const_trait]` traits + //~| ERROR `~const` can only be applied to `#[const_trait]` traits + //~| ERROR cycle detected const move || { //~ ERROR const closures are experimental let sl: &[u8] = b"foo"; diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.stderr index 0f6240cc03b80..2f8051109173d 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-112822-expected-type-for-param.stderr @@ -1,5 +1,5 @@ error[E0658]: const closures are experimental - --> $DIR/ice-112822-expected-type-for-param.rs:5:5 + --> $DIR/ice-112822-expected-type-for-param.rs:7:5 | LL | const move || { | ^^^^^ @@ -14,8 +14,16 @@ error: `~const` can only be applied to `#[const_trait]` traits LL | const fn test() -> impl ~const Fn() { | ^^^^ +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/ice-112822-expected-type-for-param.rs:3:32 + | +LL | const fn test() -> impl ~const Fn() { + | ^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0277]: can't compare `&u8` with `&u8` - --> $DIR/ice-112822-expected-type-for-param.rs:10:17 + --> $DIR/ice-112822-expected-type-for-param.rs:12:17 | LL | assert_eq!(first, &b'f'); | ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `&u8 == &u8` @@ -54,7 +62,7 @@ LL | const fn test() -> impl ~const Fn() { | ^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors Some errors have detailed explanations: E0277, E0391, E0658. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/issue-85347.rs b/tests/ui/suggestions/issue-85347.rs index 04d4c47d8e583..d14cf07d915ed 100644 --- a/tests/ui/suggestions/issue-85347.rs +++ b/tests/ui/suggestions/issue-85347.rs @@ -4,6 +4,9 @@ trait Foo { //~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments were supplied //~| ERROR associated type bindings are not allowed here //~| HELP add missing + //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments were supplied + //~| ERROR associated type bindings are not allowed here + //~| HELP add missing } fn main() {} diff --git a/tests/ui/suggestions/issue-85347.stderr b/tests/ui/suggestions/issue-85347.stderr index f330b3c1faded..45f87e539b4e6 100644 --- a/tests/ui/suggestions/issue-85347.stderr +++ b/tests/ui/suggestions/issue-85347.stderr @@ -20,7 +20,32 @@ error[E0229]: associated type bindings are not allowed here LL | type Bar<'a>: Deref::Bar>; | ^^^^^^^^^^^^^ associated type not allowed here -error: aborting due to 2 previous errors +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied + --> $DIR/issue-85347.rs:3:42 + | +LL | type Bar<'a>: Deref::Bar>; + | ^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-85347.rs:3:10 + | +LL | type Bar<'a>: Deref::Bar>; + | ^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | type Bar<'a>: Deref::Bar<'a, Target = Self>>; + | +++ + +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-85347.rs:3:46 + | +LL | type Bar<'a>: Deref::Bar>; + | ^^^^^^^^^^^^^ associated type not allowed here + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 4 previous errors Some errors have detailed explanations: E0107, E0229. For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs index 7d71fcdd15813..cab484a120c33 100644 --- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs +++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs @@ -20,6 +20,7 @@ impl Trait for () {} fn func>(t: T) -> impl Trait<(), i32> { //~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied //~| ERROR trait takes 1 generic argument but 2 generic arguments were supplied +//~| ERROR trait takes 1 generic argument but 2 generic arguments were supplied //~| ERROR type annotations needed 3 } diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr index f4ede4190fc7a..99e81a9039e73 100644 --- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr +++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr @@ -54,6 +54,23 @@ help: replace the generic bound with the associated type LL | fn func>(t: T) -> impl Trait<(), Assoc = i32> { | +++++++ +error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:20:46 + | +LL | fn func>(t: T) -> impl Trait<(), i32> { + | ^^^^^ expected 1 generic argument + | +note: trait defined here, with 1 generic parameter: `T` + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11 + | +LL | pub trait Trait { + | ^^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: replace the generic bound with the associated type + | +LL | fn func>(t: T) -> impl Trait<(), Assoc = i32> { + | +++++++ + error[E0282]: type annotations needed --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:20:41 | @@ -61,7 +78,7 @@ LL | fn func>(t: T) -> impl Trait<(), i32> { | ^^^^^^^^^^^^^^^^^^^ cannot infer type error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:27:18 + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:28:18 | LL | struct Struct> { | ^^^^^ expected 1 generic argument @@ -77,7 +94,7 @@ LL | struct Struct> { | +++++++ error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:32:23 + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:33:23 | LL | trait AnotherTrait> {} | ^^^^^ expected 1 generic argument @@ -93,7 +110,7 @@ LL | trait AnotherTrait> {} | +++++++ error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:35:9 + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:36:9 | LL | impl> Struct {} | ^^^^^ expected 1 generic argument @@ -109,7 +126,7 @@ LL | impl> Struct {} | +++++++ error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:41:58 + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:42:58 | LL | impl, U> YetAnotherTrait for Struct {} | ^^^^^^ - help: remove this generic argument @@ -117,12 +134,12 @@ LL | impl, U> YetAnotherTrait for Struct {} | expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:27:8 + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:28:8 | LL | struct Struct> { | ^^^^^^ - -error: aborting due to 10 previous errors +error: aborting due to 11 previous errors Some errors have detailed explanations: E0107, E0207, E0282. For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.fixed b/tests/ui/type-alias-impl-trait/not_well_formed.fixed deleted file mode 100644 index bd45d8cddae98..0000000000000 --- a/tests/ui/type-alias-impl-trait/not_well_formed.fixed +++ /dev/null @@ -1,19 +0,0 @@ -//@ run-rustfix -#![feature(type_alias_impl_trait)] -#![allow(dead_code)] - -fn main() {} - -trait TraitWithAssoc { - type Assoc; -} - -type Foo = impl Trait; //~ associated type `Assoc` not found for `V` - -trait Trait {} - -impl Trait for () {} - -fn foo_desugared(_: T) -> Foo { - () -} diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.rs b/tests/ui/type-alias-impl-trait/not_well_formed.rs index 7b5444ae0d345..0cf8d41c7fd4a 100644 --- a/tests/ui/type-alias-impl-trait/not_well_formed.rs +++ b/tests/ui/type-alias-impl-trait/not_well_formed.rs @@ -1,4 +1,4 @@ -//@ run-rustfix +// Can't rustfix because we apply the suggestion twice :^( #![feature(type_alias_impl_trait)] #![allow(dead_code)] @@ -8,7 +8,9 @@ trait TraitWithAssoc { type Assoc; } -type Foo = impl Trait; //~ associated type `Assoc` not found for `V` +type Foo = impl Trait; +//~^ associated type `Assoc` not found for `V` +//~| associated type `Assoc` not found for `V` trait Trait {} diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.stderr b/tests/ui/type-alias-impl-trait/not_well_formed.stderr index dbd80ffa4f6c3..a2944a1acb97a 100644 --- a/tests/ui/type-alias-impl-trait/not_well_formed.stderr +++ b/tests/ui/type-alias-impl-trait/not_well_formed.stderr @@ -9,6 +9,18 @@ help: consider restricting type parameter `V` LL | type Foo = impl Trait; | ++++++++++++++++ -error: aborting due to 1 previous error +error[E0220]: associated type `Assoc` not found for `V` + --> $DIR/not_well_formed.rs:11:29 + | +LL | type Foo = impl Trait; + | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider restricting type parameter `V` + | +LL | type Foo = impl Trait; + | ++++++++++++++++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0220`.