You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A `const` implementation of a non-`#[const_trait]` trait that uses at least one default method implementation doesn't result in a compile error. Instead, an error occurs when the non-`const` default method implementations are actually called in a constant context. This behavior deviates from Rust's design principles, so it's likely a bug.
536
-
537
-
```rust
538
-
#![feature(const_trait_impl)]
539
-
traitTr {
540
-
fnfoo() {}
541
-
}
542
-
543
-
// expected error: const trait implementations may not use non-const default
544
-
// functions / note: `foo` not implemented
545
-
implconstTrfor () {}
546
-
```
547
-
548
-
```rust
549
-
#![feature(const_trait_impl)]
550
-
#![feature(lint_reasons)]
551
-
traitTr {
552
-
fnfoo() {}
553
-
}
554
-
555
-
implconstTrfor () {}
556
-
557
-
constfnf<T: ~constTr>() { T::foo() }
558
-
#[expect(const_err)] // error: calling non-const function `<() as Tr>::foo`
559
-
const_: () =f::<()>();
560
-
```
561
-
562
-
563
519
### `[tag:const_assert_eq]``assert_eq!` and similar macros are unusable in `const fn`
0 commit comments