1
Fork 0

Rollup merge of #67574 - Centril:librustc_lowering, r=Mark-Simulacrum

Extract `rustc_ast_lowering` crate from `rustc`

Working towards https://github.com/rust-lang/rust/issues/65031.

This PR moves `src/librustc/hir/lowering{/, .rs}` to its own crate (`librustc_ast_lowering`) which is very self-contained (only `fn lower_crate` and `trait Resolver` are exposed).

r? @Mark-Simulacrum
This commit is contained in:
Mazdak Farrokhzad 2019-12-31 19:19:31 +01:00 committed by GitHub
commit 3cf2bc0e51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 125 additions and 95 deletions

View file

@ -3358,6 +3358,22 @@ dependencies = [
"core", "core",
] ]
[[package]]
name = "rustc_ast_lowering"
version = "0.0.0"
dependencies = [
"log",
"rustc",
"rustc_data_structures",
"rustc_error_codes",
"rustc_errors",
"rustc_index",
"rustc_span",
"rustc_target",
"smallvec 1.0.0",
"syntax",
]
[[package]] [[package]]
name = "rustc_builtin_macros" name = "rustc_builtin_macros"
version = "0.0.0" version = "0.0.0"
@ -3578,6 +3594,7 @@ dependencies = [
"once_cell", "once_cell",
"rustc", "rustc",
"rustc-rayon", "rustc-rayon",
"rustc_ast_lowering",
"rustc_builtin_macros", "rustc_builtin_macros",
"rustc_codegen_llvm", "rustc_codegen_llvm",
"rustc_codegen_ssa", "rustc_codegen_ssa",
@ -3783,6 +3800,7 @@ dependencies = [
"bitflags", "bitflags",
"log", "log",
"rustc", "rustc",
"rustc_ast_lowering",
"rustc_data_structures", "rustc_data_structures",
"rustc_error_codes", "rustc_error_codes",
"rustc_errors", "rustc_errors",

View file

@ -39,7 +39,6 @@ pub mod def;
pub mod def_id; pub mod def_id;
pub mod intravisit; pub mod intravisit;
pub mod itemlikevisit; pub mod itemlikevisit;
pub mod lowering;
pub mod map; pub mod map;
pub mod pat_util; pub mod pat_util;
pub mod print; pub mod print;
@ -599,7 +598,7 @@ pub enum SyntheticTyParamKind {
pub struct WhereClause<'hir> { pub struct WhereClause<'hir> {
pub predicates: &'hir [WherePredicate<'hir>], pub predicates: &'hir [WherePredicate<'hir>],
// Only valid if predicates isn't empty. // Only valid if predicates isn't empty.
span: Span, pub span: Span,
} }
impl WhereClause<'_> { impl WhereClause<'_> {

View file

@ -28,7 +28,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(arbitrary_self_types)] #![feature(arbitrary_self_types)]
#![feature(array_value_iter)]
#![feature(bool_to_option)] #![feature(bool_to_option)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(box_syntax)] #![feature(box_syntax)]

View file

