-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.
Description
Code
pub const THING: RangeInclusive<usize> = 0..=5;
Current output
error[E0412]: cannot find type `RangeInclusive` in this scope
--> <source>:2:18
|
2 | pub const THING: RangeInclusive<usize> = 0..=5;
| ^^^^^^^^^^^^^^ not found in this scope
|
help: consider importing one of these structs
|
2 + use std::range::RangeInclusive;
|
2 + use std::range::legacy::RangeInclusive;
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0412`.
Compiler returned: 1
Desired output
error[E0412]: cannot find type `RangeInclusive` in this scope
--> <source>:2:18
|
2 | pub const THING: RangeInclusive<usize> = 0..=5;
| ^^^^^^^^^^^^^^ not found in this scope
|
help: consider importing one of these structs
|
2 + use std::ops::RangeInclusive;
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0412`.
Compiler returned: 1
Rationale and extra context
It recommends to use an unstable feature which is annoying, because if you follow either of its suggestions, then it complains about #125687 being unstable
1.86
https://godbolt.org/z/43hvvj7fc
Other cases
Rust Version
rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: x86_64-unknown-linux-gnu
release: 1.88.0
LLVM version: 20.1.5
Anything else?
:3
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.