-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On recursive requirements, elide repeating output #47720
Comments
Hello @estebank, I would like to take this one but I could use some more clarification. Just to be clear, your solution expects to:
and when end of recursion is reached:
|
I'm ok with any solution you come up with. The one you have mentioned should work fine. In any way you'll probably have to modify the way BTW, I haven't come up with a repro that doesn't depend on |
Minimal reproduction: use std::marker::PhantomData;
struct AssertSync<T: Sync>(PhantomData<T>);
pub struct Foo {
bar: *const Bar,
phantom: PhantomData<Bar>,
}
pub struct Bar {
foo: *const Foo,
phantom: PhantomData<Foo>,
}
fn main() {
let _: AssertSync<Foo> = unimplemented!();
} |
I found a new instance of this. [playground] use std::ops::Deref;
fn assert_TextSized<T: TextSized>() {}
/// Text-like structures that have a text size.
pub trait TextSized: Copy {
/// The size of this text-alike.
fn text_size(self) -> usize;
}
impl TextSized for &'_ str {
fn text_size(self) -> usize {
self.len()
}
}
impl<D: Deref> TextSized for &'_ D
where for<'a> &'a D::Target: TextSized
{
fn text_size(self) -> usize {
self.deref().text_size()
}
}
const _: fn() = || {
assert_TextSized::<&()>();
};
(edited to make the example actually compile for a correct type) |
Current output
|
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
Ty
snote_obligation_cause_code
has encountered on previous runs. I feel it is reasonable to delay thenote
s from being produced until the bottom has been reached, and prune the list then. The output should be something along the lines ofThe text was updated successfully, but these errors were encountered: