Skip to content

Commit eb8acda

Browse files
authored
Unrolled build for rust-lang#121322
Rollup merge of rust-lang#121322 - compiler-errors:next-solver-fulfillment-ice, r=lcnr Don't ICE when hitting overflow limit in fulfillment loop in next solver As the title says, let's not ICE when hitting the overflow limit in fulfill. On the other hand, we don't want to treat these as true errors, since it means that whether something is considered a true error or an ambiguity is dependent on overflow handling in the solver, which seems not worth it. Now that we use the presence of true errors in fulfillment for implicit negative coherence, we especially don't want to tie together coherence and overflow. I guess I could also drain these errors out of fulfillment and put them into some `ambiguities` storage so we could return them in `select_all_or_error` without having to re-process them every time we call `select_where_possible`. Let me know if that's desired. r? lcnr
2 parents bb59453 + 994d551 commit eb8acda

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

compiler/rustc_trait_selection/src/solve/fulfill.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
109109
let mut errors = Vec::new();
110110
for i in 0.. {
111111
if !infcx.tcx.recursion_limit().value_within_limit(i) {
112-
unimplemented!("overflowed on pending obligations: {:?}", self.obligations);
112+
// Only return true errors that we have accumulated while processing;
113+
// keep ambiguities around, *including overflows*, because they shouldn't
114+
// be considered true errors.
115+
return errors;
113116
}
114117

115118
let mut has_changed = false;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ compile-flags: -Znext-solver=coherence
2+
3+
#![recursion_limit = "10"]
4+
5+
trait Trait {}
6+
7+
struct W<T: ?Sized>(*const T);
8+
trait TwoW {}
9+
impl<T: ?Sized + TwoW> TwoW for W<W<T>> {}
10+
11+
impl<T: ?Sized + TwoW> Trait for W<T> {}
12+
impl<T: ?Sized + TwoW> Trait for T {}
13+
//~^ ERROR conflicting implementations of trait `Trait` for type `W
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0119]: conflicting implementations of trait `Trait` for type `W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<_>>>>>>>>>>>>>>>>>>>>>`
2+
--> $DIR/coherence-fulfill-overflow.rs:12:1
3+
|
4+
LL | impl<T: ?Sized + TwoW> Trait for W<T> {}
5+
| ------------------------------------- first implementation here
6+
LL | impl<T: ?Sized + TwoW> Trait for T {}
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<_>>>>>>>>>>>>>>>>>>>>>`
8+
9+
error: aborting due to 1 previous error
10+
11+
For more information about this error, try `rustc --explain E0119`.

0 commit comments

Comments
 (0)