-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-inherent_associated_types`#![feature(inherent_associated_types)]``#![feature(inherent_associated_types)]`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.requires-incomplete-featuresThis issue requires the use of incomplete features.This issue requires the use of incomplete features.
Description
I tried this code:
#![feature(inherent_associated_types)]
struct A<const N: usize> {}
struct B<const N: usize> {}
impl<const N: usize> B<N> {
type C_ = C<N>;
}
struct C<const N: usize> {}
impl<const N: usize> A<N> {
type B_ = B<N>;
fn fun() -> Self::B_::C_ {
todo!()
}
}
fn main() {}
rustc says:
error[E0223]: ambiguous associated type
--> src/lib.rs:15:17
|
15 | fn fun() -> Self::B_::C_ {
| ^^^^^^^^^^^^
|
help: if there were a trait named `Example` with associated type `C_` implemented for `A<N>::B_`, you could use the fully-qualified path
|
15 | fn fun() -> <A<N>::B_ as Example>::C_ {
| ~~~~~~~~~~~~~~~~~~~~~~~~~
Meta
rustc --version --verbose
:
rustc 1.78.0-nightly (4a0cc881d 2024-03-11)
binary: rustc
commit-hash: 4a0cc881dcc4d800f10672747f61a94377ff6662
commit-date: 2024-03-11
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-inherent_associated_types`#![feature(inherent_associated_types)]``#![feature(inherent_associated_types)]`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.requires-incomplete-featuresThis issue requires the use of incomplete features.This issue requires the use of incomplete features.
Type
Projects
Status
Can Do