resolve: Simplify ambiguity checking for built-in attributes
This commit is contained in:
parent
e6739fe274
commit
9d7d9ada6d
2 changed files with 8 additions and 17 deletions
|
|
@ -684,7 +684,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
|||
let binding = (Def::NonMacroAttr(NonMacroAttrKind::Builtin),
|
||||
ty::Visibility::Public, ident.span, Mark::root())
|
||||
.to_name_binding(self.arenas);
|
||||
Ok((binding, Flags::PRELUDE, Flags::empty()))
|
||||
Ok((binding, Flags::PRELUDE, Flags::all()))
|
||||
} else {
|
||||
Err(Determinacy::Determined)
|
||||
}
|
||||
|
|
@ -917,18 +917,9 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
|||
|
||||
let builtin_attrs = mem::replace(&mut *module.builtin_attrs.borrow_mut(), Vec::new());
|
||||
for (ident, parent_scope) in builtin_attrs {
|
||||
let binding = self.early_resolve_ident_in_lexical_scope(
|
||||
let _ = self.early_resolve_ident_in_lexical_scope(
|
||||
ident, MacroNS, Some(MacroKind::Attr), false, &parent_scope, true, true, ident.span
|
||||
);
|
||||
if let Ok(binding) = binding {
|
||||
if binding.def_ignoring_ambiguity() !=
|
||||
Def::NonMacroAttr(NonMacroAttrKind::Builtin) {
|
||||
let builtin_binding = (Def::NonMacroAttr(NonMacroAttrKind::Builtin),
|
||||
ty::Visibility::Public, ident.span, Mark::root())
|
||||
.to_name_binding(self.arenas);
|
||||
self.report_ambiguity_error(ident, binding, builtin_binding);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
error[E0425]: cannot find value `NonExistent` in this scope
|
||||
--> $DIR/ambiguous-builtin-attrs.rs:30:5
|
||||
|
|
||||
LL | NonExistent; //~ ERROR cannot find value `NonExistent` in this scope
|
||||
| ^^^^^^^^^^^ not found in this scope
|
||||
|
||||
error[E0659]: `repr` is ambiguous
|
||||
--> $DIR/ambiguous-builtin-attrs.rs:9:3
|
||||
|
|
||||
|
|
@ -88,12 +94,6 @@ LL | #![feature(decl_macro)] //~ ERROR `feature` is ambiguous
|
|||
| ^^^^^^^
|
||||
= note: consider adding an explicit import of `feature` to disambiguate
|
||||
|
||||
error[E0425]: cannot find value `NonExistent` in this scope
|
||||
--> $DIR/ambiguous-builtin-attrs.rs:30:5
|
||||
|
|
||||
LL | NonExistent; //~ ERROR cannot find value `NonExistent` in this scope
|
||||
| ^^^^^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors occurred: E0425, E0659.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue