use Determinacy::*;
-use errors::{Applicability, DiagnosticBuilder};
use rustc::hir::exports::ExportMap;
-use rustc::hir::map::Definitions;
+use rustc::hir::map::{DefKey, Definitions};
use rustc::lint;
use rustc::middle::cstore::{CrateStore, MetadataLoaderDyn};
-use rustc::session::Session;
use rustc::span_bug;
use rustc::ty::query::Providers;
use rustc::ty::{self, DefIdTree, ResolverOutputs};
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
use rustc_data_structures::ptr_key::PtrKey;
use rustc_data_structures::sync::Lrc;
+use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder};
use rustc_expand::base::SyntaxExtension;
use rustc_hir::def::Namespace::*;
use rustc_hir::def::{self, CtorKind, CtorOf, DefKind, NonMacroAttrKind, PartialRes};
use rustc_hir::PrimTy::{self, Bool, Char, Float, Int, Str, Uint};
use rustc_hir::{GlobMap, TraitMap};
use rustc_metadata::creader::{CStore, CrateLoader};
+use rustc_session::lint::{BuiltinLintDiagnostics, LintBuffer};
use rustc_session::node_id::{NodeMap, NodeSet};
+use rustc_session::Session;
use rustc_span::hygiene::{ExpnId, ExpnKind, MacroKind, SyntaxContext, Transparency};
use rustc_span::source_map::Spanned;
use rustc_span::symbol::{kw, sym};
use syntax::ast::{ItemKind, Path};
use syntax::attr;
use syntax::print::pprust;
+use syntax::unwrap_or;
use syntax::visit::{self, Visitor};
-use syntax::{struct_span_err, unwrap_or};
use log::debug;
use std::cell::{Cell, RefCell};
/// when visiting the correspondent variants.
variant_vis: DefIdMap<ty::Visibility>,
- lint_buffer: lint::LintBuffer,
+ lint_buffer: LintBuffer,
next_node_id: NodeId,
}
/// This interface is used through the AST→HIR step, to embed full paths into the HIR. After that
/// the resolver is no longer needed as all the relevant information is inline.
impl rustc_ast_lowering::Resolver for Resolver<'_> {
- fn cstore(&self) -> &dyn CrateStore {
- self.cstore()
+ fn def_key(&mut self, id: DefId) -> DefKey {
+ if id.is_local() { self.definitions().def_key(id.index) } else { self.cstore().def_key(id) }
+ }
+
+ fn item_generics_num_lifetimes(&self, def_id: DefId, sess: &Session) -> usize {
+ self.cstore().item_generics_num_lifetimes(def_id, sess)
}
fn resolve_str_path(
&mut self.definitions
}
- fn lint_buffer(&mut self) -> &mut lint::LintBuffer {
+ fn lint_buffer(&mut self) -> &mut LintBuffer {
&mut self.lint_buffer
}
.chain(features.declared_lang_features.iter().map(|(feat, ..)| *feat))
.collect(),
variant_vis: Default::default(),
- lint_buffer: lint::LintBuffer::default(),
+ lint_buffer: LintBuffer::default(),
next_node_id: NodeId::from_u32(1),
}
}
self.next_node_id
}
- pub fn lint_buffer(&mut self) -> &mut lint::LintBuffer {
+ pub fn lint_buffer(&mut self) -> &mut LintBuffer {
&mut self.lint_buffer
}
if let Some(node_id) = poisoned {
self.lint_buffer.buffer_lint_with_diagnostic(
lint::builtin::PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
- node_id, ident.span,
+ node_id,
+ ident.span,
&format!("cannot find {} `{}` in this scope", ns.descr(), ident),
- lint::builtin::BuiltinLintDiagnostics::
- ProcMacroDeriveResolutionFallback(ident.span),
+ BuiltinLintDiagnostics::ProcMacroDeriveResolutionFallback(ident.span),
);
}
return Some(LexicalScopeBinding::Item(binding));
}
}
- let diag = lint::builtin::BuiltinLintDiagnostics::AbsPathWithModule(diag_span);
+ let diag = BuiltinLintDiagnostics::AbsPathWithModule(diag_span);
self.lint_buffer.buffer_lint_with_diagnostic(
lint::builtin::ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
diag_id,
cannot be referred to by absolute paths";
self.lint_buffer.buffer_lint_with_diagnostic(
lint::builtin::MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
- CRATE_NODE_ID, span_use, msg,
- lint::builtin::BuiltinLintDiagnostics::
- MacroExpandedMacroExportsAccessedByAbsolutePaths(span_def),
+ CRATE_NODE_ID,
+ span_use,
+ msg,
+ BuiltinLintDiagnostics::MacroExpandedMacroExportsAccessedByAbsolutePaths(span_def),
);
}