Skip to content

Commit 44040a0

Browse files
Also passthrough for projection clauses
1 parent b0c1474 commit 44040a0

9 files changed

+15
-18
lines changed

compiler/rustc_trait_selection/src/solve/fulfill.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,9 @@ impl<'tcx> ProofTreeVisitor<'tcx> for BestObligation<'tcx> {
460460
polarity: ty::PredicatePolarity::Positive,
461461
}))
462462
}
463-
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_))
463+
ty::PredicateKind::Clause(
464+
ty::ClauseKind::WellFormed(_) | ty::ClauseKind::Projection(..),
465+
)
464466
| ty::PredicateKind::AliasRelate(..) => ChildMode::PassThrough,
465467
_ => {
466468
return ControlFlow::Break(self.obligation.clone());

tests/ui/higher-ranked/trait-bounds/rigid-equate-projections-in-higher-ranked-fn-signature.next.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0284]: type annotations needed: cannot satisfy `for<'a> <_ as Trait<'a>>::Assoc <: <T as Trait<'_>>::Assoc`
1+
error[E0284]: type annotations needed: cannot satisfy `for<'a> <_ as Trait<'a>>::Assoc normalizes-to <T as Trait<'_>>::Assoc`
22
--> $DIR/rigid-equate-projections-in-higher-ranked-fn-signature.rs:27:50
33
|
44
LL | let _: for<'a> fn(<_ as Trait<'a>>::Assoc) = foo::<T>();
5-
| ^^^^^^^^^^ cannot satisfy `for<'a> <_ as Trait<'a>>::Assoc <: <T as Trait<'_>>::Assoc`
5+
| ^^^^^^^^^^ cannot satisfy `for<'a> <_ as Trait<'a>>::Assoc normalizes-to <T as Trait<'_>>::Assoc`
66

77
error: aborting due to 1 previous error
88

tests/ui/traits/next-solver/env-shadows-impls/param-candidate-shadows-project.stderr

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@ error[E0271]: type mismatch resolving `<T as Foo>::Assoc == i32`
22
--> $DIR/param-candidate-shadows-project.rs:27:19
33
|
44
LL | require_bar::<T>();
5-
| ^ type mismatch resolving `<T as Foo>::Assoc == i32`
5+
| ^ types differ
66
|
7-
note: types differ
8-
--> $DIR/param-candidate-shadows-project.rs:10:18
9-
|
10-
LL | type Assoc = i32;
11-
| ^^^
127
note: required for `T` to implement `Bar`
138
--> $DIR/param-candidate-shadows-project.rs:13:9
149
|

tests/ui/traits/next-solver/normalize/two-projection-param-candidates-are-ambiguous.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn needs_bar<T: Bar>() {}
2424

2525
fn foo<T: Foo<Assoc = i32> + Foo<Assoc = u32>>() {
2626
needs_bar::<T>();
27-
//~^ ERROR type annotations needed: cannot satisfy `<T as Foo>::Assoc == i32`
27+
//~^ ERROR type annotations needed: cannot normalize
2828
}
2929

3030
fn main() {}

tests/ui/traits/next-solver/normalize/two-projection-param-candidates-are-ambiguous.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0284]: type annotations needed: cannot satisfy `<T as Foo>::Assoc == i32`
1+
error[E0284]: type annotations needed: cannot normalize `<T as Foo>::Assoc`
22
--> $DIR/two-projection-param-candidates-are-ambiguous.rs:26:17
33
|
44
LL | needs_bar::<T>();
5-
| ^ cannot satisfy `<T as Foo>::Assoc == i32`
5+
| ^ cannot normalize `<T as Foo>::Assoc`
66
|
77
note: required for `T` to implement `Bar`
88
--> $DIR/two-projection-param-candidates-are-ambiguous.rs:21:9

tests/ui/traits/next-solver/specialization-transmute.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ error[E0284]: type annotations needed: cannot satisfy `<T as Default>::Id normal
2222
LL | self
2323
| ^^^^ cannot satisfy `<T as Default>::Id normalizes-to T`
2424

25-
error[E0284]: type annotations needed: cannot satisfy `<u8 as Default>::Id == Option<NonZero<u8>>`
25+
error[E0284]: type annotations needed: cannot satisfy `<u8 as Default>::Id normalizes-to Option<NonZero<u8>>`
2626
--> $DIR/specialization-transmute.rs:28:13
2727
|
2828
LL | let s = transmute::<u8, Option<NonZero<u8>>>(0);
29-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<u8 as Default>::Id == Option<NonZero<u8>>`
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<u8 as Default>::Id normalizes-to Option<NonZero<u8>>`
3030
|
3131
note: required by a bound in `transmute`
3232
--> $DIR/specialization-transmute.rs:21:25

tests/ui/traits/next-solver/specialization-unconstrained.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ fn test<T: Default<Id = U>, U>() {}
1818

1919
fn main() {
2020
test::<u32, ()>();
21-
//~^ ERROR cannot satisfy `<u32 as Default>::Id == ()`
21+
//~^ ERROR cannot satisfy `<u32 as Default>::Id normalizes-to ()`
2222
}

tests/ui/traits/next-solver/specialization-unconstrained.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ LL | #![feature(specialization)]
88
= help: consider using `min_specialization` instead, which is more stable and complete
99
= note: `#[warn(incomplete_features)]` on by default
1010

11-
error[E0284]: type annotations needed: cannot satisfy `<u32 as Default>::Id == ()`
11+
error[E0284]: type annotations needed: cannot satisfy `<u32 as Default>::Id normalizes-to ()`
1212
--> $DIR/specialization-unconstrained.rs:20:5
1313
|
1414
LL | test::<u32, ()>();
15-
| ^^^^^^^^^^^^^^^^^ cannot satisfy `<u32 as Default>::Id == ()`
15+
| ^^^^^^^^^^^^^^^^^ cannot satisfy `<u32 as Default>::Id normalizes-to ()`
1616
|
1717
note: required by a bound in `test`
1818
--> $DIR/specialization-unconstrained.rs:17:20

tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ trait Trait<T, In> {
2020
impl<In, Out> Trait<Bar, In> for Out {
2121
type Out = Out;
2222
fn convert(_i: In) -> Self::Out {
23-
//[next]~^ ERROR: cannot satisfy `<Out as Trait<Bar, In>>::Out == ()`
23+
//[next]~^ ERROR: cannot satisfy `Bar == _`
2424
//[current]~^^ ERROR: item does not constrain `Bar::{opaque#0}`, but has it in its signature
2525
unreachable!();
2626
}

0 commit comments

Comments
 (0)