Type inference regression on nightly (E0282)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
I tried this code:
use proc_macro2::{Group, Span, TokenTree};
pub fn assign_span(
span: Span,
ts: impl IntoIterator<Item = TokenTree>,
) -> impl IntoIterator<Item = TokenTree> {
ts.into_iter().map(move |tt| match tt {
TokenTree::Group(group) => {
let group = Group::new(
group.delimiter(),
assign_span(span, group.stream()).into_iter().collect(),
);
TokenTree::Group(group)
}
mut tt @ (TokenTree::Ident(_) | TokenTree::Punct(_) | TokenTree::Literal(_)) => {
tt.set_span(span);
tt
}
})
}
I expected to see this happen:
Compiling playground v0.0.1 (/playground)
Finished `release` profile [optimized] target(s) in 0.97s
Instead, this happened:
Compiling playground v0.0.1 (/playground)
error[E0282]: type annotations needed
--> src/lib.rs:11:5
|
11 | assign_span(span, group.stream()).into_iter().collect(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
For more information about this error, try `rustc --explain E0282`.
error: could not compile `playground` (lib) due to 1 previous error
Version it worked on
It most recently worked on: rustc 1.99.0-beta.3 (cbae9b4ca 2026-08-28)
Version with regression
rustc --version --verbose:
rustc 1.100.0-nightly (0dfb098f3 2026-08-31)
binary: rustc
commit-hash: 0dfb098f3aeecbe38c2566ca090193280e7349e7
commit-date: 2026-08-31
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.0
@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged
Fortunately very convenient to isolate, the function above is (aside from pub) verbatim from my library.
I'm not sure how to bisect this, but I suspect it's a yet unsupported edge case in the new trait solver anyway.
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 minimal Rust example with rustc 1.99.0-beta.3 and 1.100.0-nightly to confirm the regression and compare the E0282 diagnostic. Bisect between those versions if possible, then investigate the new trait solver's handling of the recursive impl IntoIterator return type. Done means identifying the regression cause and adding or updating a compiler regression test.
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
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100