Skip to content

Commit a93192c

Browse files
committed
add InstructionSetAttr::as_str and make the type Copy
1 parent d67a5c0 commit a93192c

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
@@ -49,12 +49,21 @@ pub enum InlineAttr {
4949
Never,
5050
}
5151

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

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

0 commit comments

Comments
 (0)