This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +38
-58
lines changed
rustc_ast_pretty/src/pprust Expand file tree Collapse file tree 3 files changed +38
-58
lines changed Original file line number Diff line number Diff line change @@ -2264,6 +2264,42 @@ bitflags::bitflags! {
22642264 }
22652265}
22662266
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+
22672303impl std:: fmt:: Debug for InlineAsmOptions {
22682304 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
22692305 bitflags:: parser:: to_writer ( self , f)
Original file line number Diff line number Diff line change @@ -1505,35 +1505,7 @@ impl<'a> State<'a> {
15051505 AsmArg :: Options ( opts) => {
15061506 s. word ( "options" ) ;
15071507 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| {
15371509 s. word ( opt) ;
15381510 } ) ;
15391511 s. pclose ( ) ;
Original file line number Diff line number Diff line change @@ -1289,35 +1289,7 @@ impl<'a> State<'a> {
12891289 AsmArg :: Options ( opts) => {
12901290 s. word ( "options" ) ;
12911291 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| {
13211293 s. word ( opt) ;
13221294 } ) ;
13231295 s. pclose ( ) ;
You can’t perform that action at this time.
0 commit comments