Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 4fbb43e

Browse files
No more TyCtxt::lazy_normalization
1 parent 794249d commit 4fbb43e

File tree

6 files changed

+8
-14
lines changed

6 files changed

+8
-14
lines changed

compiler/rustc_hir_analysis/src/collect/generics_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
5050
// We do not allow generic parameters in anon consts if we are inside
5151
// of a const parameter type, e.g. `struct Foo<const N: usize, const M: [u8; N]>` is not allowed.
5252
None
53-
} else if tcx.lazy_normalization() {
53+
} else if tcx.features().generic_const_exprs {
5454
let parent_node = tcx.hir().get_parent(hir_id);
5555
if let Node::Variant(Variant { disr_expr: Some(constant), .. }) = parent_node
5656
&& constant.hir_id == hir_id

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ pub(super) fn explicit_predicates_of<'tcx>(
463463
}
464464
}
465465
} else {
466-
if matches!(def_kind, DefKind::AnonConst) && tcx.lazy_normalization() {
466+
if matches!(def_kind, DefKind::AnonConst) && tcx.features().generic_const_exprs {
467467
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
468468
let parent_def_id = tcx.hir().get_parent_item(hir_id);
469469

compiler/rustc_hir_analysis/src/outlives/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ pub fn provide(providers: &mut Providers) {
2020
fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[(ty::Clause<'_>, Span)] {
2121
let id = tcx.hir().local_def_id_to_hir_id(item_def_id);
2222

23-
if matches!(tcx.def_kind(item_def_id), hir::def::DefKind::AnonConst) && tcx.lazy_normalization()
23+
if matches!(tcx.def_kind(item_def_id), hir::def::DefKind::AnonConst)
24+
&& tcx.features().generic_const_exprs
2425
{
2526
if tcx.hir().opt_const_param_default_param_def_id(id).is_some() {
2627
// In `generics_of` we set the generics' parent to be our parent's parent which means that

compiler/rustc_infer/src/infer/combine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl<'tcx> InferCtxt<'tcx> {
227227
return self.unify_const_variable(vid, a, relation.param_env());
228228
}
229229
(ty::ConstKind::Unevaluated(..), _) | (_, ty::ConstKind::Unevaluated(..))
230-
if self.tcx.lazy_normalization() =>
230+
if self.tcx.features().generic_const_exprs =>
231231
{
232232
relation.register_const_equate_obligation(a, b);
233233
return Ok(b);

compiler/rustc_middle/src/ty/context.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,15 +1015,6 @@ impl<'tcx> TyCtxt<'tcx> {
10151015
self.query_system.on_disk_cache.as_ref().map_or(Ok(0), |c| c.serialize(self, encoder))
10161016
}
10171017

1018-
/// If `true`, we should use lazy normalization for constants, otherwise
1019-
/// we still evaluate them eagerly.
1020-
#[inline]
1021-
pub fn lazy_normalization(self) -> bool {
1022-
let features = self.features();
1023-
// Note: We only use lazy normalization for generic const expressions.
1024-
features.generic_const_exprs
1025-
}
1026-
10271018
#[inline]
10281019
pub fn local_crate_exports_generics(self) -> bool {
10291020
debug_assert!(self.sess.opts.share_generics());

compiler/rustc_trait_selection/src/traits/project.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,9 @@ impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx
672672
#[instrument(skip(self), level = "debug")]
673673
fn fold_const(&mut self, constant: ty::Const<'tcx>) -> ty::Const<'tcx> {
674674
let tcx = self.selcx.tcx();
675-
if tcx.lazy_normalization() || !needs_normalization(&constant, self.param_env.reveal()) {
675+
if tcx.features().generic_const_exprs
676+
|| !needs_normalization(&constant, self.param_env.reveal())
677+
{
676678
constant
677679
} else {
678680
let constant = constant.super_fold_with(self);

0 commit comments

Comments
 (0)