1
Fork 0

Report cycle error using 'deepest' obligation in the cycle

This commit is contained in:
Aaron Hill 2021-08-27 17:34:48 -05:00
parent f2d9ee9c34
commit 611191f54c
No known key found for this signature in database
GPG key ID: B4087E510E98B164
9 changed files with 41 additions and 20 deletions

View file

@ -224,7 +224,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
debug!("report_overflow_error_cycle: cycle={:?}", cycle); debug!("report_overflow_error_cycle: cycle={:?}", cycle);
self.report_overflow_error(&cycle[0], false); // The 'deepest' obligation is most likely to have a useful
// cause 'backtrace'
self.report_overflow_error(cycle.iter().max_by_key(|p| p.recursion_depth).unwrap(), false);
} }
fn report_selection_error( fn report_selection_error(

View file

@ -9,7 +9,8 @@ where
use std::convert::TryFrom; use std::convert::TryFrom;
<[T; N.get()]>::try_from(()) <[T; N.get()]>::try_from(())
//~^ error: the trait bound //~^ error: the trait bound
//~^^ error: mismatched types //~| error: the trait bound
//~| error: mismatched types
} }
fn main() {} fn main() {}

View file

@ -25,7 +25,7 @@ struct Runtime<DB: Database> {
} }
struct SalsaStorage { struct SalsaStorage {
_parse: <ParseQuery as Query<RootDatabase>>::Data, _parse: <ParseQuery as Query<RootDatabase>>::Data,
//~^ ERROR overflow evaluating the requirement `RootDatabase: SourceDatabase` //~^ ERROR overflow
} }
impl Database for RootDatabase { impl Database for RootDatabase {

View file

@ -1,9 +1,27 @@
error[E0275]: overflow evaluating the requirement `RootDatabase: SourceDatabase` error[E0275]: overflow evaluating the requirement `SalsaStorage: RefUnwindSafe`
--> $DIR/cycle-cache-err-60010.rs:27:13 --> $DIR/cycle-cache-err-60010.rs:27:13
| |
LL | _parse: <ParseQuery as Query<RootDatabase>>::Data, LL | _parse: <ParseQuery as Query<RootDatabase>>::Data,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: required because it appears within the type `*const SalsaStorage`
= note: required because it appears within the type `Unique<SalsaStorage>`
= note: required because it appears within the type `Box<SalsaStorage>`
note: required because it appears within the type `Runtime<RootDatabase>`
--> $DIR/cycle-cache-err-60010.rs:23:8
|
LL | struct Runtime<DB: Database> {
| ^^^^^^^
note: required because it appears within the type `RootDatabase`
--> $DIR/cycle-cache-err-60010.rs:20:8
|
LL | struct RootDatabase {
| ^^^^^^^^^^^^
note: required because of the requirements on the impl of `SourceDatabase` for `RootDatabase`
--> $DIR/cycle-cache-err-60010.rs:44:9
|
LL | impl<T> SourceDatabase for T
| ^^^^^^^^^^^^^^ ^
note: required because of the requirements on the impl of `Query<RootDatabase>` for `ParseQuery` note: required because of the requirements on the impl of `Query<RootDatabase>` for `ParseQuery`
--> $DIR/cycle-cache-err-60010.rs:37:10 --> $DIR/cycle-cache-err-60010.rs:37:10
| |

View file

@ -15,8 +15,8 @@ impl<'a> Y for C<'a> {
struct C<'a>(&'a ()); struct C<'a>(&'a ());
struct X<T: Y>(T::P); struct X<T: Y>(T::P);
impl<T: NotAuto> NotAuto for Box<T> {} impl<T: NotAuto> NotAuto for Box<T> {} //~ NOTE: required
impl<T: Y> NotAuto for X<T> where T::P: NotAuto {} //~ NOTE: required impl<T: Y> NotAuto for X<T> where T::P: NotAuto {}
impl<'a> NotAuto for C<'a> {} impl<'a> NotAuto for C<'a> {}
fn is_send<S: NotAuto>() {} fn is_send<S: NotAuto>() {}
@ -26,6 +26,6 @@ fn main() {
// Should only be a few notes. // Should only be a few notes.
is_send::<X<C<'static>>>(); is_send::<X<C<'static>>>();
//~^ ERROR overflow evaluating //~^ ERROR overflow evaluating
//~| 2 redundant requirements hidden //~| 3 redundant requirements hidden
//~| required because of //~| required because of
} }

View file

@ -1,15 +1,15 @@
error[E0275]: overflow evaluating the requirement `Box<X<C<'_>>>: NotAuto` error[E0275]: overflow evaluating the requirement `X<C<'_>>: NotAuto`
--> $DIR/lifetime.rs:27:5 --> $DIR/lifetime.rs:27:5
| |
LL | is_send::<X<C<'static>>>(); LL | is_send::<X<C<'static>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: required because of the requirements on the impl of `NotAuto` for `X<C<'_>>` note: required because of the requirements on the impl of `NotAuto` for `Box<X<C<'_>>>`
--> $DIR/lifetime.rs:19:12 --> $DIR/lifetime.rs:18:18
| |
LL | impl<T: Y> NotAuto for X<T> where T::P: NotAuto {} LL | impl<T: NotAuto> NotAuto for Box<T> {}
| ^^^^^^^ ^^^^ | ^^^^^^^ ^^^^^^
= note: 2 redundant requirements hidden = note: 3 redundant requirements hidden
= note: required because of the requirements on the impl of `NotAuto` for `X<C<'static>>` = note: required because of the requirements on the impl of `NotAuto` for `X<C<'static>>`
note: required by a bound in `is_send` note: required by a bound in `is_send`
--> $DIR/lifetime.rs:22:15 --> $DIR/lifetime.rs:22:15

View file

@ -1,4 +1,4 @@
error[E0275]: overflow evaluating the requirement `{integer}: Tweedledee` error[E0275]: overflow evaluating the requirement `{integer}: Tweedledum`
--> $DIR/simultaneous.rs:18:5 --> $DIR/simultaneous.rs:18:5
| |
LL | is_ee(4); LL | is_ee(4);

View file

@ -5,10 +5,10 @@ LL | type Foo = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
| |
note: ...which requires type-checking `m::bar`... note: ...which requires type-checking `m::bar`...
--> $DIR/auto-trait-leakage3.rs:14:5 --> $DIR/auto-trait-leakage3.rs:15:9
| |
LL | pub fn bar() { LL | is_send(foo());
| ^^^^^^^^^^^^ | ^^^^^^^
= note: ...which requires evaluating trait selection obligation `impl std::fmt::Debug: std::marker::Send`... = note: ...which requires evaluating trait selection obligation `impl std::fmt::Debug: std::marker::Send`...
= note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle
note: cycle used when checking item types in module `m` note: cycle used when checking item types in module `m`

View file

@ -5,10 +5,10 @@ LL | type Foo = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
| |
note: ...which requires type-checking `m::bar`... note: ...which requires type-checking `m::bar`...
--> $DIR/inference-cycle.rs:14:5 --> $DIR/inference-cycle.rs:15:9
| |
LL | pub fn bar() { LL | is_send(foo()); // Today: error
| ^^^^^^^^^^^^ | ^^^^^^^
= note: ...which requires evaluating trait selection obligation `impl std::fmt::Debug: std::marker::Send`... = note: ...which requires evaluating trait selection obligation `impl std::fmt::Debug: std::marker::Send`...
= note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle
note: cycle used when checking item types in module `m` note: cycle used when checking item types in module `m`