Repository navigation
ICE: error performing ParamEnvAnd { ... } possibly related to (lack of) HRTBs in closures #124440
Copy link
Copy link
Open
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.T-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.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.
Description
Activity
- addedC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-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.
on Apr 27, 2024 - addedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Apr 27, 2024 Infectious-Smile commented
on Apr 27, 2024 on Apr 27, 2024 · Hidden as resolvedshow commentMore actions- removedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on May 9, 2024 - addedS-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.
on May 9, 2024 The next-gen trait solver currently fails with:
error[E0277]: the trait bound `Bar<{closure@qq.rs:22:16: 22:19}>: Foo` is not satisfied --> qq.rs:22:16 | 22 | assert_foo(|_| ()); | ---------- ^^^^^^ the trait `Foo` is not implemented for `Bar<{closure@qq.rs:22:16: 22:19}>` | | | required by a bound introduced by this call | = help: the trait `Foo` is implemented for `Bar<F>` note: required by a bound in `assert_foo` --> qq.rs:17:13 | 15 | fn assert_foo<F>(_: F) | ---------- required by a bound in this function 16 | where 17 | Bar<F>: Foo, | ^^^ required by this bound in `assert_foo`Meaning it doesn't ICE.
- addedA-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-trait-systemArea: Trait systemArea: Trait systemfixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)
on Sep 24, 2024 - marked ICE: error from fully_perform, with HRTB on GAT #136666 as a duplicate of this issue
on Oct 5, 2026 - added a commit that references this issue
on Oct 5, 2026 - added a commit that references this issue
on Oct 8, 2026
Metadata
Metadata
Assignees
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.T-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.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.
Credits to @kvverti for finding the following ICE while experimenting with some of my code that was producing HRTB-related errors.
Code
Meta
rustc --version --verbose:Error output
Command:
cargo buildBacktrace
Notes
The code compiles successfully if the closure is explicitly typed like so:
Or if an identify function is used like so:
My original code produces an error (not ICE) that seems to be a diagnostics bug, complaining about trait bounds not being satisfied when it should really state something along the lines of
implementation of FnMut is not general enough.An MRE is provided below.
Original code and error