Rollup merge of #100483 - compiler-errors:point-to-projection-too, r=jyn514
Point to generic or arg if it's the self type of unsatisfied projection predicate We do this for `TraitPredicate`s in `point_at_type_arg_instead_of_call_if_possible` and `point_at_arg_instead_of_call_if_possible`, so also do it for `ProjectionPredicate`. Improves spans for a lot of unit tests.
This commit is contained in:
commit
ee63d09bd6
@ -1664,12 +1664,13 @@ fn unpeel_to_top<'a, 'tcx>(
|
|||||||
ObligationCauseCode::ImplDerivedObligation(code) => {
|
ObligationCauseCode::ImplDerivedObligation(code) => {
|
||||||
code.derived.parent_trait_pred.self_ty().skip_binder().into()
|
code.derived.parent_trait_pred.self_ty().skip_binder().into()
|
||||||
}
|
}
|
||||||
_ if let ty::PredicateKind::Trait(predicate) =
|
_ => match error.obligation.predicate.kind().skip_binder() {
|
||||||
error.obligation.predicate.kind().skip_binder() =>
|
ty::PredicateKind::Trait(predicate) => predicate.self_ty().into(),
|
||||||
{
|
ty::PredicateKind::Projection(predicate) => {
|
||||||
predicate.self_ty().into()
|
predicate.projection_ty.self_ty().into()
|
||||||
}
|
}
|
||||||
_ => continue,
|
_ => continue,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
let self_ = self.resolve_vars_if_possible(self_);
|
let self_ = self.resolve_vars_if_possible(self_);
|
||||||
let ty_matches_self = |ty: Ty<'tcx>| ty.walk().any(|arg| arg == self_);
|
let ty_matches_self = |ty: Ty<'tcx>| ty.walk().any(|arg| arg == self_);
|
||||||
@ -1759,25 +1760,28 @@ fn point_at_type_arg_instead_of_call_if_possible(
|
|||||||
if let hir::ExprKind::Call(path, _) = &call_expr.kind {
|
if let hir::ExprKind::Call(path, _) = &call_expr.kind {
|
||||||
if let hir::ExprKind::Path(hir::QPath::Resolved(_, path)) = &path.kind {
|
if let hir::ExprKind::Path(hir::QPath::Resolved(_, path)) = &path.kind {
|
||||||
for error in errors {
|
for error in errors {
|
||||||
if let ty::PredicateKind::Trait(predicate) =
|
let self_ty = match error.obligation.predicate.kind().skip_binder() {
|
||||||
error.obligation.predicate.kind().skip_binder()
|
ty::PredicateKind::Trait(predicate) => predicate.self_ty(),
|
||||||
|
ty::PredicateKind::Projection(predicate) => {
|
||||||
|
predicate.projection_ty.self_ty()
|
||||||
|
}
|
||||||
|
_ => continue,
|
||||||
|
};
|
||||||
|
// If any of the type arguments in this path segment caused the
|
||||||
|
// `FulfillmentError`, point at its span (#61860).
|
||||||
|
for arg in path
|
||||||
|
.segments
|
||||||
|
.iter()
|
||||||
|
.filter_map(|seg| seg.args.as_ref())
|
||||||
|
.flat_map(|a| a.args.iter())
|
||||||
{
|
{
|
||||||
// If any of the type arguments in this path segment caused the
|
if let hir::GenericArg::Type(hir_ty) = &arg
|
||||||
// `FulfillmentError`, point at its span (#61860).
|
&& let Some(ty) =
|
||||||
for arg in path
|
self.typeck_results.borrow().node_type_opt(hir_ty.hir_id)
|
||||||
.segments
|
&& self.resolve_vars_if_possible(ty) == self_ty
|
||||||
.iter()
|
|
||||||
.filter_map(|seg| seg.args.as_ref())
|
|
||||||
.flat_map(|a| a.args.iter())
|
|
||||||
{
|
{
|
||||||
if let hir::GenericArg::Type(hir_ty) = &arg
|
error.obligation.cause.span = hir_ty.span;
|
||||||
&& let Some(ty) =
|
break;
|
||||||
self.typeck_results.borrow().node_type_opt(hir_ty.hir_id)
|
|
||||||
&& self.resolve_vars_if_possible(ty) == predicate.self_ty()
|
|
||||||
{
|
|
||||||
error.obligation.cause.span = hir_ty.span;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
error[E0271]: type mismatch resolving `<ModelT as Vehicle>::Color == Blue`
|
error[E0271]: type mismatch resolving `<ModelT as Vehicle>::Color == Blue`
|
||||||
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:31:10
|
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:31:19
|
||||||
|
|
|
|
||||||
LL | fn b() { blue_car(ModelT); }
|
LL | fn b() { blue_car(ModelT); }
|
||||||
| ^^^^^^^^ type mismatch resolving `<ModelT as Vehicle>::Color == Blue`
|
| -------- ^^^^^^ type mismatch resolving `<ModelT as Vehicle>::Color == Blue`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: expected this to be `Blue`
|
note: expected this to be `Blue`
|
||||||
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:16:40
|
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:16:40
|
||||||
@ -16,10 +18,12 @@ LL | fn blue_car<C:Car<Color=Blue>>(c: C) {
|
|||||||
| ^^^^^^^^^^ required by this bound in `blue_car`
|
| ^^^^^^^^^^ required by this bound in `blue_car`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<ModelU as Vehicle>::Color == Black`
|
error[E0271]: type mismatch resolving `<ModelU as Vehicle>::Color == Black`
|
||||||
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:32:10
|
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:32:20
|
||||||
|
|
|
|
||||||
LL | fn c() { black_car(ModelU); }
|
LL | fn c() { black_car(ModelU); }
|
||||||
| ^^^^^^^^^ type mismatch resolving `<ModelU as Vehicle>::Color == Black`
|
| --------- ^^^^^^ type mismatch resolving `<ModelU as Vehicle>::Color == Black`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: expected this to be `Black`
|
note: expected this to be `Black`
|
||||||
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:21:40
|
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:21:40
|
||||||
|
@ -14,10 +14,12 @@ LL | fn foo2<I: Foo<A = Bar>>(x: I) {
|
|||||||
| +++++++++
|
| +++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
|
error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
|
||||||
--> $DIR/associated-types-eq-3.rs:38:5
|
--> $DIR/associated-types-eq-3.rs:38:10
|
||||||
|
|
|
|
||||||
LL | foo1(a);
|
LL | foo1(a);
|
||||||
| ^^^^ type mismatch resolving `<isize as Foo>::A == Bar`
|
| ---- ^ type mismatch resolving `<isize as Foo>::A == Bar`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: expected this to be `Bar`
|
note: expected this to be `Bar`
|
||||||
--> $DIR/associated-types-eq-3.rs:12:14
|
--> $DIR/associated-types-eq-3.rs:12:14
|
||||||
@ -34,7 +36,9 @@ error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
|
|||||||
--> $DIR/associated-types-eq-3.rs:40:9
|
--> $DIR/associated-types-eq-3.rs:40:9
|
||||||
|
|
|
|
||||||
LL | baz(&a);
|
LL | baz(&a);
|
||||||
| ^^ type mismatch resolving `<isize as Foo>::A == Bar`
|
| --- ^^ type mismatch resolving `<isize as Foo>::A == Bar`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: expected this to be `Bar`
|
note: expected this to be `Bar`
|
||||||
--> $DIR/associated-types-eq-3.rs:12:14
|
--> $DIR/associated-types-eq-3.rs:12:14
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
error[E0271]: type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
|
error[E0271]: type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
|
||||||
--> $DIR/associated-types-eq-hr.rs:87:5
|
--> $DIR/associated-types-eq-hr.rs:87:11
|
||||||
|
|
|
|
||||||
LL | foo::<UintStruct>();
|
LL | foo::<UintStruct>();
|
||||||
| ^^^^^^^^^^^^^^^^^ type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
|
| ^^^^^^^^^^ type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
|
||||||
|
|
|
|
||||||
note: expected this to be `&isize`
|
note: expected this to be `&isize`
|
||||||
--> $DIR/associated-types-eq-hr.rs:26:14
|
--> $DIR/associated-types-eq-hr.rs:26:14
|
||||||
@ -21,10 +21,10 @@ LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>,
|
|||||||
| ^^^^^^^^^^^^^ required by this bound in `foo`
|
| ^^^^^^^^^^^^^ required by this bound in `foo`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
|
error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
|
||||||
--> $DIR/associated-types-eq-hr.rs:91:5
|
--> $DIR/associated-types-eq-hr.rs:91:11
|
||||||
|
|
|
|
||||||
LL | bar::<IntStruct>();
|
LL | bar::<IntStruct>();
|
||||||
| ^^^^^^^^^^^^^^^^ type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
|
| ^^^^^^^^^ type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
|
||||||
|
|
|
|
||||||
note: expected this to be `&usize`
|
note: expected this to be `&usize`
|
||||||
--> $DIR/associated-types-eq-hr.rs:14:14
|
--> $DIR/associated-types-eq-hr.rs:14:14
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
error[E0271]: type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<T>`
|
error[E0271]: type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<T>`
|
||||||
--> $DIR/associated-types-issue-20346.rs:34:5
|
--> $DIR/associated-types-issue-20346.rs:34:36
|
||||||
|
|
|
|
||||||
LL | fn test_adapter<T, I: Iterator<Item=Option<T>>>(it: I) {
|
LL | fn test_adapter<T, I: Iterator<Item=Option<T>>>(it: I) {
|
||||||
| - this type parameter
|
| - this type parameter
|
||||||
...
|
...
|
||||||
LL | is_iterator_of::<Option<T>, _>(&adapter);
|
LL | is_iterator_of::<Option<T>, _>(&adapter);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<T>`
|
| ------------------------------ ^^^^^^^^ type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<T>`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: expected this to be `Option<T>`
|
note: expected this to be `Option<T>`
|
||||||
--> $DIR/associated-types-issue-20346.rs:23:17
|
--> $DIR/associated-types-issue-20346.rs:23:17
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
error[E0271]: type mismatch resolving `<T as Foo>::Y == i32`
|
error[E0271]: type mismatch resolving `<T as Foo>::Y == i32`
|
||||||
--> $DIR/associated-types-multiple-types-one-trait.rs:13:5
|
--> $DIR/associated-types-multiple-types-one-trait.rs:13:12
|
||||||
|
|
|
|
||||||
LL | want_y(t);
|
LL | want_y(t);
|
||||||
| ^^^^^^ expected `i32`, found associated type
|
| ------ ^ expected `i32`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected type `i32`
|
= note: expected type `i32`
|
||||||
found associated type `<T as Foo>::Y`
|
found associated type `<T as Foo>::Y`
|
||||||
@ -17,10 +19,12 @@ LL | fn have_x_want_y<T:Foo<X=u32, Y = i32>>(t: &T)
|
|||||||
| +++++++++
|
| +++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<T as Foo>::X == u32`
|
error[E0271]: type mismatch resolving `<T as Foo>::X == u32`
|
||||||
--> $DIR/associated-types-multiple-types-one-trait.rs:18:5
|
--> $DIR/associated-types-multiple-types-one-trait.rs:18:12
|
||||||
|
|
|
|
||||||
LL | want_x(t);
|
LL | want_x(t);
|
||||||
| ^^^^^^ expected `u32`, found associated type
|
| ------ ^ expected `u32`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected type `u32`
|
= note: expected type `u32`
|
||||||
found associated type `<T as Foo>::X`
|
found associated type `<T as Foo>::X`
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
error[E0271]: type mismatch resolving `<A as Trait>::Associated == ()`
|
error[E0271]: type mismatch resolving `<A as Trait>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:56:5
|
--> $DIR/issue-87261.rs:56:19
|
||||||
|
|
|
|
||||||
LL | accepts_trait(a);
|
LL | accepts_trait(a);
|
||||||
| ^^^^^^^^^^^^^ expected `()`, found associated type
|
| ------------- ^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<A as Trait>::Associated`
|
found associated type `<A as Trait>::Associated`
|
||||||
@ -17,10 +19,12 @@ LL | A: Trait<Associated = ()> + 'static,
|
|||||||
| +++++++++++++++++
|
| +++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<B as Trait>::Associated == ()`
|
error[E0271]: type mismatch resolving `<B as Trait>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:59:5
|
--> $DIR/issue-87261.rs:59:19
|
||||||
|
|
|
|
||||||
LL | accepts_trait(b);
|
LL | accepts_trait(b);
|
||||||
| ^^^^^^^^^^^^^ expected `()`, found associated type
|
| ------------- ^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<B as Trait>::Associated`
|
found associated type `<B as Trait>::Associated`
|
||||||
@ -33,10 +37,12 @@ LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {}
|
|||||||
| ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait`
|
| ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<C as Trait>::Associated == ()`
|
error[E0271]: type mismatch resolving `<C as Trait>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:62:5
|
--> $DIR/issue-87261.rs:62:19
|
||||||
|
|
|
|
||||||
LL | accepts_trait(c);
|
LL | accepts_trait(c);
|
||||||
| ^^^^^^^^^^^^^ expected `()`, found associated type
|
| ------------- ^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<C as Trait>::Associated`
|
found associated type `<C as Trait>::Associated`
|
||||||
@ -51,10 +57,12 @@ LL | C: Trait<Associated = ()> + Foo,
|
|||||||
| +++++++++++++++++
|
| +++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<D as Trait>::Associated == ()`
|
error[E0271]: type mismatch resolving `<D as Trait>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:65:5
|
--> $DIR/issue-87261.rs:65:19
|
||||||
|
|
|
|
||||||
LL | accepts_trait(d);
|
LL | accepts_trait(d);
|
||||||
| ^^^^^^^^^^^^^ expected `()`, found associated type
|
| ------------- ^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<D as Trait>::Associated`
|
found associated type `<D as Trait>::Associated`
|
||||||
@ -67,10 +75,12 @@ LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {}
|
|||||||
| ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait`
|
| ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<E as GenericTrait<()>>::Associated == ()`
|
error[E0271]: type mismatch resolving `<E as GenericTrait<()>>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:68:5
|
--> $DIR/issue-87261.rs:68:27
|
||||||
|
|
|
|
||||||
LL | accepts_generic_trait(e);
|
LL | accepts_generic_trait(e);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
| --------------------- ^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<E as GenericTrait<()>>::Associated`
|
found associated type `<E as GenericTrait<()>>::Associated`
|
||||||
@ -85,10 +95,12 @@ LL | E: GenericTrait<(), Associated = ()> + 'static,
|
|||||||
| +++++++++++++++++
|
| +++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<F as GenericTrait<()>>::Associated == ()`
|
error[E0271]: type mismatch resolving `<F as GenericTrait<()>>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:71:5
|
--> $DIR/issue-87261.rs:71:27
|
||||||
|
|
|
|
||||||
LL | accepts_generic_trait(f);
|
LL | accepts_generic_trait(f);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
| --------------------- ^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<F as GenericTrait<()>>::Associated`
|
found associated type `<F as GenericTrait<()>>::Associated`
|
||||||
@ -103,10 +115,12 @@ LL | F: GenericTrait<(), Associated = ()> + Foo,
|
|||||||
| +++++++++++++++++
|
| +++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<G as GenericTrait<()>>::Associated == ()`
|
error[E0271]: type mismatch resolving `<G as GenericTrait<()>>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:74:5
|
--> $DIR/issue-87261.rs:74:27
|
||||||
|
|
|
|
||||||
LL | accepts_generic_trait(g);
|
LL | accepts_generic_trait(g);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
| --------------------- ^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<G as GenericTrait<()>>::Associated`
|
found associated type `<G as GenericTrait<()>>::Associated`
|
||||||
@ -119,13 +133,15 @@ LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {}
|
|||||||
| ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait`
|
| ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<impl Trait as Trait>::Associated == ()`
|
error[E0271]: type mismatch resolving `<impl Trait as Trait>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:79:5
|
--> $DIR/issue-87261.rs:79:19
|
||||||
|
|
|
|
||||||
LL | fn returns_opaque() -> impl Trait + 'static {
|
LL | fn returns_opaque() -> impl Trait + 'static {
|
||||||
| -------------------- the found opaque type
|
| -------------------- the found opaque type
|
||||||
...
|
...
|
||||||
LL | accepts_trait(returns_opaque());
|
LL | accepts_trait(returns_opaque());
|
||||||
| ^^^^^^^^^^^^^ expected `()`, found associated type
|
| ------------- ^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<impl Trait as Trait>::Associated`
|
found associated type `<impl Trait as Trait>::Associated`
|
||||||
@ -140,13 +156,15 @@ LL | fn returns_opaque() -> impl Trait<Associated = ()> + 'static {
|
|||||||
| +++++++++++++++++
|
| +++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<impl DerivedTrait as Trait>::Associated == ()`
|
error[E0271]: type mismatch resolving `<impl DerivedTrait as Trait>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:82:5
|
--> $DIR/issue-87261.rs:82:19
|
||||||
|
|
|
|
||||||
LL | fn returns_opaque_derived() -> impl DerivedTrait + 'static {
|
LL | fn returns_opaque_derived() -> impl DerivedTrait + 'static {
|
||||||
| --------------------------- the found opaque type
|
| --------------------------- the found opaque type
|
||||||
...
|
...
|
||||||
LL | accepts_trait(returns_opaque_derived());
|
LL | accepts_trait(returns_opaque_derived());
|
||||||
| ^^^^^^^^^^^^^ expected `()`, found associated type
|
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<impl DerivedTrait as Trait>::Associated`
|
found associated type `<impl DerivedTrait as Trait>::Associated`
|
||||||
@ -161,13 +179,15 @@ LL | fn returns_opaque_derived() -> impl DerivedTrait<Associated = ()> + 'static
|
|||||||
| +++++++++++++++++
|
| +++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<impl Trait + Foo as Trait>::Associated == ()`
|
error[E0271]: type mismatch resolving `<impl Trait + Foo as Trait>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:85:5
|
--> $DIR/issue-87261.rs:85:19
|
||||||
|
|
|
|
||||||
LL | fn returns_opaque_foo() -> impl Trait + Foo {
|
LL | fn returns_opaque_foo() -> impl Trait + Foo {
|
||||||
| ---------------- the found opaque type
|
| ---------------- the found opaque type
|
||||||
...
|
...
|
||||||
LL | accepts_trait(returns_opaque_foo());
|
LL | accepts_trait(returns_opaque_foo());
|
||||||
| ^^^^^^^^^^^^^ expected `()`, found associated type
|
| ------------- ^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<impl Trait + Foo as Trait>::Associated`
|
found associated type `<impl Trait + Foo as Trait>::Associated`
|
||||||
@ -182,13 +202,15 @@ LL | fn returns_opaque_foo() -> impl Trait<Associated = ()> + Foo {
|
|||||||
| +++++++++++++++++
|
| +++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<impl DerivedTrait + Foo as Trait>::Associated == ()`
|
error[E0271]: type mismatch resolving `<impl DerivedTrait + Foo as Trait>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:88:5
|
--> $DIR/issue-87261.rs:88:19
|
||||||
|
|
|
|
||||||
LL | fn returns_opaque_derived_foo() -> impl DerivedTrait + Foo {
|
LL | fn returns_opaque_derived_foo() -> impl DerivedTrait + Foo {
|
||||||
| ----------------------- the found opaque type
|
| ----------------------- the found opaque type
|
||||||
...
|
...
|
||||||
LL | accepts_trait(returns_opaque_derived_foo());
|
LL | accepts_trait(returns_opaque_derived_foo());
|
||||||
| ^^^^^^^^^^^^^ expected `()`, found associated type
|
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<impl DerivedTrait + Foo as Trait>::Associated`
|
found associated type `<impl DerivedTrait + Foo as Trait>::Associated`
|
||||||
@ -201,13 +223,15 @@ LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {}
|
|||||||
| ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait`
|
| ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<impl GenericTrait<()> as GenericTrait<()>>::Associated == ()`
|
error[E0271]: type mismatch resolving `<impl GenericTrait<()> as GenericTrait<()>>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:91:5
|
--> $DIR/issue-87261.rs:91:27
|
||||||
|
|
|
|
||||||
LL | fn returns_opaque_generic() -> impl GenericTrait<()> + 'static {
|
LL | fn returns_opaque_generic() -> impl GenericTrait<()> + 'static {
|
||||||
| ------------------------------- the found opaque type
|
| ------------------------------- the found opaque type
|
||||||
...
|
...
|
||||||
LL | accepts_generic_trait(returns_opaque_generic());
|
LL | accepts_generic_trait(returns_opaque_generic());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
| --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<impl GenericTrait<()> as GenericTrait<()>>::Associated`
|
found associated type `<impl GenericTrait<()> as GenericTrait<()>>::Associated`
|
||||||
@ -222,13 +246,15 @@ LL | fn returns_opaque_generic() -> impl GenericTrait<(), Associated = ()> + 'st
|
|||||||
| +++++++++++++++++
|
| +++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated == ()`
|
error[E0271]: type mismatch resolving `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:94:5
|
--> $DIR/issue-87261.rs:94:27
|
||||||
|
|
|
|
||||||
LL | fn returns_opaque_generic_foo() -> impl GenericTrait<()> + Foo {
|
LL | fn returns_opaque_generic_foo() -> impl GenericTrait<()> + Foo {
|
||||||
| --------------------------- the found opaque type
|
| --------------------------- the found opaque type
|
||||||
...
|
...
|
||||||
LL | accepts_generic_trait(returns_opaque_generic_foo());
|
LL | accepts_generic_trait(returns_opaque_generic_foo());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
| --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated`
|
found associated type `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated`
|
||||||
@ -243,13 +269,15 @@ LL | fn returns_opaque_generic_foo() -> impl GenericTrait<(), Associated = ()> +
|
|||||||
| +++++++++++++++++
|
| +++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated == ()`
|
error[E0271]: type mismatch resolving `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated == ()`
|
||||||
--> $DIR/issue-87261.rs:97:5
|
--> $DIR/issue-87261.rs:97:27
|
||||||
|
|
|
|
||||||
LL | fn returns_opaque_generic_duplicate() -> impl GenericTrait<()> + GenericTrait<u8> {
|
LL | fn returns_opaque_generic_duplicate() -> impl GenericTrait<()> + GenericTrait<u8> {
|
||||||
| ---------------------------------------- the found opaque type
|
| ---------------------------------------- the found opaque type
|
||||||
...
|
...
|
||||||
LL | accepts_generic_trait(returns_opaque_generic_duplicate());
|
LL | accepts_generic_trait(returns_opaque_generic_duplicate());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
| --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated`
|
found associated type `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated`
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
error[E0271]: type mismatch resolving `<i8 as Trait>::AssociatedType == u32`
|
error[E0271]: type mismatch resolving `<i8 as Trait>::AssociatedType == u32`
|
||||||
--> $DIR/E0271.rs:10:5
|
--> $DIR/E0271.rs:10:9
|
||||||
|
|
|
|
||||||
LL | foo(3_i8);
|
LL | foo(3_i8);
|
||||||
| ^^^ type mismatch resolving `<i8 as Trait>::AssociatedType == u32`
|
| --- ^^^^ type mismatch resolving `<i8 as Trait>::AssociatedType == u32`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: expected this to be `u32`
|
note: expected this to be `u32`
|
||||||
--> $DIR/E0271.rs:7:43
|
--> $DIR/E0271.rs:7:43
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
error[E0271]: type mismatch resolving `<{integer} as Fun>::F<'_> == [u8]`
|
error[E0271]: type mismatch resolving `<{integer} as Fun>::F<'_> == [u8]`
|
||||||
--> $DIR/issue-74684-2.rs:23:5
|
--> $DIR/issue-74684-2.rs:23:9
|
||||||
|
|
|
|
||||||
LL | bug(Box::new(x));
|
LL | bug(Box::new(x));
|
||||||
| ^^^ type mismatch resolving `<{integer} as Fun>::F<'_> == [u8]`
|
| --- ^^^^^^^^^^^ type mismatch resolving `<{integer} as Fun>::F<'_> == [u8]`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: expected this to be `[u8]`
|
note: expected this to be `[u8]`
|
||||||
--> $DIR/issue-74684-2.rs:10:18
|
--> $DIR/issue-74684-2.rs:10:18
|
||||||
|
@ -36,9 +36,9 @@ trait Ty<'a> {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = Unit2.m(
|
let v = Unit2.m(
|
||||||
//~^ ERROR type mismatch
|
|
||||||
L {
|
L {
|
||||||
//~^ ERROR to be a closure that returns `Unit3`, but it returns `Unit4`
|
//~^ ERROR to be a closure that returns `Unit3`, but it returns `Unit4`
|
||||||
|
//~| ERROR type mismatch
|
||||||
f: |x| {
|
f: |x| {
|
||||||
drop(x);
|
drop(x);
|
||||||
Unit4
|
Unit4
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
error[E0271]: type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
|
error[E0271]: type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
|
||||||
--> $DIR/issue-62203-hrtb-ice.rs:38:19
|
--> $DIR/issue-62203-hrtb-ice.rs:39:9
|
||||||
|
|
|
|
||||||
LL | let v = Unit2.m(
|
LL | let v = Unit2.m(
|
||||||
| ^ type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
|
| - required by a bound introduced by this call
|
||||||
|
LL | / L {
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
LL | | f: |x| {
|
||||||
|
... |
|
||||||
|
LL | | },
|
||||||
|
LL | | },
|
||||||
|
| |_________^ type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
|
||||||
|
|
|
|
||||||
note: expected this to be `<_ as Ty<'_>>::V`
|
note: expected this to be `<_ as Ty<'_>>::V`
|
||||||
--> $DIR/issue-62203-hrtb-ice.rs:21:14
|
--> $DIR/issue-62203-hrtb-ice.rs:21:14
|
||||||
@ -23,16 +31,15 @@ LL | F: for<'r> T0<'r, (<Self as Ty<'r>>::V,), O = <B as Ty<'r>>::V>,
|
|||||||
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m`
|
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m`
|
||||||
|
|
||||||
error[E0271]: expected `[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]` to be a closure that returns `Unit3`, but it returns `Unit4`
|
error[E0271]: expected `[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]` to be a closure that returns `Unit3`, but it returns `Unit4`
|
||||||
--> $DIR/issue-62203-hrtb-ice.rs:40:9
|
--> $DIR/issue-62203-hrtb-ice.rs:39:9
|
||||||
|
|
|
|
||||||
LL | let v = Unit2.m(
|
LL | let v = Unit2.m(
|
||||||
| - required by a bound introduced by this call
|
| - required by a bound introduced by this call
|
||||||
LL |
|
|
||||||
LL | / L {
|
LL | / L {
|
||||||
LL | |
|
LL | |
|
||||||
|
LL | |
|
||||||
LL | | f: |x| {
|
LL | | f: |x| {
|
||||||
LL | | drop(x);
|
... |
|
||||||
LL | | Unit4
|
|
||||||
LL | | },
|
LL | | },
|
||||||
LL | | },
|
LL | | },
|
||||||
| |_________^ expected struct `Unit3`, found struct `Unit4`
|
| |_________^ expected struct `Unit3`, found struct `Unit4`
|
||||||
|
@ -52,10 +52,12 @@ LL | G: FnOnce<ARG, Output = RET> + ~const Destruct,
|
|||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select`
|
||||||
|
|
||||||
error[E0271]: expected `fn(i32) -> bool {bar}` to be a fn item that returns `i32`, but it returns `bool`
|
error[E0271]: expected `fn(i32) -> bool {bar}` to be a fn item that returns `i32`, but it returns `bool`
|
||||||
--> $DIR/const-eval-select-bad.rs:29:5
|
--> $DIR/const-eval-select-bad.rs:29:34
|
||||||
|
|
|
|
||||||
LL | const_eval_select((1,), foo, bar);
|
LL | const_eval_select((1,), foo, bar);
|
||||||
| ^^^^^^^^^^^^^^^^^ expected `i32`, found `bool`
|
| ----------------- ^^^ expected `i32`, found `bool`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `const_eval_select`
|
note: required by a bound in `const_eval_select`
|
||||||
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
|
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
error[E0271]: type mismatch resolving `<i32 as Is>::T == i64`
|
error[E0271]: type mismatch resolving `<i32 as Is>::T == i64`
|
||||||
--> $DIR/check-trait-object-bounds-5.rs:23:5
|
--> $DIR/check-trait-object-bounds-5.rs:23:12
|
||||||
|
|
|
|
||||||
LL | is_obj(x)
|
LL | is_obj(x)
|
||||||
| ^^^^^^ type mismatch resolving `<i32 as Is>::T == i64`
|
| ------ ^ type mismatch resolving `<i32 as Is>::T == i64`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: expected this to be `i64`
|
note: expected this to be `i64`
|
||||||
--> $DIR/check-trait-object-bounds-5.rs:9:14
|
--> $DIR/check-trait-object-bounds-5.rs:9:14
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
error[E0271]: type mismatch resolving `<i32 as Is>::T == i64`
|
error[E0271]: type mismatch resolving `<i32 as Is>::T == i64`
|
||||||
--> $DIR/check-trait-object-bounds-6.rs:20:5
|
--> $DIR/check-trait-object-bounds-6.rs:20:12
|
||||||
|
|
|
|
||||||
LL | is_obj(x)
|
LL | is_obj(x)
|
||||||
| ^^^^^^ type mismatch resolving `<i32 as Is>::T == i64`
|
| ------ ^ type mismatch resolving `<i32 as Is>::T == i64`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: expected this to be `i64`
|
note: expected this to be `i64`
|
||||||
--> $DIR/check-trait-object-bounds-6.rs:9:14
|
--> $DIR/check-trait-object-bounds-6.rs:9:14
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
error[E0271]: type mismatch resolving `<dyn Trait<B = B, A = A> as SuperTrait>::A == B`
|
error[E0271]: type mismatch resolving `<dyn Trait<B = B, A = A> as SuperTrait>::A == B`
|
||||||
--> $DIR/enforce-supertrait-projection.rs:9:5
|
--> $DIR/enforce-supertrait-projection.rs:9:17
|
||||||
|
|
|
|
||||||
LL | fn transmute<A, B>(x: A) -> B {
|
LL | fn transmute<A, B>(x: A) -> B {
|
||||||
| - - expected type parameter
|
| - - expected type parameter
|
||||||
| |
|
| |
|
||||||
| found type parameter
|
| found type parameter
|
||||||
LL | foo::<A, B, dyn Trait<A = A, B = B>>(x)
|
LL | foo::<A, B, dyn Trait<A = A, B = B>>(x)
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `B`, found type parameter `A`
|
| ^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `B`, found type parameter `A`
|
||||||
|
|
|
|
||||||
= note: expected type parameter `B`
|
= note: expected type parameter `B`
|
||||||
found type parameter `A`
|
found type parameter `A`
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
error[E0271]: type mismatch resolving `<T as Pointee>::Metadata == ()`
|
error[E0271]: type mismatch resolving `<T as Pointee>::Metadata == ()`
|
||||||
--> $DIR/pointee-tail-is-generic-errors.rs:13:5
|
--> $DIR/pointee-tail-is-generic-errors.rs:13:15
|
||||||
|
|
|
|
||||||
LL | is_thin::<T>();
|
LL | is_thin::<T>();
|
||||||
| ^^^^^^^^^^^^ expected `()`, found associated type
|
| ^ expected `()`, found associated type
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<T as Pointee>::Metadata`
|
found associated type `<T as Pointee>::Metadata`
|
||||||
@ -15,13 +15,13 @@ LL | fn is_thin<T: std::ptr::Pointee<Metadata = ()> + ?Sized>() {}
|
|||||||
| ^^^^^^^^^^^^^ required by this bound in `is_thin`
|
| ^^^^^^^^^^^^^ required by this bound in `is_thin`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<Opaque as Pointee>::Metadata == ()`
|
error[E0271]: type mismatch resolving `<Opaque as Pointee>::Metadata == ()`
|
||||||
--> $DIR/pointee-tail-is-generic-errors.rs:16:5
|
--> $DIR/pointee-tail-is-generic-errors.rs:16:15
|
||||||
|
|
|
|
||||||
LL | type Opaque = impl std::fmt::Debug + ?Sized;
|
LL | type Opaque = impl std::fmt::Debug + ?Sized;
|
||||||
| ----------------------------- the found opaque type
|
| ----------------------------- the found opaque type
|
||||||
...
|
...
|
||||||
LL | is_thin::<Opaque>();
|
LL | is_thin::<Opaque>();
|
||||||
| ^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
| ^^^^^^ expected `()`, found associated type
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found associated type `<Opaque as Pointee>::Metadata`
|
found associated type `<Opaque as Pointee>::Metadata`
|
||||||
|
Loading…
Reference in New Issue
Block a user