Skip to content

Commit 2e087d2

Browse files
committed
review
1 parent 9cba14b commit 2e087d2

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

Diff for: compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
707707
// Test the callee's predicates, substituting in `ref_ty` for the moved argument type.
708708
clauses.instantiate(tcx, new_args).predicates.iter().all(|&(mut clause)| {
709709
// Normalize before testing to see through type aliases and projections.
710-
if let Ok(normalized) = tcx.try_normalize_erasing_regions(self.param_env, clause) {
710+
if let Ok(normalized) =
711+
tcx.try_normalize_erasing_regions(self.infcx.typing_env(self.param_env), clause)
712+
{
711713
clause = normalized;
712714
}
713715
self.infcx.predicate_must_hold_modulo_regions(&Obligation::new(

Diff for: compiler/rustc_hir_analysis/src/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ fn check_type_defn<'tcx>(
11261126
let ty = tcx.type_of(variant.tail().did).instantiate_identity();
11271127
let ty = tcx.erase_regions(ty);
11281128
assert!(!ty.has_infer());
1129-
ty.needs_drop(tcx, ty::TypingEnv::non_body_analysis(tcx, item.owner_id.def_id))
1129+
ty.needs_drop(tcx, wfcx.infcx.typing_env(wfcx.param_env))
11301130
}
11311131
};
11321132
// All fields (except for possibly the last) should be sized.

Diff for: compiler/rustc_infer/src/infer/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ impl<'tcx> InferCtxt<'tcx> {
12861286
u
12871287
}
12881288

1289-
/// Extract [ty::TypingMode] of this inference context to get a `TypingEnv`
1289+
/// Extract [`ty::TypingMode`] of this inference context to get a `TypingEnv`
12901290
/// which contains the necessary information to use the trait system without
12911291
/// using canonicalization or carrying this inference context around.
12921292
pub fn typing_env(&self, param_env: ty::ParamEnv<'tcx>) -> ty::TypingEnv<'tcx> {
@@ -1304,8 +1304,8 @@ impl<'tcx> InferCtxt<'tcx> {
13041304
ty::TypingEnv { typing_mode, param_env }
13051305
}
13061306

1307-
/// Similar to [Self::canonicalize_query], except that it returns
1308-
/// a [PseudoCanonicalInput] and requires both the `value` and the
1307+
/// Similar to [`Self::canonicalize_query`], except that it returns
1308+
/// a [`PseudoCanonicalInput`] and requires both the `value` and the
13091309
/// `param_env` to not contain any inference variables or placeholders.
13101310
pub fn pseudo_canonicalize_query<V>(
13111311
&self,

Diff for: compiler/rustc_middle/src/ty/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,8 @@ impl<'tcx> TypingEnv<'tcx> {
11971197
// as these placeholders are also local to the current inference context. However, we
11981198
// currently use pseudo-canonical queries in the trait solver which replaces params with
11991199
// placeholders. We should also simply not use pseudo-canonical queries in the trait
1200-
// solver, at which point we can readd this assert.
1200+
// solver, at which point we can readd this assert. As of writing this comment, this is
1201+
// only used by `fn layout_is_pointer_like` when calling `layout_of`.
12011202
//
12021203
// debug_assert!(!value.has_placeholders());
12031204
PseudoCanonicalInput { typing_env: self, value }

Diff for: compiler/rustc_mir_build/src/build/expr/as_rvalue.rs

+2
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
227227
if range.start <= range.end { BinOp::BitAnd } else { BinOp::BitOr };
228228

229229
let mut comparer = |range: u128, bin_op: BinOp| -> Place<'tcx> {
230+
// We can use `ty::TypingEnv::fully_monomorphized()`` here
231+
// as we only need it to compute the layout of a primitive.
230232
let range_val = Const::from_bits(
231233
this.tcx,
232234
range,

0 commit comments

Comments
 (0)