Skip to content

Commit f38bc95

Browse files
committed
add InstructionSetAttr::as_str and make the type Copy
1 parent 9b1e322 commit f38bc95

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
@@ -43,12 +43,21 @@ pub enum InlineAttr {
4343
Never,
4444
}
4545

46-
#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq, HashStable_Generic)]
46+
#[derive(Copy, Clone, Encodable, Decodable, Debug, PartialEq, Eq, HashStable_Generic)]
4747
pub enum InstructionSetAttr {
4848
ArmA32,
4949
ArmT32,
5050
}
5151

52+
impl InstructionSetAttr {
53+
pub fn as_str(self) -> &'static str {
54+
match self {
55+
Self::ArmA32 => sym::a32.as_str(),
56+
Self::ArmT32 => sym::t32.as_str(),
57+
}
58+
}
59+
}
60+
5261
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
5362
pub enum OptimizeAttr {
5463
None,

0 commit comments

Comments
 (0)