Skip to content

Commit 04aaeb6

Browse files
committed
Add magic constant to encode unstability of ensure_not_fmt_string_literal!
1 parent d2beae1 commit 04aaeb6

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
@@ -41,6 +41,7 @@
4141
#![feature(slice_patterns)]
4242
#![feature(debug_builders)]
4343
#![feature(utf8_error)]
44+
#![feature(ensure_not_fmt_string_literal)] // (referenced in expansions)
4445
#![cfg_attr(test, feature(rand, rustc_private, test, hash, collections))]
4546
#![cfg_attr(test, allow(deprecated))] // rand
4647

src/libcore/fmt/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,5 +1084,16 @@ impl<'b, T: Debug> Debug for RefMut<'b, T> {
10841084
}
10851085
}
10861086

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

0 commit comments

Comments
 (0)