Closed
Description
In the following code, I can successfully refer to the private inherent associated type m::T::P
:
#![feature(inherent_associated_types)]
#![allow(dead_code, incomplete_features)]
mod m {
pub struct T;
impl T {
type P = ();
}
}
type U = m::T::P;
I expected to see an error denying the access.
If the associated item was a constant, this would indeed be the case:
error[E0624]: associated constant `P` is private
--> src/lib.rs:10:21
|
7 | const P: () = ();
| ----------- private associated constant defined here
...
10 | const U: () = m::T::P;
| ^ private associated constant
Meta
rustc --version --verbose
:
rustc 1.67.0-nightly (85f4f41de 2022-11-08)
binary: rustc
commit-hash: 85f4f41deb1557ca8ab228319d33003dd2f20f45
commit-date: 2022-11-08
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4
@rustbot label T-compiler requires-nightly A-associated-items A-visibility F-inherent_associated_types