diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-05-11 15:05:00 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-05-13 17:42:59 +0300 |
| commit | 2da080e779b4e6f4359c031824c3bdcedad452fd (patch) | |
| tree | 891c3e4d560110edf05dbace4c47d767b13aa06e /src/librustc_mir | |
| parent | dbae169ac16de632d21fd3394bc8a939b2524512 (diff) | |
rustc: treat ReEarlyBound as free without replacing it with ReFree.
Diffstat (limited to 'src/librustc_mir')
| -rw-r--r-- | src/librustc_mir/shim.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 587cc27f4b8..6f4480bf6dd 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -15,7 +15,7 @@ use rustc::middle::const_val::ConstVal; use rustc::mir::*; use rustc::mir::transform::MirSource; use rustc::ty::{self, Ty}; -use rustc::ty::subst::{Kind, Subst}; +use rustc::ty::subst::{Kind, Subst, Substs}; use rustc::ty::maps::Providers; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; @@ -65,7 +65,6 @@ fn make_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, build_call_shim( tcx, - ¶m_env, def_id, adjustment, CallKind::Indirect, @@ -77,7 +76,6 @@ fn make_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, // trans::mir knows to turn to an actual virtual call. build_call_shim( tcx, - ¶m_env, def_id, Adjustment::Identity, CallKind::Direct(def_id), @@ -93,7 +91,6 @@ fn make_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, build_call_shim( tcx, - ¶m_env, call_once, Adjustment::RefMut, CallKind::Direct(call_mut), @@ -157,7 +154,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, let substs = if let Some(ty) = ty { tcx.mk_substs(iter::once(Kind::from(ty))) } else { - param_env.free_substs + Substs::identity_for_item(tcx, def_id) }; let fn_ty = tcx.type_of(def_id).subst(tcx, substs); let sig = tcx.erase_late_bound_regions(&fn_ty.fn_sig()); @@ -271,7 +268,6 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { /// If `untuple_args` is a vec of types, the second argument of the /// function will be untupled as these types. fn build_call_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, - param_env: &ty::ParameterEnvironment<'tcx>, def_id: DefId, rcvr_adjustment: Adjustment, call_kind: CallKind, @@ -282,7 +278,7 @@ fn build_call_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, call_kind={:?}, untuple_args={:?})", def_id, rcvr_adjustment, call_kind, untuple_args); - let fn_ty = tcx.type_of(def_id).subst(tcx, param_env.free_substs); + let fn_ty = tcx.type_of(def_id); let sig = tcx.erase_late_bound_regions(&fn_ty.fn_sig()); let span = tcx.def_span(def_id); @@ -324,9 +320,10 @@ fn build_call_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, CallKind::Direct(def_id) => ( Operand::Constant(box Constant { span: span, - ty: tcx.type_of(def_id).subst(tcx, param_env.free_substs), + ty: tcx.type_of(def_id), literal: Literal::Value { - value: ConstVal::Function(def_id, param_env.free_substs), + value: ConstVal::Function(def_id, + Substs::identity_for_item(tcx, def_id)), }, }), vec![rcvr] |
