Skip to content

Commit 3ba2761

Browse files
committed
resolve: Simplify ambiguity checking for built-in attributes
1 parent 8e8e33b commit 3ba2761

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
@@ -680,7 +680,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
680680
let binding = (Def::NonMacroAttr(NonMacroAttrKind::Builtin),
681681
ty::Visibility::Public, ident.span, Mark::root())
682682
.to_name_binding(self.arenas);
683-
Ok((binding, Flags::PRELUDE, Flags::empty()))
683+
Ok((binding, Flags::PRELUDE, Flags::all()))
684684
} else {
685685
Err(Determinacy::Determined)
686686
}
@@ -911,18 +911,9 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
911911

912912
let builtin_attrs = mem::replace(&mut *module.builtin_attrs.borrow_mut(), Vec::new());
913913
for (ident, parent_scope) in builtin_attrs {
914-
let binding = self.early_resolve_ident_in_lexical_scope(
914+
let _ = self.early_resolve_ident_in_lexical_scope(
915915
ident, MacroNS, Some(MacroKind::Attr), false, &parent_scope, true, true, ident.span
916916
);
917-
if let Ok(binding) = binding {
918-
if binding.def_ignoring_ambiguity() !=
919-
Def::NonMacroAttr(NonMacroAttrKind::Builtin) {
920-
let builtin_binding = (Def::NonMacroAttr(NonMacroAttrKind::Builtin),
921-
ty::Visibility::Public, ident.span, Mark::root())
922-
.to_name_binding(self.arenas);
923-
self.report_ambiguity_error(ident, binding, builtin_binding);
924-
}
925-
}
926917
}
927918
}
928919

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)