-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
(same goes for "duplicate associated function" and similar errors)
I was playing around with macro-generated methods, and stumbled upon a bad diagnostic:
struct S;
macro_rules! methods {
( $($name:ident)* ) => {
$( fn $name(&self) {} )*
}
}
impl S {
fn a(&self) {}
methods!(a b c);
}
fn main() {}
<anon>:5:12: 5:30 error: duplicate method [E0201]
<anon>:5 $( fn $name(&self) {} )*
^~~~~~~~~~~~~~~~~~
<anon>:12:5: 12:21 note: in this expansion of methods! (defined in <anon>)
Rustc should print a note: previous definition here
and include the name of the method in the diagnostic (since both could be defined by macros, in which case the name will not be obvious).
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints