@@ -19,7 +19,8 @@ pub struct Placeholder {
1919}
2020
2121impl Placeholder {
22- #[ inline( always) ]
22+ #[ cfg_attr( bootstrap, inline( always) ) ]
23+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
2324 pub const fn new (
2425 position : usize ,
2526 fill : char ,
@@ -95,7 +96,8 @@ pub struct Argument<'a> {
9596
9697#[ rustc_diagnostic_item = "ArgumentMethods" ]
9798impl < ' a > Argument < ' a > {
98- #[ inline( always) ]
99+ #[ cfg_attr( bootstrap, inline( always) ) ]
100+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
99101 fn new < ' b , T > ( x : & ' b T , f : fn ( & T , & mut Formatter < ' _ > ) -> Result ) -> Argument < ' b > {
100102 Argument {
101103 // INVARIANT: this creates an `ArgumentType<'b>` from a `&'b T` and
@@ -109,47 +111,58 @@ impl<'a> Argument<'a> {
109111 }
110112 }
111113
112- #[ inline( always) ]
114+ #[ cfg_attr( bootstrap, inline( always) ) ]
115+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
113116 pub fn new_display < ' b , T : Display > ( x : & ' b T ) -> Argument < ' b > {
114117 Self :: new ( x, Display :: fmt)
115118 }
116- #[ inline( always) ]
119+ #[ cfg_attr( bootstrap, inline( always) ) ]
120+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
117121 pub fn new_debug < ' b , T : Debug > ( x : & ' b T ) -> Argument < ' b > {
118122 Self :: new ( x, Debug :: fmt)
119123 }
120- #[ inline( always) ]
124+ #[ cfg_attr( bootstrap, inline( always) ) ]
125+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
121126 pub fn new_debug_noop < ' b , T : Debug > ( x : & ' b T ) -> Argument < ' b > {
122127 Self :: new ( x, |_, _| Ok ( ( ) ) )
123128 }
124- #[ inline( always) ]
129+ #[ cfg_attr( bootstrap, inline( always) ) ]
130+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
125131 pub fn new_octal < ' b , T : Octal > ( x : & ' b T ) -> Argument < ' b > {
126132 Self :: new ( x, Octal :: fmt)
127133 }
128- #[ inline( always) ]
134+ #[ cfg_attr( bootstrap, inline( always) ) ]
135+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
129136 pub fn new_lower_hex < ' b , T : LowerHex > ( x : & ' b T ) -> Argument < ' b > {
130137 Self :: new ( x, LowerHex :: fmt)
131138 }
132- #[ inline( always) ]
139+ #[ cfg_attr( bootstrap, inline( always) ) ]
140+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
133141 pub fn new_upper_hex < ' b , T : UpperHex > ( x : & ' b T ) -> Argument < ' b > {
134142 Self :: new ( x, UpperHex :: fmt)
135143 }
136- #[ inline( always) ]
144+ #[ cfg_attr( bootstrap, inline( always) ) ]
145+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
137146 pub fn new_pointer < ' b , T : Pointer > ( x : & ' b T ) -> Argument < ' b > {
138147 Self :: new ( x, Pointer :: fmt)
139148 }
140- #[ inline( always) ]
149+ #[ cfg_attr( bootstrap, inline( always) ) ]
150+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
141151 pub fn new_binary < ' b , T : Binary > ( x : & ' b T ) -> Argument < ' b > {
142152 Self :: new ( x, Binary :: fmt)
143153 }
144- #[ inline( always) ]
154+ #[ cfg_attr( bootstrap, inline( always) ) ]
155+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
145156 pub fn new_lower_exp < ' b , T : LowerExp > ( x : & ' b T ) -> Argument < ' b > {
146157 Self :: new ( x, LowerExp :: fmt)
147158 }
148- #[ inline( always) ]
159+ #[ cfg_attr( bootstrap, inline( always) ) ]
160+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
149161 pub fn new_upper_exp < ' b , T : UpperExp > ( x : & ' b T ) -> Argument < ' b > {
150162 Self :: new ( x, UpperExp :: fmt)
151163 }
152- #[ inline( always) ]
164+ #[ cfg_attr( bootstrap, inline( always) ) ]
165+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
153166 pub fn from_usize ( x : & usize ) -> Argument < ' _ > {
154167 Argument { ty : ArgumentType :: Count ( * x) }
155168 }
@@ -164,7 +177,8 @@ impl<'a> Argument<'a> {
164177 // it here is an explicit CFI violation.
165178 #[ allow( inline_no_sanitize) ]
166179 #[ no_sanitize( cfi, kcfi) ]
167- #[ inline( always) ]
180+ #[ cfg_attr( bootstrap, inline( always) ) ]
181+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
168182 pub ( super ) unsafe fn fmt ( & self , f : & mut Formatter < ' _ > ) -> Result {
169183 match self . ty {
170184 // SAFETY:
@@ -180,7 +194,8 @@ impl<'a> Argument<'a> {
180194 }
181195 }
182196
183- #[ inline( always) ]
197+ #[ cfg_attr( bootstrap, inline( always) ) ]
198+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
184199 pub ( super ) fn as_usize ( & self ) -> Option < usize > {
185200 match self . ty {
186201 ArgumentType :: Count ( count) => Some ( count) ,
@@ -198,7 +213,8 @@ impl<'a> Argument<'a> {
198213 /// let f = format_args!("{}", "a");
199214 /// println!("{f}");
200215 /// ```
201- #[ inline( always) ]
216+ #[ cfg_attr( bootstrap, inline( always) ) ]
217+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
202218 pub fn none ( ) -> [ Self ; 0 ] {
203219 [ ]
204220 }
@@ -215,7 +231,8 @@ pub struct UnsafeArg {
215231impl UnsafeArg {
216232 /// See documentation where `UnsafeArg` is required to know when it is safe to
217233 /// create and use `UnsafeArg`.
218- #[ inline( always) ]
234+ #[ cfg_attr( bootstrap, inline( always) ) ]
235+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
219236 pub unsafe fn new ( ) -> Self {
220237 Self { _private : ( ) }
221238 }
0 commit comments