@@ -183,38 +183,6 @@ impl Argument<'_> {
183
183
ArgumentType :: Placeholder { .. } => None ,
184
184
}
185
185
}
186
-
187
- /// Used by `format_args` when all arguments are gone after inlining,
188
- /// when using `&[]` would incorrectly allow for a bigger lifetime.
189
- ///
190
- /// This fails without format argument inlining, and that shouldn't be different
191
- /// when the argument is inlined:
192
- ///
193
- /// ```compile_fail,E0716
194
- /// let f = format_args!("{}", "a");
195
- /// println!("{f}");
196
- /// ```
197
- #[ inline]
198
- pub const fn none ( ) -> [ Self ; 0 ] {
199
- [ ]
200
- }
201
- }
202
-
203
- /// This struct represents the unsafety of constructing an `Arguments`.
204
- /// It exists, rather than an unsafe function, in order to simplify the expansion
205
- /// of `format_args!(..)` and reduce the scope of the `unsafe` block.
206
- #[ lang = "format_unsafe_arg" ]
207
- pub struct UnsafeArg {
208
- _private : ( ) ,
209
- }
210
-
211
- impl UnsafeArg {
212
- /// See documentation where `UnsafeArg` is required to know when it is safe to
213
- /// create and use `UnsafeArg`.
214
- #[ inline]
215
- pub const unsafe fn new ( ) -> Self {
216
- Self { _private : ( ) }
217
- }
218
186
}
219
187
220
188
/// Used by the format_args!() macro to create a fmt::Arguments object.
@@ -248,8 +216,7 @@ impl<'a> Arguments<'a> {
248
216
249
217
/// Specifies nonstandard formatting parameters.
250
218
///
251
- /// An `rt::UnsafeArg` is required because the following invariants must be held
252
- /// in order for this function to be safe:
219
+ /// SAFETY: the following invariants must be held:
253
220
/// 1. The `pieces` slice must be at least as long as `fmt`.
254
221
/// 2. Every `rt::Placeholder::position` value within `fmt` must be a valid index of `args`.
255
222
/// 3. Every `rt::Count::Param` within `fmt` must contain a valid index of `args`.
@@ -261,11 +228,10 @@ impl<'a> Arguments<'a> {
261
228
/// const _: () = if false { panic!("a {:1}", "a") };
262
229
/// ```
263
230
#[ inline]
264
- pub fn new_v1_formatted (
231
+ pub unsafe fn new_v1_formatted (
265
232
pieces : & ' a [ & ' static str ] ,
266
233
args : & ' a [ rt:: Argument < ' a > ] ,
267
234
fmt : & ' a [ rt:: Placeholder ] ,
268
- _unsafe_arg : rt:: UnsafeArg ,
269
235
) -> Arguments < ' a > {
270
236
Arguments { pieces, fmt : Some ( fmt) , args }
271
237
}
0 commit comments