Skip to content

Commit f6014cc

Browse files
committed
test(toolchain_limitations): update the example of [ref:const_assert_eq]
`Debug` isn't marked with `#[const_trait]`, so we can't implement `const Debug` on a struct anymore. Fortunately, the original error can still be reproduced by passing `u32` to `assert_eq!` instead.
1 parent fd8a537 commit f6014cc

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

doc/toolchain_limitations.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -533,21 +533,8 @@ impl const Iterator for MyIterator {
533533
### `[tag:const_assert_eq]` `assert_eq!` and similar macros are unusable in `const fn`
534534

535535
```rust,compile_fail,E0015
536-
#![feature(const_trait_impl)]
537-
#![feature(const_mut_refs)]
538-
struct A;
539-
impl const PartialEq for A {
540-
fn eq(&self, _: &Self) -> bool { true }
541-
fn ne(&self, _: &Self) -> bool { false }
542-
}
543-
impl const core::fmt::Debug for A {
544-
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
545-
unimplemented!()
546-
}
547-
}
548-
549-
// error[E0015]: cannot call non-const fn `assert_failed::<A, A>` in constants
550-
const _: () = assert_eq!(A, A);
536+
// error[E0015]: cannot call non-const fn `assert_failed::<u32, u32>` in constants
537+
const _: () = assert_eq!(42u32, 42u32);
551538
```
552539

553540

0 commit comments

Comments
 (0)