Skip to content

attempted to read from stolen value: rustc_middle::mir::Body #130316

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

Closed
aWeinzierl opened this issue Sep 13, 2024 · 2 comments
Closed

attempted to read from stolen value: rustc_middle::mir::Body #130316

aWeinzierl opened this issue Sep 13, 2024 · 2 comments
Labels
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

@aWeinzierl
Copy link

aWeinzierl commented Sep 13, 2024

Code

cargo-features = ["edition2024"]

[package]
name = "app"
version = "0.1.0"
edition = "2024"

[dependencies]
iced = { git = "https://github.com/iced-rs/iced" }
matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk" }
#![feature(async_closure)]
use iced::{widget::Container, Task};    
use matrix_sdk::Client;
pub type Message = ();

fn main() -> iced::Result {
    iced::application("", App::update, App::view)
        .run_with(App::new)
}
struct App{}
impl App {
    fn new() -> (Self, Task<Message>) { (Self {}, Task::none()) }
    fn update(&mut self, _: Message) -> Task<Message> {
        let name: String = "".into();
        return Task::perform( async move || -> () {
                let client = Client::builder()
                    .server_name_or_homeserver_url(name)
                    .build()
                    .await;
                ()
            } ()
            , |_|()
        );
    }
    fn view(&self) -> iced::Element<Message> {
        Container::new("").into()
    }
}

Meta

rustc --version --verbose:

rustc 1.83.0-nightly (adaff5368 2024-09-12)
binary: rustc
commit-hash: adaff5368b0c7b328a0320a218751d65ab1bba97
commit-date: 2024-09-12
host: x86_64-pc-windows-msvc
release: 1.83.0-nightly
LLVM version: 19.1.0

Error output

thread 'rustc' panicked at compiler\rustc_mir_transform\src\coroutine\by_move_body.rs:89:48:
attempted to read from stolen value: rustc_middle::mir::Body
stack backtrace:  <see below>
error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `C:\Users\andre\Git\app\rustc-ice-2024-09-13T18_07_22-3376.txt` to your bug report

note: compiler flags: -Z unstable-options --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
#0 [coroutine_by_move_body_def_id] looking up the coroutine by-move body for `<impl at src/main.rs:11:1: 11:9>::update::{closure#0}::{closure#0}`
#1 [mir_shims] generating MIR shim for `core::ptr::drop_in_place`
#2 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `app` (bin "app")

Caused by:
  process didn't exit successfully: `C:\Users\andre\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\rustc.exe --crate-name app --edition=2024 -Z unstable-options src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=119 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg cfg(docsrs) --check-cfg "cfg(feature, values())" -C metadata=fad473a2eb870f7b --out-dir C:\Users\andre\Git\app\target\debug\deps -C incremental=C:\Users\andre\Git\app\target\debug\incremental -L dependency=C:\Users\andre\Git\app\target\debug\deps --extern iced=C:\Users\andre\Git\app\target\debug\deps\libiced-2cc65eb3aeb7fd49.rlib --extern matrix_sdk=C:\Users\andre\Git\app\target\debug\deps\libmatrix_sdk-3970ce14a5f243bb.rlib -L native=C:\Users\andre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows_x86_64_msvc-0.52.6\lib -L native=C:\Users\andre\Git\app\target\debug\build\blake3-5142136ff73ba3d7\out -L native=C:\Users\andre\Git\app\target\debug\build\blake3-5142136ff73ba3d7\out` (exit code: 101)
