File tree 3 files changed +38
-58
lines changed
rustc_ast_pretty/src/pprust
3 files changed +38
-58
lines changed Original file line number Diff line number Diff line change @@ -2264,6 +2264,42 @@ bitflags::bitflags! {
2264
2264
}
2265
2265
}
2266
2266
2267
+ impl InlineAsmOptions {
2268
+ pub fn human_readable_names ( & self ) -> Vec < & ' static str > {
2269
+ let mut options = vec ! [ ] ;
2270
+
2271
+ if self . contains ( InlineAsmOptions :: PURE ) {
2272
+ options. push ( "pure" ) ;
2273
+ }
2274
+ if self . contains ( InlineAsmOptions :: NOMEM ) {
2275
+ options. push ( "nomem" ) ;
2276
+ }
2277
+ if self . contains ( InlineAsmOptions :: READONLY ) {
2278
+ options. push ( "readonly" ) ;
2279
+ }
2280
+ if self . contains ( InlineAsmOptions :: PRESERVES_FLAGS ) {
2281
+ options. push ( "preserves_flags" ) ;
2282
+ }
2283
+ if self . contains ( InlineAsmOptions :: NORETURN ) {
2284
+ options. push ( "noreturn" ) ;
2285
+ }
2286
+ if self . contains ( InlineAsmOptions :: NOSTACK ) {
2287
+ options. push ( "nostack" ) ;
2288
+ }
2289
+ if self . contains ( InlineAsmOptions :: ATT_SYNTAX ) {
2290
+ options. push ( "att_syntax" ) ;
2291
+ }
2292
+ if self . contains ( InlineAsmOptions :: RAW ) {
2293
+ options. push ( "raw" ) ;
2294
+ }
2295
+ if self . contains ( InlineAsmOptions :: MAY_UNWIND ) {
2296
+ options. push ( "may_unwind" ) ;
2297
+ }
2298
+
2299
+ options
2300
+ }
2301
+ }
2302
+
2267
2303
impl std:: fmt:: Debug for InlineAsmOptions {
2268
2304
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
2269
2305
bitflags:: parser:: to_writer ( self , f)
Original file line number Diff line number Diff line change @@ -1505,35 +1505,7 @@ impl<'a> State<'a> {
1505
1505
AsmArg :: Options ( opts) => {
1506
1506
s. word ( "options" ) ;
1507
1507
s. popen ( ) ;
1508
- let mut options = vec ! [ ] ;
1509
- if opts. contains ( InlineAsmOptions :: PURE ) {
1510
- options. push ( "pure" ) ;
1511
- }
1512
- if opts. contains ( InlineAsmOptions :: NOMEM ) {
1513
- options. push ( "nomem" ) ;
1514
- }
1515
- if opts. contains ( InlineAsmOptions :: READONLY ) {
1516
- options. push ( "readonly" ) ;
1517
- }
1518
- if opts. contains ( InlineAsmOptions :: PRESERVES_FLAGS ) {
1519
- options. push ( "preserves_flags" ) ;
1520
- }
1521
- if opts. contains ( InlineAsmOptions :: NORETURN ) {
1522
- options. push ( "noreturn" ) ;
1523
- }
1524
- if opts. contains ( InlineAsmOptions :: NOSTACK ) {
1525
- options. push ( "nostack" ) ;
1526
- }
1527
- if opts. contains ( InlineAsmOptions :: ATT_SYNTAX ) {
1528
- options. push ( "att_syntax" ) ;
1529
- }
1530
- if opts. contains ( InlineAsmOptions :: RAW ) {
1531
- options. push ( "raw" ) ;
1532
- }
1533
- if opts. contains ( InlineAsmOptions :: MAY_UNWIND ) {
1534
- options. push ( "may_unwind" ) ;
1535
- }
1536
- s. commasep ( Inconsistent , & options, |s, & opt| {
1508
+ s. commasep ( Inconsistent , & opts. human_readable_names ( ) , |s, & opt| {
1537
1509
s. word ( opt) ;
1538
1510
} ) ;
1539
1511
s. pclose ( ) ;
Original file line number Diff line number Diff line change @@ -1289,35 +1289,7 @@ impl<'a> State<'a> {
1289
1289
AsmArg :: Options ( opts) => {
1290
1290
s. word ( "options" ) ;
1291
1291
s. popen ( ) ;
1292
- let mut options = vec ! [ ] ;
1293
- if opts. contains ( ast:: InlineAsmOptions :: PURE ) {
1294
- options. push ( "pure" ) ;
1295
- }
1296
- if opts. contains ( ast:: InlineAsmOptions :: NOMEM ) {
1297
- options. push ( "nomem" ) ;
1298
- }
1299
- if opts. contains ( ast:: InlineAsmOptions :: READONLY ) {
1300
- options. push ( "readonly" ) ;
1301
- }
1302
- if opts. contains ( ast:: InlineAsmOptions :: PRESERVES_FLAGS ) {
1303
- options. push ( "preserves_flags" ) ;
1304
- }
1305
- if opts. contains ( ast:: InlineAsmOptions :: NORETURN ) {
1306
- options. push ( "noreturn" ) ;
1307
- }
1308
- if opts. contains ( ast:: InlineAsmOptions :: NOSTACK ) {
1309
- options. push ( "nostack" ) ;
1310
- }
1311
- if opts. contains ( ast:: InlineAsmOptions :: ATT_SYNTAX ) {
1312
- options. push ( "att_syntax" ) ;
1313
- }
1314
- if opts. contains ( ast:: InlineAsmOptions :: RAW ) {
1315
- options. push ( "raw" ) ;
1316
- }
1317
- if opts. contains ( ast:: InlineAsmOptions :: MAY_UNWIND ) {
1318
- options. push ( "may_unwind" ) ;
1319
- }
1320
- s. commasep ( Inconsistent , & options, |s, & opt| {
1292
+ s. commasep ( Inconsistent , & opts. human_readable_names ( ) , |s, & opt| {
1321
1293
s. word ( opt) ;
1322
1294
} ) ;
1323
1295
s. pclose ( ) ;
You can’t perform that action at this time.
0 commit comments