@ -523,7 +523,7 @@ pub enum BuiltinLintDiagnostics {
DeprecatedMacro(Option<Symbol>, Span), DeprecatedMacro(Option<Symbol>, Span),
} }
pub(crate) fn add_elided_lifetime_in_path_suggestion( pub fn add_elided_lifetime_in_path_suggestion(
sess: &Session, sess: &Session,
db: &mut DiagnosticBuilder<'_>, db: &mut DiagnosticBuilder<'_>,
n: usize, n: usize,

View file

@ -0,0 +1,22 @@
[package]
authors = ["The Rust Project Developers"]
name = "rustc_ast_lowering"
version = "0.0.0"
edition = "2018"
[lib]
name = "rustc_ast_lowering"
path = "lib.rs"
doctest = false
[dependencies]
log = { version = "0.4", features = ["release_max_level_info", "std"] }
rustc = { path = "../librustc" }
rustc_target = { path = "../librustc_target" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_index = { path = "../librustc_index" }
rustc_span = { path = "../librustc_span" }
rustc_error_codes = { path = "../librustc_error_codes" }
rustc_errors = { path = "../librustc_errors" }
syntax = { path = "../libsyntax" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] }

View file

@ -1,16 +1,16 @@
use super::{ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs}; use super::{ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs};
use crate::hir;
use crate::hir::def::Res;
use rustc::bug;
use rustc::hir;
use rustc::hir::def::Res;
use rustc_data_structures::thin_vec::ThinVec; use rustc_data_structures::thin_vec::ThinVec;
use rustc_error_codes::*;
use rustc_span::source_map::{respan, DesugaringKind, Span, Spanned};
use rustc_span::symbol::{sym, Symbol};
use syntax::ast::*; use syntax::ast::*;
use syntax::attr; use syntax::attr;
use syntax::ptr::P as AstP; use syntax::ptr::P as AstP;
use syntax::source_map::{respan, DesugaringKind, Span, Spanned}; use syntax::{span_err, struct_span_err};
use syntax::symbol::{sym, Symbol};
use rustc_error_codes::*;
impl<'hir> LoweringContext<'_, 'hir> { impl<'hir> LoweringContext<'_, 'hir> {
fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] { fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] {
@ -82,11 +82,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
this.lower_expr_while_in_loop_scope(e.span, cond, body, opt_label) this.lower_expr_while_in_loop_scope(e.span, cond, body, opt_label)
}), }),
ExprKind::Loop(ref body, opt_label) => self.with_loop_scope(e.id, |this| { ExprKind::Loop(ref body, opt_label) => self.with_loop_scope(e.id, |this| {
hir::ExprKind::Loop( hir::ExprKind::Loop(this.lower_block(body, false), opt_label, hir::LoopSource::Loop)
this.lower_block(body, false),
this.lower_label(opt_label),
hir::LoopSource::Loop,
)
}), }),
ExprKind::TryBlock(ref body) => self.lower_expr_try_block(body), ExprKind::TryBlock(ref body) => self.lower_expr_try_block(body),
ExprKind::Match(ref expr, ref arms) => hir::ExprKind::Match( ExprKind::Match(ref expr, ref arms) => hir::ExprKind::Match(
@ -123,10 +119,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
self.lower_expr_closure(capture_clause, movability, decl, body, fn_decl_span) self.lower_expr_closure(capture_clause, movability, decl, body, fn_decl_span)
} }
} }
ExprKind::Block(ref blk, opt_label) => hir::ExprKind::Block( ExprKind::Block(ref blk, opt_label) => {
self.lower_block(blk, opt_label.is_some()), hir::ExprKind::Block(self.lower_block(blk, opt_label.is_some()), opt_label)
self.lower_label(opt_label), }
),
ExprKind::Assign(ref el, ref er, span) => { ExprKind::Assign(ref el, ref er, span) => {
hir::ExprKind::Assign(self.lower_expr(el), self.lower_expr(er), span) hir::ExprKind::Assign(self.lower_expr(el), self.lower_expr(er), span)
} }
@ -407,11 +402,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
); );
// `[opt_ident]: loop { ... }` // `[opt_ident]: loop { ... }`
hir::ExprKind::Loop( hir::ExprKind::Loop(self.block_expr(self.arena.alloc(match_expr)), opt_label, source)
self.block_expr(self.arena.alloc(match_expr)),
self.lower_label(opt_label),
source,
)
} }
/// Desugar `try { <stmts>; <expr> }` into `{ <stmts>; ::std::ops::Try::from_ok(<expr>) }`, /// Desugar `try { <stmts>; <expr> }` into `{ <stmts>; ::std::ops::Try::from_ok(<expr>) }`,
@ -836,10 +827,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
} }
} }
fn lower_label(&mut self, label: Option<Label>) -> Option<hir::Label> {
label.map(|label| hir::Label { ident: label.ident })
}
fn lower_loop_destination(&mut self, destination: Option<(NodeId, Label)>) -> hir::Destination { fn lower_loop_destination(&mut self, destination: Option<(NodeId, Label)>) -> hir::Destination {
let target_id = match destination { let target_id = match destination {
Some((id, _)) => { Some((id, _)) => {
@ -857,7 +844,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
.unwrap_or(Err(hir::LoopIdError::OutsideLoopScope)) .unwrap_or(Err(hir::LoopIdError::OutsideLoopScope))
.into(), .into(),
}; };
hir::Destination { label: self.lower_label(destination.map(|(_, label)| label)), target_id } hir::Destination { label: destination.map(|(_, label)| label), target_id }
} }
fn lower_jump_destination(&mut self, id: NodeId, opt_label: Option<Label>) -> hir::Destination { fn lower_jump_destination(&mut self, id: NodeId, opt_label: Option<Label>) -> hir::Destination {
@ -1100,8 +1087,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
); );
// `[opt_ident]: loop { ... }` // `[opt_ident]: loop { ... }`
let kind = let kind = hir::ExprKind::Loop(loop_block, opt_label, hir::LoopSource::ForLoop);
hir::ExprKind::Loop(loop_block, self.lower_label(opt_label), hir::LoopSource::ForLoop);
let loop_expr = self.arena.alloc(hir::Expr { let loop_expr = self.arena.alloc(hir::Expr {
hir_id: self.lower_node_id(e.id), hir_id: self.lower_node_id(e.id),
kind, kind,

View file

@ -1,28 +1,25 @@
use super::AnonymousLifetimeMode; use super::{AnonymousLifetimeMode, LoweringContext, ParamMode};
use super::ImplTraitContext; use super::{ImplTraitContext, ImplTraitPosition, ImplTraitTypeIdVisitor};
use super::ImplTraitPosition;
use super::ImplTraitTypeIdVisitor;
use super::LoweringContext;
use super::ParamMode;
use crate::arena::Arena;
use crate::hir;
use crate::hir::def::{DefKind, Res};
use crate::hir::def_id::DefId;
use crate::util::nodemap::NodeMap;
use rustc::arena::Arena;
use rustc::bug;
use rustc::hir;
use rustc::hir::def::{DefKind, Res};
use rustc::hir::def_id::DefId;
use rustc::util::nodemap::NodeMap;
use rustc_error_codes::*;
use rustc_span::source_map::{respan, DesugaringKind};
use rustc_span::symbol::{kw, sym};
use rustc_span::Span;
use rustc_target::spec::abi; use rustc_target::spec::abi;
use smallvec::SmallVec;
use std::collections::BTreeSet;
use syntax::ast::*; use syntax::ast::*;
use syntax::attr; use syntax::attr;
use syntax::source_map::{respan, DesugaringKind}; use syntax::struct_span_err;
use syntax::symbol::{kw, sym};
use syntax::visit::{self, Visitor}; use syntax::visit::{self, Visitor};
use syntax_pos::Span;
use rustc_error_codes::*; use log::debug;
use smallvec::{smallvec, SmallVec};
use std::collections::BTreeSet;
pub(super) struct ItemLowerer<'a, 'lowering, 'hir> { pub(super) struct ItemLowerer<'a, 'lowering, 'hir> {
pub(super) lctx: &'a mut LoweringContext<'lowering, 'hir>, pub(super) lctx: &'a mut LoweringContext<'lowering, 'hir>,
@ -1429,7 +1426,7 @@ pub(super) struct GenericsCtor<'hir> {
span: Span, span: Span,
} }
impl GenericsCtor<'hir> { impl<'hir> GenericsCtor<'hir> {
pub(super) fn into_generics(self, arena: &'hir Arena<'hir>) -> hir::Generics<'hir> { pub(super) fn into_generics(self, arena: &'hir Arena<'hir>) -> hir::Generics<'hir> {
hir::Generics { hir::Generics {
params: arena.alloc_from_iter(self.params), params: arena.alloc_from_iter(self.params),

View file

@ -32,45 +32,47 @@
//! get confused if the spans from leaf AST nodes occur in multiple places //! get confused if the spans from leaf AST nodes occur in multiple places
//! in the HIR, especially for multiple identifiers. //! in the HIR, especially for multiple identifiers.
use crate::arena::Arena; #![feature(array_value_iter)]
use crate::dep_graph::DepGraph;
use crate::hir::def::{DefKind, Namespace, PartialRes, PerNS, Res}; use rustc::arena::Arena;
use crate::hir::def_id::{DefId, DefIndex, CRATE_DEF_INDEX}; use rustc::dep_graph::DepGraph;
use crate::hir::map::{DefKey, DefPathData, Definitions}; use rustc::hir::def::{DefKind, Namespace, PartialRes, PerNS, Res};
use crate::hir::{self, ParamName}; use rustc::hir::def_id::{DefId, DefIndex, CRATE_DEF_INDEX};
use crate::hir::{ConstArg, GenericArg}; use rustc::hir::map::{DefKey, DefPathData, Definitions};
use crate::lint; use rustc::hir::{self, ConstArg, GenericArg, ParamName};
use crate::lint::builtin::{self, ELIDED_LIFETIMES_IN_PATHS}; use rustc::lint;
use crate::middle::cstore::CrateStore; use rustc::lint::builtin::{self, ELIDED_LIFETIMES_IN_PATHS};
use crate::session::config::nightly_options; use rustc::middle::cstore::CrateStore;
use crate::session::Session; use rustc::session::config::nightly_options;
use crate::util::captures::Captures; use rustc::session::Session;
use crate::util::common::FN_OUTPUT_NAME; use rustc::util::captures::Captures;
use crate::util::nodemap::{DefIdMap, NodeMap}; use rustc::util::common::FN_OUTPUT_NAME;
use errors::Applicability; use rustc::util::nodemap::{DefIdMap, NodeMap};
use rustc::{bug, span_bug};
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::sync::Lrc; use rustc_data_structures::sync::Lrc;
use rustc_error_codes::*;
use rustc_errors::Applicability;
use rustc_index::vec::IndexVec; use rustc_index::vec::IndexVec;
use rustc_span::hygiene::ExpnId;
use smallvec::SmallVec; use rustc_span::source_map::{respan, DesugaringKind, ExpnData, ExpnKind, Spanned};
use std::collections::BTreeMap; use rustc_span::symbol::{kw, sym, Symbol};
use std::mem; use rustc_span::Span;
use syntax::ast; use syntax::ast;
use syntax::ast::*; use syntax::ast::*;
use syntax::attr; use syntax::attr;
use syntax::errors;
use syntax::print::pprust; use syntax::print::pprust;
use syntax::ptr::P as AstP; use syntax::ptr::P as AstP;
use syntax::sess::ParseSess; use syntax::sess::ParseSess;
use syntax::source_map::{respan, DesugaringKind, ExpnData, ExpnKind, Spanned};
use syntax::symbol::{kw, sym, Symbol};
use syntax::token::{self, Nonterminal, Token}; use syntax::token::{self, Nonterminal, Token};
use syntax::tokenstream::{TokenStream, TokenTree}; use syntax::tokenstream::{TokenStream, TokenTree};
use syntax::visit::{self, Visitor}; use syntax::visit::{self, Visitor};
use syntax_pos::hygiene::ExpnId; use syntax::{help, struct_span_err, walk_list};
use syntax_pos::Span;
use rustc_error_codes::*; use log::{debug, trace};
use smallvec::{smallvec, SmallVec};
use std::collections::BTreeMap;
use std::mem;
macro_rules! arena_vec { macro_rules! arena_vec {
($this:expr; $($x:expr),*) => ({ ($this:expr; $($x:expr),*) => ({
@ -84,7 +86,7 @@ mod item;
const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF; const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF;
pub struct LoweringContext<'a, 'hir: 'a> { struct LoweringContext<'a, 'hir: 'a> {
crate_root: Option<Symbol>, crate_root: Option<Symbol>,
/// Used to assign IDs to HIR nodes that do not directly correspond to AST nodes. /// Used to assign IDs to HIR nodes that do not directly correspond to AST nodes.
@ -235,13 +237,13 @@ enum ImplTraitPosition {
Other, Other,
} }
impl<'b, 'a> ImplTraitContext<'b, 'a> { impl<'a> ImplTraitContext<'_, 'a> {
#[inline] #[inline]
fn disallowed() -> Self { fn disallowed() -> Self {
ImplTraitContext::Disallowed(ImplTraitPosition::Other) ImplTraitContext::Disallowed(ImplTraitPosition::Other)
} }
fn reborrow(&'c mut self) -> ImplTraitContext<'c, 'a> { fn reborrow<'this>(&'this mut self) -> ImplTraitContext<'this, 'a> {
use self::ImplTraitContext::*; use self::ImplTraitContext::*;
match self { match self {
Universal(params) => Universal(params), Universal(params) => Universal(params),
@ -372,8 +374,8 @@ struct ImplTraitTypeIdVisitor<'a> {
ids: &'a mut SmallVec<[NodeId; 1]>, ids: &'a mut SmallVec<[NodeId; 1]>,
} }
impl<'a, 'b> Visitor<'a> for ImplTraitTypeIdVisitor<'b> { impl Visitor<'_> for ImplTraitTypeIdVisitor<'_> {
fn visit_ty(&mut self, ty: &'a Ty) { fn visit_ty(&mut self, ty: &Ty) {
match ty.kind { match ty.kind {
TyKind::Typeof(_) | TyKind::BareFn(_) => return, TyKind::Typeof(_) | TyKind::BareFn(_) => return,
@ -383,7 +385,7 @@ impl<'a, 'b> Visitor<'a> for ImplTraitTypeIdVisitor<'b> {
visit::walk_ty(self, ty); visit::walk_ty(self, ty);
} }
fn visit_path_segment(&mut self, path_span: Span, path_segment: &'v PathSegment) { fn visit_path_segment(&mut self, path_span: Span, path_segment: &PathSegment) {
if let Some(ref p) = path_segment.args { if let Some(ref p) = path_segment.args {
if let GenericArgs::Parenthesized(_) = **p { if let GenericArgs::Parenthesized(_) = **p {
return; return;
@ -687,7 +689,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
self.resolver.get_import_res(id).present_items() self.resolver.get_import_res(id).present_items()
} }
fn diagnostic(&self) -> &errors::Handler { fn diagnostic(&self) -> &rustc_errors::Handler {
self.sess.diagnostic() self.sess.diagnostic()
} }
@ -3288,7 +3290,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
} }
} }
fn body_ids(bodies: &BTreeMap<hir::BodyId, hir::Body<'hir>>) -> Vec<hir::BodyId> { fn body_ids(bodies: &BTreeMap<hir::BodyId, hir::Body<'_>>) -> Vec<hir::BodyId> {
// Sorting by span ensures that we get things in order within a // Sorting by span ensures that we get things in order within a
// file, and also puts the files in a sensible order. // file, and also puts the files in a sensible order.
let mut body_ids: Vec<_> = bodies.keys().cloned().collect(); let mut body_ids: Vec<_> = bodies.keys().cloned().collect();
@ -3303,7 +3305,7 @@ struct GenericArgsCtor<'hir> {
parenthesized: bool, parenthesized: bool,
} }
impl GenericArgsCtor<'hir> { impl<'hir> GenericArgsCtor<'hir> {
fn is_empty(&self) -> bool { fn is_empty(&self) -> bool {
self.args.is_empty() && self.bindings.is_empty() && !self.parenthesized self.args.is_empty() && self.bindings.is_empty() && !self.parenthesized
} }

View file

@ -20,6 +20,7 @@ rustc_parse = { path = "../librustc_parse" }
syntax_pos = { path = "../librustc_span", package = "rustc_span" } syntax_pos = { path = "../librustc_span", package = "rustc_span" }
rustc_serialize = { path = "../libserialize", package = "serialize" } rustc_serialize = { path = "../libserialize", package = "serialize" }
rustc = { path = "../librustc" } rustc = { path = "../librustc" }
rustc_ast_lowering = { path = "../librustc_ast_lowering" }
rustc_incremental = { path = "../librustc_incremental" } rustc_incremental = { path = "../librustc_incremental" }
rustc_traits = { path = "../librustc_traits" } rustc_traits = { path = "../librustc_traits" }
rustc_data_structures = { path = "../librustc_data_structures" } rustc_data_structures = { path = "../librustc_data_structures" }

View file

@ -7,7 +7,6 @@ use rustc::arena::Arena;
use rustc::dep_graph::DepGraph; use rustc::dep_graph::DepGraph;
use rustc::hir; use rustc::hir;
use rustc::hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc::hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc::hir::lowering::lower_crate;
use rustc::lint; use rustc::lint;
use rustc::middle::cstore::{CrateStore, MetadataLoader, MetadataLoaderDyn}; use rustc::middle::cstore::{CrateStore, MetadataLoader, MetadataLoaderDyn};
use rustc::middle::{self, resolve_lifetime, stability}; use rustc::middle::{self, resolve_lifetime, stability};
@ -442,8 +441,14 @@ pub fn lower_to_hir<'res, 'tcx>(
) -> Result<hir::map::Forest<'tcx>> { ) -> Result<hir::map::Forest<'tcx>> {
// Lower AST to HIR. // Lower AST to HIR.
let hir_forest = time(sess, "lowering AST -> HIR", || { let hir_forest = time(sess, "lowering AST -> HIR", || {
let nt_to_tokenstream = rustc_parse::nt_to_tokenstream; let hir_crate = rustc_ast_lowering::lower_crate(
let hir_crate = lower_crate(sess, &dep_graph, &krate, resolver, nt_to_tokenstream, arena); sess,
&dep_graph,
&krate,
resolver,
rustc_parse::nt_to_tokenstream,
arena,
);
if sess.opts.debugging_opts.hir_stats { if sess.opts.debugging_opts.hir_stats {
hir_stats::print_hir_stats(&hir_crate); hir_stats::print_hir_stats(&hir_crate);

View file

@ -16,8 +16,8 @@ use std::{f32, f64, i16, i32, i64, i8, u16, u32, u64, u8};
use rustc_target::spec::abi::Abi; use rustc_target::spec::abi::Abi;
use syntax::errors::Applicability; use syntax::errors::Applicability;
use syntax::symbol::sym;
use syntax::{ast, attr, source_map}; use syntax::{ast, attr, source_map};
use syntax_pos::symbol::sym;
use syntax_pos::Span; use syntax_pos::Span;
use rustc::hir; use rustc::hir;

View file

@ -15,10 +15,11 @@ bitflags = "1.2.1"
log = "0.4" log = "0.4"
syntax = { path = "../libsyntax" } syntax = { path = "../libsyntax" }
rustc_expand = { path = "../librustc_expand" } rustc_expand = { path = "../librustc_expand" }
rustc = { path = "../librustc" }
arena = { path = "../libarena" } arena = { path = "../libarena" }
errors = { path = "../librustc_errors", package = "rustc_errors" } errors = { path = "../librustc_errors", package = "rustc_errors" }
syntax_pos = { path = "../librustc_span", package = "rustc_span" } syntax_pos = { path = "../librustc_span", package = "rustc_span" }
rustc = { path = "../librustc" }
rustc_ast_lowering = { path = "../librustc_ast_lowering" }
rustc_data_structures = { path = "../librustc_data_structures" } rustc_data_structures = { path = "../librustc_data_structures" }
rustc_feature = { path = "../librustc_feature" } rustc_feature = { path = "../librustc_feature" }
rustc_metadata = { path = "../librustc_metadata" } rustc_metadata = { path = "../librustc_metadata" }

View file

@ -24,7 +24,7 @@ use rustc::hir::def::Namespace::*;
use rustc::hir::def::{self, CtorKind, CtorOf, DefKind, ExportMap, NonMacroAttrKind, PartialRes}; use rustc::hir::def::{self, CtorKind, CtorOf, DefKind, ExportMap, NonMacroAttrKind, PartialRes};
use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc::hir::map::Definitions; use rustc::hir::map::Definitions;
use rustc::hir::{self, Bool, Char, Float, Int, PrimTy, Str, Uint}; use rustc::hir::{Bool, Char, Float, Int, PrimTy, Str, Uint};
use rustc::hir::{GlobMap, TraitMap}; use rustc::hir::{GlobMap, TraitMap};
use rustc::lint; use rustc::lint;
use rustc::middle::cstore::{CrateStore, MetadataLoaderDyn}; use rustc::middle::cstore::{CrateStore, MetadataLoaderDyn};
@ -1026,7 +1026,7 @@ impl<'a, 'b> DefIdTree for &'a Resolver<'b> {
/// This interface is used through the AST→HIR step, to embed full paths into the HIR. After that /// 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. /// the resolver is no longer needed as all the relevant information is inline.
impl<'a> hir::lowering::Resolver for Resolver<'a> { impl rustc_ast_lowering::Resolver for Resolver<'_> {
fn cstore(&self) -> &dyn CrateStore { fn cstore(&self) -> &dyn CrateStore {
self.cstore() self.cstore()
} }

View file

@ -6,8 +6,8 @@ use errors::{Applicability, DiagnosticBuilder};
use rustc::hir::{self, is_range_literal, print, Node}; use rustc::hir::{self, is_range_literal, print, Node};
use rustc::ty::adjustment::AllowTwoPhase; use rustc::ty::adjustment::AllowTwoPhase;
use rustc::ty::{self, AssocItem, Ty}; use rustc::ty::{self, AssocItem, Ty};
use syntax::symbol::sym;
use syntax::util::parser::PREC_POSTFIX; use syntax::util::parser::PREC_POSTFIX;
use syntax_pos::symbol::sym;
use syntax_pos::Span; use syntax_pos::Span;
use super::method::probe; use super::method::probe;