-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Anonymous lifetime inference regression #10396
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Interesting. I'm probably going to need more context to diagnose what's going on. @sfackler is it possible to create something self-contained or, failing that, point me at the repo / revision where this occurs? |
Here's a minimal reproduction: enum Foo<'self> {
V(&'self str)
}
fn f(arr: &[&Foo]) {
for &f in arr.iter() {
println!("{:?}", f);
}
} It looks like the key part is that |
@nikomatsakis updated example: enum Foo<'s> {
V(&'s str)
}
fn f(arr: &[&Foo]) {
for &f in arr.iter() {
println!("{:?}", f);
}
}
fn main() {} |
This small testcase I've found (while working on #12809) seems to indicate that we don't infer struct Foo<'a, 'b> {
foo: &'a &'b int
}
fn foo<'a, 'b>(x: Foo<'a, 'b>) {
let _y = x.foo;
} |
I spoke with @eddyb and pointed him at regions-variance-covariant-use-contravariant.rs to illustrate that we do infer The fact that the code above does not compile as-is is interesting. I cannot tell if that is actually related to the original bug filed here or not. I have now filed #13703 for it. (Moved rest of comment to the issue description for #13703.) |
This now compiles. |
Do not suggest to derive `Default` on generics with implicit arguments Fixes rust-lang#10396 changelog: FP: [`derivable_impls`]: do not suggest to derive `Default` on generics with implicit arguments
The following function compiled up to today:
After updating to the from yesterday's Rust nightly to today's, it now fails to compile with the following error:
Possibly related to #10153?
The text was updated successfully, but these errors were encountered: