Skip to content

Commit 1b3c13b

Browse files
m-ou-sejdonszelmann
authored andcommitted
Allow builtin macros to be used more than once.
This removes E0773 "A builtin-macro was defined more than once."
1 parent 3e61eb1 commit 1b3c13b

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

compiler/rustc_builtin_macros/src/eii.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,8 @@ fn eii_(
6262

6363
let item = item.into_inner();
6464

65-
let ast::Item {
66-
attrs,
67-
id: _,
68-
span: item_span,
69-
vis,
70-
kind: ItemKind::Fn(mut func),
71-
tokens: _,
72-
} = item
65+
let ast::Item { attrs, id: _, span: item_span, vis, kind: ItemKind::Fn(mut func), tokens: _ } =
66+
item
7367
else {
7468
ecx.dcx()
7569
.emit_err(EIIMacroExpectedFunction { span, name: path_to_string(&meta_item.path) });
@@ -195,7 +189,7 @@ fn eii_(
195189
extern_item_path: ast::Path::from_ident(func.ident),
196190
impl_unsafe,
197191
}),
198-
}
192+
},
199193
),
200194
tokens: None,
201195
}));

compiler/rustc_resolve/src/macros.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,8 +1138,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
11381138
if let Some(builtin_name) = ext.builtin_name {
11391139
// The macro was marked with `#[rustc_builtin_macro]`.
11401140
if let Some(builtin_ext_kind) = self.builtin_macros.get(&builtin_name) {
1141-
// The macro is a built-in, replace its expander function
1142-
// while still taking everything else from the source code.
11431141
ext.kind = builtin_ext_kind.clone();
11441142
rule_spans = Vec::new();
11451143
} else {

0 commit comments

Comments
 (0)