Skip to content
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

ice: miri: aggregate_field_path_elem: got non-aggregate type CoroutineClosure #120946

Closed
matthiaskrgr opened this issue Feb 11, 2024 · 7 comments · Fixed by #120950
Closed

ice: miri: aggregate_field_path_elem: got non-aggregate type CoroutineClosure #120946

matthiaskrgr opened this issue Feb 11, 2024 · 7 comments · Fixed by #120950
Assignees
Labels
A-miri Area: The miri tool C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

// edition:2021
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

#![feature(async_closure, noop_waker, async_fn_traits)]

use std::future::Future;
use std::ops::{AsyncFnMut, AsyncFnOnce};
use std::pin::pin;
use std::task::*;

pub fn block_on<T>(fut: impl Future<Output = T>) -> T {
    let mut fut = pin!(fut);
    let ctx = &mut Context::from_waker(Waker::noop());

    loop {
        match fut.as_mut().poll(ctx) {
            Poll::Pending => {}
            Poll::Ready(t) => break t,
        }
    }
}

async fn call_mut(f: &mut impl AsyncFnMut(i32)) {
    f(0).await;
}

async fn call_once(f: impl AsyncFnOnce(i32)) {
    f(1).await;
}

// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}.coroutine_closure_by_move.0.mir
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}.coroutine_closure_by_mut.0.mir
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.coroutine_by_mut.0.mir
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.coroutine_by_move.0.mir
pub fn main() {
    block_on(async {
        let b = 2i32;
        let mut async_closure = async move |a: i32| {
            let a = &a;
            let b = &b;
        };
        call_mut(&mut async_closure).await;
        call_once(async_closure).await;
    });
}

Meta

rustc --version --verbose:

miri 0.1.0 (6cc4843 2024-02-10)

Error output

<output>
Backtrace

Preparing a sysroot for Miri (target: x86_64-unknown-linux-gnu)... done
WARNING: Ignoring `RUSTC_WRAPPER` environment variable, Miri does not support wrapping.
   Compiling mirice v0.1.0 (/tmp/im/mirice)
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
     Running `/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri runner target/miri/x86_64-unknown-linux-gnu/debug/mirice`
warning: unused variable: `a`
  --> src/main.rs:40:17
   |
40 |             let a = &a;
   |                 ^ help: if this is intentional, prefix it with an underscore: `_a`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `b`
  --> src/main.rs:41:17
   |
41 |             let b = &b;
   |                 ^ help: if this is intentional, prefix it with an underscore: `_b`

