Skip to content

Commit 778553f

Browse files
committed
add InstructionSetAttr::as_str and make the type Copy
1 parent 9185e3c commit 778553f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

compiler/rustc_attr/src/builtin.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,21 @@ pub enum InlineAttr {
4747
Never,
4848
}
4949

50-
#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq, HashStable_Generic)]
50+
#[derive(Copy, Clone, Encodable, Decodable, Debug, PartialEq, Eq, HashStable_Generic)]
5151
pub enum InstructionSetAttr {
5252
ArmA32,
5353
ArmT32,
5454
}
5555

56+
impl InstructionSetAttr {
57+
pub fn as_str(self) -> &'static str {
58+
match self {
59+
Self::ArmA32 => sym::a32.as_str(),
60+
Self::ArmT32 => sym::t32.as_str(),
61+
}
62+
}
63+
}
64+
5665
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
5766
pub enum OptimizeAttr {
5867
None,

0 commit comments

Comments
 (0)