Backtrace

   0: std::panicking::begin_panic_handler
             at /rustc/adaff5368b0c7b328a0320a218751d65ab1bba97\library/std\src\panicking.rs:665
   1: core::panicking::panic_fmt
             at /rustc/adaff5368b0c7b328a0320a218751d65ab1bba97\library/core\src\panicking.rs:74
   2: <rustc_monomorphize::polymorphize::MarkUsedGenericParams as rustc_type_ir::visit::TypeVisitor<rustc_middle::ty::context::TyCtxt>>::visit_ty
   3: rustc_mir_transform::coroutine::by_move_body::coroutine_by_move_body_def_id
   4: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::depth_limit_error
   5: rustc_ty_utils::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
   6: <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string
   7: rustc_monomorphize::polymorphize::unused_generic_params
   8: <rustc_mir_transform::validate::Validator as rustc_mir_transform::pass_manager::MirPass>::run_pass
   9: <rustc_mir_transform::validate::Validator as rustc_mir_transform::pass_manager::MirPass>::run_pass
  10: <rustc_mir_transform::simplify::SimplifyCfg as rustc_mir_transform::pass_manager::MirPass>::run_pass
  11: rustc_mir_transform::shim::make_shim
  12: <dyn std::io::Write as nu_ansi_term::write::AnyWrite>::write_str
  13: <dyn std::io::Write as nu_ansi_term::write::AnyWrite>::write_str
  14: <dyn std::io::Write as nu_ansi_term::write::AnyWrite>::write_str
  15: rustc_ty_utils::ty::adt_sized_constraint
  16: rustc_query_impl::query_system
  17: <rustc_middle::ty::context::TyCtxt>::instance_mir
  18: rustc_monomorphize::polymorphize::unused_generic_params
  19: rustc_monomorphize::polymorphize::unused_generic_params
  20: rustc_monomorphize::polymorphize::unused_generic_params
  21: rustc_monomorphize::polymorphize::unused_generic_params
  22: rustc_monomorphize::polymorphize::unused_generic_params
  23: rustc_monomorphize::polymorphize::unused_generic_params
  24: rustc_monomorphize::polymorphize::unused_generic_params
  25: rustc_monomorphize::polymorphize::unused_generic_params
  26: rustc_monomorphize::polymorphize::unused_generic_params
  27: rustc_monomorphize::polymorphize::unused_generic_params
  28: rustc_monomorphize::polymorphize::unused_generic_params
  29: rustc_monomorphize::polymorphize::unused_generic_params
  30: rustc_monomorphize::polymorphize::unused_generic_params
  31: rustc_monomorphize::polymorphize::unused_generic_params
  32: rustc_monomorphize::polymorphize::unused_generic_params
  33: rustc_monomorphize::polymorphize::unused_generic_params
  34: rustc_monomorphize::polymorphize::unused_generic_params
  35: rustc_monomorphize::polymorphize::unused_generic_params
  36: rustc_monomorphize::polymorphize::unused_generic_params
  37: rustc_monomorphize::polymorphize::unused_generic_params
  38: rustc_monomorphize::polymorphize::unused_generic_params
  39: rustc_monomorphize::polymorphize::unused_generic_params
  40: rustc_monomorphize::polymorphize::unused_generic_params
  41: rustc_monomorphize::polymorphize::unused_generic_params
  42: rustc_monomorphize::polymorphize::unused_generic_params
  43: rustc_monomorphize::polymorphize::unused_generic_params
  44: rustc_monomorphize::polymorphize::unused_generic_params
  45: rustc_monomorphize::polymorphize::unused_generic_params
  46: rustc_monomorphize::polymorphize::unused_generic_params
  47: rustc_monomorphize::polymorphize::unused_generic_params
  48: rustc_monomorphize::polymorphize::unused_generic_params
  49: rustc_monomorphize::polymorphize::unused_generic_params
  50: rustc_monomorphize::polymorphize::unused_generic_params
  51: rustc_monomorphize::polymorphize::unused_generic_params
  52: rustc_monomorphize::polymorphize::unused_generic_params
  53: rustc_monomorphize::polymorphize::unused_generic_params
  54: rustc_monomorphize::polymorphize::unused_generic_params
  55: rustc_monomorphize::polymorphize::unused_generic_params
  56: rustc_monomorphize::polymorphize::unused_generic_params
  57: rustc_monomorphize::polymorphize::unused_generic_params
  58: rustc_monomorphize::partitioning::collect_and_partition_mono_items
  59: <dyn std::io::Write as nu_ansi_term::write::AnyWrite>::write_str
  60: <dyn std::io::Write as nu_ansi_term::write::AnyWrite>::write_str
  61: rustc_ty_utils::ty::adt_sized_constraint
  62: rustc_query_impl::query_system
  63: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  64: <rustc_interface::queries::Linker>::codegen_and_build_linker
  65: _rust_alloc_error_handler
  66: _rust_alloc_error_handler
  67: _rust_alloc_error_handler
  68: alloc::boxed::impl$48::call_once
             at /rustc/adaff5368b0c7b328a0320a218751d65ab1bba97\library/alloc\src\boxed.rs:2229
  69: alloc::boxed::impl$48::call_once
             at /rustc/adaff5368b0c7b328a0320a218751d65ab1bba97\library/alloc\src\boxed.rs:2229
  70: std::sys::pal::windows::thread::impl$0::new::thread_start
             at /rustc/adaff5368b0c7b328a0320a218751d65ab1bba97\library/std\src\sys\pal\windows\thread.rs:55
  71: BaseThreadInitThunk
  72: RtlUserThreadStart
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

rustc-ice-2024-09-13T18_10_53-2928.txt

Cargo.toml.txt

Additional note

During minimization the project was in a state in which removing a empty line or a line comment could introduce the internal compiler error.

@aWeinzierl aWeinzierl added 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. labels Sep 13, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 13, 2024
@kpreid
Copy link
Contributor

kpreid commented Sep 14, 2024

Might be the same as #130167.

@aWeinzierl
Copy link
Author

The error doesn't happen anymore, tested with rustc 1.83.0-nightly (da88968 2024-09-20)

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 25, 2024
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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants