diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
commit | d1b2d29528b7794b41e66fc2136e395a02f8529b (patch) | |
tree | a4a17504b260206dec3cf55b2dca82929a348ac2 /compiler/rustc_ty_utils/src/consts.rs | |
parent | Releasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip |
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_ty_utils/src/consts.rs')
-rw-r--r-- | compiler/rustc_ty_utils/src/consts.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/rustc_ty_utils/src/consts.rs b/compiler/rustc_ty_utils/src/consts.rs index 426c98012..383cc996b 100644 --- a/compiler/rustc_ty_utils/src/consts.rs +++ b/compiler/rustc_ty_utils/src/consts.rs @@ -42,7 +42,7 @@ pub(crate) fn destructure_const<'tcx>( (field_consts, None) } ty::Adt(def, _) if def.variants().is_empty() => bug!("unreachable"), - ty::Adt(def, substs) => { + ty::Adt(def, args) => { let (variant_idx, branches) = if def.is_enum() { let (head, rest) = branches.split_first().unwrap(); (VariantIdx::from_u32(head.unwrap_leaf().try_to_u32().unwrap()), rest) @@ -53,7 +53,7 @@ pub(crate) fn destructure_const<'tcx>( let mut field_consts = Vec::with_capacity(fields.len()); for (field, field_valtree) in iter::zip(fields, branches) { - let field_ty = field.ty(tcx, substs); + let field_ty = field.ty(tcx, args); let field_const = ty::Const::new_value(tcx, *field_valtree, field_ty); field_consts.push(field_const); } @@ -133,8 +133,8 @@ fn recurse_build<'tcx>( let val = ty::ValTree::zst(); ty::Const::new_value(tcx, val, node.ty) } - &ExprKind::NamedConst { def_id, substs, user_ty: _ } => { - let uneval = ty::UnevaluatedConst::new(def_id, substs); + &ExprKind::NamedConst { def_id, args, user_ty: _ } => { + let uneval = ty::UnevaluatedConst::new(def_id, args); ty::Const::new_unevaluated(tcx, uneval, node.ty) } ExprKind::ConstParam { param, .. } => ty::Const::new_param(tcx, *param, node.ty), @@ -174,7 +174,7 @@ fn recurse_build<'tcx>( } // `ExprKind::Use` happens when a `hir::ExprKind::Cast` is a // "coercion cast" i.e. using a coercion or is a no-op. - // This is important so that `N as usize as usize` doesnt unify with `N as usize`. (untested) + // This is important so that `N as usize as usize` doesn't unify with `N as usize`. (untested) &ExprKind::Use { source } => { let arg = recurse_build(tcx, body, source, root_span)?; ty::Const::new_expr(tcx, Expr::Cast(CastKind::Use, arg, node.ty), node.ty) @@ -306,8 +306,9 @@ impl<'a, 'tcx> IsThirPolymorphic<'a, 'tcx> { } match expr.kind { - thir::ExprKind::NamedConst { substs, .. } - | thir::ExprKind::ConstBlock { substs, .. } => substs.has_non_region_param(), + thir::ExprKind::NamedConst { args, .. } | thir::ExprKind::ConstBlock { args, .. } => { + args.has_non_region_param() + } thir::ExprKind::ConstParam { .. } => true, thir::ExprKind::Repeat { value, count } => { self.visit_expr(&self.thir()[value]); |