Repository navigation
Regression 1.66 "some_fn::{opaque#0}<'_> does not live long enough" #107426
Copy link
Copy link
Closed
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
Code
Unfortunately I couldn't minimize it further without using a dependency (code can be executed online here):
/*
[dependencies]
sycamore = "0.8.2"
web-sys = "0.3"
*/
use sycamore::prelude::{Scope, View, Html, DomNode, ReadSignal, GenericNode};
pub fn create_toggle_bool<'a>(cx: Scope<'a>, initial: bool) -> (&'a ReadSignal<bool>, impl Fn() + Copy + 'a) {
// let open = sycamore::prelude::create_signal(cx, false);
// let open_toggle = || open.set(!*open.get());
// (open, open_toggle)
(todo!(), || {})
}
pub fn Foo<G: Html>(cx: Scope) -> View<G> {
let (open, open_toggle) = create_toggle_bool(cx, false);
// Uncomment these 2 lines to make it compile (moved out of the function)
// let open = sycamore::prelude::create_signal(cx, false);
// let open_toggle = || open.set(!*open.get());
let a = move |_: web_sys::Event| open_toggle();
move || {
let __el = DomNode::text_node("test");
::sycamore::generic_node::GenericNode::event(&__el, cx, "click", a);
__el;
};
todo!()
}
fn main() {
}The code compiles and runs with 1.66 but fails with 1.67:
error: `create_toggle_bool::{opaque#0}<'_>` does not live long enough
--> src/main.rs:28:9
|
28 | ::sycamore::generic_node::GenericNode::event(&__el, cx, "click", a);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I expect this code to still compile on 1.67
Version it worked on
1.66
Version with regression
1.67
rustc 1.67.0 (fc594f156 2023-01-24)
binary: rustc
commit-hash: fc594f15669680fa70d255faec3ca3fb507c3405
commit-date: 2023-01-24
host: x86_64-unknown-linux-gnu
release: 1.67.0
LLVM version: 15.0.6
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Activity
Teapot4195 commentedon Jan 28, 2023
searched nightlies: from nightly-2022-09-15 to nightly-2022-10-15
regressed nightly: nightly-2022-09-26
searched commit range: 3f83906...f5193a9
regressed commit: f5193a9
bisected with cargo-bisect-rustc v0.6.5
Host triple: x86_64-unknown-linux-gnu
Reproduce with:
@rustbot label -E-needs-bisection
clubby789 commentedon Jan 28, 2023
Minimized to:
@rustbot label -E-needs-mcve
clubby789 commentedon Jan 28, 2023
#95474
Noratrieb commentedon Jan 29, 2023
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.
8 remaining items
steffahn commentedon Jan 31, 2023
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 :-)
Dav1dde commentedon Jan 31, 2023
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?
aliemjay commentedon Mar 3, 2023
This regression can indeed be mitigated (cc #108691), at least for the MCVE we have.
@rustbot label -A-diagonstics regression-from-stable-to-stable
apiraino commentedon Mar 7, 2023
WG-prioritization assigning priority (Zulip discussion).
@rustbot label -I-prioritize +P-medium