-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.
Description
This code:
#![feature(const_trait_impl, const_fn_trait_bound, const_panic)]
pub trait Foo {
fn bar(self) -> usize;
const MAX: Self;
}
impl const Foo for usize {
fn bar(self) -> usize { self }
const MAX: Self = Self::MAX;
}
const fn spam<T: Foo>(n: usize) {
assert!(n <= T::MAX.bar());
}
fn main() {}
Using:
rustc 1.56.0-nightly (ac50a5335 2021-08-27)
binary: rustc
commit-hash: ac50a53359328a5d7f2f558833e63d59d372e4f7
commit-date: 2021-08-27
host: x86_64-pc-windows-gnu
release: 1.56.0-nightly
LLVM version: 13.0.0
Gives:
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
--> ...\test.rs:13:18
|
13 | assert!(n <= T::MAX.bar());
| ^^^^^^^^^^^^
I think this used to compile up to the precedent Nightly.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.