-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
1.79 regression in const
temporary lifetime extension
#126562
Comments
@rustbot claim I think I found what needs to be fixed. Just claiming the fix; I don't know how handling the regression should go. |
We recently changed our rules for promotion of function calls, quite deliberately: #121557. This seems to me to be expected fall-out from that change? |
Cc @rust-lang/wg-const-eval |
That does look to be more directly relevant than #121346. The initial report can't fix itself with @rustbot release-assignment The thread I was pulling on didn't go anywhere and I don't know enough to determine much more on my own, plus may be intentional |
The intended way to write such code is |
So that it's mentioned directly here: the urlo source looks like pub static ASSETS_DIR: Option<include_dir::Dir<'_>> = if cfg!(target_arch = "wasm32") {
Some(include_dir::include_dir!("$CARGO_MANIFEST_DIR/assets"))
} else {
None
}; and cannot introduce a |
The const block should be inside that included file then. Basically, when you want |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
This is now fixed upstream in include_dir, see Michael-F-Bryan/include_dir#99. |
Closing as deliberate and expected breakage. |
Code
I tried this code: [playground] [godbolt]
I expected to see this happen: code compiles: temporary is promoted to
&'static
due to theconst
evaluation context.Instead, this happened: code errors: temporary value dropped while borrowed.
Version it worked on
It most recently worked on: 1.78
Version with regression
rustc --version --verbose
:Meta
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged
Bisects to #121557
Initially reported on urlo: https://users.rust-lang.org/t/code-compiles-in-1-78-0-but-not-in-1-79-0/113038?u=cad97
The text was updated successfully, but these errors were encountered: