Closed
Description
When encountering recursive requirements, elide some of the repeating output instead of having the following wall of text detailing every recursive step the compiler takes:
error[E0275]: overflow evaluating the requirement `Foo: std::marker::Sync`
--> src/main.rs:5:1
|
5 | / lazy_static! {
6 | | static ref CHAR: Foo = unimplemented!();
7 | | }
| |_^
|
= help: consider adding a `#![recursion_limit="128"]` attribute to your crate
= note: required because it appears within the type `std::marker::PhantomData<Foo>`
= note: required because it appears within the type `Bar`
= note: required because it appears within the type `std::marker::PhantomData<Bar>`
= note: required because it appears within the type `Foo`
= note: required because it appears within the type `std::marker::PhantomData<Foo>`
= note: required because it appears within the type `Bar`
= note: required because it appears within the type `std::marker::PhantomData<Bar>`
= note: required because it appears within the type `Foo`
= note: required because it appears within the type `std::marker::PhantomData<Foo>`
= note: required because it appears within the type `Bar`
8<8<8<8<8<8<8<
= note: required by `lazy_static::lazy::Lazy`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
The following code
rust/src/librustc/traits/error_reporting.rs
Lines 1285 to 1293 in a0dcecf
needs to be modified to pass down a vector of the Ty
s note_obligation_cause_code
has encountered on previous runs. I feel it is reasonable to delay the note
s from being produced until the bottom has been reached, and prune the list then. The output should be something along the lines of
error[E0275]: overflow evaluating the requirement `Foo: std::marker::Sync`
--> src/main.rs:5:1
|
5 | / lazy_static! {
6 | | static ref CHAR: Foo = unimplemented!();
7 | | }
| |_^
|
= help: consider adding a `#![recursion_limit="128"]` attribute to your crate
= note: required because it appears within the type `std::marker::PhantomData<Foo>`
= note: required because it appears within the type `Bar`
= note: required because it appears within the type `std::marker::PhantomData<Bar>`
= note: required because it appears within the type `Foo`
= note: required because it appears within the type `std::marker::PhantomData<Foo>`
= note: ...and so on, these requirements repeat until reaching the recursion limit
= note: required by `lazy_static::lazy::Lazy`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)