I tried this code on the latest nightly:
#![feature(decl_macro)]
trait Trait {
type T;
}
macro trait_impl {
() => {
type T = ();
}
}
impl Trait for i32 {
trait_impl!();
type T = ();
}
I expected to see this happen: an error about type T being defined twice in the same impl. (This is what happens with macro_rules! trait_impl.)
Instead, this happened: the code just compiles. The same also works when considering a function rather than a type.
I tried this code on the latest nightly:
I expected to see this happen: an error about
type Tbeing defined twice in the same impl. (This is what happens withmacro_rules! trait_impl.)Instead, this happened: the code just compiles. The same also works when considering a function rather than a type.