diff options
| author | Boxy <rust@boxyuwu.dev> | 2025-05-01 16:22:31 +0100 |
|---|---|---|
| committer | Boxy <rust@boxyuwu.dev> | 2025-05-22 12:47:19 +0100 |
| commit | 217c4ad427a5dbf6b23f23c70358a31064884231 (patch) | |
| tree | d3a8c985eb24510dbd38835f723627cd3734f948 /compiler/rustc_hir_analysis | |
| parent | b1774b8d7382325d2bb5cc518e463ae9d6de5898 (diff) | |
| download | rust-217c4ad427a5dbf6b23f23c70358a31064884231.tar.gz rust-217c4ad427a5dbf6b23f23c70358a31064884231.zip | |
Review Comments
Diffstat (limited to 'compiler/rustc_hir_analysis')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/collect.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_hir_analysis/src/collect/generics_of.rs | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index dfe9d7af3ad..8b9fae732c1 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -1836,9 +1836,9 @@ fn anon_const_kind<'tcx>(tcx: TyCtxt<'tcx>, def: LocalDefId) -> ty::AnonConstKin match tcx.hir_node(const_arg_id) { hir::Node::ConstArg(_) => { if tcx.features().generic_const_exprs() { - ty::AnonConstKind::GCEConst + ty::AnonConstKind::GCE } else if tcx.features().min_generic_const_args() { - ty::AnonConstKind::MCGConst + ty::AnonConstKind::MCG } else if let hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Repeat(_, repeat_count), .. @@ -1847,7 +1847,7 @@ fn anon_const_kind<'tcx>(tcx: TyCtxt<'tcx>, def: LocalDefId) -> ty::AnonConstKin { ty::AnonConstKind::RepeatExprCount } else { - ty::AnonConstKind::MCGConst + ty::AnonConstKind::MCG } } _ => ty::AnonConstKind::NonTypeSystem, diff --git a/compiler/rustc_hir_analysis/src/collect/generics_of.rs b/compiler/rustc_hir_analysis/src/collect/generics_of.rs index d261f3f85fe..7eb896f0bf1 100644 --- a/compiler/rustc_hir_analysis/src/collect/generics_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/generics_of.rs @@ -106,7 +106,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { match tcx.anon_const_kind(def_id) { // Stable: anon consts are not able to use any generic parameters... - ty::AnonConstKind::MCGConst => None, + ty::AnonConstKind::MCG => None, // we provide generics to repeat expr counts as a backwards compatibility hack. #76200 ty::AnonConstKind::RepeatExprCount => Some(parent_did), @@ -116,13 +116,13 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { // We could potentially mirror the hack done for defaults of generic parameters but // this case just doesn't come up much compared to `const N: u32 = ...`. Long term the // hack for defaulted parameters should be removed eventually anyway. - ty::AnonConstKind::GCEConst if in_param_ty => None, + ty::AnonConstKind::GCE if in_param_ty => None, // GCE anon consts as a default for a generic parameter should have their provided generics // "truncated" up to whatever generic parameter this anon const is within the default of. // // FIXME(generic_const_exprs): This only handles `const N: usize = /*defid*/` but not type // parameter defaults, e.g. `T = Foo</*defid*/>`. - ty::AnonConstKind::GCEConst + ty::AnonConstKind::GCE if let Some(param_id) = tcx.hir_opt_const_param_default_param_def_id(hir_id) => { @@ -169,7 +169,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { has_late_bound_regions: generics.has_late_bound_regions, }; } - ty::AnonConstKind::GCEConst => Some(parent_did), + ty::AnonConstKind::GCE => Some(parent_did), // Field defaults are allowed to use generic parameters, e.g. `field: u32 = /*defid: N + 1*/` ty::AnonConstKind::NonTypeSystem |
