Finish rustup.
This commit is contained in:
@@ -9,7 +9,6 @@ use rustc::traits::Reveal;
|
||||
use rustc::traits;
|
||||
use rustc::ty::subst::{Subst, Substs};
|
||||
use rustc::ty;
|
||||
use rustc::ty::layout::TargetDataLayout;
|
||||
use rustc::mir::transform::MirSource;
|
||||
use rustc_errors;
|
||||
use std::borrow::Cow;
|
||||
@@ -317,13 +316,15 @@ pub fn implements_trait<'a, 'tcx>(
|
||||
parent_node_id: Option<NodeId>
|
||||
) -> bool {
|
||||
let ty = cx.tcx.erase_regions(&ty);
|
||||
let mut b = if let Some(id) = parent_node_id {
|
||||
cx.tcx.infer_ctxt(BodyId { node_id: id })
|
||||
let param_env = if let Some(id) = parent_node_id {
|
||||
let def_id = cx.tcx.hir.body_owner_def_id(BodyId { node_id: id });
|
||||
cx.tcx.param_env(def_id).reveal_all()
|
||||
} else {
|
||||
cx.tcx.infer_ctxt(())
|
||||
ty::ParamEnv::empty(Reveal::All)
|
||||
};
|
||||
b.enter(|infcx| {
|
||||
let obligation = cx.tcx.predicate_for_trait_def(traits::ObligationCause::dummy(), trait_id, 0, ty, ty_params);
|
||||
cx.tcx.infer_ctxt(()).enter(|infcx| {
|
||||
let obligation = cx.tcx.predicate_for_trait_def(
|
||||
param_env, traits::ObligationCause::dummy(), trait_id, 0, ty, ty_params);
|
||||
|
||||
traits::SelectionContext::new(&infcx).evaluate_obligation_conservatively(&obligation)
|
||||
})
|
||||
@@ -778,12 +779,9 @@ pub fn same_tys<'a, 'tcx>(
|
||||
b: ty::Ty<'tcx>,
|
||||
parameter_item: DefId
|
||||
) -> bool {
|
||||
let parameter_env = cx.tcx.param_env(parameter_item);
|
||||
cx.tcx.infer_ctxt(parameter_env).enter(|infcx| {
|
||||
let substs = Substs::identity_for_item(cx.tcx, parameter_item);
|
||||
let new_a = a.subst(infcx.tcx, substs);
|
||||
let new_b = b.subst(infcx.tcx, substs);
|
||||
infcx.can_equate(&new_a, &new_b).is_ok()
|
||||
let param_env = cx.tcx.param_env(parameter_item).reveal_all();
|
||||
cx.tcx.infer_ctxt(()).enter(|infcx| {
|
||||
infcx.can_eq(param_env, a, b).is_ok()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -961,7 +959,6 @@ pub fn is_try(expr: &Expr) -> Option<&Expr> {
|
||||
}
|
||||
|
||||
pub fn type_size<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: ty::Ty<'tcx>) -> Option<u64> {
|
||||
cx.tcx
|
||||
.infer_ctxt(())
|
||||
.enter(|infcx| ty.layout(&infcx).ok().map(|lay| lay.size(&TargetDataLayout::parse(cx.sess())).bytes()))
|
||||
ty.layout(cx.tcx, ty::ParamEnv::empty(Reveal::All))
|
||||
.ok().map(|layout| layout.size(cx.tcx).bytes())
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ pub const BOX_NEW: [&'static str; 4] = ["std", "boxed", "Box", "new"];
|
||||
pub const BTREEMAP: [&'static str; 4] = ["collections", "btree", "map", "BTreeMap"];
|
||||
pub const BTREEMAP_ENTRY: [&'static str; 4] = ["collections", "btree", "map", "Entry"];
|
||||
pub const BTREESET: [&'static str; 4] = ["collections", "btree", "set", "BTreeSet"];
|
||||
pub const CARRIER_TRANSLATE: [&'static str; 4] = ["std", "ops", "Carrier", "translate"];
|
||||
pub const CLONE: [&'static str; 4] = ["core", "clone", "Clone", "clone"];
|
||||
pub const CLONE_TRAIT: [&'static str; 3] = ["core", "clone", "Clone"];
|
||||
pub const CMP_MAX: [&'static str; 3] = ["core", "cmp", "max"];
|
||||
@@ -72,6 +71,7 @@ pub const STRING: [&'static str; 3] = ["collections", "string", "String"];
|
||||
pub const TO_OWNED: [&'static str; 3] = ["collections", "borrow", "ToOwned"];
|
||||
pub const TO_STRING: [&'static str; 3] = ["collections", "string", "ToString"];
|
||||
pub const TRANSMUTE: [&'static str; 4] = ["core", "intrinsics", "", "transmute"];
|
||||
pub const TRY_INTO_RESULT: [&'static str; 4] = ["std", "ops", "Try", "into_result"];
|
||||
pub const VEC: [&'static str; 3] = ["collections", "vec", "Vec"];
|
||||
pub const VEC_DEQUE: [&'static str; 3] = ["collections", "vec_deque", "VecDeque"];
|
||||
pub const VEC_FROM_ELEM: [&'static str; 3] = ["collections", "vec", "from_elem"];
|
||||
|
||||
Reference in New Issue
Block a user