Closed
Description
The following code gives an ICE
#![allow(unused_must_use)]
#![feature(trace_macros)]
trace_macros!(true);
macro_rules! write_html {
($w:expr, ) => (());
($w:expr, $tag:ident [] $($rest:tt)*) => (
write!($w, "hello");
write_html!($w,);
);
}
fn main() {
use std::fmt::Write;
let mut out = String::new();
write_html!(&mut out,html[]);
}
Error messages in stable
write_html! { & mut out , html [ ] }
write! { &mut out , "hello" }
write_html! { &mut out , }
<anon>:18:17: 2:54 error: mismatched types:
expected `()`,
found `core::result::Result<(), core::fmt::Error>`
(expected (),
found enum `core::result::Result`) [E0308]
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'capacity overflow', /home/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/option.rs:330
playpen: application terminated with error code 101
Error message on nighly
write_html! { & mut out , html [ ] }
write! { &mut out , "hello" }
write_html! { &mut out , }
<anon>:18:17: 2:54 error: mismatched types:
expected `()`,
found `core::result::Result<(), core::fmt::Error>`
(expected (),
found enum `core::result::Result`) [E0308]
(internal compiler error: unprintable span)
<std macros>:1:1: 2:56 note: in expansion of write!
<anon>:10:9: 10:28 note: expansion site
<anon>:6:1: 13:2 note: in expansion of write_html!
<anon>:18:5: 18:34 note: expansion site
<anon>:18:17: 2:54 help: see the detailed explanation for E0308
error: aborting due to previous error
playpen: application terminated with error code 101
I cannot judge if this has already been reported.
Metadata
Metadata
Assignees
Labels
No labels