Simply do not ICE
This commit is contained in:
parent
0395fa387a
commit
994d55158d
3 changed files with 30 additions and 1 deletions
|
@ -109,7 +109,10 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
|
||||||
let mut errors = Vec::new();
|
let mut errors = Vec::new();
|
||||||
for i in 0.. {
|
for i in 0.. {
|
||||||
if !infcx.tcx.recursion_limit().value_within_limit(i) {
|
if !infcx.tcx.recursion_limit().value_within_limit(i) {
|
||||||
unimplemented!("overflowed on pending obligations: {:?}", self.obligations);
|
// Only return true errors that we have accumulated while processing;
|
||||||
|
// keep ambiguities around, *including overflows*, because they shouldn't
|
||||||
|
// be considered true errors.
|
||||||
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut has_changed = false;
|
let mut has_changed = false;
|
||||||
|
|
15
tests/ui/traits/next-solver/coherence-fulfill-overflow.rs
Normal file
15
tests/ui/traits/next-solver/coherence-fulfill-overflow.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
//@ compile-flags: -Znext-solver=coherence
|
||||||
|
|
||||||
|
#![recursion_limit = "10"]
|
||||||
|
|
||||||
|
trait Trait {}
|
||||||
|
|
||||||
|
struct W<T: ?Sized>(*const T);
|
||||||
|
trait TwoW {}
|
||||||
|
impl<T: ?Sized + TwoW> TwoW for W<W<T>> {}
|
||||||
|
|
||||||
|
impl<T: ?Sized + TwoW> Trait for W<T> {}
|
||||||
|
impl<T: ?Sized + TwoW> Trait for T {}
|
||||||
|
//~^ ERROR conflicting implementations of trait `Trait` for type `W
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,11 @@
|
||||||
|
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<_>>>>>>>>>>>>>>>>>>>>>`
|
||||||
|
--> $DIR/coherence-fulfill-overflow.rs:12:1
|
||||||
|
|
|
||||||
|
LL | impl<T: ?Sized + TwoW> Trait for W<T> {}
|
||||||
|
| ------------------------------------- first implementation here
|
||||||
|
LL | impl<T: ?Sized + TwoW> Trait for T {}
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<_>>>>>>>>>>>>>>>>>>>>>`
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0119`.
|
Loading…
Add table
Add a link
Reference in a new issue