Skip to content

Commit 1f0d857

Browse files
committed
add InstructionSetAttr::as_str and make the type Copy
1 parent 2c7b296 commit 1f0d857

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

compiler/rustc_attr/src/builtin.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,21 @@ pub enum InlineAttr {
4848
Never,
4949
}
5050

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

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

0 commit comments

Comments
 (0)