-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-const_trait_impl`#![feature(const_trait_impl)]``#![feature(const_trait_impl)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I tried this code:
#![feature(const_trait_impl)]
#[const_trait]
pub trait Aaa {
fn x() -> u8;
}
struct Impl;
impl const Aaa for Impl {
fn x() -> u8 { 0 }
}
pub const fn y() -> u8 { Impl::x() }
I expected to see this happen: it compiles without an error.
Instead, this happened:
error[E0015]: cannot call non-const fn `<Impl as Aaa>::x` in constant functions
--> src/lib.rs:14:26
|
14 | pub const fn y() -> u8 { Impl::x() }
| ^^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
rustc --version --verbose
:
rustc 1.73.0-nightly (f88a8b71c 2023-08-08)
binary: rustc
commit-hash: f88a8b71cebb730cbd5058c45ebcae1d4d9be377
commit-date: 2023-08-08
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 17.0.0
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-const_trait_impl`#![feature(const_trait_impl)]``#![feature(const_trait_impl)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.