Skip to content

Commit 3975af5

Browse files
committed
auto merge of #20837 : huonw/rust/remove-unused-lifetime, r=nikomatsakis
2 parents d36dc15 + 719c5d7 commit 3975af5

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

src/libcore/fmt/mod.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ impl<'a> Arguments<'a> {
180180
/// unsafety, but will ignore invalid .
181181
#[doc(hidden)] #[inline]
182182
#[unstable = "implementation detail of the `format_args!` macro"]
183+
#[cfg(stage0)] // SNAP 9e4e524
183184
pub fn with_placeholders(pieces: &'a [&'a str],
184185
fmt: &'a [rt::Argument<'a>],
185186
args: &'a [Argument<'a>]) -> Arguments<'a> {
@@ -189,6 +190,24 @@ impl<'a> Arguments<'a> {
189190
args: args
190191
}
191192
}
193+
/// This function is used to specify nonstandard formatting parameters.
194+
/// The `pieces` array must be at least as long as `fmt` to construct
195+
/// a valid Arguments structure. Also, any `Count` within `fmt` that is
196+
/// `CountIsParam` or `CountIsNextParam` has to point to an argument
197+
/// created with `argumentuint`. However, failing to do so doesn't cause
198+
/// unsafety, but will ignore invalid .
199+
#[doc(hidden)] #[inline]
200+
#[unstable = "implementation detail of the `format_args!` macro"]
201+
#[cfg(not(stage0))]
202+
pub fn with_placeholders(pieces: &'a [&'a str],
203+
fmt: &'a [rt::Argument],
204+
args: &'a [Argument<'a>]) -> Arguments<'a> {
205+
Arguments {
206+
pieces: pieces,
207+
fmt: Some(fmt),
208+
args: args
209+
}
210+
}
192211
}
193212

194213
/// This structure represents a safely precompiled version of a format string
@@ -207,7 +226,11 @@ pub struct Arguments<'a> {
207226
pieces: &'a [&'a str],
208227

209228
// Placeholder specs, or `None` if all specs are default (as in "{}{}").
229+
// SNAP 9e4e524
230+
#[cfg(stage0)]
210231
fmt: Option<&'a [rt::Argument<'a>]>,
232+
#[cfg(not(stage0))]
233+
fmt: Option<&'a [rt::Argument]>,
211234

212235
// Dynamic arguments for interpolation, to be interleaved with string
213236
// pieces. (Every argument is preceded by a string piece.)

src/libcore/fmt/rt.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,17 @@ pub use self::Count::*;
2121
pub use self::Position::*;
2222
pub use self::Flag::*;
2323

24+
// SNAP 9e4e524
2425
#[doc(hidden)]
2526
#[derive(Copy)]
27+
#[cfg(not(stage0))]
28+
pub struct Argument {
29+
pub position: Position,
30+
pub format: FormatSpec,
31+
}
32+
#[doc(hidden)]
33+
#[derive(Copy)]
34+
#[cfg(stage0)]
2635
pub struct Argument<'a> {
2736
pub position: Position,
2837
pub format: FormatSpec,

src/libsyntax/ext/format.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -579,13 +579,9 @@ impl<'a, 'b> Context<'a, 'b> {
579579
} else {
580580
// Build up the static array which will store our precompiled
581581
// nonstandard placeholders, if there are any.
582-
let piece_ty = self.ecx.ty_path(self.ecx.path_all(
582+
let piece_ty = self.ecx.ty_path(self.ecx.path_global(
583583
self.fmtsp,
584-
true, Context::rtpath(self.ecx, "Argument"),
585-
vec![static_lifetime],
586-
vec![],
587-
vec![]
588-
));
584+
Context::rtpath(self.ecx, "Argument")));
589585
let fmt = Context::static_array(self.ecx,
590586
"__STATIC_FMTARGS",
591587
piece_ty,

0 commit comments

Comments
 (0)