@@ -19,7 +19,8 @@ pub struct Placeholder {
19
19
}
20
20
21
21
impl Placeholder {
22
- #[ inline( always) ]
22
+ #[ cfg_attr( bootstrap, inline( always) ) ]
23
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
23
24
pub const fn new (
24
25
position : usize ,
25
26
fill : char ,
@@ -95,7 +96,8 @@ pub struct Argument<'a> {
95
96
96
97
#[ rustc_diagnostic_item = "ArgumentMethods" ]
97
98
impl < ' a > Argument < ' a > {
98
- #[ inline( always) ]
99
+ #[ cfg_attr( bootstrap, inline( always) ) ]
100
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
99
101
fn new < ' b , T > ( x : & ' b T , f : fn ( & T , & mut Formatter < ' _ > ) -> Result ) -> Argument < ' b > {
100
102
Argument {
101
103
// INVARIANT: this creates an `ArgumentType<'b>` from a `&'b T` and
@@ -109,47 +111,58 @@ impl<'a> Argument<'a> {
109
111
}
110
112
}
111
113
112
- #[ inline( always) ]
114
+ #[ cfg_attr( bootstrap, inline( always) ) ]
115
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
113
116
pub fn new_display < ' b , T : Display > ( x : & ' b T ) -> Argument < ' b > {
114
117
Self :: new ( x, Display :: fmt)
115
118
}
116
- #[ inline( always) ]
119
+ #[ cfg_attr( bootstrap, inline( always) ) ]
120
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
117
121
pub fn new_debug < ' b , T : Debug > ( x : & ' b T ) -> Argument < ' b > {
118
122
Self :: new ( x, Debug :: fmt)
119
123
}
120
- #[ inline( always) ]
124
+ #[ cfg_attr( bootstrap, inline( always) ) ]
125
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
121
126
pub fn new_debug_noop < ' b , T : Debug > ( x : & ' b T ) -> Argument < ' b > {
122
127
Self :: new ( x, |_, _| Ok ( ( ) ) )
123
128
}
124
- #[ inline( always) ]
129
+ #[ cfg_attr( bootstrap, inline( always) ) ]
130
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
125
131
pub fn new_octal < ' b , T : Octal > ( x : & ' b T ) -> Argument < ' b > {
126
132
Self :: new ( x, Octal :: fmt)
127
133
}
128
- #[ inline( always) ]
134
+ #[ cfg_attr( bootstrap, inline( always) ) ]
135
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
129
136
pub fn new_lower_hex < ' b , T : LowerHex > ( x : & ' b T ) -> Argument < ' b > {
130
137
Self :: new ( x, LowerHex :: fmt)
131
138
}
132
- #[ inline( always) ]
139
+ #[ cfg_attr( bootstrap, inline( always) ) ]
140
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
133
141
pub fn new_upper_hex < ' b , T : UpperHex > ( x : & ' b T ) -> Argument < ' b > {
134
142
Self :: new ( x, UpperHex :: fmt)
135
143
}
136
- #[ inline( always) ]
144
+ #[ cfg_attr( bootstrap, inline( always) ) ]
145
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
137
146
pub fn new_pointer < ' b , T : Pointer > ( x : & ' b T ) -> Argument < ' b > {
138
147
Self :: new ( x, Pointer :: fmt)
139
148
}
140
- #[ inline( always) ]
149
+ #[ cfg_attr( bootstrap, inline( always) ) ]
150
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
141
151
pub fn new_binary < ' b , T : Binary > ( x : & ' b T ) -> Argument < ' b > {
142
152
Self :: new ( x, Binary :: fmt)
143
153
}
144
- #[ inline( always) ]
154
+ #[ cfg_attr( bootstrap, inline( always) ) ]
155
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
145
156
pub fn new_lower_exp < ' b , T : LowerExp > ( x : & ' b T ) -> Argument < ' b > {
146
157
Self :: new ( x, LowerExp :: fmt)
147
158
}
148
- #[ inline( always) ]
159
+ #[ cfg_attr( bootstrap, inline( always) ) ]
160
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
149
161
pub fn new_upper_exp < ' b , T : UpperExp > ( x : & ' b T ) -> Argument < ' b > {
150
162
Self :: new ( x, UpperExp :: fmt)
151
163
}
152
- #[ inline( always) ]
164
+ #[ cfg_attr( bootstrap, inline( always) ) ]
165
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
153
166
pub fn from_usize ( x : & usize ) -> Argument < ' _ > {
154
167
Argument { ty : ArgumentType :: Count ( * x) }
155
168
}
@@ -164,7 +177,8 @@ impl<'a> Argument<'a> {
164
177
// it here is an explicit CFI violation.
165
178
#[ allow( inline_no_sanitize) ]
166
179
#[ no_sanitize( cfi, kcfi) ]
167
- #[ inline( always) ]
180
+ #[ cfg_attr( bootstrap, inline( always) ) ]
181
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
168
182
pub ( super ) unsafe fn fmt ( & self , f : & mut Formatter < ' _ > ) -> Result {
169
183
match self . ty {
170
184
// SAFETY:
@@ -180,7 +194,8 @@ impl<'a> Argument<'a> {
180
194
}
181
195
}
182
196
183
- #[ inline( always) ]
197
+ #[ cfg_attr( bootstrap, inline( always) ) ]
198
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
184
199
pub ( super ) fn as_usize ( & self ) -> Option < usize > {
185
200
match self . ty {
186
201
ArgumentType :: Count ( count) => Some ( count) ,
@@ -198,7 +213,8 @@ impl<'a> Argument<'a> {
198
213
/// let f = format_args!("{}", "a");
199
214
/// println!("{f}");
200
215
/// ```
201
- #[ inline( always) ]
216
+ #[ cfg_attr( bootstrap, inline( always) ) ]
217
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
202
218
pub fn none ( ) -> [ Self ; 0 ] {
203
219
[ ]
204
220
}
@@ -215,7 +231,8 @@ pub struct UnsafeArg {
215
231
impl UnsafeArg {
216
232
/// See documentation where `UnsafeArg` is required to know when it is safe to
217
233
/// create and use `UnsafeArg`.
218
- #[ inline( always) ]
234
+ #[ cfg_attr( bootstrap, inline( always) ) ]
235
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
219
236
pub unsafe fn new ( ) -> Self {
220
237
Self { _private : ( ) }
221
238
}
0 commit comments