_ => false,
}
}
+
+ fn descr(&self) -> &'static str {
+ if self.is_extern_crate() { "extern crate" } else { self.def().kind_name() }
+ }
}
/// Interns the names of the primitive types.
module_map.insert(DefId::local(CRATE_DEF_INDEX), graph_root);
let mut definitions = Definitions::new();
- DefCollector::new(&mut definitions)
+ DefCollector::new(&mut definitions, Mark::root())
.collect_root(crate_name, &session.local_crate_disambiguator().as_str());
let mut invocations = FxHashMap();
path_span: Span)
-> Option<LexicalScopeBinding<'a>> {
if ns == TypeNS {
- ident.ctxt = ident.ctxt.modern();
+ ident.ctxt = if ident.name == keywords::SelfType.name() {
+ SyntaxContext::empty() // FIXME(jseyfried) improve `Self` hygiene
+ } else {
+ ident.ctxt.modern()
+ }
}
// Walk backwards up the ribs in scope.
for &PrivacyError(span, name, binding) in &self.privacy_errors {
if !reported_spans.insert(span) { continue }
- if binding.is_extern_crate() {
- // Warn when using an inaccessible extern crate.
- let node_id = match binding.kind {
- NameBindingKind::Import { directive, .. } => directive.id,
- _ => unreachable!(),
- };
- let msg = format!("extern crate `{}` is private", name);
- self.session.add_lint(lint::builtin::INACCESSIBLE_EXTERN_CRATE, node_id, span, msg);
- } else {
- let def = binding.def();
- self.session.span_err(span, &format!("{} `{}` is private", def.kind_name(), name));
- }
+ span_err!(self.session, span, E0603, "{} `{}` is private", binding.descr(), name);
}
}