Skip to content

Commit 1eb763e

Browse files
committed
resolve: Simplify ambiguity checking for built-in attributes
1 parent d1b3eb5 commit 1eb763e

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

src/librustc_resolve/macros.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
677677
let binding = (Def::NonMacroAttr(NonMacroAttrKind::Builtin),
678678
ty::Visibility::Public, ident.span, Mark::root())
679679
.to_name_binding(self.arenas);
680-
Ok((binding, Flags::PRELUDE, Flags::empty()))
680+
Ok((binding, Flags::PRELUDE, Flags::all()))
681681
} else {
682682
Err(Determinacy::Determined)
683683
}
@@ -907,18 +907,9 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
907907

908908
let builtin_attrs = mem::replace(&mut *module.builtin_attrs.borrow_mut(), Vec::new());
909909
for (ident, parent_scope) in builtin_attrs {
910-
let binding = self.early_resolve_ident_in_lexical_scope(
910+
let _ = self.early_resolve_ident_in_lexical_scope(
911911
ident, MacroNS, Some(MacroKind::Attr), false, &parent_scope, true, true, ident.span
912912
);
913-
if let Ok(binding) = binding {
914-
if binding.def_ignoring_ambiguity() !=
915-
Def::NonMacroAttr(NonMacroAttrKind::Builtin) {
916-
let builtin_binding = (Def::NonMacroAttr(NonMacroAttrKind::Builtin),
917-
ty::Visibility::Public, ident.span, Mark::root())
918-
.to_name_binding(self.arenas);
919-
self.report_ambiguity_error(ident, binding, builtin_binding);
920-
}
921-
}
922913
}
923914
}
924915

src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
error[E0425]: cannot find value `NonExistent` in this scope
2+
--> $DIR/ambiguous-builtin-attrs.rs:30:5
3+
|
4+
LL | NonExistent; //~ ERROR cannot find value `NonExistent` in this scope
5+
| ^^^^^^^^^^^ not found in this scope
6+
17
error[E0659]: `repr` is ambiguous
28
--> $DIR/ambiguous-builtin-attrs.rs:9:3
39
|
@@ -88,12 +94,6 @@ LL | #![feature(decl_macro)] //~ ERROR `feature` is ambiguous
8894
| ^^^^^^^
8995
= note: consider adding an explicit import of `feature` to disambiguate
9096

91-
error[E0425]: cannot find value `NonExistent` in this scope
92-
--> $DIR/ambiguous-builtin-attrs.rs:30:5
93-
|
94-
LL | NonExistent; //~ ERROR cannot find value `NonExistent` in this scope
95-
| ^^^^^^^^^^^ not found in this scope
96-
9797
error: aborting due to 6 previous errors
9898

9999
Some errors occurred: E0425, E0659.

0 commit comments

Comments
 (0)