Auto merge of #67886 - Centril:rustc_hir_canon_imports, r=nagisa
Nix `rustc_hir` reexports in rustc::hir r? @Zoxc cc @Mark-Simulacrum
This commit is contained in:
commit
ebbb2bf37a
345 changed files with 949 additions and 911 deletions
|
|
@ -15,6 +15,7 @@ arena = { path = "../libarena" }
|
|||
log = "0.4"
|
||||
rustc = { path = "../librustc" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
rustc_hir = { path = "../librustc_hir" }
|
||||
errors = { path = "../librustc_errors", package = "rustc_errors" }
|
||||
rustc_target = { path = "../librustc_target" }
|
||||
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
|
||||
|
|
|
|||
|
|
@ -3,11 +3,6 @@
|
|||
//! instance of `AstConv`.
|
||||
|
||||
use crate::collect::PlaceholderHirTyCollector;
|
||||
use crate::hir::def::{CtorOf, DefKind, Res};
|
||||
use crate::hir::def_id::DefId;
|
||||
use crate::hir::intravisit::Visitor;
|
||||
use crate::hir::print;
|
||||
use crate::hir::{self, ExprKind, GenericArg, GenericArgs};
|
||||
use crate::lint;
|
||||
use crate::middle::lang_items::SizedTraitLangItem;
|
||||
use crate::middle::resolve_lifetime as rl;
|
||||
|
|
@ -15,6 +10,7 @@ use crate::namespace::Namespace;
|
|||
use crate::require_c_abi_if_c_variadic;
|
||||
use crate::util::common::ErrorReported;
|
||||
use errors::{Applicability, DiagnosticId};
|
||||
use rustc::hir::intravisit::Visitor;
|
||||
use rustc::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;
|
||||
use rustc::traits;
|
||||
use rustc::ty::subst::{self, InternalSubsts, Subst, SubstsRef};
|
||||
|
|
@ -22,6 +18,11 @@ use rustc::ty::wf::object_region_bounds;
|
|||
use rustc::ty::{self, Const, DefIdTree, ToPredicate, Ty, TyCtxt, TypeFoldable};
|
||||
use rustc::ty::{GenericParamDef, GenericParamDefKind};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorOf, DefKind, Res};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::print;
|
||||
use rustc_hir::{ExprKind, GenericArg, GenericArgs};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{MultiSpan, Span, DUMMY_SP};
|
||||
use rustc_target::spec::abi;
|
||||
|
|
@ -2554,12 +2555,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
assert_eq!(opt_self_ty, None);
|
||||
self.prohibit_generics(path.segments);
|
||||
match prim_ty {
|
||||
hir::Bool => tcx.types.bool,
|
||||
hir::Char => tcx.types.char,
|
||||
hir::Int(it) => tcx.mk_mach_int(it),
|
||||
hir::Uint(uit) => tcx.mk_mach_uint(uit),
|
||||
hir::Float(ft) => tcx.mk_mach_float(ft),
|
||||
hir::Str => tcx.mk_str(),
|
||||
hir::PrimTy::Bool => tcx.types.bool,
|
||||
hir::PrimTy::Char => tcx.types.char,
|
||||
hir::PrimTy::Int(it) => tcx.mk_mach_int(it),
|
||||
hir::PrimTy::Uint(uit) => tcx.mk_mach_uint(uit),
|
||||
hir::PrimTy::Float(ft) => tcx.mk_mach_float(ft),
|
||||
hir::PrimTy::Str => tcx.mk_str(),
|
||||
}
|
||||
}
|
||||
Res::Err => {
|
||||
|
|
@ -2773,11 +2774,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
}
|
||||
let input_tys = decl.inputs.iter().map(|a| self.ty_of_arg(a, None));
|
||||
let output_ty = match decl.output {
|
||||
hir::Return(ref output) => {
|
||||
hir::FunctionRetTy::Return(ref output) => {
|
||||
visitor.visit_ty(output);
|
||||
self.ast_ty_to_ty(output)
|
||||
}
|
||||
hir::DefaultReturn(..) => tcx.mk_unit(),
|
||||
hir::FunctionRetTy::DefaultReturn(..) => tcx.mk_unit(),
|
||||
};
|
||||
|
||||
debug!("ty_of_fn: output_ty={:?}", output_ty);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
use crate::check::coercion::CoerceMany;
|
||||
use crate::check::{Diverges, Expectation, FnCtxt, Needs};
|
||||
use rustc::hir::{self, ExprKind};
|
||||
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use rustc::traits::ObligationCauseCode;
|
||||
use rustc::traits::{IfExpressionCause, MatchExpressionArmCause, ObligationCause};
|
||||
use rustc::ty::Ty;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::ExprKind;
|
||||
use rustc_span::Span;
|
||||
|
||||
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
|
@ -219,7 +220,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
&self,
|
||||
span: Span,
|
||||
then_expr: &'tcx hir::Expr<'tcx>,
|
||||
coercion: &mut CoerceMany<'tcx, '_, rustc::hir::Arm<'tcx>>,
|
||||
coercion: &mut CoerceMany<'tcx, '_, rustc_hir::Arm<'tcx>>,
|
||||
) -> bool {
|
||||
// If this `if` expr is the parent's function return expr,
|
||||
// the cause of the type coercion is the return type, point at it. (#25228)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
use super::method::MethodCallee;
|
||||
use super::{FnCtxt, Needs, PlaceOp};
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::infer::{InferCtxt, InferOk};
|
||||
use rustc::session::DiagnosticMessageId;
|
||||
use rustc::traits::{self, TraitEngine};
|
||||
use rustc::ty::adjustment::{Adjust, Adjustment, OverloadedDeref};
|
||||
use rustc::ty::{self, TraitRef, Ty, TyCtxt};
|
||||
use rustc::ty::{ToPredicate, TypeFoldable};
|
||||
use rustc_hir as hir;
|
||||
|
||||
use rustc_span::Span;
|
||||
use syntax::ast::Ident;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use rustc_span::Span;
|
|||
use rustc_target::spec::abi;
|
||||
use syntax::ast::Ident;
|
||||
|
||||
use rustc::hir;
|
||||
use rustc_hir as hir;
|
||||
|
||||
use rustc_error_codes::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ use crate::hir::def_id::DefId;
|
|||
use crate::lint;
|
||||
use crate::util::common::ErrorReported;
|
||||
use errors::{Applicability, DiagnosticBuilder};
|
||||
use rustc::hir;
|
||||
use rustc::middle::lang_items;
|
||||
use rustc::session::Session;
|
||||
use rustc::traits;
|
||||
|
|
@ -43,6 +42,7 @@ use rustc::ty::cast::{CastKind, CastTy};
|
|||
use rustc::ty::error::TypeError;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::ty::{self, Ty, TypeAndMut, TypeFoldable};
|
||||
use rustc_hir as hir;
|
||||
use rustc_span::Span;
|
||||
use syntax::ast;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ use super::{check_fn, Expectation, FnCtxt, GeneratorTypes};
|
|||
|
||||
use crate::astconv::AstConv;
|
||||
use crate::middle::{lang_items, region};
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use rustc::infer::LateBoundRegionConversionTime;
|
||||
use rustc::infer::{InferOk, InferResult};
|
||||
|
|
@ -14,6 +12,8 @@ use rustc::traits::Obligation;
|
|||
use rustc::ty::fold::TypeFoldable;
|
||||
use rustc::ty::subst::InternalSubsts;
|
||||
use rustc::ty::{self, GenericParamDefKind, Ty};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_span::source_map::Span;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use std::cmp;
|
||||
|
|
@ -548,8 +548,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
// First, convert the types that the user supplied (if any).
|
||||
let supplied_arguments = decl.inputs.iter().map(|a| astconv.ast_ty_to_ty(a));
|
||||
let supplied_return = match decl.output {
|
||||
hir::Return(ref output) => astconv.ast_ty_to_ty(&output),
|
||||
hir::DefaultReturn(_) => match body.generator_kind {
|
||||
hir::FunctionRetTy::Return(ref output) => astconv.ast_ty_to_ty(&output),
|
||||
hir::FunctionRetTy::DefaultReturn(_) => match body.generator_kind {
|
||||
// In the case of the async block that we create for a function body,
|
||||
// we expect the return type of the block to match that of the enclosing
|
||||
// function.
|
||||
|
|
@ -696,7 +696,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
self.tcx.types.err
|
||||
});
|
||||
|
||||
if let hir::Return(ref output) = decl.output {
|
||||
if let hir::FunctionRetTy::Return(ref output) = decl.output {
|
||||
astconv.ast_ty_to_ty(&output);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,8 +52,6 @@
|
|||
|
||||
use crate::check::{FnCtxt, Needs};
|
||||
use errors::DiagnosticBuilder;
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use rustc::infer::{Coercion, InferOk, InferResult};
|
||||
use rustc::traits::{self, ObligationCause, ObligationCauseCode};
|
||||
|
|
@ -65,6 +63,8 @@ use rustc::ty::fold::TypeFoldable;
|
|||
use rustc::ty::relate::RelateResult;
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
use rustc::ty::{self, Ty, TypeAndMut};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_span;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use errors::{Applicability, DiagnosticId};
|
||||
use rustc::hir::def::{DefKind, Res};
|
||||
use rustc::hir::{self, GenericParamKind, ImplItemKind, TraitItemKind};
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::infer::{self, InferOk};
|
||||
use rustc::traits::{self, ObligationCause, ObligationCauseCode, Reveal};
|
||||
use rustc::ty::error::{ExpectedFound, TypeError};
|
||||
|
|
@ -8,7 +7,9 @@ use rustc::ty::subst::{InternalSubsts, Subst};
|
|||
use rustc::ty::util::ExplicitSelf;
|
||||
use rustc::ty::{self, GenericParamDefKind, TyCtxt};
|
||||
use rustc::util::common::ErrorReported;
|
||||
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::{GenericParamKind, ImplItemKind, TraitItemKind};
|
||||
use rustc_span::Span;
|
||||
use syntax::errors::pluralize;
|
||||
|
||||
|
|
@ -877,9 +878,9 @@ fn compare_synthetic_generics<'tcx>(
|
|||
_ => unreachable!(),
|
||||
};
|
||||
struct Visitor(Option<Span>, hir::def_id::DefId);
|
||||
impl<'v> hir::intravisit::Visitor<'v> for Visitor {
|
||||
impl<'v> intravisit::Visitor<'v> for Visitor {
|
||||
fn visit_ty(&mut self, ty: &'v hir::Ty<'v>) {
|
||||
hir::intravisit::walk_ty(self, ty);
|
||||
intravisit::walk_ty(self, ty);
|
||||
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) =
|
||||
ty.kind
|
||||
{
|
||||
|
|
@ -892,14 +893,14 @@ fn compare_synthetic_generics<'tcx>(
|
|||
}
|
||||
fn nested_visit_map<'this>(
|
||||
&'this mut self,
|
||||
) -> hir::intravisit::NestedVisitorMap<'this, 'v>
|
||||
) -> intravisit::NestedVisitorMap<'this, 'v>
|
||||
{
|
||||
hir::intravisit::NestedVisitorMap::None
|
||||
intravisit::NestedVisitorMap::None
|
||||
}
|
||||
}
|
||||
let mut visitor = Visitor(None, impl_def_id);
|
||||
for ty in input_tys {
|
||||
hir::intravisit::Visitor::visit_ty(&mut visitor, ty);
|
||||
intravisit::Visitor::visit_ty(&mut visitor, ty);
|
||||
}
|
||||
let span = visitor.0?;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@ use rustc::infer::InferOk;
|
|||
use rustc::traits::{self, ObligationCause};
|
||||
|
||||
use errors::{Applicability, DiagnosticBuilder};
|
||||
use rustc::hir::{self, is_range_literal, print, Node};
|
||||
use rustc::ty::adjustment::AllowTwoPhase;
|
||||
use rustc::ty::{self, AssocItem, Ty};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::{is_range_literal, print, Node};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Span;
|
||||
use syntax::util::parser::PREC_POSTFIX;
|
||||
|
|
|
|||
|
|
@ -17,10 +17,6 @@ use crate::check::TupleArgumentsFlag::DontTupleArguments;
|
|||
use crate::util::common::ErrorReported;
|
||||
|
||||
use errors::{pluralize, Applicability, DiagnosticBuilder, DiagnosticId};
|
||||
use rustc::hir;
|
||||
use rustc::hir::def::{CtorKind, DefKind, Res};
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::{ExprKind, QPath};
|
||||
use rustc::infer;
|
||||
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use rustc::middle::lang_items;
|
||||
|
|
@ -31,6 +27,10 @@ use rustc::ty::Ty;
|
|||
use rustc::ty::TypeFoldable;
|
||||
use rustc::ty::{AdtKind, Visibility};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorKind, DefKind, Res};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{ExprKind, QPath};
|
||||
use rustc_span::hygiene::DesugaringKind;
|
||||
use rustc_span::source_map::Span;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
|
|
@ -306,11 +306,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
) -> Ty<'tcx> {
|
||||
let tcx = self.tcx;
|
||||
let expected_inner = match unop {
|
||||
hir::UnNot | hir::UnNeg => expected,
|
||||
hir::UnDeref => NoExpectation,
|
||||
hir::UnOp::UnNot | hir::UnOp::UnNeg => expected,
|
||||
hir::UnOp::UnDeref => NoExpectation,
|
||||
};
|
||||
let needs = match unop {
|
||||
hir::UnDeref => needs,
|
||||
hir::UnOp::UnDeref => needs,
|
||||
_ => Needs::None,
|
||||
};
|
||||
let mut oprnd_t = self.check_expr_with_expectation_and_needs(&oprnd, expected_inner, needs);
|
||||
|
|
@ -318,7 +318,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
if !oprnd_t.references_error() {
|
||||
oprnd_t = self.structurally_resolved_type(expr.span, oprnd_t);
|
||||
match unop {
|
||||
hir::UnDeref => {
|
||||
hir::UnOp::UnDeref => {
|
||||
if let Some(mt) = oprnd_t.builtin_deref(true) {
|
||||
oprnd_t = mt.ty;
|
||||
} else if let Some(ok) = self.try_overloaded_deref(expr.span, oprnd_t, needs) {
|
||||
|
|
@ -362,14 +362,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
oprnd_t = tcx.types.err;
|
||||
}
|
||||
}
|
||||
hir::UnNot => {
|
||||
hir::UnOp::UnNot => {
|
||||
let result = self.check_user_unop(expr, oprnd_t, unop);
|
||||
// If it's builtin, we can reuse the type, this helps inference.
|
||||
if !(oprnd_t.is_integral() || oprnd_t.kind == ty::Bool) {
|
||||
oprnd_t = result;
|
||||
}
|
||||
}
|
||||
hir::UnNeg => {
|
||||
hir::UnOp::UnNeg => {
|
||||
let result = self.check_user_unop(expr, oprnd_t, unop);
|
||||
// If it's builtin, we can reuse the type, this helps inference.
|
||||
if !oprnd_t.is_numeric() {
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@
|
|||
//! types computed here.
|
||||
|
||||
use super::FnCtxt;
|
||||
use rustc::hir::def::{CtorKind, DefKind, Res};
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::{self, Expr, ExprKind, Pat, PatKind};
|
||||
use rustc::middle::region::{self, YieldData};
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorKind, DefKind, Res};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{Expr, ExprKind, Pat, PatKind};
|
||||
use rustc_span::Span;
|
||||
|
||||
struct InteriorVisitor<'a, 'tcx> {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use rustc::ty::{self, Ty, TyCtxt};
|
|||
use rustc_span::symbol::Symbol;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use rustc::hir;
|
||||
use rustc_hir as hir;
|
||||
|
||||
use rustc_error_codes::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use crate::astconv::AstConv;
|
|||
use crate::check::{callee, FnCtxt, Needs, PlaceOp};
|
||||
use crate::hir::def_id::DefId;
|
||||
use crate::hir::GenericArg;
|
||||
use rustc::hir;
|
||||
use rustc::infer::{self, InferOk};
|
||||
use rustc::traits;
|
||||
use rustc::ty::adjustment::{Adjust, Adjustment, OverloadedDeref, PointerCast};
|
||||
|
|
@ -12,6 +11,7 @@ use rustc::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
|
|||
use rustc::ty::fold::TypeFoldable;
|
||||
use rustc::ty::subst::{Subst, SubstsRef};
|
||||
use rustc::ty::{self, GenericParamDefKind, Ty};
|
||||
use rustc_hir as hir;
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::ops::Deref;
|
||||
|
|
@ -425,7 +425,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
|
|||
match exprs.last().unwrap().kind {
|
||||
hir::ExprKind::Field(ref expr, _)
|
||||
| hir::ExprKind::Index(ref expr, _)
|
||||
| hir::ExprKind::Unary(hir::UnDeref, ref expr) => exprs.push(&expr),
|
||||
| hir::ExprKind::Unary(hir::UnOp::UnDeref, ref expr) => exprs.push(&expr),
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
|
|
@ -471,7 +471,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
|
|||
&[index_expr_ty],
|
||||
);
|
||||
}
|
||||
hir::ExprKind::Unary(hir::UnDeref, ref base_expr) => {
|
||||
hir::ExprKind::Unary(hir::UnOp::UnDeref, ref base_expr) => {
|
||||
self.convert_place_op_to_mutable(PlaceOp::Deref, expr, base_expr, &[]);
|
||||
}
|
||||
_ => {}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,6 @@ pub use self::MethodError::*;
|
|||
use crate::check::FnCtxt;
|
||||
use crate::namespace::Namespace;
|
||||
use errors::{Applicability, DiagnosticBuilder};
|
||||
use rustc::hir;
|
||||
use rustc::hir::def::{CtorOf, DefKind};
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::infer::{self, InferOk};
|
||||
use rustc::traits;
|
||||
use rustc::ty::subst::Subst;
|
||||
|
|
@ -23,6 +20,9 @@ use rustc::ty::subst::{InternalSubsts, SubstsRef};
|
|||
use rustc::ty::GenericParamDefKind;
|
||||
use rustc::ty::{self, ToPolyTraitRef, ToPredicate, TraitRef, Ty, TypeFoldable};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorOf, DefKind};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_span::Span;
|
||||
use syntax::ast;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use crate::hir::def::DefKind;
|
|||
use crate::hir::def_id::DefId;
|
||||
use crate::namespace::Namespace;
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::infer::canonical::OriginalQueryValues;
|
||||
use rustc::infer::canonical::{Canonical, QueryResponse};
|
||||
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
|
|
@ -29,6 +28,7 @@ use rustc::ty::{
|
|||
};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_hir as hir;
|
||||
use rustc_span::{symbol::Symbol, Span, DUMMY_SP};
|
||||
use std::cmp::max;
|
||||
use std::iter;
|
||||
|
|
|
|||
|
|
@ -5,15 +5,17 @@ use crate::check::FnCtxt;
|
|||
use crate::middle::lang_items::FnOnceTraitLangItem;
|
||||
use crate::namespace::Namespace;
|
||||
use errors::{pluralize, Applicability, DiagnosticBuilder};
|
||||
use rustc::hir::def::{DefKind, Res};
|
||||
use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::hir::map as hir_map;
|
||||
use rustc::hir::{self, ExprKind, Node, QPath};
|
||||
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use rustc::traits::Obligation;
|
||||
use rustc::ty::print::with_crate_prefix;
|
||||
use rustc::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
|
||||
use rustc_hir::{ExprKind, Node, QPath};
|
||||
use rustc_span::{source_map, FileName, Span};
|
||||
use syntax::ast;
|
||||
use syntax::util::lev_distance;
|
||||
|
|
@ -1073,18 +1075,18 @@ impl UsePlacementFinder<'tcx> {
|
|||
target_module: hir::HirId,
|
||||
) -> (Option<Span>, bool) {
|
||||
let mut finder = UsePlacementFinder { target_module, span: None, found_use: false, tcx };
|
||||
hir::intravisit::walk_crate(&mut finder, krate);
|
||||
intravisit::walk_crate(&mut finder, krate);
|
||||
(finder.span, finder.found_use)
|
||||
}
|
||||
}
|
||||
|
||||
impl hir::intravisit::Visitor<'tcx> for UsePlacementFinder<'tcx> {
|
||||
impl intravisit::Visitor<'tcx> for UsePlacementFinder<'tcx> {
|
||||
fn visit_mod(&mut self, module: &'tcx hir::Mod<'tcx>, _: Span, hir_id: hir::HirId) {
|
||||
if self.span.is_some() {
|
||||
return;
|
||||
}
|
||||
if hir_id != self.target_module {
|
||||
hir::intravisit::walk_mod(self, module, hir_id);
|
||||
intravisit::walk_mod(self, module, hir_id);
|
||||
return;
|
||||
}
|
||||
// Find a `use` statement.
|
||||
|
|
@ -1124,8 +1126,8 @@ impl hir::intravisit::Visitor<'tcx> for UsePlacementFinder<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn nested_visit_map<'this>(&'this mut self) -> hir::intravisit::NestedVisitorMap<'this, 'tcx> {
|
||||
hir::intravisit::NestedVisitorMap::None
|
||||
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> {
|
||||
intravisit::NestedVisitorMap::None
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,11 +91,7 @@ use crate::astconv::{AstConv, PathSeg};
|
|||
use crate::middle::lang_items;
|
||||
use crate::namespace::Namespace;
|
||||
use errors::{pluralize, Applicability, DiagnosticBuilder, DiagnosticId};
|
||||
use rustc::hir::def::{CtorOf, DefKind, Res};
|
||||
use rustc::hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, LOCAL_CRATE};
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::hir::{self, ExprKind, GenericArg, HirIdMap, ItemKind, Node, PatKind, QPath};
|
||||
use rustc::infer::canonical::{Canonical, OriginalQueryValues, QueryResponse};
|
||||
use rustc::infer::error_reporting::TypeAnnotationNeeded::E0282;
|
||||
use rustc::infer::opaque_types::OpaqueTypeDecl;
|
||||
|
|
@ -118,6 +114,11 @@ use rustc::ty::{
|
|||
ToPredicate, Ty, TyCtxt, UserType,
|
||||
};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorOf, DefKind, Res};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, LOCAL_CRATE};
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_hir::{ExprKind, GenericArg, HirIdMap, ItemKind, Node, PatKind, QPath};
|
||||
use rustc_index::vec::Idx;
|
||||
use rustc_span::hygiene::DesugaringKind;
|
||||
use rustc_span::source_map::{original_sp, DUMMY_SP};
|
||||
|
|
@ -390,6 +391,7 @@ impl UnsafetyState {
|
|||
}
|
||||
|
||||
pub fn recurse(&mut self, blk: &hir::Block<'_>) -> UnsafetyState {
|
||||
use hir::BlockCheckMode;
|
||||
match self.unsafety {
|
||||
// If this unsafe, then if the outer function was already marked as
|
||||
// unsafe we shouldn't attribute the unsafe'ness to the block. This
|
||||
|
|
@ -399,16 +401,16 @@ impl UnsafetyState {
|
|||
|
||||
unsafety => {
|
||||
let (unsafety, def, count) = match blk.rules {
|
||||
hir::PushUnsafeBlock(..) => {
|
||||
BlockCheckMode::PushUnsafeBlock(..) => {
|
||||
(unsafety, blk.hir_id, self.unsafe_push_count.checked_add(1).unwrap())
|
||||
}
|
||||
hir::PopUnsafeBlock(..) => {
|
||||
BlockCheckMode::PopUnsafeBlock(..) => {
|
||||
(unsafety, blk.hir_id, self.unsafe_push_count.checked_sub(1).unwrap())
|
||||
}
|
||||
hir::UnsafeBlock(..) => {
|
||||
BlockCheckMode::UnsafeBlock(..) => {
|
||||
(hir::Unsafety::Unsafe, blk.hir_id, self.unsafe_push_count)
|
||||
}
|
||||
hir::DefaultBlock => (unsafety, self.def, self.unsafe_push_count),
|
||||
BlockCheckMode::DefaultBlock => (unsafety, self.def, self.unsafe_push_count),
|
||||
};
|
||||
UnsafetyState { def, unsafety, unsafe_push_count: count, from_fn: false }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
use super::method::MethodCallee;
|
||||
use super::{FnCtxt, Needs};
|
||||
use errors::{self, Applicability};
|
||||
use rustc::hir;
|
||||
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
|
||||
use rustc::ty::TyKind::{Adt, Array, Char, FnDef, Never, Ref, Str, Tuple, Uint};
|
||||
use rustc::ty::{self, Ty, TypeFoldable};
|
||||
use rustc_hir as hir;
|
||||
use rustc_span::Span;
|
||||
use syntax::ast::Ident;
|
||||
|
||||
|
|
@ -689,16 +689,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
),
|
||||
);
|
||||
match actual.kind {
|
||||
Uint(_) if op == hir::UnNeg => {
|
||||
Uint(_) if op == hir::UnOp::UnNeg => {
|
||||
err.note("unsigned values cannot be negated");
|
||||
}
|
||||
Str | Never | Char | Tuple(_) | Array(_, _) => {}
|
||||
Ref(_, ref lty, _) if lty.kind == Str => {}
|
||||
_ => {
|
||||
let missing_trait = match op {
|
||||
hir::UnNeg => "std::ops::Neg",
|
||||
hir::UnNot => "std::ops::Not",
|
||||
hir::UnDeref => "std::ops::UnDerf",
|
||||
hir::UnOp::UnNeg => "std::ops::Neg",
|
||||
hir::UnOp::UnNot => "std::ops::Not",
|
||||
hir::UnOp::UnDeref => "std::ops::UnDerf",
|
||||
};
|
||||
err.note(&format!(
|
||||
"an implementation of `{}` might \
|
||||
|
|
@ -771,9 +771,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
span_bug!(span, "&& and || are not overloadable")
|
||||
}
|
||||
}
|
||||
} else if let Op::Unary(hir::UnNot, _) = op {
|
||||
} else if let Op::Unary(hir::UnOp::UnNot, _) = op {
|
||||
("not", lang.not_trait())
|
||||
} else if let Op::Unary(hir::UnNeg, _) = op {
|
||||
} else if let Op::Unary(hir::UnOp::UnNeg, _) = op {
|
||||
("neg", lang.neg_trait())
|
||||
} else {
|
||||
bug!("lookup_op_method: op not supported: {:?}", op)
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
use crate::check::FnCtxt;
|
||||
use errors::{pluralize, Applicability, DiagnosticBuilder};
|
||||
use rustc::hir::def::{CtorKind, DefKind, Res};
|
||||
use rustc::hir::pat_util::EnumerateAndAdjustIterator;
|
||||
use rustc::hir::{self, HirId, Pat, PatKind};
|
||||
use rustc::infer;
|
||||
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use rustc::traits::Pattern;
|
||||
use rustc::ty::subst::GenericArg;
|
||||
use rustc::ty::{self, BindingMode, Ty, TypeFoldable};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorKind, DefKind, Res};
|
||||
use rustc_hir::pat_util::EnumerateAndAdjustIterator;
|
||||
use rustc_hir::{HirId, Pat, PatKind};
|
||||
use rustc_span::hygiene::DesugaringKind;
|
||||
use rustc_span::Span;
|
||||
use syntax::ast;
|
||||
|
|
|
|||
|
|
@ -76,15 +76,15 @@ use crate::check::dropck;
|
|||
use crate::check::FnCtxt;
|
||||
use crate::mem_categorization as mc;
|
||||
use crate::middle::region;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::infer::outlives::env::OutlivesEnvironment;
|
||||
use rustc::infer::{self, RegionObligation, SuppressRegionErrors};
|
||||
use rustc::ty::adjustment;
|
||||
use rustc::ty::subst::{GenericArgKind, SubstsRef};
|
||||
use rustc::ty::{self, Ty};
|
||||
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::{self, PatKind};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::PatKind;
|
||||
use rustc_span::Span;
|
||||
use std::mem;
|
||||
use std::ops::Deref;
|
||||
|
|
@ -492,7 +492,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionCtxt<'a, 'tcx> {
|
|||
if is_method_call {
|
||||
let origin = match expr.kind {
|
||||
hir::ExprKind::MethodCall(..) => infer::ParameterOrigin::MethodCall,
|
||||
hir::ExprKind::Unary(op, _) if op == hir::UnDeref => {
|
||||
hir::ExprKind::Unary(op, _) if op == hir::UnOp::UnDeref => {
|
||||
infer::ParameterOrigin::OverloadedDeref
|
||||
}
|
||||
_ => infer::ParameterOrigin::OverloadedOperator,
|
||||
|
|
@ -577,7 +577,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionCtxt<'a, 'tcx> {
|
|||
intravisit::walk_expr(self, expr);
|
||||
}
|
||||
|
||||
hir::ExprKind::Unary(hir::UnDeref, ref base) => {
|
||||
hir::ExprKind::Unary(hir::UnOp::UnDeref, ref base) => {
|
||||
// For *a, the lifetime of a must enclose the deref
|
||||
if is_method_call {
|
||||
self.constrain_call(expr, Some(base), None::<hir::Expr<'_>>.iter());
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ use super::FnCtxt;
|
|||
use crate::expr_use_visitor as euv;
|
||||
use crate::mem_categorization as mc;
|
||||
use crate::mem_categorization::PlaceBase;
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::def_id::LocalDefId;
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::infer::UpvarRegion;
|
||||
use rustc::ty::{self, Ty, TyCtxt, UpvarSubsts};
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_span::Span;
|
||||
use syntax::ast;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
use crate::check::{FnCtxt, Inherited};
|
||||
use crate::constrained_generic_params::{identify_constrained_generic_params, Parameter};
|
||||
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::ItemKind;
|
||||
use rustc::infer::opaque_types::may_define_opaque_type;
|
||||
use rustc::middle::lang_items;
|
||||
use rustc::traits::{self, ObligationCause, ObligationCauseCode};
|
||||
use rustc::ty::subst::{InternalSubsts, Subst};
|
||||
use rustc::ty::{self, AdtKind, GenericParamDefKind, ToPredicate, Ty, TyCtxt, TypeFoldable};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::ItemKind;
|
||||
|
||||
use errors::DiagnosticBuilder;
|
||||
use rustc_span::symbol::sym;
|
||||
|
|
@ -16,8 +16,8 @@ use rustc_span::Span;
|
|||
use syntax::ast;
|
||||
use syntax::feature_gate;
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::itemlikevisit::ParItemLikeVisitor;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::itemlikevisit::ParItemLikeVisitor;
|
||||
|
||||
use rustc_error_codes::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
use crate::check::FnCtxt;
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::{DefId, DefIdSet, DefIndex};
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::infer::error_reporting::TypeAnnotationNeeded::E0282;
|
||||
use rustc::infer::InferCtxt;
|
||||
|
|
@ -13,6 +11,8 @@ use rustc::ty::adjustment::{Adjust, Adjustment, PointerCast};
|
|||
use rustc::ty::fold::{TypeFoldable, TypeFolder};
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, DefIdSet, DefIndex};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Span;
|
||||
|
||||
|
|
@ -133,8 +133,8 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
|||
// operating on scalars, we clear the overload.
|
||||
fn fix_scalar_builtin_expr(&mut self, e: &hir::Expr<'_>) {
|
||||
match e.kind {
|
||||
hir::ExprKind::Unary(hir::UnNeg, ref inner)
|
||||
| hir::ExprKind::Unary(hir::UnNot, ref inner) => {
|
||||
hir::ExprKind::Unary(hir::UnOp::UnNeg, ref inner)
|
||||
| hir::ExprKind::Unary(hir::UnOp::UnNot, ref inner) => {
|
||||
let inner_ty = self.fcx.node_ty(inner.hir_id);
|
||||
let inner_ty = self.fcx.resolve_vars_if_possible(&inner_ty);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ use errors::Applicability;
|
|||
use rustc_span::Span;
|
||||
use syntax::ast;
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::{DefId, DefIdSet, LOCAL_CRATE};
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::hir::print::visibility_qualified;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, DefIdSet, LOCAL_CRATE};
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_hir::print::visibility_qualified;
|
||||
|
||||
pub fn check_crate(tcx: TyCtxt<'_>) {
|
||||
let mut used_trait_imports = DefIdSet::default();
|
||||
|
|
|
|||
|
|
@ -13,8 +13,9 @@ use rustc::ty::util::CopyImplementationError;
|
|||
use rustc::ty::TypeFoldable;
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::{self, ItemKind};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::ItemKind;
|
||||
|
||||
use rustc_error_codes::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
//! `tcx.inherent_impls(def_id)`). That value, however,
|
||||
//! is computed by selecting an idea from this table.
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::ty::{self, CrateInherentImpls, TyCtxt};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
|
||||
use rustc_span::Span;
|
||||
use syntax::ast;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use crate::namespace::Namespace;
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::traits::{self, IntercrateMode};
|
||||
use rustc::ty::TyCtxt;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
|
||||
use rustc_error_codes::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Orphan checker: every impl either implements a trait defined in this
|
||||
//! crate or pertains to a type defined in this crate.
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::traits;
|
||||
use rustc::ty::{self, TyCtxt};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
|
||||
use rustc_error_codes::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
//! Unsafety checker: every impl either implements a trait defined in this
|
||||
//! crate or pertains to a type defined in this crate.
|
||||
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::hir::{self, Unsafety};
|
||||
use rustc::ty::TyCtxt;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_hir::Unsafety;
|
||||
|
||||
use rustc_error_codes::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ use crate::constrained_generic_params as cgp;
|
|||
use crate::lint;
|
||||
use crate::middle::resolve_lifetime as rl;
|
||||
use crate::middle::weak_lang_items;
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
|
||||
use rustc::mir::mono::Linkage;
|
||||
use rustc::ty::query::Providers;
|
||||
|
|
@ -31,22 +32,18 @@ use rustc::ty::{self, AdtKind, Const, DefIdTree, ToPolyTraitRef, Ty, TyCtxt};
|
|||
use rustc::ty::{ReprOptions, ToPredicate};
|
||||
use rustc::util::captures::Captures;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_target::spec::abi;
|
||||
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorKind, DefKind, Res};
|
||||
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_hir::{GenericParamKind, Node, Unsafety};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_target::spec::abi;
|
||||
use syntax::ast;
|
||||
use syntax::ast::{Ident, MetaItemKind};
|
||||
use syntax::attr::{list_contains_name, mark_used, InlineAttr, OptimizeAttr};
|
||||
use syntax::feature_gate;
|
||||
|
||||
use rustc::hir::def::{CtorKind, DefKind, Res};
|
||||
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::GenericParamKind;
|
||||
use rustc::hir::Node;
|
||||
use rustc::hir::{self, Unsafety};
|
||||
|
||||
use errors::{Applicability, StashKey};
|
||||
|
||||
use rustc_error_codes::*;
|
||||
|
|
@ -114,7 +111,7 @@ impl<'v> Visitor<'v> for PlaceholderHirTyCollector {
|
|||
if let hir::TyKind::Infer = t.kind {
|
||||
self.0.push(t.span);
|
||||
}
|
||||
hir::intravisit::walk_ty(self, t)
|
||||
intravisit::walk_ty(self, t)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -353,7 +350,7 @@ fn type_param_predicates(
|
|||
tcx: TyCtxt<'_>,
|
||||
(item_def_id, def_id): (DefId, DefId),
|
||||
) -> ty::GenericPredicates<'_> {
|
||||
use rustc::hir::*;
|
||||
use rustc_hir::*;
|
||||
|
||||
// In the AST, bounds can derive from two places. Either
|
||||
// written inline like `<T: Foo>` or in a where-clause like
|
||||
|
|
@ -712,7 +709,7 @@ fn convert_variant(
|
|||
}
|
||||
|
||||
fn adt_def(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::AdtDef {
|
||||
use rustc::hir::*;
|
||||
use rustc_hir::*;
|
||||
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
let item = match tcx.hir().get(hir_id) {
|
||||
|
|
@ -992,7 +989,7 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
|
|||
}
|
||||
|
||||
fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
|
||||
use rustc::hir::*;
|
||||
use rustc_hir::*;
|
||||
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
|
||||
|
|
@ -1260,7 +1257,7 @@ fn infer_placeholder_type(
|
|||
}
|
||||
|
||||
fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||
use rustc::hir::*;
|
||||
use rustc_hir::*;
|
||||
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
|
||||
|
|
@ -1562,7 +1559,7 @@ fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
|||
}
|
||||
|
||||
fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||
use rustc::hir::{ImplItem, Item, TraitItem};
|
||||
use rustc_hir::{ImplItem, Item, TraitItem};
|
||||
|
||||
debug!("find_opaque_ty_constraints({:?})", def_id);
|
||||
|
||||
|
|
@ -1811,8 +1808,8 @@ pub fn get_infer_ret_ty(output: &'hir hir::FunctionRetTy<'hir>) -> Option<&'hir
|
|||
}
|
||||
|
||||
fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> {
|
||||
use rustc::hir::Node::*;
|
||||
use rustc::hir::*;
|
||||
use rustc_hir::Node::*;
|
||||
use rustc_hir::*;
|
||||
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
|
||||
|
|
@ -2029,8 +2026,8 @@ fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> {
|
|||
/// Returns a list of user-specified type predicates for the definition with ID `def_id`.
|
||||
/// N.B., this does not include any implied/inferred constraints.
|
||||
fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> {
|
||||
use rustc::hir::*;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir::*;
|
||||
|
||||
debug!("explicit_predicates_of(def_id={:?})", def_id);
|
||||
|
||||
|
|
@ -2499,7 +2496,7 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
|
|||
for (input, ty) in decl.inputs.iter().zip(*fty.inputs().skip_binder()) {
|
||||
check(&input, ty)
|
||||
}
|
||||
if let hir::Return(ref ty) = decl.output {
|
||||
if let hir::FunctionRetTy::Return(ref ty) = decl.output {
|
||||
check(&ty, *fty.output().skip_binder())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,12 @@ use self::OverloadedCallType::*;
|
|||
// Export these here so that Clippy can use them.
|
||||
pub use mc::{Place, PlaceBase, Projection};
|
||||
|
||||
use rustc::hir::def::Res;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::{self, PatKind};
|
||||
use rustc::infer::InferCtxt;
|
||||
use rustc::ty::{self, adjustment, TyCtxt};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::PatKind;
|
||||
|
||||
use crate::mem_categorization as mc;
|
||||
use rustc_span::Span;
|
||||
|
|
@ -192,7 +193,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
|
|||
|
||||
hir::ExprKind::Type(ref subexpr, _) => self.walk_expr(subexpr),
|
||||
|
||||
hir::ExprKind::Unary(hir::UnDeref, ref base) => {
|
||||
hir::ExprKind::Unary(hir::UnOp::UnDeref, ref base) => {
|
||||
// *base
|
||||
self.select_from_expr(base);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@
|
|||
//! fixed, but for the moment it's easier to do these checks early.
|
||||
|
||||
use crate::constrained_generic_params as cgp;
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::{self, TyCtxt, TypeFoldable};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||
|
||||
use rustc_span::Span;
|
||||
|
|
|
|||
|
|
@ -93,8 +93,6 @@ mod outlives;
|
|||
mod structured_errors;
|
||||
mod variance;
|
||||
|
||||
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc::hir::{self, Node};
|
||||
use rustc::infer::InferOk;
|
||||
use rustc::lint;
|
||||
use rustc::middle;
|
||||
|
|
@ -106,6 +104,9 @@ use rustc::ty::subst::SubstsRef;
|
|||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::util;
|
||||
use rustc::util::common::ErrorReported;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_hir::Node;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
|
|
|
|||
|
|
@ -48,18 +48,16 @@
|
|||
//! result of `*x'`, effectively, where `x'` is a `Categorization::Upvar` reference
|
||||
//! tied to `x`. The type of `x'` will be a borrowed pointer.
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::def::{DefKind, Res};
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::PatKind;
|
||||
use rustc::infer::InferCtxt;
|
||||
use rustc::ty::adjustment;
|
||||
use rustc::ty::fold::TypeFoldable;
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
|
||||
use rustc_span::Span;
|
||||
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::PatKind;
|
||||
use rustc_span::Span;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum PlaceBase {
|
||||
|
|
@ -347,7 +345,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
|||
|
||||
let expr_ty = self.expr_ty(expr)?;
|
||||
match expr.kind {
|
||||
hir::ExprKind::Unary(hir::UnDeref, ref e_base) => {
|
||||
hir::ExprKind::Unary(hir::UnOp::UnDeref, ref e_base) => {
|
||||
if self.tables.is_method_call(expr) {
|
||||
self.cat_overloaded_place(expr, e_base)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use rustc::hir;
|
||||
use rustc::ty;
|
||||
use rustc_hir as hir;
|
||||
|
||||
// Whether an item exists in the type or value namespace.
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use rustc::hir::def_id::DefId;
|
||||
use rustc::ty::{self, OutlivesPredicate, TyCtxt};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
||||
use super::utils::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::hir::{self, Node};
|
||||
use rustc::ty::subst::{GenericArg, GenericArgKind, Subst};
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_hir::Node;
|
||||
use rustc_span::Span;
|
||||
|
||||
use super::explicit::ExplicitPredicatesMap;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use hir::Node;
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::subst::GenericArgKind;
|
||||
use rustc::ty::{self, CratePredicatesMap, TyCtxt};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Span;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use rustc::hir;
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::ty::TyCtxt;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
use rustc_error_codes::*;
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
//! We walk the set of items and, for each member, generate new constraints.
|
||||
|
||||
use hir::def_id::DefId;
|
||||
use rustc::hir;
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::ty::subst::{GenericArgKind, SubstsRef};
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
|
||||
use super::terms::VarianceTerm::*;
|
||||
use super::terms::*;
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
use arena;
|
||||
use hir::Node;
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::{self, CrateVariancesMap, TyCtxt};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||
|
||||
/// Defines the `TermsContext` basically houses an arena where we can
|
||||
/// allocate terms.
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
//! optimal solution to the constraints. The final variance for each
|
||||
//! inferred is then written into the `variance_map` in the tcx.
|
||||
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::ty;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
||||
use super::constraints::*;
|
||||
use super::terms::VarianceTerm::*;
|
||||
|
|
|
|||
|
|
@ -10,9 +10,10 @@
|
|||
// a variable.
|
||||
|
||||
use arena::TypedArena;
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::hir::{self, HirIdMap};
|
||||
use rustc::ty::{self, TyCtxt};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_hir::HirIdMap;
|
||||
use std::fmt;
|
||||
|
||||
use self::VarianceTerm::*;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use rustc::hir;
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::ty::TyCtxt;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
use rustc_error_codes::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue