Inaccurate error message when using parametric type recursion
Open
Nobody has claimed this yet.
A-diagnostics
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
enum NestedDataType<T> {
Nil,
Cons(Box<NestedDataType<(T, T)>>),
}
Current output
error[E0392]: type parameter `T` is never used
--> src/lib.rs:1:21
|
1 | enum NestedDataType<T> {
| ^ unused type parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
Desired output
Cannot support parametric type recursion
Rationale and extra context
No response
Other cases
No response
Rust Version
rustc 1.78.0-nightly (3406ada96 2024-02-21)
binary: rustc
commit-hash: 3406ada96f8e16e49e947a91db3eba0db45245fa
commit-date: 2024-02-21
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0
Anything else?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository files or tests are named. Reproduce the enum with rustc 1.78.0-nightly and compare the E0392 diagnostic with the requested parametric-recursion message. Trace the compiler path that reports the unused type parameter; done means the example emits the intended diagnostic without the misleading E0392 output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100