Closed
Description
There is a corner case where the weak (contextual) keyword default
can't be used in an identifier position. It occurs when a macro whose path starts with default
is called inside an impl
.
macro_rules! foo {
($($x:tt)*) => { $($x)* }
}
macro_rules! default {
($($x:tt)*) => { $($x)* }
}
struct A;
impl A {
foo! { fn bar() {} }
default! { fn baz() {} } // ERROR
}
fn main() {
A::bar();
A::baz();
}
Expected behavior: it compiles.
Observed behavior: parse error.
Version: rustc 1.19.0-nightly (28fd1e519 2017-05-27)