-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ICE: opaque_types_defined_by
not defined for synthetic mir body
#141466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
this compiled previously seems to bisect to #128440 ? |
reproduces with other functions too, as long as they are //@ compile-flags: --edition=2021 --crate-type lib
pub fn foo() {
async || {
use std::ops::RangeInclusive;
&RangeInclusive::new((), ());
};
} |
@rustbot label: -P-high +P-medium This is very hard to hit, so I'm going to reprioritize it as medium. It doesn't really matter anyways, b/c I'll open a fix in a second anyways. |
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this issue
May 26, 2025
…ic-body, r=lcnr Support `opaque_types_defined_by` for `SyntheticCoroutineBody` We create a synthetic MIR body for the `AsyncFnOnce` impl for async closures. That body goes through all passes that a regular body does, including promotion. Promotion sometimes requires computing that the type of an rvalue is `Freeze`, which requires computing the typing env of a body. This requires calling `opaque_types_defined_by` on the body's def id, which leads to an ICE today since we don't expect that query to be called for synthetic bodies. While we could fix this by, for example, computing the typeck root of the body before calling a `TypingEnv` constructor, I think it's appropriate to do a more general fix here since I think it's reasonable that other passes might do analysis too. Fixes rust-lang#141466 r? `@lcnr` or `@oli-obk`
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
May 27, 2025
…ic-body, r=lcnr Support `opaque_types_defined_by` for `SyntheticCoroutineBody` We create a synthetic MIR body for the `AsyncFnOnce` impl for async closures. That body goes through all passes that a regular body does, including promotion. Promotion sometimes requires computing that the type of an rvalue is `Freeze`, which requires computing the typing env of a body. This requires calling `opaque_types_defined_by` on the body's def id, which leads to an ICE today since we don't expect that query to be called for synthetic bodies. While we could fix this by, for example, computing the typeck root of the body before calling a `TypingEnv` constructor, I think it's appropriate to do a more general fix here since I think it's reasonable that other passes might do analysis too. Fixes rust-lang#141466 r? ``@lcnr`` or ``@oli-obk``
rust-timer
added a commit
that referenced
this issue
May 27, 2025
Rollup merge of #141584 - compiler-errors:typing-env-synthetic-body, r=lcnr Support `opaque_types_defined_by` for `SyntheticCoroutineBody` We create a synthetic MIR body for the `AsyncFnOnce` impl for async closures. That body goes through all passes that a regular body does, including promotion. Promotion sometimes requires computing that the type of an rvalue is `Freeze`, which requires computing the typing env of a body. This requires calling `opaque_types_defined_by` on the body's def id, which leads to an ICE today since we don't expect that query to be called for synthetic bodies. While we could fix this by, for example, computing the typeck root of the body before calling a `TypingEnv` constructor, I think it's appropriate to do a more general fix here since I think it's reasonable that other passes might do analysis too. Fixes #141466 r? ```@lcnr``` or ```@oli-obk```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: