Skip to content

Commit e8f0c68

Browse files
committed
[generic_assert] "Constify" the Debug trait
1 parent 0493557 commit e8f0c68

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

library/core/src/fmt/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,8 @@ impl Display for Arguments<'_> {
845845
/// assert_eq!(format!("The origin is: {origin:#?}"), expected);
846846
/// ```
847847
848+
#[const_trait]
849+
#[rustc_const_unstable(feature = "const_debug", issue = "none")]
848850
#[stable(feature = "rust1", since = "1.0.0")]
849851
#[rustc_on_unimplemented(
850852
on(
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//@ check-pass
2+
3+
#![feature(const_debug, const_trait_impl)]
4+
5+
use std::fmt::Debug;
6+
use std::fmt::Formatter;
7+
8+
pub struct Foo;
9+
10+
impl const Debug for Foo {
11+
fn fmt(&self, _: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
12+
Ok(())
13+
}
14+
}
15+
16+
fn main() {}

0 commit comments

Comments
 (0)