Bless test fallout (duplicate diagnostics)

This commit is contained in:
Michael Goulet 2024-03-20 12:52:54 -04:00
parent aa39dbb962
commit ce5f8c93fa
54 changed files with 571 additions and 128 deletions

View File

@ -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() {

View File

@ -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<U>`, it will register a predicate of `T: Trait<U>`, 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<ExprFnSig<'t
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => 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() {

View File

@ -3,6 +3,7 @@
trait T {
type A: S<C<X = 0i32> = 34>;
//~^ ERROR associated type bindings are not allowed here
//~| ERROR associated type bindings are not allowed here
}
trait S {

View File

@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here
LL | type A: S<C<X = 0i32> = 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<C<X = 0i32> = 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`.

View File

@ -6,6 +6,7 @@
trait T {
type A: S<C<X = 0i32> = 34>;
//~^ ERROR associated type bindings are not allowed here
//~| ERROR associated type bindings are not allowed here
}
trait S {

View File

@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here
LL | type A: S<C<X = 0i32> = 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<C<X = 0i32> = 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`.

View File

@ -6,6 +6,7 @@ pub trait TraitWithAssoc {
pub type Foo<V> = impl Trait<V::Assoc>;
//~^ ERROR
//~| ERROR
pub trait Trait<U> {}

View File

@ -9,6 +9,18 @@ help: consider restricting type parameter `V`
LL | pub type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>;
| ++++++++++++++++
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<V> = impl Trait<V::Assoc>;
| ^^^^^ 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<V: TraitWithAssoc> = impl Trait<V::Assoc>;
| ++++++++++++++++
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0220`.

View File

@ -37,8 +37,10 @@ fn take2<P: Project<SELF = {}>>(_: P) {}
trait Iface<'r> {
//~^ NOTE the lifetime parameter `'r` is defined here
//~| NOTE the lifetime parameter `'r` is defined here
type Assoc<const Q: usize>: 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`
@ -48,6 +50,18 @@ 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 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 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;
}

View File

@ -44,18 +44,18 @@ LL | fn take2<P: Project<SELF = {}>>(_: 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<const Q: usize>: 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<const Q: usize>: Trait<'r, Self, Q, K = { loop {} }>
| ^ its type must not depend on `Self`
@ -63,7 +63,7 @@ LL | type Assoc<const Q: usize>: 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<const Q: usize>: Trait<'r, Self, Q, K = { loop {} }>
| - ^ its type must not depend on the const parameter `Q`
@ -72,5 +72,37 @@ LL | type Assoc<const Q: usize>: 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<const Q: usize>: 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<const Q: usize>: 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<const Q: usize>: 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

View File

@ -3,6 +3,7 @@
trait T {
type A: S<C<X = 0i32> = 34>;
//~^ ERROR associated type bindings are not allowed here
//~| ERROR associated type bindings are not allowed here
}
trait S {

View File

@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here
LL | type A: S<C<X = 0i32> = 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<C<X = 0i32> = 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`.

View File

@ -7,7 +7,9 @@ impl Lexer<i32> {
type Cursor = ();
}
type X = impl for<T> Fn() -> Lexer<T>::Cursor; //~ ERROR associated type `Cursor` not found for `Lexer<T>` in the current scope
//~^ ERROR: unconstrained opaque type
type X = impl for<T> Fn() -> Lexer<T>::Cursor;
//~^ ERROR associated type `Cursor` not found for `Lexer<T>` in the current scope
//~| ERROR associated type `Cursor` not found for `Lexer<T>` in the current scope
//~| ERROR: unconstrained opaque type
fn main() {}

View File

@ -10,6 +10,19 @@ LL | type X = impl for<T> Fn() -> Lexer<T>::Cursor;
= note: the associated type was found for
- `Lexer<i32>`
error[E0220]: associated type `Cursor` not found for `Lexer<T>` in the current scope
--> $DIR/issue-109299-1.rs:10:40
|
LL | struct Lexer<T>(T);
| --------------- associated item `Cursor` not found for this struct
...
LL | type X = impl for<T> Fn() -> Lexer<T>::Cursor;
| ^^^^^^ associated item not found in `Lexer<T>`
|
= note: the associated type was found for
- `Lexer<i32>`
= 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<T> Fn() -> Lexer<T>::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`.

View File

@ -132,16 +132,19 @@ where
fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
//~^ 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<Item: Copy, Item: Copy> {
//~^ 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<Item: 'static, Item: 'static> {
//~^ 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<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
//~^ 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<Item: Copy, Item: Copy>;
//~^ 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<Item: 'static, Item: 'static>;
//~^ 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<T: Iterator<Item: Copy, Item: Send>> {}
//~^ 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<Item: Copy, Item: Send>;
//~^ 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<Item: Copy, Item: Copy>;
//~^ 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<Item: 'static, Item: 'static>;
//~^ 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() {}

View File

@ -198,8 +198,18 @@ LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
| |
| `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<Item: Copy, Item: Send> {
| ---------- ^^^^^^^^^^ 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::<T>()
| +++++
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<Item: Copy, Item: Copy> {
| ---------- ^^^^^^^^^^ 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<Item: Copy, Item: Copy> {
| ---------- ^^^^^^^^^^ 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::<T>()
| +++++
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<Item: 'static, Item: 'static> {
| ------------- ^^^^^^^^^^^^^ 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<Item: 'static, Item: 'static> {
| ------------- ^^^^^^^^^^^^^ 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::<T>()
| +++++
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<Item: Copy, Item: Send>) {}
| ---------- ^^^^^^^^^^ re-bound here
@ -256,7 +286,7 @@ LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
| `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<Item: Copy, Item: Copy>) {}
| ---------- ^^^^^^^^^^ re-bound here
@ -264,7 +294,7 @@ LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
| `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<Item: 'static, Item: 'static>) {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -272,7 +302,7 @@ LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| `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: Iterator<Item: Copy, Item: Send>> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -280,7 +310,7 @@ LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = 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: Iterator<Item: Copy, Item: Copy>> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -288,7 +318,7 @@ LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = 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: Iterator<Item: 'static, Item: 'static>> = T;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -296,7 +326,7 @@ LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = 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<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -304,7 +334,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| `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<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -312,7 +342,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| `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<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -320,7 +350,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| `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<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
@ -328,7 +358,7 @@ LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = 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<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
@ -336,7 +366,7 @@ LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = 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<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -344,7 +374,7 @@ LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = 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<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -352,7 +382,17 @@ LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| `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:186:40
|
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ 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<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here
@ -360,7 +400,17 @@ LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:187:43
--> $DIR/duplicate.rs:189:40
|
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ 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:192:43
|
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -368,7 +418,17 @@ LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| `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<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ 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<T: Iterator<Item: Copy, Item: Send>> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -376,7 +436,7 @@ LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| `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<T: Iterator<Item: Copy, Item: Copy>> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -384,7 +444,7 @@ LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| `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<T: Iterator<Item: 'static, Item: 'static>> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -392,7 +452,7 @@ LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| `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<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -400,7 +460,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| `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<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -410,7 +470,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
= 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<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -420,7 +480,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
= 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<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -428,7 +488,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| `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<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -438,7 +498,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
= 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<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -448,7 +508,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
= 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<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -456,7 +516,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| `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<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -466,7 +526,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
= 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<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -476,7 +536,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
= 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<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -484,7 +544,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| `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<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -492,7 +552,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| `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<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -500,7 +560,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| `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<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -508,7 +568,7 @@ LL | Self: Iterator<Item: Copy, Item: Send>,
| `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<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -518,7 +578,7 @@ LL | Self: Iterator<Item: Copy, Item: Send>,
= 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<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -528,7 +588,7 @@ LL | Self: Iterator<Item: Copy, Item: Send>,
= 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<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -536,7 +596,7 @@ LL | Self: Iterator<Item: Copy, Item: Copy>,
| `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<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -546,7 +606,7 @@ LL | Self: Iterator<Item: Copy, Item: Copy>,
= 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<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -556,7 +616,7 @@ LL | Self: Iterator<Item: Copy, Item: Copy>,
= 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<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -564,7 +624,7 @@ LL | Self: Iterator<Item: 'static, Item: 'static>,
| `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<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -574,7 +634,7 @@ LL | Self: Iterator<Item: 'static, Item: 'static>,
= 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<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -584,7 +644,7 @@ LL | Self: Iterator<Item: 'static, Item: 'static>,
= 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<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -592,7 +652,17 @@ LL | type A: Iterator<Item: Copy, Item: Send>;
| `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:257:34
|
LL | type A: Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ 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<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here
@ -600,14 +670,34 @@ LL | type A: Iterator<Item: Copy, Item: Copy>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:259:37
--> $DIR/duplicate.rs:262:34
|
LL | type A: Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ 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:267:37
|
LL | type A: Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ 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<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ 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`.

View File

@ -1,6 +1,7 @@
trait T {
type A: S<C<i32 = u32> = ()>;
//~^ ERROR associated type bindings are not allowed here
//~| ERROR associated type bindings are not allowed here
}
trait Q {}

View File

@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here
LL | type A: S<C<i32 = u32> = ()>;
| ^^^^^^^^^ 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<C<i32 = u32> = ()>;
| ^^^^^^^^^ 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`.

View File

@ -1,5 +1,6 @@
fn get_iter(vec: &[i32]) -> impl Iterator<Item = {}> + '_ {
//~^ ERROR expected type, found constant
//~| ERROR expected type, found constant
//~| ERROR associated const equality is incomplete
vec.iter()
}

View File

@ -19,6 +19,18 @@ LL | fn get_iter(vec: &[i32]) -> impl Iterator<Item = {}> + '_ {
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<Item = {}> + '_ {
| ---- ^^ 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`.

View File

@ -4,6 +4,7 @@
async fn copy() -> Result<()>
//~^ ERROR enum takes 2 generic arguments
//~| ERROR enum takes 2 generic arguments
{
Ok(())
}

View File

@ -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`.

View File

@ -15,7 +15,9 @@ impl MarketMultiplier {
async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> 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())
}

View File

@ -7,7 +7,7 @@ LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> 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>(T);
| ^^^^^^^^^^^^
@ -19,7 +19,7 @@ LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> 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>(T);
| ^^^^^^^^^^^^ -
@ -28,6 +28,38 @@ help: add missing generic argument
LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> 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<MarketMultiplier>) -> 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>(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<MarketMultiplier>) -> 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>(T);
| ^^^^^^^^^^^^ -
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> {
| +++
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0107`.

View File

@ -13,6 +13,7 @@ impl<const N: usize> Marker<N> for Example<N> {}
fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
//~^ ERROR: type provided when a constant was expected
//~| ERROR: type provided when a constant was expected
Example::<gimme_a_const!(marker)>
//~^ ERROR: type provided when a constant was expected
}

View File

@ -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<gimme_a_const!(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::<gimme_a_const!(marker)>
| ----------------------
@ -41,7 +41,7 @@ LL | let _fail = Example::<external_macro!()>;
= 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::<gimme_a_const!()>;
| ^^^^^^^^^^^^^^^^ 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<gimme_a_const!(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<gimme_a_const!(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::<gimme_a_const!(marker)>
| ^^^^^^^^^^^^^^^^^^^^^^
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::<external_macro!()>;
| ^^^^^^^^^^^^^^^^^
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::<gimme_a_const!()>;
| ^^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors
error: aborting due to 9 previous errors
For more information about this error, try `rustc --explain E0747`.

View File

@ -1,6 +1,7 @@
trait T {
type A: S<C<(), i32 = ()> = ()>;
//~^ ERROR associated type bindings are not allowed here
//~| ERROR associated type bindings are not allowed here
}
trait Q {}

View File

@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here
LL | type A: S<C<(), i32 = ()> = ()>;
| ^^^^^^^^ 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<C<(), i32 = ()> = ()>;
| ^^^^^^^^ 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`.

View File

@ -13,6 +13,7 @@ trait C {
trait D<T> {
type CType: C<DType = Self>;
//~^ ERROR missing generics for associated type
//~| ERROR missing generics for associated type
}
fn main() {}

View File

@ -14,6 +14,23 @@ help: add missing generic argument
LL | type CType: C<DType<T> = 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<DType = Self>;
| ^^^^^ 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<T>: D<T, CType = Self>;
| ^^^^^ -
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | type CType: C<DType<T> = Self>;
| +++
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0107`.

View File

@ -5,6 +5,8 @@
fn ice() -> impl AsRef<Fn(&())> {
//~^ 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
}

View File

@ -12,5 +12,19 @@ help: if this is an object-safe trait, use `dyn`
LL | fn ice() -> impl AsRef<dyn Fn(&())> {
| +++
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<Fn(&())> {
| ^^^^^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= 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<dyn Fn(&())> {
| +++
warning: 2 warnings emitted

View File

@ -12,6 +12,7 @@ impl<'a, I: 'a + Iterable> Iterable for &'a I {
fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missing>> {}
//~^ ERROR binding for associated type `Item` references lifetime `'missing`
//~| ERROR binding for associated type `Item` references lifetime `'missing`
//~| ERROR `()` is not an iterator
}

View File

@ -4,6 +4,14 @@ error[E0582]: binding for associated type `Item` references lifetime `'missing`,
LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missing>> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
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<Item = Self::Item<'missing>> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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<Item = Self::Item<'missin
|
= help: the trait `Iterator` is not implemented for `()`
error: aborting due to 3 previous errors
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0195, E0277, E0582.
For more information about an error, try `rustc --explain E0195`.

View File

@ -4,6 +4,7 @@ use std::iter;
fn f<T>(data: &[T]) -> impl Iterator<Item = Vec> {
//~^ ERROR: missing generics for struct `Vec` [E0107]
//~| ERROR: missing generics for struct `Vec` [E0107]
iter::empty()
}

View File

@ -9,6 +9,18 @@ help: add missing generic argument
LL | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec<T>> {
| +++
error: aborting due to 1 previous error
error[E0107]: missing generics for struct `Vec`
--> $DIR/issue-92305.rs:5:45
|
LL | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec> {
| ^^^ expected at least 1 generic argument
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec<T>> {
| +++
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0107`.

View File

@ -7,6 +7,7 @@ fn frob() -> impl Fn<P, Output = T> + '_ {}
//~| 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!()

View File

@ -42,8 +42,19 @@ LL | fn frob() -> impl Fn<P, Output = T> + '_ {}
= 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<P, Output = T> + '_ {}
| ^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn(P) -> T`
|
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/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<P, Output = T> + '_ {}
| ^^^^
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`.

View File

@ -7,6 +7,7 @@ impl Trait for i32 {}
// ICE in this case.
fn produce<T>() -> impl Trait<Assoc = impl Trait> {
//~^ ERROR associated type `Assoc` not found for `Trait`
//~| ERROR associated type `Assoc` not found for `Trait`
16
}

View File

@ -4,6 +4,14 @@ error[E0220]: associated type `Assoc` not found for `Trait`
LL | fn produce<T>() -> impl Trait<Assoc = 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<T>() -> impl Trait<Assoc = 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`.

View File

@ -11,6 +11,7 @@ fn ref_arg<T: ?Send>(_: &T) {}
//~^ warning: relaxing a default bound only does something for `?Sized`
fn ret() -> impl Iterator<Item = ()> + ?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() {

View File

@ -16,8 +16,16 @@ warning: relaxing a default bound only does something for `?Sized`; all other tr
LL | fn ret() -> impl Iterator<Item = ()> + ?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<Item = ()> + ?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: ?Send + ?Sized>(_: &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`.

View File

@ -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();

View File

@ -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`.

View File

@ -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

View File

@ -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";

View File

@ -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`.

View File

@ -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() {}

View File

@ -20,7 +20,32 @@ error[E0229]: associated type bindings are not allowed here
LL | type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>;
| ^^^^^^^^^^^^^ 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<Target = <Self>::Bar<Target = Self>>;
| ^^^ 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<Target = <Self>::Bar<Target = Self>>;
| ^^^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | type Bar<'a>: Deref<Target = <Self>::Bar<'a, Target = Self>>;
| +++
error[E0229]: associated type bindings are not allowed here
--> $DIR/issue-85347.rs:3:46
|
LL | type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>;
| ^^^^^^^^^^^^^ 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`.

View File

@ -20,6 +20,7 @@ impl<T, S> Trait<T, S> for () {}
fn func<T: Trait<u32, String>>(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
}

View File

@ -54,6 +54,23 @@ help: replace the generic bound with the associated type
LL | fn func<T: Trait<u32, String>>(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: Trait<u32, String>>(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<T> {
| ^^^^^ -
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: replace the generic bound with the associated type
|
LL | fn func<T: Trait<u32, String>>(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: Trait<u32, String>>(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<T: Trait<u32, String>> {
| ^^^^^ expected 1 generic argument
@ -77,7 +94,7 @@ LL | struct Struct<T: Trait<u32, Assoc = String>> {
| +++++++
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<T: Trait<T, i32>> {}
| ^^^^^ expected 1 generic argument
@ -93,7 +110,7 @@ LL | trait AnotherTrait<T: Trait<T, 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:35:9
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:36:9
|
LL | impl<T: Trait<u32, String>> Struct<T> {}
| ^^^^^ expected 1 generic argument
@ -109,7 +126,7 @@ LL | impl<T: Trait<u32, Assoc = String>> Struct<T> {}
| +++++++
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<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T, U> {}
| ^^^^^^ - help: remove this generic argument
@ -117,12 +134,12 @@ LL | impl<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T, U> {}
| 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<T: Trait<u32, String>> {
| ^^^^^^ -
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`.

View File

@ -1,19 +0,0 @@
//@ run-rustfix
#![feature(type_alias_impl_trait)]
#![allow(dead_code)]
fn main() {}
trait TraitWithAssoc {
type Assoc;
}
type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>; //~ associated type `Assoc` not found for `V`
trait Trait<U> {}
impl<W> Trait<W> for () {}
fn foo_desugared<T: TraitWithAssoc>(_: T) -> Foo<T> {
()
}

View File

@ -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<V> = impl Trait<V::Assoc>; //~ associated type `Assoc` not found for `V`
type Foo<V> = impl Trait<V::Assoc>;
//~^ associated type `Assoc` not found for `V`
//~| associated type `Assoc` not found for `V`
trait Trait<U> {}

View File

@ -9,6 +9,18 @@ help: consider restricting type parameter `V`
LL | type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>;
| ++++++++++++++++
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<V> = impl Trait<V::Assoc>;
| ^^^^^ 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<V: TraitWithAssoc> = impl Trait<V::Assoc>;
| ++++++++++++++++
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0220`.