-
Notifications
You must be signed in to change notification settings - Fork 13k
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
"a temporary value which is freed while still in use" in nightly but not on stable #105891
Comments
This also fails in beta, (Rust 1.67 beta) @rustbot label +regression-from-stable-to-beta |
This comment was marked as duplicate.
This comment was marked as duplicate.
searched nightlies: from nightly-2022-10-29 to nightly-2022-12-08 (around where beta branched) bisected with cargo-bisect-rustc v0.6.5Host triple: x86_64-pc-windows-msvc cargo bisect-rustc --preserve --access github --start 1.66.0 --regress=error --end 2022-12-08 -- check @rustbot label -regression-from-stable-to-nightly |
This also fails on stable if you have a three-chain. E.g.: let _res = is_not(obfstr::obfstr!("linux")) && is_not(obfstr::obfstr!("windows")) && is_not(obfstr::obfstr!("macos")); gives:
I need to investigate more on what obfstr is doing, but it's likely that this is an expected breakage. With #103293, it was known that it is going to cause some breakage. crater runs showed only one regression at build time. A workaround is easy, you can add fn main() {
let product = "macos";
let is_not = |s: &str| !product.eq_ignore_ascii_case(s);
let _res = is_not(obfstr::obfstr!("windows")) && is_not(obfstr::obfstr!("macos"));
} That way, your code will also work with three-chains. |
I guess adding |
Hmm this is basically the same regression as the one that broke spaad_internal. Reducing the example from above to not need fn main() {
let product = "macos";
let is_not = |s| !product.eq_ignore_ascii_case(s);
let _res = is_not(&"windows".to_string()) && is_not(&"macos".to_string());
}
The best would be to fix the underlying closure lifetime (or type?) inference issue that got surfaced (not caused) by my PR in these instances. If that doesn't work, a suggestion would definitely improve things I think. I don't really know how those parts of the compiler work tho. |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
Code
I tried this code:
I expected to see this happen: the code compiles without problems on stable and nightly
Instead, this happened: compilation failed but only on nightly
Version it worked on
It most recently worked on: Rust 1.66
Version with regression
rustc --version --verbose
:Backtrace
Backtrace
The text was updated successfully, but these errors were encountered: