Open
Description
Code
// check-pass
#![feature(generic_const_items, associated_const_equality)]
#![allow(incomplete_features, dead_code)]
trait Owner {
const K<const N: u16>: u32;
}
impl Owner for () {
const K<const N: u32>: u32 = N + 1;
}
fn take1(_: impl Owner<K<99> = 100>) {}
fn main() {
take1(());
}
Meta
rustc --version --verbose
:
f967532a47eb728ada44473a5c4c2eca1a45fe30
Error output
error[E0053]: const `K` has an incompatible generic parameter for trait `Owner`
--> E3C8E80B9F16D249D1078B5DF2852F8E37EB546C642CE235A1E955910CCB2F71.rs:11:13
|
6 | trait Owner {
| -----
7 | const K<const N: u16>: u32;
| ------------ expected const parameter of type `u16`
...
10 | impl Owner for () {
| -----------------
11 | const K<const N: u32>: u32 = N + 1;
| ^^^^^^^^^^^^ found const parameter of type `u32`
Metadata
Metadata
Assignees
Labels
Category: This is a bug.`#![feature(associated_const_equality)]``#![feature(generic_const_items)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.This issue requires a build of rustc or tooling with debug-assertions in some way
Type
Projects
Status
Can Do
Status
Can Do
Milestone
Relationships
Development
No branches or pull requests
Activity
[-]ICE: `expected type differs from actual type u16 / u32[/-][+]ICE: `expected type differs from actual type` u16 / u32[/+]matthiaskrgr commentedon Dec 9, 2023
Backtrace
fmease commentedon Dec 10, 2023
F-generic_const_items`#![feature(generic_const_items)]`
isn't necessarily at fault, I was able to find an exact reproducer that only involves
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
:
matthiaskrgr commentedon Dec 10, 2023
There is already an error that says expected u16, found u32, does it make sense to make the ice a delayed span bug?
fmease commentedon Dec 10, 2023
Potentially, yes. I'd need to look into the code a bit more to double-check if that'd make sense or if there's a better solution.
13 remaining items