X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_ty_utils%2Fsrc%2Fconsts.rs;h=3cef47c0f8ba481d2b3bde2a117b38be3ae5bb18;hb=131ef9580815329aa3647fa84d7c74769fefbccf;hp=e057bb668250192a2999a9b1070634b0ac61b7ae;hpb=8a5ce1d615bd2495308da0d36ebd95e00f16eced;p=rust.git diff --git a/compiler/rustc_ty_utils/src/consts.rs b/compiler/rustc_ty_utils/src/consts.rs index e057bb66825..3cef47c0f8b 100644 --- a/compiler/rustc_ty_utils/src/consts.rs +++ b/compiler/rustc_ty_utils/src/consts.rs @@ -33,7 +33,7 @@ pub(crate) fn destructure_const<'tcx>( // construct the consts for the elements of the array/slice let field_consts = branches .iter() - .map(|b| tcx.mk_const(ty::ConstS { kind: ty::ConstKind::Value(*b), ty: *inner_ty })) + .map(|b| tcx.mk_const(ty::ConstKind::Value(*b), *inner_ty)) .collect::>(); debug!(?field_consts); @@ -52,10 +52,7 @@ pub(crate) fn destructure_const<'tcx>( for (field, field_valtree) in iter::zip(fields, branches) { let field_ty = field.ty(tcx, substs); - let field_const = tcx.mk_const(ty::ConstS { - kind: ty::ConstKind::Value(*field_valtree), - ty: field_ty, - }); + let field_const = tcx.mk_const(ty::ConstKind::Value(*field_valtree), field_ty); field_consts.push(field_const); } debug!(?field_consts); @@ -65,10 +62,7 @@ pub(crate) fn destructure_const<'tcx>( ty::Tuple(elem_tys) => { let fields = iter::zip(*elem_tys, branches) .map(|(elem_ty, elem_valtree)| { - tcx.mk_const(ty::ConstS { - kind: ty::ConstKind::Value(*elem_valtree), - ty: elem_ty, - }) + tcx.mk_const(ty::ConstKind::Value(*elem_valtree), elem_ty) }) .collect::>(); @@ -261,17 +255,13 @@ fn recurse_build(&mut self, node: thir::ExprId) -> Result { - let const_param = self - .tcx - .mk_const(ty::ConstS { kind: ty::ConstKind::Param(*param), ty: node.ty }); + let const_param = self.tcx.mk_const(ty::ConstKind::Param(*param), node.ty); self.nodes.push(Node::Leaf(const_param)) }