error: internal compiler error: /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/compiler/rustc_const_eval/src/interpret/validity.rs:292:18: aggregate_field_path_elem: got non-aggregate type CoroutineClosure(DefId(0:17 ~ mirice[9343]::main::{closure#0}::{closure#0}), [i8, Binder(extern "RustCall" fn(std::future::ResumeTy, (i32,)) -> ((), ()), []), (i32,), Binder(fn() -> (&ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) i32,), [Region(BrAnon)]), CoroutineWitness(DefId(0:18 ~ mirice[9343]::main::{closure#0}::{closure#0}::{closure#0}), [])])

thread 'rustc' panicked at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/compiler/rustc_errors/src/lib.rs:929:30:
Box<dyn Any>
stack backtrace:
   0:     0x7fb448a0b936 - std::backtrace_rs::backtrace::libunwind::trace::hce337a0fd0c5e1da
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fb448a0b936 - std::backtrace_rs::backtrace::trace_unsynchronized::hbc9b4a5cec9b81eb
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb448a0b936 - std::sys_common::backtrace::_print_fmt::habe453adcd959f3b
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7fb448a0b936 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h67bb2d10ecb8af10
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fb448a5e380 - core::fmt::rt::Argument::fmt::hd5debad710e176b4
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/core/src/fmt/rt.rs:142:9
   5:     0x7fb448a5e380 - core::fmt::write::h5987d5bee25e3bd6
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fb4489ff0ef - std::io::Write::write_fmt::h0876e0f4bddb923c
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/io/mod.rs:1854:15
   7:     0x7fb448a0b714 - std::sys_common::backtrace::_print::h4ae69e83d64cbf46
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fb448a0b714 - std::sys_common::backtrace::print::h1d97d5831d0262fb
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fb448a0e4d7 - std::panicking::default_hook::{{closure}}::h39fabb1b3e65f47a
  10:     0x7fb448a0e239 - std::panicking::default_hook::h416520d6bb2cb53f
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/panicking.rs:292:9
  11:     0x7fb4457266dc - std[3acc11fb688f3d76]::panicking::update_hook::<alloc[408654ec2a1215fa]::boxed::Box<rustc_driver_impl[a7481a600b2f11a0]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fb448a0ec26 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h2450ecbe2b1c1ea3
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/alloc/src/boxed.rs:2030:9
  13:     0x7fb448a0ec26 - std::panicking::rust_panic_with_hook::h99ef5cbc4b3b0ae4
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/panicking.rs:785:13
  14:     0x7fb445758034 - std[3acc11fb688f3d76]::panicking::begin_panic::<rustc_errors[1a010a4816a218fe]::ExplicitBug>::{closure#0}
  15:     0x7fb445754726 - std[3acc11fb688f3d76]::sys_common::backtrace::__rust_end_short_backtrace::<std[3acc11fb688f3d76]::panicking::begin_panic<rustc_errors[1a010a4816a218fe]::ExplicitBug>::{closure#0}, !>
  16:     0x7fb44574fe56 - std[3acc11fb688f3d76]::panicking::begin_panic::<rustc_errors[1a010a4816a218fe]::ExplicitBug>
  17:     0x7fb445763271 - <rustc_errors[1a010a4816a218fe]::diagnostic_builder::BugAbort as rustc_errors[1a010a4816a218fe]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7fb445b1a16e - <rustc_errors[1a010a4816a218fe]::DiagCtxt>::bug::<alloc[408654ec2a1215fa]::string::String>
  19:     0x7fb445bb505b - rustc_middle[9f94bb95ba4eb693]::util::bug::opt_span_bug_fmt::<rustc_span[4a89bdba9678f8e0]::span_encoding::Span>::{closure#0}
  20:     0x7fb445b9c2ea - rustc_middle[9f94bb95ba4eb693]::ty::context::tls::with_opt::<rustc_middle[9f94bb95ba4eb693]::util::bug::opt_span_bug_fmt<rustc_span[4a89bdba9678f8e0]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fb445b9c188 - rustc_middle[9f94bb95ba4eb693]::ty::context::tls::with_context_opt::<rustc_middle[9f94bb95ba4eb693]::ty::context::tls::with_opt<rustc_middle[9f94bb95ba4eb693]::util::bug::opt_span_bug_fmt<rustc_span[4a89bdba9678f8e0]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fb443b8f9e0 - rustc_middle[9f94bb95ba4eb693]::util::bug::bug_fmt
  23:     0x5557bd9cd04a - <rustc_const_eval[12fc7f34b1bb2601]::interpret::validity::ValidityVisitor<miri[827b2b8b4315e2f2]::machine::MiriMachine> as rustc_const_eval[12fc7f34b1bb2601]::interpret::visitor::ValueVisitor<miri[827b2b8b4315e2f2]::machine::MiriMachine>>::visit_field
  24:     0x5557bd9ce2c8 - <rustc_const_eval[12fc7f34b1bb2601]::interpret::validity::ValidityVisitor<miri[827b2b8b4315e2f2]::machine::MiriMachine> as rustc_const_eval[12fc7f34b1bb2601]::interpret::visitor::ValueVisitor<miri[827b2b8b4315e2f2]::machine::MiriMachine>>::visit_value
  25:     0x5557bd9a998a - <rustc_const_eval[12fc7f34b1bb2601]::interpret::eval_context::InterpCx<miri[827b2b8b4315e2f2]::machine::MiriMachine>>::validate_operand_internal
  26:     0x5557bd99ce8f - <rustc_const_eval[12fc7f34b1bb2601]::interpret::eval_context::InterpCx<miri[827b2b8b4315e2f2]::machine::MiriMachine>>::eval_rvalue_into_place
  27:     0x5557bda18ff3 - <rustc_const_eval[12fc7f34b1bb2601]::interpret::eval_context::InterpCx<miri[827b2b8b4315e2f2]::machine::MiriMachine> as miri[827b2b8b4315e2f2]::concurrency::thread::EvalContextExt>::run_threads
  28:     0x5557bda2a514 - miri[827b2b8b4315e2f2]::eval::eval_entry
  29:     0x5557bd86c693 - <miri[93aa4a3be542fe23]::MiriCompilerCalls as rustc_driver_impl[a7481a600b2f11a0]::Callbacks>::after_analysis
  30:     0x7fb44773a5ba - rustc_interface[57a4cb1189ffa880]::interface::run_compiler::<core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>, rustc_driver_impl[a7481a600b2f11a0]::run_compiler::{closure#0}>::{closure#0}
  31:     0x7fb4477d2b46 - std[3acc11fb688f3d76]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[57a4cb1189ffa880]::util::run_in_thread_with_globals<rustc_interface[57a4cb1189ffa880]::util::run_in_thread_pool_with_globals<rustc_interface[57a4cb1189ffa880]::interface::run_compiler<core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>, rustc_driver_impl[a7481a600b2f11a0]::run_compiler::{closure#0}>::{closure#0}, core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>>::{closure#0}, core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>>
  32:     0x7fb4477d2973 - <<std[3acc11fb688f3d76]::thread::Builder>::spawn_unchecked_<rustc_interface[57a4cb1189ffa880]::util::run_in_thread_with_globals<rustc_interface[57a4cb1189ffa880]::util::run_in_thread_pool_with_globals<rustc_interface[57a4cb1189ffa880]::interface::run_compiler<core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>, rustc_driver_impl[a7481a600b2f11a0]::run_compiler::{closure#0}>::{closure#0}, core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>>::{closure#0}, core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>>::{closure#1} as core[8df037f8ced6ea1f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  33:     0x7fb448a17eb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h61e4d902e063b23d
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/alloc/src/boxed.rs:2016:9
  34:     0x7fb448a17eb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfa3eaf4f75275f59
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/alloc/src/boxed.rs:2016:9
  35:     0x7fb448a17eb5 - std::sys::pal::unix::thread::Thread::new::thread_start::hb901d27f412b0ecd
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/sys/pal/unix/thread.rs:108:17
  36:     0x7fb4427bd9eb - <unknown>
  37:     0x7fb4428417cc - <unknown>
  38:                0x0 - <unknown>

note: we would appreciate a bug report: https://github.com/rust-lang/miri/issues/new

note: please attach the file at `/tmp/im/mirice/rustc-ice-2024-02-11T21_09_07-2228199.txt` to your bug report

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -C target-cpu=native

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

Miri caused an ICE during evaluation. Here's the interpreter backtrace at the time of the panic:
note: the place in the program where the ICE was triggered
  --> src/main.rs:44:19
   |
44 |         call_once(async_closure).await;
   |                   ^^^^^^^^^^^^^
   |
   = note: inside closure at src/main.rs:44:19: 44:32
note: inside `block_on::<(), {async block@src/main.rs:37:14: 45:6}>`
  --> src/main.rs:17:15
   |
17 |         match fut.as_mut().poll(ctx) {
   |               ^^^^^^^^^^^^^^^^^^^^^^
note: inside `main`
  --> src/main.rs:37:5
   |
37 | /     block_on(async {
38 | |         let b = 2i32;
39 | |         let mut async_closure = async move |a: i32| {
40 | |             let a = &a;
...  |
44 | |         call_once(async_closure).await;
45 | |     });
   | |______^
   = note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5: 250:71
   = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:155:18: 155:21
   = note: inside closure at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:166:18: 166:82
   = note: inside `std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:284:13: 284:31
   = note: inside `std::panicking::r#try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:554:40: 554:43
   = note: inside `std::panicking::r#try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:518:19: 518:81
   = note: inside `std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:142:14: 142:33
   = note: inside closure at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:148:48: 148:73
   = note: inside `std::panicking::r#try::do_call::<{closure@std::rt::lang_start_internal::{closure#2}}, isize>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:554:40: 554:43
   = note: inside `std::panicking::r#try::<isize, {closure@std::rt::lang_start_internal::{closure#2}}>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:518:19: 518:81
   = note: inside `std::panic::catch_unwind::<{closure@std::rt::lang_start_internal::{closure#2}}, isize>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:142:14: 142:33
   = note: inside `std::rt::lang_start_internal` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:148:20: 148:98
   = note: inside `std::rt::lang_start::<()>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:165:17: 170:6

error: aborting due to 1 previous error; 2 warnings emitted

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Feb 11, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 11, 2024
@matthiaskrgr
Copy link
Member Author

bit smaller:

#![feature(async_closure, noop_waker, async_fn_traits)]

use std::future::Future;
use std::ops::AsyncFnOnce;
use std::pin::pin;
use std::task::*;

pub fn block_on<T>(fut: impl Future<Output = T>) -> T {
    let mut fut = pin!(fut);
    let ctx = &mut Context::from_waker(Waker::noop());

    loop {
        match fut.as_mut().poll(ctx) {
            Poll::Pending => {}
            Poll::Ready(t) => break t,
        }
    }
}

async fn call_once(f: impl AsyncFnOnce(i32)) {
    f(1).await;
}


pub fn main() {
    block_on(async {
        let b = 2i32;
        let mut async_closure = async move |_| {
            let b = &b;
        };
        call_once(async_closure).await;
    });
}

cc @rust-lang/miri

@matthiaskrgr matthiaskrgr added the A-miri Area: The miri tool label Feb 11, 2024
@RalfJung
Copy link
Member

RalfJung commented Feb 11, 2024

Yeah we have special support for Coroutines and Closures in this logic:

// coroutines and closures.
ty::Closure(def_id, _) | ty::Coroutine(def_id, _) => {

And it seems now we have a new similar kind of unnamed ADT that needs similar support. @compiler-errors How similar is it to Coroutines and Closures, can it reuse the exact same logic? In particular, will closure_captures give a sensible result?

Maybe it'd make sense to group these in one TyKind to they can be treated together where appropriate?

@RalfJung
Copy link
Member

Hm, why is there a function that says "closure or coroutine" that only checks for closures?

pub fn is_closure_or_coroutine(self, def_id: DefId) -> bool {
matches!(self.def_kind(def_id), DefKind::Closure)
}

Or does DefKind::Closure also include coroutines? It doesn't have a doc comment that would say so. Does it include CoroutineClosure as well?

@matthiaskrgr
Copy link
Member Author

shorter sample from tests/codegen/async-closure-debug.rs

#![feature(async_closure)]

fn async_closure_test(upvar: &str) -> impl async Fn() + '_ {
    async move || {
        let hello = String::from("hello");
        println!("{hello}, {upvar}");
    }
}

fn main() {
    let _async_closure = async_closure_test("world");
}

@RalfJung
Copy link
Member

Yeah #120361 didn't add Miri tests so I am not surprised that it is broken.

@compiler-errors
Copy link
Member

@RalfJung:

Maybe it'd make sense to group these in one TyKind to they can be treated together where appropriate?

They are extremely different (they have different substs, have different layouts, different traits are implemented for them), and it would be very confusing to group them into one TyKind.

Or does DefKind::Closure also include coroutines? It doesn't have a doc comment that would say so.

Yes, this was recently done by @bvanjoi and @petrochenkov, I believe. The reason behind this is that they are all expressed in the HIR (and earlier in the AST) as the same construct hir::ExprKind::Closure, and the DefCollector that assigns DefIds cannot not distinguish them.

Does it include CoroutineClosure as well?

Yes, it does. I can make that change to clarify the function behavior.

@compiler-errors compiler-errors self-assigned this Feb 11, 2024
@RalfJung
Copy link
Member

Yes, this was recently done by @bvanjoi and @petrochenkov, I believe. The reason behind this is that they are all expressed in the HIR (and earlier in the AST) as the same construct hir::ExprKind::Closure, and the DefCollector that assigns DefIds cannot not distinguish them.

Okay. Would be good to document this in the DefKind definition then, the current situation is quite confusing.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 12, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 12, 2024
…, r=RalfJung,oli-obk

Fix async closures in CTFE

First commit renames `is_coroutine_or_closure` into `is_closure_like`, because `is_coroutine_or_closure_or_coroutine_closure` seems confusing and long.

Second commit fixes some forgotten cases where we want to handle `TyKind::CoroutineClosure` the same as closures and coroutines.

The test exercises the change to `ValidityVisitor::aggregate_field_path_elem` which is the source of rust-lang#120946, but not the change to `UsedParamsNeedSubstVisitor`, though I feel like it's not that big of a deal. Let me know if you'd like for me to look into constructing a test for the latter, though I have no idea what it'd look like (we can't assert against `TooGeneric` anywhere?).

Fixes rust-lang#120946

r? oli-obk cc `@RalfJung`
@bors bors closed this as completed in 15896bd Feb 13, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 13, 2024
Rollup merge of rust-lang#120950 - compiler-errors:miri-async-closurs, r=RalfJung,oli-obk

Fix async closures in CTFE

First commit renames `is_coroutine_or_closure` into `is_closure_like`, because `is_coroutine_or_closure_or_coroutine_closure` seems confusing and long.

Second commit fixes some forgotten cases where we want to handle `TyKind::CoroutineClosure` the same as closures and coroutines.

The test exercises the change to `ValidityVisitor::aggregate_field_path_elem` which is the source of rust-lang#120946, but not the change to `UsedParamsNeedSubstVisitor`, though I feel like it's not that big of a deal. Let me know if you'd like for me to look into constructing a test for the latter, though I have no idea what it'd look like (we can't assert against `TooGeneric` anywhere?).

Fixes rust-lang#120946

r? oli-obk cc ``@RalfJung``
flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 26, 2024
…, r=RalfJung,oli-obk

Fix async closures in CTFE

First commit renames `is_coroutine_or_closure` into `is_closure_like`, because `is_coroutine_or_closure_or_coroutine_closure` seems confusing and long.

Second commit fixes some forgotten cases where we want to handle `TyKind::CoroutineClosure` the same as closures and coroutines.

The test exercises the change to `ValidityVisitor::aggregate_field_path_elem` which is the source of rust-lang#120946, but not the change to `UsedParamsNeedSubstVisitor`, though I feel like it's not that big of a deal. Let me know if you'd like for me to look into constructing a test for the latter, though I have no idea what it'd look like (we can't assert against `TooGeneric` anywhere?).

Fixes rust-lang#120946

r? oli-obk cc ``@RalfJung``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-miri Area: The miri tool C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants