-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-decl-macros-2-0Area: Declarative macros 2.0 (#39412)Area: Declarative macros 2.0 (#39412)A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.F-decl_macro`#![feature(decl_macro)]``#![feature(decl_macro)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
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.
Metadata
Metadata
Assignees
Labels
A-decl-macros-2-0Area: Declarative macros 2.0 (#39412)Area: Declarative macros 2.0 (#39412)A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.F-decl_macro`#![feature(decl_macro)]``#![feature(decl_macro)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.