From f3218b2a707aaf8de8ce2798865d3df4a7a0484a Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 11 Dec 2023 21:08:05 +0000 Subject: [PATCH] Make ConstKind and TyKind Copy --- compiler/rustc_middle/src/arena.rs | 4 ---- compiler/rustc_middle/src/ty/consts.rs | 3 ++- compiler/rustc_type_ir/src/const_kind.rs | 1 + compiler/rustc_type_ir/src/ty_kind.rs | 1 + 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_middle/src/arena.rs b/compiler/rustc_middle/src/arena.rs index 9b41b77928e..52fd494a10d 100644 --- a/compiler/rustc_middle/src/arena.rs +++ b/compiler/rustc_middle/src/arena.rs @@ -92,10 +92,6 @@ macro_rules! arena_types { [] name_set: rustc_data_structures::unord::UnordSet, [] ordered_name_set: rustc_data_structures::fx::FxIndexSet, - // Interned types - [] tys: rustc_type_ir::WithCachedTypeInfo>, - [] consts: rustc_type_ir::WithCachedTypeInfo>, - // Note that this deliberately duplicates items in the `rustc_hir::arena`, // since we need to allocate this type on both the `rustc_hir` arena // (during lowering) and the `librustc_middle` arena (for decoding MIR) diff --git a/compiler/rustc_middle/src/ty/consts.rs b/compiler/rustc_middle/src/ty/consts.rs index 293df4f691d..3c52c45f3a8 100644 --- a/compiler/rustc_middle/src/ty/consts.rs +++ b/compiler/rustc_middle/src/ty/consts.rs @@ -41,7 +41,8 @@ fn ty(self) -> Ty<'tcx> { } /// Typed constant value. -#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, HashStable, TyEncodable, TyDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(HashStable, TyEncodable, TyDecodable)] pub struct ConstData<'tcx> { pub ty: Ty<'tcx>, pub kind: ConstKind<'tcx>, diff --git a/compiler/rustc_type_ir/src/const_kind.rs b/compiler/rustc_type_ir/src/const_kind.rs index 879de58f100..0aaaad5af05 100644 --- a/compiler/rustc_type_ir/src/const_kind.rs +++ b/compiler/rustc_type_ir/src/const_kind.rs @@ -10,6 +10,7 @@ #[derive(derivative::Derivative)] #[derivative( Clone(bound = ""), + Copy(bound = ""), PartialOrd(bound = ""), PartialOrd = "feature_allow_slow_enum", Ord(bound = ""), diff --git a/compiler/rustc_type_ir/src/ty_kind.rs b/compiler/rustc_type_ir/src/ty_kind.rs index a7a5cae254c..72ca9199a53 100644 --- a/compiler/rustc_type_ir/src/ty_kind.rs +++ b/compiler/rustc_type_ir/src/ty_kind.rs @@ -111,6 +111,7 @@ pub enum AliasKind { #[derive(derivative::Derivative)] #[derivative( Clone(bound = ""), + Copy(bound = ""), PartialOrd(bound = ""), PartialOrd = "feature_allow_slow_enum", Ord(bound = ""),