Skip to content

Commit 82ecfc3

Browse files
committed
HACK unknowable goal, don't compute other candidates
1 parent b020856 commit 82ecfc3

16 files changed

+31
-5
lines changed

Diff for: compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,17 @@ where
304304

305305
let mut candidates = vec![];
306306

307+
match self.solver_mode() {
308+
SolverMode::Normal => {}
309+
SolverMode::Coherence => {
310+
self.assemble_coherence_unknowable_candidates(goal, &mut candidates)
311+
}
312+
}
313+
314+
if !candidates.is_empty() {
315+
return candidates;
316+
}
317+
307318
self.assemble_impl_candidates(goal, &mut candidates);
308319

309320
self.assemble_builtin_impl_candidates(goal, &mut candidates);
@@ -316,9 +327,7 @@ where
316327

317328
match self.solver_mode() {
318329
SolverMode::Normal => self.discard_impls_shadowed_by_env(goal, &mut candidates),
319-
SolverMode::Coherence => {
320-
self.assemble_coherence_unknowable_candidates(goal, &mut candidates)
321-
}
330+
SolverMode::Coherence => {}
322331
}
323332

324333
candidates

Diff for: tests/ui/coherence/coherence-negative-outlives-lifetimes.stock.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
66
LL | impl<'a, T> MyTrait<'a> for &'a T {}
77
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
88
|
9+
= note: downstream crates may implement trait `std::marker::Sized` for type `&_`
910
= note: downstream crates may implement trait `MyPredicate<'_>` for type `&_`
1011

1112
error: aborting due to 1 previous error

Diff for: tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
66
LL | impl<'a, T> MyTrait<'a> for &'a T {}
77
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
88
|
9+
= note: downstream crates may implement trait `std::marker::Sized` for type `&_`
910
= note: downstream crates may implement trait `MyPredicate<'_>` for type `&_`
1011

1112
error: aborting due to 1 previous error

Diff for: tests/ui/coherence/coherence-overlap-issue-23516-inherent.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LL |
77
LL | impl<U:Sugar> Cake<Box<U>> { fn dummy(&self) { } }
88
| --------------- other definition for `dummy`
99
|
10+
= note: downstream crates may implement trait `std::marker::Sized` for type `std::boxed::Box<_>`
1011
= note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>`
1112

1213
error: aborting due to 1 previous error

Diff for: tests/ui/coherence/coherence-overlap-issue-23516.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | impl<T:Sugar> Sweet for T { }
66
LL | impl<U:Sugar> Sweet for Box<U> { }
77
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>`
88
|
9+
= note: downstream crates may implement trait `std::marker::Sized` for type `std::boxed::Box<_>`
910
= note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>`
1011

1112
error: aborting due to 1 previous error

Diff for: tests/ui/coherence/coherence-overlap-negate-not-use-feature-gate.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ LL | impl<T: DerefMut> Foo for T {}
66
LL | impl<U> Foo for &U {}
77
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
88
|
9+
= note: downstream crates may implement trait `std::marker::Sized` for type `&_`
10+
= note: downstream crates may implement trait `std::ops::Deref` for type `&_`
911
= note: downstream crates may implement trait `std::ops::DerefMut` for type `&_`
1012

1113
error: aborting due to 1 previous error

Diff for: tests/ui/coherence/coherence-overlap-unnormalizable-projection-0.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ LL | | for<'a> <T as WithAssoc<'a>>::Assoc: WhereBound,
1111
LL | impl<T> Trait for Box<T> {}
1212
| ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>`
1313
|
14+
= note: downstream crates may implement trait `std::marker::Sized` for type `std::boxed::Box<_>`
1415
= note: downstream crates may implement trait `WithAssoc<'a>` for type `std::boxed::Box<_>`
1516

1617
error: aborting due to 1 previous error

Diff for: tests/ui/coherence/coherence-overlap-unnormalizable-projection-1.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ LL | | for<'a> Box<<T as WithAssoc<'a>>::Assoc>: WhereBound,
1111
LL | impl<T> Trait for Box<T> {}
1212
| ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>`
1313
|
14+
= note: downstream crates may implement trait `std::marker::Sized` for type `std::boxed::Box<_>`
1415
= note: downstream crates may implement trait `WithAssoc<'a>` for type `std::boxed::Box<_>`
1516
= note: downstream crates may implement trait `WhereBound` for type `std::boxed::Box<_>`
1617

Diff for: tests/ui/coherence/coherence-wasm-bindgen.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ LL | | R: ReturnWasmAbi,
1515
|
1616
= warning: the behavior may change in a future release
1717
= note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
18+
= note: downstream crates may implement trait `std::marker::Sized` for type `&_`
1819
= note: downstream crates may implement trait `FromWasmAbi` for type `&_`
1920
= note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
2021
note: the lint level is defined here

Diff for: tests/ui/coherence/negative-coherence-check-placeholder-outlives.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | impl<T> Bar for T where T: Foo {}
66
LL | impl<T> Bar for Box<T> {}
77
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>`
88
|
9+
= note: downstream crates may implement trait `std::marker::Sized` for type `std::boxed::Box<_>`
910
= note: downstream crates may implement trait `Foo` for type `std::boxed::Box<_>`
1011

1112
error: aborting due to 1 previous error

Diff for: tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LL | impl<T> Bar for T where T: Foo {}
77
LL | impl<T> Bar for &T {}
88
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
99
|
10+
= note: downstream crates may implement trait `std::marker::Sized` for type `&_`
1011
= note: downstream crates may implement trait `Foo` for type `&_`
1112

1213
error: aborting due to 1 previous error

Diff for: tests/ui/coherence/normalize-for-errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ impl<S: Iterator> MyTrait<S> for (Box<<(MyType,) as Mirror>::Assoc>, S::Item) {}
1414
//~^ ERROR conflicting implementations of trait `MyTrait<_>` for type `(Box<(MyType,)>,
1515
//~| NOTE conflicting implementation for `(Box<(MyType,)>,
1616
//~| NOTE upstream crates may add a new impl of trait `std::marker::Copy` for type `std::boxed::Box<(MyType,)>` in future versions
17-
//~| NOTE upstream crates may add a new impl of trait `std::clone::Clone` for type `(MyType,)` in future versions
17+
//~| NOTE upstream crates may add a new impl of trait `std::clone::Clone` for type `std::boxed::Box<(MyType,)>` in future versions
1818

1919
fn main() {}

Diff for: tests/ui/coherence/normalize-for-errors.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL |
77
LL | impl<S: Iterator> MyTrait<S> for (Box<<(MyType,) as Mirror>::Assoc>, S::Item) {}
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(Box<(MyType,)>, <_ as Iterator>::Item)`
99
|
10-
= note: upstream crates may add a new impl of trait `std::clone::Clone` for type `(MyType,)` in future versions
10+
= note: upstream crates may add a new impl of trait `std::clone::Clone` for type `std::boxed::Box<(MyType,)>` in future versions
1111
= note: upstream crates may add a new impl of trait `std::marker::Copy` for type `std::boxed::Box<(MyType,)>` in future versions
1212

1313
error: aborting due to 1 previous error

Diff for: tests/ui/coherence/occurs-check/associated-type.next.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ LL | | where
1414
LL | | for<'a> *const T: ToUnit<'a>,
1515
| |_________________________________^ conflicting implementation for `for<'a> fn(&'a (), ())`
1616
|
17+
= note: upstream crates may add a new impl of trait `std::clone::Clone` for type `for<'a> fn(&'a (), ())` in future versions
18+
= note: upstream crates may add a new impl of trait `std::marker::Copy` for type `for<'a> fn(&'a (), ())` in future versions
1719
= note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
1820

1921
error[E0284]: type annotations needed: cannot normalize `<for<'a> fn(&'a (), ()) as Overlap<for<'a> fn(&'a (), ())>>::Assoc`

Diff for: tests/ui/coherence/occurs-check/associated-type.old.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ LL | | where
1414
LL | | for<'a> *const T: ToUnit<'a>,
1515
| |_________________________________^ conflicting implementation for `for<'a> fn(&'a (), ())`
1616
|
17+
= note: upstream crates may add a new impl of trait `std::clone::Clone` for type `for<'a> fn(&'a (), ())` in future versions
18+
= note: upstream crates may add a new impl of trait `std::marker::Copy` for type `for<'a> fn(&'a (), ())` in future versions
1719
= note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
1820

1921
error: aborting due to 1 previous error

Diff for: tests/ui/feature-gates/feature-gate-with_negative_coherence.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ LL |
77
LL | impl<T> Foo for &T { }
88
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
99
|
10+
= note: downstream crates may implement trait `std::marker::Sized` for type `&_`
11+
= note: downstream crates may implement trait `std::ops::Deref` for type `&_`
1012
= note: downstream crates may implement trait `std::ops::DerefMut` for type `&_`
1113

1214
error: aborting due to 1 previous error

0 commit comments

Comments
 (0)