Code
#![feature(min_generic_const_args)]
#![feature(inherent_associated_types)]
pub struct Foo([u8; Bar::LEN]);
pub struct Bar;
impl Bar {
pub const LEN: usize = 1;
}
fn main() {
}
Current output
error: use of `const` in the type system not defined as `type const`
--> src/main.rs:4:21
|
4 | pub struct Foo([u8; Bar::LEN]);
| ^^^^^^^^
|
help: add `type` before `const` for `Bar::LEN`
|
9 | type pub const LEN: usize = 1;
| ++++
Desired output
error: use of `const` in the type system not defined as `type const`
--> src/main.rs:4:21
|
4 | pub struct Foo([u8; Bar::LEN]);
| ^^^^^^^^
|
help: add `type` before `const` for `Bar::LEN`
|
9 | pub type const LEN: usize = 1;
| ++++
Rationale and extra context
should suggest pub type const instead of type pub const.
Other cases
Rust Version
rustc 1.98.0-nightly (54333ff07 2026-05-22)
binary: rustc
commit-hash: 54333ff079780f803f65dcee30c544050b35f544
commit-date: 2026-05-22
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6
Anything else?
No response
Code
Current output
Desired output
Rationale and extra context
should suggest
pub type constinstead oftype pub const.Other cases
Rust Version
Anything else?
No response