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:
@@ -8,7 +8,6 @@ use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::ty::{self, subst::SubstsRef, AdtDef, Ty};
|
||||
use rustc_span::DUMMY_SP;
|
||||
use rustc_trait_selection::traits::{
|
||||
self, ImplSource, Obligation, ObligationCause, SelectionContext,
|
||||
};
|
||||
@@ -92,7 +91,7 @@ impl Qualif for HasMutInterior {
|
||||
}
|
||||
|
||||
fn in_any_value_of_ty<'tcx>(cx: &ConstCx<'_, 'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
!ty.is_freeze(cx.tcx.at(DUMMY_SP), cx.param_env)
|
||||
!ty.is_freeze(cx.tcx, cx.param_env)
|
||||
}
|
||||
|
||||
fn in_adt_inherently<'tcx>(
|
||||
|
||||
@@ -8,7 +8,6 @@ use rustc_middle::mir::{self, BasicBlock, Local, Location, Statement, StatementK
|
||||
use rustc_mir_dataflow::fmt::DebugWithContext;
|
||||
use rustc_mir_dataflow::JoinSemiLattice;
|
||||
use rustc_mir_dataflow::{Analysis, AnalysisDomain, CallReturnPlaces};
|
||||
use rustc_span::DUMMY_SP;
|
||||
|
||||
use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
@@ -120,10 +119,7 @@ where
|
||||
///
|
||||
/// [rust-lang/unsafe-code-guidelines#134]: https://github.com/rust-lang/unsafe-code-guidelines/issues/134
|
||||
fn shared_borrow_allows_mutation(&self, place: mir::Place<'tcx>) -> bool {
|
||||
!place
|
||||
.ty(self.ccx.body, self.ccx.tcx)
|
||||
.ty
|
||||
.is_freeze(self.ccx.tcx.at(DUMMY_SP), self.ccx.param_env)
|
||||
!place.ty(self.ccx.body, self.ccx.tcx).ty.is_freeze(self.ccx.tcx, self.ccx.param_env)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -235,9 +235,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
|
||||
// `Operand::Copy` is only supposed to be used with `Copy` types.
|
||||
if let Operand::Copy(place) = operand {
|
||||
let ty = place.ty(&self.body.local_decls, self.tcx).ty;
|
||||
let span = self.body.source_info(location).span;
|
||||
|
||||
if !ty.is_copy_modulo_regions(self.tcx.at(span), self.param_env) {
|
||||
if !ty.is_copy_modulo_regions(self.tcx, self.param_env) {
|
||||
self.fail(location, format!("`Operand::Copy` with non-`Copy` type {}", ty));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user