Address review comments
This commit is contained in:
parent
09fff50637
commit
83f553c95c
14 changed files with 140 additions and 10 deletions
|
|
@ -141,8 +141,7 @@ impl<'a> Resolver<'a> {
|
|||
crate fn get_macro(&mut self, res: Res) -> Option<Lrc<SyntaxExtension>> {
|
||||
match res {
|
||||
Res::Def(DefKind::Macro(..), def_id) => self.get_macro_by_def_id(def_id),
|
||||
Res::NonMacroAttr(attr_kind) =>
|
||||
Some(self.non_macro_attr(attr_kind == NonMacroAttrKind::Tool)),
|
||||
Res::NonMacroAttr(attr_kind) => Some(self.non_macro_attr(attr_kind.is_used())),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1472,7 +1472,7 @@ impl<'a> Resolver<'a> {
|
|||
Scope::MacroRules(..) => true,
|
||||
Scope::CrateRoot => true,
|
||||
Scope::Module(..) => true,
|
||||
Scope::RegisteredAttrs => true,
|
||||
Scope::RegisteredAttrs => use_prelude,
|
||||
Scope::MacroUsePrelude => use_prelude || rust_2015,
|
||||
Scope::BuiltinAttrs => true,
|
||||
Scope::LegacyPluginHelpers => use_prelude || rust_2015,
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ fn fast_print_path(path: &ast::Path) -> Symbol {
|
|||
}
|
||||
}
|
||||
|
||||
/// The code common between processing `#![register_tool]` and `#![register_attr]`.
|
||||
fn registered_idents(
|
||||
sess: &Session,
|
||||
attrs: &[ast::Attribute],
|
||||
|
|
@ -832,7 +833,8 @@ impl<'a> Resolver<'a> {
|
|||
res: Option<Res>, span: Span) {
|
||||
if let Some(Res::NonMacroAttr(kind)) = res {
|
||||
if kind != NonMacroAttrKind::Tool && binding.map_or(true, |b| b.is_import()) {
|
||||
let msg = format!("cannot use a {} through an import", kind.descr());
|
||||
let msg =
|
||||
format!("cannot use {} {} through an import", kind.article(), kind.descr());
|
||||
let mut err = self.session.struct_span_err(span, &msg);
|
||||
if let Some(binding) = binding {
|
||||
err.span_note(binding.span, &format!("the {} imported here", kind.descr()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue