Report cycle error using 'deepest' obligation in the cycle
This commit is contained in:
parent
f2d9ee9c34
commit
611191f54c
9 changed files with 41 additions and 20 deletions
|
@ -224,7 +224,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
|
||||
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(
|
||||
|
|
|
@ -9,7 +9,8 @@ where
|
|||
use std::convert::TryFrom;
|
||||
<[T; N.get()]>::try_from(())
|
||||
//~^ error: the trait bound
|
||||
//~^^ error: mismatched types
|
||||
//~| error: the trait bound
|
||||
//~| error: mismatched types
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -25,7 +25,7 @@ struct Runtime<DB: Database> {
|
|||
}
|
||||
struct SalsaStorage {
|
||||
_parse: <ParseQuery as Query<RootDatabase>>::Data,
|
||||
//~^ ERROR overflow evaluating the requirement `RootDatabase: SourceDatabase`
|
||||
//~^ ERROR overflow
|
||||
}
|
||||
|
||||
impl Database for RootDatabase {
|
||||
|
|
|
@ -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
|
||||
|
|
||||
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`
|
||||
--> $DIR/cycle-cache-err-60010.rs:37:10
|
||||
|
|
||||
|
|
|
@ -15,8 +15,8 @@ impl<'a> Y for C<'a> {
|
|||
struct C<'a>(&'a ());
|
||||
struct X<T: Y>(T::P);
|
||||
|
||||
impl<T: NotAuto> NotAuto for Box<T> {}
|
||||
impl<T: Y> NotAuto for X<T> where T::P: NotAuto {} //~ NOTE: required
|
||||
impl<T: NotAuto> NotAuto for Box<T> {} //~ NOTE: required
|
||||
impl<T: Y> NotAuto for X<T> where T::P: NotAuto {}
|
||||
impl<'a> NotAuto for C<'a> {}
|
||||
|
||||
fn is_send<S: NotAuto>() {}
|
||||
|
@ -26,6 +26,6 @@ fn main() {
|
|||
// Should only be a few notes.
|
||||
is_send::<X<C<'static>>>();
|
||||
//~^ ERROR overflow evaluating
|
||||
//~| 2 redundant requirements hidden
|
||||
//~| 3 redundant requirements hidden
|
||||
//~| required because of
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
||||
LL | is_send::<X<C<'static>>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: required because of the requirements on the impl of `NotAuto` for `X<C<'_>>`
|
||||
--> $DIR/lifetime.rs:19:12
|
||||
note: required because of the requirements on the impl of `NotAuto` for `Box<X<C<'_>>>`
|
||||
--> $DIR/lifetime.rs:18:18
|
||||
|
|
||||
LL | impl<T: Y> NotAuto for X<T> where T::P: NotAuto {}
|
||||
| ^^^^^^^ ^^^^
|
||||
= note: 2 redundant requirements hidden
|
||||
LL | impl<T: NotAuto> NotAuto for Box<T> {}
|
||||
| ^^^^^^^ ^^^^^^
|
||||
= note: 3 redundant requirements hidden
|
||||
= note: required because of the requirements on the impl of `NotAuto` for `X<C<'static>>`
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/lifetime.rs:22:15
|
||||
|
|
|
@ -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
|
||||
|
|
||||
LL | is_ee(4);
|
||||
|
|
|
@ -5,10 +5,10 @@ LL | type Foo = impl std::fmt::Debug;
|
|||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
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 again requires computing type of `m::Foo::{opaque#0}`, completing the cycle
|
||||
note: cycle used when checking item types in module `m`
|
||||
|
|
|
@ -5,10 +5,10 @@ LL | type Foo = impl std::fmt::Debug;
|
|||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
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 again requires computing type of `m::Foo::{opaque#0}`, completing the cycle
|
||||
note: cycle used when checking item types in module `m`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue