Accept TyCtxt
instead of TyCtxtAt
in Ty::is_*
functions
Functions in answer: - `Ty::is_freeze` - `Ty::is_sized` - `Ty::is_unpin` - `Ty::is_copy_modulo_regions`
This commit is contained in:
parent
44fcfb0a96
commit
a17ccfa621
29 changed files with 51 additions and 69 deletions
|
@ -312,7 +312,7 @@ impl<'tcx> UnsafetyChecker<'_, 'tcx> {
|
|||
} else if !place
|
||||
.ty(self.body, self.tcx)
|
||||
.ty
|
||||
.is_freeze(self.tcx.at(self.source_info.span), self.param_env)
|
||||
.is_freeze(self.tcx, self.param_env)
|
||||
{
|
||||
UnsafetyViolationDetails::BorrowOfLayoutConstrainedField
|
||||
} else {
|
||||
|
|
|
@ -633,7 +633,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
|||
}
|
||||
if !rvalue
|
||||
.ty(&self.ecx.frame().body.local_decls, *self.ecx.tcx)
|
||||
.is_sized(self.ecx.tcx, self.param_env)
|
||||
.is_sized(*self.ecx.tcx, self.param_env)
|
||||
{
|
||||
// the interpreter doesn't support unsized locals (only unsized arguments),
|
||||
// but rustc does (in a kinda broken way), so we have to skip them here
|
||||
|
|
|
@ -500,7 +500,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
|||
}
|
||||
if !rvalue
|
||||
.ty(&self.ecx.frame().body.local_decls, *self.ecx.tcx)
|
||||
.is_sized(self.ecx.tcx, self.param_env)
|
||||
.is_sized(*self.ecx.tcx, self.param_env)
|
||||
{
|
||||
// the interpreter doesn't support unsized locals (only unsized arguments),
|
||||
// but rustc does (in a kinda broken way), so we have to skip them here
|
||||
|
|
|
@ -11,7 +11,6 @@ use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
|
|||
use rustc_middle::mir::{Body, Local, Location, Operand, Terminator, TerminatorKind, RETURN_PLACE};
|
||||
use rustc_middle::ty::{self, DeducedParamAttrs, ParamEnv, Ty, TyCtxt};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::DUMMY_SP;
|
||||
|
||||
/// A visitor that determines which arguments have been mutated. We can't use the mutability field
|
||||
/// on LocalDecl for this because it has no meaning post-optimization.
|
||||
|
@ -232,7 +231,7 @@ pub fn deduced_param_attrs<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx [Ded
|
|||
body.local_decls.iter().skip(1).take(body.arg_count).enumerate().map(
|
||||
|(arg_index, local_decl)| DeducedParamAttrs {
|
||||
read_only: !deduce_read_only.mutable_args.contains(arg_index)
|
||||
&& local_decl.ty.is_freeze(tcx.at(DUMMY_SP), ParamEnv::reveal_all()),
|
||||
&& local_decl.ty.is_freeze(tcx, ParamEnv::reveal_all()),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
|
@ -312,7 +312,7 @@ fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -
|
|||
let param_env = tcx.param_env(def_id);
|
||||
|
||||
let mut builder = CloneShimBuilder::new(tcx, def_id, self_ty);
|
||||
let is_copy = self_ty.is_copy_modulo_regions(tcx.at(builder.span), param_env);
|
||||
let is_copy = self_ty.is_copy_modulo_regions(tcx, param_env);
|
||||
|
||||
let dest = Place::return_place();
|
||||
let src = tcx.mk_place_deref(Place::from(Local::new(1 + 0)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue