-
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
format_args! returned from a closure causes corruption/crash #27592
Comments
My theory is that this is a failing in borrowck, allowing |
Running this through |
My branch for RFC rust-lang/rfcs#1214 reports the following error:
|
subissue of #27579 |
@TimNN note that the pretty expansion failing to compile is a bit of a red herring because it's not pretty printed correctly, if you wrap the |
Minimal example: use std::ops::Deref;
fn write<'a, F>(f: F) where F: FnOnce() -> &'a u32 {
println!("{}", f());
}
fn main() {
let k = || (&mut 42).deref(); // no rvalue promotion here please
write(k)
} |
causes errors, post rebase). Issue rust-lang#27592 is still alive and well, whatever it is.
The following code causes an abort in the generated executable, due to a bad jump in
::std::fmt::write
(indirect call to 0x1)This is present on stable, beta, and nightly, both with and without optimisation on. (from my tests in playpen)
The text was updated successfully, but these errors were encountered: