Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

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

compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs

Lines changed: 12 additions & 3 deletions
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

tests/ui/coherence/coherence-negative-outlives-lifetimes.stock.stderr

Lines changed: 1 addition & 0 deletions
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

tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr

Lines changed: 1 addition & 0 deletions
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

tests/ui/coherence/coherence-overlap-issue-23516-inherent.stderr

Lines changed: 1 addition & 0 deletions
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

tests/ui/coherence/coherence-overlap-issue-23516.stderr

Lines changed: 1 addition & 0 deletions
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

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

Lines changed: 2 additions & 0 deletions
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

tests/ui/coherence/coherence-overlap-unnormalizable-projection-0.stderr

Lines changed: 1 addition & 0 deletions
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

tests/ui/coherence/coherence-overlap-unnormalizable-projection-1.stderr

Lines changed: 1 addition & 0 deletions
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

tests/ui/coherence/coherence-wasm-bindgen.stderr

Lines changed: 1 addition & 0 deletions
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

tests/ui/coherence/negative-coherence-check-placeholder-outlives.stderr

Lines changed: 1 addition & 0 deletions
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

0 commit comments

Comments
 (0)