-
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
Broken compilation with &(dyn Trait + '_)
#103762
Comments
I think it's very close to #100615, so I'll close this as duplicate. Please feel free to reopen if it's not the case. |
Reverting the decision because I misunderstood the context and assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-high |
Indeed, from what I can tell, it seems that #97720 regressed this. Specifically, this change here. My understanding of this change is that it stopped pushing lifetime resolution in function signatures to typeck, and instead made it so that every occurrence of So I guess rustc used to think that the It seems a little unfortunate that we ever accepted this. I say this because having struct Type<'a> { a: &'a () }
fn foo(_: &Type<'_>) -> &'_ str { loop {} }
fn main() {}
I'm interested in trying to undo the regression, so I'll claim this. It seems like what I'd need to do is make the But perhaps there's someone who thinks we should just let it regress? |
Note this other one is also broken: pub trait AsStr {
fn as_str(&self) -> &str;
}
fn foo(bar: &(AsStr + '_)) -> &'_ str {
bar.as_str()
} Both cases do not appear at the same place in |
That's valid syntax? |
That's deprecated syntax, but it's valid, yes - Rust used to have just |
Code
I tried this code:
I expected to see this happen: code compiles successfully.
Instead, this happened:
Version it worked on
It most recently worked on Rust 1.63.0.
Version with regression
It is broken on current stable, i.e. 1.64.0.
Here's the output by
cargo-bisect-rustc
:It seems to have been found previously by
gluon
developers and fixed in their own code in this commit, and today popped up also on URLO.@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged
The text was updated successfully, but these errors were encountered: