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 9d28fe3 commit cc791ebCopy full SHA for cc791eb
library/core/src/fmt/rt.rs
@@ -174,8 +174,15 @@ impl Argument<'_> {
174
/// let f = format_args!("{}", "a");
175
/// println!("{f}");
176
/// ```
177
+ ///
178
+ /// This function should _not_ be const, to make sure we don't accept
179
+ /// format_args!() and panic!() with arguments in const, even when not evaluated:
180
181
+ /// ```compile_fail,E0015
182
+ /// const _: () = if false { panic!("a {}", "a") };
183
+ /// ```
184
#[inline]
- pub const fn none() -> [Self; 0] {
185
+ pub fn none() -> [Self; 0] {
186
[]
187
}
188
0 commit comments