We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d6fe3d commit 0980622Copy full SHA for 0980622
library/core/src/fmt/rt.rs
@@ -205,8 +205,15 @@ impl Argument<'_> {
205
/// let f = format_args!("{}", "a");
206
/// println!("{f}");
207
/// ```
208
+ ///
209
+ /// This function should _not_ be const, to make sure we don't accept
210
+ /// format_args!() and panic!() with arguments in const, even when not evaluated:
211
212
+ /// ```compile_fail,E0015
213
+ /// const _: () = if false { panic!("a {}", "a") };
214
+ /// ```
215
#[inline]
- pub const fn none() -> [Self; 0] {
216
+ pub fn none() -> [Self; 0] {
217
[]
218
}
219
0 commit comments