next solver: FN unused variable
Open
Nobody has claimed this yet.
A-diagnostics
C-bug
L-false-negative
T-compiler
WG-trait-system-refactor
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
#![allow(unconditional_recursion)]
fn fun<T>(x: T) -> impl Sized {
let x = 0;
fun(std::env::temp_dir())
}
fn main() {}
old solver:
error[E0720]: cannot resolve opaque type
--> a.rs:2:20
|
2 | fn fun<T>(x: T) -> impl Sized {
| ^^^^^^^^^^
warning: unused variable: `x`
--> a.rs:2:11
|
2 | fn fun<T>(x: T) -> impl Sized {
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
= note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
warning: unused variable: `x`
--> a.rs:3:9
|
3 | let x = 0;
| ^ help: if this is intentional, prefix it with an underscore: `_x`
error: aborting due to 1 previous error; 2 warnings emitted
For more information about this error, try `rustc --explain E0720`.
next solver:
error[E0282]: type annotations needed
--> a.rs:2:20
|
2 | fn fun<T>(x: T) -> impl Sized {
| ^^^^^^^^^^ cannot infer type
|
= note: cannot infer type of hidden type of opaque
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0282`.
the next solve eats the warnings about the unused variables somehow.
rustc 1.100.0-nightly (923c95cdf 2026-09-16)
binary: rustc
commit-hash: 923c95cdf5ba65cea505aa2ea829f578e1506ed8
commit-date: 2026-09-16
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.1
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
Start by compiling the provided reproducer with the old and next solvers using the reported nightly version, then compare the diagnostics. Trace how the next solver handles the opaque-type inference failure and unused-variable warnings. Done means the inference error remains while both unused-variable warnings are emitted with their usual suggestions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100