-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Code that misuses the write!
macro hangs rustc for 1 minute and then SIGILLs (OOM)
#19163
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
Comments
Same here. The error message is completely different from that of the old compiler.
|
This is a duplicate of #19155, by the way. |
I don't think this is a dup of that. The compiler doesn't OOM in my bug. |
Oh, then it is a separate one. To be accurate, my test above also consumed the entire memory and died. |
Fail to reproduce on Linux with rustc 1.0.0-dev (4e4e8cf 2015-01-24 22:14:14 +0000). |
The macro_rules! mywrite {
($dst:expr, $($arg:tt)*) => ({
let dst = &mut *$dst; //~ error: cannot borrow immutable borrowed content as mutable
(|&mut: args| { dst.write_fmt(args) })(format_args!($($arg)*))
})
}
fn main() {
let mut v = vec![];
mywrite!(&v, "Hello world");
} We should add a test to avoid regressions. |
The subtlety with |
Still no hang with // mywrite.rs
#![crate_type="lib"]
#[macro_export]
macro_rules! mywrite {
($dst:expr, $($arg:tt)*) => ({
let dst = &mut *$dst; //~ error: cannot borrow immutable borrowed content as mutable
(|&mut: args| { dst.write_fmt(args) })(format_args!($($arg)*))
})
} and // main.rs
$ cat main.rs
#[macro_use] extern crate mywrite;
fn main() {
let mut v = vec![];
mywrite!(&v, "Hello world");
} Result:
|
fix: Stabilize sort order of `related_tests`
STR
Output
Backtrace
Version
1d81776
Can anyone reproduce? I find this bizarre...
cc @alexcrichton @jakub- @sfackler
The text was updated successfully, but these errors were encountered: