Skip to content

Commit 04d4516

Browse files
committed
w
1 parent f0bffce commit 04d4516

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

compiler/rustc_trait_selection/src/traits/coherence.rs

+3
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,9 @@ impl<'a, 'tcx> ProofTreeVisitor<'tcx> for AmbiguityCausesVisitor<'a> {
964964
let lazily_normalize_ty = |ty: Ty<'tcx>| {
965965
let mut fulfill_cx = <dyn TraitEngine<'tcx>>::new(infcx);
966966
if matches!(ty.kind(), ty::Alias(..)) {
967+
// FIXME(-Ztrait-solver=next-coherence): we currently don't
968+
// normalize opaque types here, resulting in diverging behavior
969+
// for TAITs.
967970
match infcx
968971
.at(&ObligationCause::dummy(), param_env)
969972
.structurally_normalize(ty, &mut *fulfill_cx)

tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | impl From<()> for S {
77
LL | impl<I> From<I> for S
88
| ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
99
|
10-
= note: downstream crates may implement trait `std::iter::Iterator` for type `()`
10+
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
1111

1212
error: aborting due to previous error
1313

tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <T as std::convert::From<Foo>>
2+
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <T as std::convert::From<Foo>>
3+
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <T as std::convert::From<Foo>>
4+
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <T as std::convert::From<Foo>>
15
error[E0119]: conflicting implementations of trait `Into<T>` for type `Foo`
26
--> $DIR/coherence-treats-tait-ambig.rs:10:1
37
|
@@ -7,7 +11,6 @@ LL | impl Into<T> for Foo {
711
= note: conflicting implementation in crate `core`:
812
- impl<T, U> Into<U> for T
913
where U: From<T>;
10-
= note: downstream crates may implement trait `std::convert::From<Foo>` for type `T`
1114

1215
error: aborting due to previous error
1316

tests/ui/impl-trait/coherence-treats-tait-ambig.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// revisions: current next
2-
//[next] compile-flags: -Ztrait-solver=next
3-
41
#![feature(type_alias_impl_trait)]
52

63
type T = impl Sized;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0119]: conflicting implementations of trait `Into<T>` for type `Foo`
2+
--> $DIR/coherence-treats-tait-ambig.rs:7:1
3+
|
4+
LL | impl Into<T> for Foo {
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: conflicting implementation in crate `core`:
8+
- impl<T, U> Into<U> for T
9+
where U: From<T>;
10+
11+
error: aborting due to previous error
12+
13+
For more information about this error, try `rustc --explain E0119`.

0 commit comments

Comments
 (0)