-
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
Regression 1.66 "some_fn::{opaque#0}<'_>
does not live long enough"
#107426
Comments
searched nightlies: from nightly-2022-09-15 to nightly-2022-10-15 bisected with cargo-bisect-rustc v0.6.5Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --end=2022-10-15 @rustbot label -E-needs-bisection |
Minimized to: use std::marker::PhantomData;
#[derive(Clone, Copy)]
pub struct Scope<'a>(&'a PhantomData<&'a mut &'a ()>);
fn event<'a, F: FnMut() + 'a>(_: Scope<'a>, _: F) {}
fn make_fn<'a>(_: Scope<'a>) -> impl Fn() + Copy + 'a {
|| {}
}
fn foo(cx: Scope) {
let open_toggle = make_fn(cx);
|| event(cx, open_toggle);
}
fn main() {} @rustbot label -E-needs-mcve |
|
Since the crater run there found no regressions I'm gonna @oli-obk anyways but I don't think there's anything to do here. |
Yea, this is expected breakage. We should improve the diagnostic though. |
Is the reduced example unsound? I would expect |
The minimized example is not really unsound as in it doesn't contain UB - it doesn't do anything. But the feature that it uses is unsound. Such is the fate of a safe language, it often has "false positives". |
Thanks, but this is a bit advanced for me still, but if this is expected I can close the issue or do you want me to keep it open for better diagnostics? |
On my machine the original post as well as the reduced example regress in 1.66, not 1.67. Can someone confirm or deny this? If that’s true, than the title here would be misleading. |
some_fn::{opaque#0}<'_>
does not live long enough"some_fn::{opaque#0}<'_>
does not live long enough"
Godbolt agrees, this regressed in 1.66 |
I only looked at this issue, because there’s been a thread on URLO on a similarly-looking issue that appears to actually regress on 1.67: #107516 Mentioning it here, because it might be of interest to readers of this thread :-) |
This is weird, this only broke on my CI because it was pinned to stable (-> 1.67), my local machine was still compiling and running the code fine on 1.66. Maybe the reduced example already regressed in 1.66 but my corner case only regresses in 1.67? |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
Code
Unfortunately I couldn't minimize it further without using a dependency (code can be executed online here):
GenericNode
DomNode#event
The code compiles and runs with 1.66 but fails with 1.67:
I expect this code to still compile on 1.67
Version it worked on
1.66
Version with regression
1.67
The text was updated successfully, but these errors were encountered: