Skip to content

Commit a17ccfa

Browse files
committed
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`
1 parent 44fcfb0 commit a17ccfa

File tree

29 files changed

+51
-69
lines changed

29 files changed

+51
-69
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
17761776
// `Sized` bound in no way depends on precise regions, so this
17771777
// shouldn't affect `is_sized`.
17781778
let erased_ty = tcx.erase_regions(ty);
1779-
if !erased_ty.is_sized(tcx.at(span), self.param_env) {
1779+
if !erased_ty.is_sized(tcx, self.param_env) {
17801780
// in current MIR construction, all non-control-flow rvalue
17811781
// expressions evaluate through `as_temp` or `into` a return
17821782
// slot or local, so to find all unsized rvalues it is enough

compiler/rustc_codegen_ssa/src/traits/type_.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::common::TypeKind;
55
use crate::mir::place::PlaceRef;
66
use rustc_middle::ty::layout::TyAndLayout;
77
use rustc_middle::ty::{self, Ty};
8-
use rustc_span::DUMMY_SP;
98
use rustc_target::abi::call::{ArgAbi, CastTarget, FnAbi, Reg};
109
use rustc_target::abi::{AddressSpace, Integer};
1110

@@ -75,16 +74,16 @@ pub trait DerivedTypeMethods<'tcx>: BaseTypeMethods<'tcx> + MiscMethods<'tcx> {
7574
}
7675

7776
fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
78-
ty.is_sized(self.tcx().at(DUMMY_SP), ty::ParamEnv::reveal_all())
77+
ty.is_sized(self.tcx(), ty::ParamEnv::reveal_all())
7978
}
8079

8180
fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
82-
ty.is_freeze(self.tcx().at(DUMMY_SP), ty::ParamEnv::reveal_all())
81+
ty.is_freeze(self.tcx(), ty::ParamEnv::reveal_all())
8382
}
8483

8584
fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {
8685
let param_env = ty::ParamEnv::reveal_all();
87-
if ty.is_sized(self.tcx().at(DUMMY_SP), param_env) {
86+
if ty.is_sized(self.tcx(), param_env) {
8887
return false;
8988
}
9089

compiler/rustc_const_eval/src/const_eval/valtrees.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ fn create_pointee_place<'tcx>(
212212
) -> MPlaceTy<'tcx> {
213213
let tcx = ecx.tcx.tcx;
214214

215-
if !ty.is_sized(ecx.tcx, ty::ParamEnv::empty()) {
215+
if !ty.is_sized(*ecx.tcx, ty::ParamEnv::empty()) {
216216
// We need to create `Allocation`s for custom DSTs
217217

218218
let (unsized_inner_ty, num_elems) = get_info_on_unsized_field(ty, valtree, tcx);
@@ -398,7 +398,7 @@ fn valtree_into_mplace<'tcx>(
398398

399399
let mut place_inner = match ty.kind() {
400400
ty::Str | ty::Slice(_) => ecx.mplace_index(&place, i as u64).unwrap(),
401-
_ if !ty.is_sized(ecx.tcx, ty::ParamEnv::empty())
401+
_ if !ty.is_sized(*ecx.tcx, ty::ParamEnv::empty())
402402
&& i == branches.len() - 1 =>
403403
{
404404
// Note: For custom DSTs we need to manually process the last unsized field.

compiler/rustc_const_eval/src/interpret/eval_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
468468

469469
#[inline]
470470
pub fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
471-
ty.is_freeze(self.tcx, self.param_env)
471+
ty.is_freeze(*self.tcx, self.param_env)
472472
}
473473

474474
pub fn load_mir(

compiler/rustc_const_eval/src/interpret/intern.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fn intern_shallow<'rt, 'mir, 'tcx, M: CompileTimeMachine<'mir, 'tcx, const_eval:
114114
if let InternMode::Static(mutability) = mode {
115115
// For this, we need to take into account `UnsafeCell`. When `ty` is `None`, we assume
116116
// no interior mutability.
117-
let frozen = ty.map_or(true, |ty| ty.is_freeze(ecx.tcx, ecx.param_env));
117+
let frozen = ty.map_or(true, |ty| ty.is_freeze(*ecx.tcx, ecx.param_env));
118118
// For statics, allocation mutability is the combination of place mutability and
119119
// type mutability.
120120
// The entire allocation needs to be mutable if it contains an `UnsafeCell` anywhere.

compiler/rustc_const_eval/src/interpret/validity.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use rustc_middle::mir::interpret::InterpError;
1515
use rustc_middle::ty;
1616
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
1717
use rustc_span::symbol::{sym, Symbol};
18-
use rustc_span::DUMMY_SP;
1918
use rustc_target::abi::{Abi, Scalar as ScalarAbi, Size, VariantIdx, Variants, WrappingRange};
2019

2120
use std::hash::Hash;
@@ -726,7 +725,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
726725
) -> InterpResult<'tcx> {
727726
// Special check preventing `UnsafeCell` inside unions in the inner part of constants.
728727
if matches!(self.ctfe_mode, Some(CtfeValidationMode::Const { inner: true, .. })) {
729-
if !op.layout.ty.is_freeze(self.ecx.tcx.at(DUMMY_SP), self.ecx.param_env) {
728+
if !op.layout.ty.is_freeze(*self.ecx.tcx, self.ecx.param_env) {
730729
throw_validation_failure!(self.path, { "`UnsafeCell` in a `const`" });
731730
}
732731
}

compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use rustc_infer::infer::TyCtxtInferExt;
88
use rustc_middle::mir;
99
use rustc_middle::mir::*;
1010
use rustc_middle::ty::{self, subst::SubstsRef, AdtDef, Ty};
11-
use rustc_span::DUMMY_SP;
1211
use rustc_trait_selection::traits::{
1312
self, ImplSource, Obligation, ObligationCause, SelectionContext,
1413
};
@@ -92,7 +91,7 @@ impl Qualif for HasMutInterior {
9291
}
9392

9493
fn in_any_value_of_ty<'tcx>(cx: &ConstCx<'_, 'tcx>, ty: Ty<'tcx>) -> bool {
95-
!ty.is_freeze(cx.tcx.at(DUMMY_SP), cx.param_env)
94+
!ty.is_freeze(cx.tcx, cx.param_env)
9695
}
9796

9897
fn in_adt_inherently<'tcx>(

compiler/rustc_const_eval/src/transform/check_consts/resolver.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use rustc_middle::mir::{self, BasicBlock, Local, Location, Statement, StatementK
88
use rustc_mir_dataflow::fmt::DebugWithContext;
99
use rustc_mir_dataflow::JoinSemiLattice;
1010
use rustc_mir_dataflow::{Analysis, AnalysisDomain, CallReturnPlaces};
11-
use rustc_span::DUMMY_SP;
1211

1312
use std::fmt;
1413
use std::marker::PhantomData;
@@ -120,10 +119,7 @@ where
120119
///
121120
/// [rust-lang/unsafe-code-guidelines#134]: https://github.com/rust-lang/unsafe-code-guidelines/issues/134
122121
fn shared_borrow_allows_mutation(&self, place: mir::Place<'tcx>) -> bool {
123-
!place
124-
.ty(self.ccx.body, self.ccx.tcx)
125-
.ty
126-
.is_freeze(self.ccx.tcx.at(DUMMY_SP), self.ccx.param_env)
122+
!place.ty(self.ccx.body, self.ccx.tcx).ty.is_freeze(self.ccx.tcx, self.ccx.param_env)
127123
}
128124
}
129125

compiler/rustc_const_eval/src/transform/validate.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
235235
// `Operand::Copy` is only supposed to be used with `Copy` types.
236236
if let Operand::Copy(place) = operand {
237237
let ty = place.ty(&self.body.local_decls, self.tcx).ty;
238-
let span = self.body.source_info(location).span;
239238

240-
if !ty.is_copy_modulo_regions(self.tcx.at(span), self.param_env) {
239+
if !ty.is_copy_modulo_regions(self.tcx, self.param_env) {
241240
self.fail(location, format!("`Operand::Copy` with non-`Copy` type {}", ty));
242241
}
243242
}

compiler/rustc_hir_analysis/src/check/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
114114
_ => {
115115
// Fallback case: allow `ManuallyDrop` and things that are `Copy`.
116116
ty.ty_adt_def().is_some_and(|adt_def| adt_def.is_manually_drop())
117-
|| ty.is_copy_modulo_regions(tcx.at(span), param_env)
117+
|| ty.is_copy_modulo_regions(tcx, param_env)
118118
}
119119
}
120120
}

compiler/rustc_hir_analysis/src/check/intrinsicck.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
3333
fn is_thin_ptr_ty(&self, ty: Ty<'tcx>) -> bool {
3434
// Type still may have region variables, but `Sized` does not depend
3535
// on those, so just erase them before querying.
36-
if ty.is_sized(self.tcx.at(DUMMY_SP), self.param_env) {
36+
if ty.is_sized(self.tcx, self.param_env) {
3737
return true;
3838
}
3939
if let ty::Foreign(..) = ty.kind() {
@@ -128,7 +128,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
128128

129129
// Check that the type implements Copy. The only case where this can
130130
// possibly fail is for SIMD types which don't #[derive(Copy)].
131-
if !ty.is_copy_modulo_regions(self.tcx.at(expr.span), self.param_env) {
131+
if !ty.is_copy_modulo_regions(self.tcx, self.param_env) {
132132
let msg = "arguments for inline assembly must be copyable";
133133
let mut err = self.tcx.sess.struct_span_err(expr.span, msg);
134134
err.note(&format!("`{ty}` does not implement the Copy trait"));

compiler/rustc_lint/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
752752
return;
753753
}
754754
let param_env = ty::ParamEnv::empty();
755-
if ty.is_copy_modulo_regions(cx.tcx.at(item.span), param_env) {
755+
if ty.is_copy_modulo_regions(cx.tcx, param_env) {
756756
return;
757757
}
758758
if can_type_implement_copy(

compiler/rustc_lint/src/types.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_middle::ty::subst::SubstsRef;
1111
use rustc_middle::ty::{self, AdtKind, DefIdTree, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable};
1212
use rustc_span::source_map;
1313
use rustc_span::symbol::sym;
14-
use rustc_span::{Span, Symbol, DUMMY_SP};
14+
use rustc_span::{Span, Symbol};
1515
use rustc_target::abi::{Abi, WrappingRange};
1616
use rustc_target::abi::{Integer, TagEncoding, Variants};
1717
use rustc_target::spec::abi::Abi as SpecAbi;
@@ -931,7 +931,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
931931
match *ty.kind() {
932932
ty::Adt(def, substs) => {
933933
if def.is_box() && matches!(self.mode, CItemKind::Definition) {
934-
if ty.boxed_ty().is_sized(tcx.at(DUMMY_SP), self.cx.param_env) {
934+
if ty.boxed_ty().is_sized(tcx, self.cx.param_env) {
935935
return FfiSafe;
936936
} else {
937937
return FfiUnsafe {
@@ -1082,7 +1082,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
10821082
ty::RawPtr(ty::TypeAndMut { ty, .. }) | ty::Ref(_, ty, _)
10831083
if {
10841084
matches!(self.mode, CItemKind::Definition)
1085-
&& ty.is_sized(self.cx.tcx.at(DUMMY_SP), self.cx.param_env)
1085+
&& ty.is_sized(self.cx.tcx, self.cx.param_env)
10861086
} =>
10871087
{
10881088
FfiSafe

compiler/rustc_middle/src/ty/layout.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ where
830830
} else {
831831
match mt {
832832
hir::Mutability::Not => {
833-
if ty.is_freeze(tcx.at(DUMMY_SP), cx.param_env()) {
833+
if ty.is_freeze(tcx, cx.param_env()) {
834834
PointerKind::Frozen
835835
} else {
836836
PointerKind::SharedMutable
@@ -841,7 +841,7 @@ where
841841
// noalias, as another pointer to the structure can be obtained, that
842842
// is not based-on the original reference. We consider all !Unpin
843843
// types to be potentially self-referential here.
844-
if ty.is_unpin(tcx.at(DUMMY_SP), cx.param_env()) {
844+
if ty.is_unpin(tcx, cx.param_env()) {
845845
PointerKind::UniqueBorrowed
846846
} else {
847847
PointerKind::UniqueBorrowedPinned

compiler/rustc_middle/src/ty/util.rs

+8-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
44
use crate::ty::layout::IntegerExt;
5-
use crate::ty::query::TyCtxtAt;
65
use crate::ty::{
76
self, DefIdTree, FallibleTypeFolder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable,
87
TypeVisitable,
@@ -821,12 +820,8 @@ impl<'tcx> Ty<'tcx> {
821820
/// does copies even when the type actually doesn't satisfy the
822821
/// full requirements for the `Copy` trait (cc #29149) -- this
823822
/// winds up being reported as an error during NLL borrow check.
824-
pub fn is_copy_modulo_regions(
825-
self,
826-
tcx_at: TyCtxtAt<'tcx>,
827-
param_env: ty::ParamEnv<'tcx>,
828-
) -> bool {
829-
self.is_trivially_pure_clone_copy() || tcx_at.is_copy_raw(param_env.and(self))
823+
pub fn is_copy_modulo_regions(self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool {
824+
self.is_trivially_pure_clone_copy() || tcx.is_copy_raw(param_env.and(self))
830825
}
831826

832827
/// Checks whether values of this type `T` have a size known at
@@ -835,8 +830,8 @@ impl<'tcx> Ty<'tcx> {
835830
/// over-approximation in generic contexts, where one can have
836831
/// strange rules like `<T as Foo<'static>>::Bar: Sized` that
837832
/// actually carry lifetime requirements.
838-
pub fn is_sized(self, tcx_at: TyCtxtAt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool {
839-
self.is_trivially_sized(tcx_at.tcx) || tcx_at.is_sized_raw(param_env.and(self))
833+
pub fn is_sized(self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool {
834+
self.is_trivially_sized(tcx) || tcx.is_sized_raw(param_env.and(self))
840835
}
841836

842837
/// Checks whether values of this type `T` implement the `Freeze`
@@ -846,8 +841,8 @@ impl<'tcx> Ty<'tcx> {
846841
/// optimization as well as the rules around static values. Note
847842
/// that the `Freeze` trait is not exposed to end users and is
848843
/// effectively an implementation detail.
849-
pub fn is_freeze(self, tcx_at: TyCtxtAt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool {
850-
self.is_trivially_freeze() || tcx_at.is_freeze_raw(param_env.and(self))
844+
pub fn is_freeze(self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool {
845+
self.is_trivially_freeze() || tcx.is_freeze_raw(param_env.and(self))
851846
}
852847

853848
/// Fast path helper for testing if a type is `Freeze`.
@@ -886,8 +881,8 @@ impl<'tcx> Ty<'tcx> {
886881
}
887882

888883
/// Checks whether values of this type `T` implement the `Unpin` trait.
889-
pub fn is_unpin(self, tcx_at: TyCtxtAt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool {
890-
self.is_trivially_unpin() || tcx_at.is_unpin_raw(param_env.and(self))
884+
pub fn is_unpin(self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool {
885+
self.is_trivially_unpin() || tcx.is_unpin_raw(param_env.and(self))
891886
}
892887

893888
/// Fast path helper for testing if a type is `Unpin`.

compiler/rustc_mir_build/src/build/expr/as_operand.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
153153

154154
if tcx.features().unsized_fn_params {
155155
let ty = expr.ty;
156-
let span = expr.span;
157156
let param_env = this.param_env;
158157

159-
if !ty.is_sized(tcx.at(span), param_env) {
158+
if !ty.is_sized(tcx, param_env) {
160159
// !sized means !copy, so this is an unsized move
161-
assert!(!ty.is_copy_modulo_regions(tcx.at(span), param_env));
160+
assert!(!ty.is_copy_modulo_regions(tcx, param_env));
162161

163162
// As described above, detect the case where we are passing a value of unsized
164163
// type, and that value is coming from the deref of a box.

compiler/rustc_mir_build/src/check_unsafety.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
260260
};
261261
match borrow_kind {
262262
BorrowKind::Shallow | BorrowKind::Shared | BorrowKind::Unique => {
263-
if !ty.is_freeze(self.tcx.at(pat.span), self.param_env) {
263+
if !ty.is_freeze(self.tcx, self.param_env) {
264264
self.requires_unsafe(pat.span, BorrowOfLayoutConstrainedField);
265265
}
266266
}
@@ -457,9 +457,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
457457
if visitor.found {
458458
match borrow_kind {
459459
BorrowKind::Shallow | BorrowKind::Shared | BorrowKind::Unique
460-
if !self.thir[arg]
461-
.ty
462-
.is_freeze(self.tcx.at(self.thir[arg].span), self.param_env) =>
460+
if !self.thir[arg].ty.is_freeze(self.tcx, self.param_env) =>
463461
{
464462
self.requires_unsafe(expr.span, BorrowOfLayoutConstrainedField)
465463
}

compiler/rustc_mir_build/src/thir/pattern/check_match.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1004,8 +1004,8 @@ fn maybe_point_at_variant<'a, 'p: 'a, 'tcx: 'a>(
10041004
}
10051005

10061006
/// Check if a by-value binding is by-value. That is, check if the binding's type is not `Copy`.
1007-
fn is_binding_by_move(cx: &MatchVisitor<'_, '_, '_>, hir_id: HirId, span: Span) -> bool {
1008-
!cx.typeck_results.node_type(hir_id).is_copy_modulo_regions(cx.tcx.at(span), cx.param_env)
1007+
fn is_binding_by_move(cx: &MatchVisitor<'_, '_, '_>, hir_id: HirId) -> bool {
1008+
!cx.typeck_results.node_type(hir_id).is_copy_modulo_regions(cx.tcx, cx.param_env)
10091009
}
10101010

10111011
/// Check that there are no borrow or move conflicts in `binding @ subpat` patterns.
@@ -1031,7 +1031,7 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_, '_>, pat: &Pa
10311031

10321032
// Get the binding move, extract the mutability if by-ref.
10331033
let mut_outer = match typeck_results.extract_binding_mode(sess, pat.hir_id, pat.span) {
1034-
Some(ty::BindByValue(_)) if is_binding_by_move(cx, pat.hir_id, pat.span) => {
1034+
Some(ty::BindByValue(_)) if is_binding_by_move(cx, pat.hir_id) => {
10351035
// We have `x @ pat` where `x` is by-move. Reject all borrows in `pat`.
10361036
let mut conflicts_ref = Vec::new();
10371037
sub.each_binding(|_, hir_id, span, _| {
@@ -1070,7 +1070,7 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_, '_>, pat: &Pa
10701070
(Mutability::Mut, Mutability::Mut) => conflicts_mut_mut.push((span, name)), // 2x `ref mut`.
10711071
_ => conflicts_mut_ref.push((span, name)), // `ref` + `ref mut` in either direction.
10721072
},
1073-
Some(ty::BindByValue(_)) if is_binding_by_move(cx, hir_id, span) => {
1073+
Some(ty::BindByValue(_)) if is_binding_by_move(cx, hir_id) => {
10741074
conflicts_move.push((span, name)) // `ref mut?` + by-move conflict.
10751075
}
10761076
Some(ty::BindByValue(_)) | None => {} // `ref mut?` + by-copy is fine.

compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ impl<'tcx> ConstToPat<'tcx> {
506506
// convert the dereferenced constant to a pattern that is the sub-pattern of the
507507
// deref pattern.
508508
_ => {
509-
if !pointee_ty.is_sized(tcx.at(span), param_env) {
509+
if !pointee_ty.is_sized(tcx, param_env) {
510510
// `tcx.deref_mir_constant()` below will ICE with an unsized type
511511
// (except slices, which are handled in a separate arm above).
512512
let msg = format!("cannot use unsized non-slice type `{}` in constant patterns", pointee_ty);
@@ -534,7 +534,7 @@ impl<'tcx> ConstToPat<'tcx> {
534534
ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::FnDef(..) => {
535535
PatKind::Constant { value: cv }
536536
}
537-
ty::RawPtr(pointee) if pointee.ty.is_sized(tcx.at(span), param_env) => {
537+
ty::RawPtr(pointee) if pointee.ty.is_sized(tcx, param_env) => {
538538
PatKind::Constant { value: cv }
539539
}
540540
// FIXME: these can have very surprising behaviour where optimization levels or other

compiler/rustc_mir_transform/src/check_unsafety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ impl<'tcx> UnsafetyChecker<'_, 'tcx> {
312312
} else if !place
313313
.ty(self.body, self.tcx)
314314
.ty
315-
.is_freeze(self.tcx.at(self.source_info.span), self.param_env)
315+
.is_freeze(self.tcx, self.param_env)
316316
{
317317
UnsafetyViolationDetails::BorrowOfLayoutConstrainedField
318318
} else {

compiler/rustc_mir_transform/src/const_prop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
633633
}
634634
if !rvalue
635635
.ty(&self.ecx.frame().body.local_decls, *self.ecx.tcx)
636-
.is_sized(self.ecx.tcx, self.param_env)
636+
.is_sized(*self.ecx.tcx, self.param_env)
637637
{
638638
// the interpreter doesn't support unsized locals (only unsized arguments),
639639
// but rustc does (in a kinda broken way), so we have to skip them here

compiler/rustc_mir_transform/src/const_prop_lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
500500
}
501501
if !rvalue
502502
.ty(&self.ecx.frame().body.local_decls, *self.ecx.tcx)
503-
.is_sized(self.ecx.tcx, self.param_env)
503+
.is_sized(*self.ecx.tcx, self.param_env)
504504
{
505505
// the interpreter doesn't support unsized locals (only unsized arguments),
506506
// but rustc does (in a kinda broken way), so we have to skip them here

0 commit comments

Comments
 (0)