Change:
One example is the method on . Internally it creates a , when it could simply be taking exactly that as an argument. In miri I had to write which just feels a little riddiculous (taking apart the , just to have the method construct it back). There's probably many other similar methods and functions that should be taking a
Can I take this one if no one is working on that ?
it's all yours!

Discussion:
} let pointee = tcx.normalize_associated_type_in_env(&pointee, param_env); <del> if pointee.is_sized(tcx, param_env, DUMMY_SP) { </del> <ins> if pointee.is_sized(tcx.at(DUMMY_SP), param_env) { </ins> return Ok(tcx.intern_layout(LayoutDetails::scalar(self, data_ptr))); }

let param_env = tcx.param_env(def.did); let last_field = def.variants[v].fields.last().unwrap(); let always_sized = tcx.type_of(last_field.did) <del> .is_sized(tcx, param_env, DUMMY_SP); </del> <ins> .is_sized(tcx.at(DUMMY_SP), param_env); </ins> if !always_sized { StructKind::MaybeUnsized } else { StructKind::AlwaysSized } };

use ty::{self, Ty, TyCtxt, TypeFoldable}; use ty::fold::TypeVisitor; use ty::subst::{Subst, UnpackedKind}; <ins> use ty::maps::TyCtxtAt; </ins> use ty::TypeVariants::*; use util::common::ErrorReported; use middle::lang_items;

} pub fn is_sized(&'tcx self, <del> tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, span: Span)-> bool </del> <ins> tcx_at: TyCtxtAt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>)-> bool </ins> { <del> tcx.at(span).is_sized_raw(param_env.and(self)) </del> <ins> tcx_at.is_sized_raw(param_env.and(self)) </ins> } pub fn is_freeze(&'tcx self,

// shouldn't affect `is_sized`. let gcx = self.tcx().global_tcx(); let erased_ty = gcx.lift(&self.tcx().erase_regions(&ty)).unwrap(); <del> if !erased_ty.is_sized(gcx, self.param_env, span) { </del> <ins> if !erased_ty.is_sized(gcx.at(span), self.param_env) { </ins> // in current MIR construction, all non-control-flow rvalue // expressions evaluate through `as_temp` or `into` a return // slot or local, so to find all unsized rvalues it is enough

} pub(super) fn type_is_sized(&self, ty: Ty<'tcx>) -> bool { <del> ty.is_sized(self.tcx, self.param_env, DUMMY_SP) </del> <ins> ty.is_sized(self.tcx.at(DUMMY_SP), self.param_env) </ins> } pub fn load_mir(

let ptr_vtable = |inner_source: Ty<'tcx>, inner_target: Ty<'tcx>| { let type_has_metadata = |ty: Ty<'tcx>| -> bool { use syntax_pos::DUMMY_SP; <del> if ty.is_sized(tcx, ty::ParamEnv::empty(traits::Reveal::All), DUMMY_SP) { </del> <ins> if ty.is_sized(tcx.at(DUMMY_SP), ty::ParamEnv::empty(traits::Reveal::All)) { </ins> return false; } let tail = tcx.struct_tail(ty);

} pub fn type_is_sized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool { <del> ty.is_sized(tcx, ty::ParamEnv::empty(traits::Reveal::All), DUMMY_SP) </del> <ins> ty.is_sized(tcx.at(DUMMY_SP), ty::ParamEnv::empty(traits::Reveal::All)) </ins> } pub fn type_is_freeze<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {

pub fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool { use syntax_pos::DUMMY_SP; <del> if ty.is_sized(self.tcx, ty::ParamEnv::empty(traits::Reveal::All), DUMMY_SP) { </del> <ins> if ty.is_sized(self.tcx.at(DUMMY_SP), ty::ParamEnv::empty(traits::Reveal::All)) { </ins> return false; }