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
|
ObligationCauseCode::BuiltinDerivedObligation(ref data) => { |
|
let parent_trait_ref = self.resolve_type_vars_if_possible(&data.parent_trait_ref); |
|
err.note(&format!("required because it appears within the type `{}`", |
|
parent_trait_ref.0.self_ty())); |
|
let parent_predicate = parent_trait_ref.to_predicate(); |
|
self.note_obligation_cause_code(err, |
|
&parent_predicate, |
|
&data.parent_code); |
|
} |
needs to be modified to pass down a vector of the Tys note_obligation_cause_code has encountered on previous runs. I feel it is reasonable to delay the notes 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)
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:
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
Tysnote_obligation_cause_codehas encountered on previous runs. I feel it is reasonable to delay thenotes from being produced until the bottom has been reached, and prune the list then. The output should be something along the lines of