Open
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