Skip to content

Commit 94888a9

Browse files
committed
Add magic constant to encode unstability of ensure_not_fmt_string_literal!
1 parent 402d0c8 commit 94888a9

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/libcollections/fmt.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,3 +446,6 @@ pub fn format(args: Arguments) -> string::String {
446446
let _ = write!(&mut output, "{}", args);
447447
output
448448
}
449+
450+
#[unstable(feature = "ensure_not_fmt_string_literal")]
451+
pub use ::core::fmt::ENSURE_NOT_FMT_STRING_LITERAL_IS_UNSTABLE;

src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#![feature(str_char)]
4141
#![feature(slice_patterns)]
4242
#![feature(debug_builders)]
43+
#![feature(ensure_not_fmt_string_literal)] // (referenced in expansions)
4344
#![cfg_attr(test, feature(rand, rustc_private, test, hash, collections))]
4445
#![cfg_attr(test, allow(deprecated))] // rand
4546

src/libcore/fmt/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,5 +1078,16 @@ impl<'b, T: Debug> Debug for RefMut<'b, T> {
10781078
}
10791079
}
10801080

1081+
/// This constant is a trick to force `ensure_not_fmt_string_literal!`
1082+
/// to be treated as unstable whenever it occurs outside a macro
1083+
/// marked with `#[allow_internal_unstable]`.
1084+
///
1085+
/// This constant really should not ever be stabilized; if we ever
1086+
/// decide to stabilize the `ensure_not_fmt_string_literal!` macro
1087+
/// itself, then we should remove its use of this constant (and then
1088+
/// remove this constant).
1089+
#[unstable(feature = "ensure_not_fmt_string_literal")]
1090+
pub const ENSURE_NOT_FMT_STRING_LITERAL_IS_UNSTABLE: () = ();
1091+
10811092
// If you expected tests to be here, look instead at the run-pass/ifmt.rs test,
10821093
// it's a lot easier than creating all of the rt::Piece structures here.

0 commit comments

Comments
 (0)