Skip to content

ICE: None in compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs #114423

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

struct RGB {
    g: f64,
    b: f64,
}

fn main() {
    let (r, alone_in_path, b): (f32, f32, f32) = (e.clone(), e.clone());
    let _ = RGB { r, g, b };
}

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (fcf3006e0 2023-08-03)
binary: rustc
commit-hash: fcf3006e0133365ecd26894689c086387edcbecb
commit-date: 2023-08-03
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Error output

error[E0425]: cannot find value `e` in this scope
 --> treereduce.out:7:51
  |
7 |     let (r, alone_in_path, b): (f32, f32, f32) = (e.clone(), e.clone());
  |                                                   ^ not found in this scope

error[E0425]: cannot find value `e` in this scope
 --> treereduce.out:7:62
  |
7 |     let (r, alone_in_path, b): (f32, f32, f32) = (e.clone(), e.clone());
  |                                                              ^ not found in this scope

error[E0425]: cannot find value `g` in this scope
 --> treereduce.out:8:22
  |
8 |     let _ = RGB { r, g, b };
  |                      ^ help: a local variable with a similar name exists: `b`

error[E0308]: mismatched types
 --> treereduce.out:7:50
  |
7 |     let (r, alone_in_path, b): (f32, f32, f32) = (e.clone(), e.clone());
  |                                ---------------   ^^^^^^^^^^^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 2 elements
  |                                |
  |                                expected due to this
  |
  = note: expected tuple `(f32, f32, f32)`
             found tuple `(f32, f32)`

error[E0560]: struct `RGB` has no field named `r`
 --> treereduce.out:8:19
  |
8 |     let _ = RGB { r, g, b };
  |                   ^ `RGB` does not have this field
  |
  = note: all struct fields are already assigned
Backtrace


thread 'rustc' panicked at compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:1612:67:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7f9ad456319c - std::backtrace_rs::backtrace::libunwind::trace::h63bb23e9dd9d0f13
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9ad456319c - std::backtrace_rs::backtrace::trace_unsynchronized::h15eabfca85a40e74
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9ad456319c - std::sys_common::backtrace::_print_fmt::hf0c7b8002dbb638c
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f9ad456319c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf11a95c6d431836f
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9ad45c989c - core::fmt::rt::Argument::fmt::h15de052cc2ee80f2
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/core/src/fmt/rt.rs:138:9
   5:     0x7f9ad45c989c - core::fmt::write::h297aea74590c27b8
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f9ad455590e - std::io::Write::write_fmt::hdd9207bc895694ae
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/io/mod.rs:1714:15
   7:     0x7f9ad4562f85 - std::sys_common::backtrace::_print::hf5af2b088c0bb2dc
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f9ad4562f85 - std::sys_common::backtrace::print::ha8ca06c086ae5d11
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f9ad45660da - std::panicking::panic_hook_with_disk_dump::{{closure}}::h87259dc27362a87b
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/panicking.rs:278:22
  10:     0x7f9ad4565d73 - std::panicking::panic_hook_with_disk_dump::h213c181176413b01
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/panicking.rs:312:9
  11:     0x7f9ad7819669 - <rustc_driver_impl[48833e2cf35ff341]::install_ice_hook::{closure#0} as core[d518b4b6aca24807]::ops::function::FnOnce<(&core[d518b4b6aca24807]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7f9ad4566980 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hf02ba24503119f1e
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/alloc/src/boxed.rs:2021:9
  13:     0x7f9ad4566980 - std::panicking::rust_panic_with_hook::he3f35d9a4da09197
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/panicking.rs:733:13
  14:     0x7f9ad45666c1 - std::panicking::begin_panic_handler::{{closure}}::h1da43fd6513fbaa9
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/panicking.rs:619:13
  15:     0x7f9ad45636d6 - std::sys_common::backtrace::__rust_end_short_backtrace::ha82571f41bc683b1
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7f9ad4566452 - rust_begin_unwind
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/panicking.rs:617:5
  17:     0x7f9ad45c5c53 - core::panicking::panic_fmt::h7e0e7d3421fec8c6
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/core/src/panicking.rs:67:14
  18:     0x7f9ad45c5ce3 - core::panicking::panic::h5cac734708e516f7
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/core/src/panicking.rs:117:5
  19:     0x7f9ad7ad4521 - <&mut <rustc_hir_typeck[ea3bd8b2e77d4ed7]::fn_ctxt::FnCtxt>::note_type_is_not_clone_inner_expr::{closure#1} as core[d518b4b6aca24807]::ops::function::FnOnce<((usize, &rustc_hir[3abc18155a11be14]::hir::Pat),)>>::call_once
  20:     0x7f9ad79f7e54 - <rustc_hir_typeck[ea3bd8b2e77d4ed7]::fn_ctxt::FnCtxt>::note_type_is_not_clone_inner_expr
  21:     0x7f9ad79d77df - <rustc_hir_typeck[ea3bd8b2e77d4ed7]::fn_ctxt::FnCtxt>::emit_coerce_suggestions
  22:     0x7f9ad5b82964 - <rustc_hir_typeck[ea3bd8b2e77d4ed7]::fn_ctxt::FnCtxt>::demand_coerce_diag
  23:     0x7f9ad5b7dc2e - <rustc_hir_typeck[ea3bd8b2e77d4ed7]::fn_ctxt::FnCtxt>::check_expr_struct_fields
  24:     0x7f9ad5b004eb - <rustc_hir_typeck[ea3bd8b2e77d4ed7]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  25:     0x7f9ad5b42669 - <rustc_hir_typeck[ea3bd8b2e77d4ed7]::fn_ctxt::FnCtxt>::check_decl
  26:     0x7f9ad5b3db1f - <rustc_hir_typeck[ea3bd8b2e77d4ed7]::fn_ctxt::FnCtxt>::check_block_with_expected
  27:     0x7f9ad5afe5e8 - <rustc_hir_typeck[ea3bd8b2e77d4ed7]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28:     0x7f9ad6228dc6 - <rustc_hir_typeck[ea3bd8b2e77d4ed7]::fn_ctxt::FnCtxt>::check_return_expr
  29:     0x7f9ad621f66c - rustc_hir_typeck[ea3bd8b2e77d4ed7]::check::check_fn
  30:     0x7f9ad620dfca - rustc_hir_typeck[ea3bd8b2e77d4ed7]::typeck
  31:     0x7f9ad584f23e - rustc_query_impl[8b4b153c5b7de6d8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8b4b153c5b7de6d8]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[285106c4fd623be0]::query::erase::Erased<[u8; 8usize]>>
  32:     0x7f9ad584f20e - <rustc_query_impl[8b4b153c5b7de6d8]::query_impl::typeck::dynamic_query::{closure#2} as core[d518b4b6aca24807]::ops::function::FnOnce<(rustc_middle[285106c4fd623be0]::ty::context::TyCtxt, rustc_span[313c88adb0f8cb98]::def_id::LocalDefId)>>::call_once
  33:     0x7f9ad599914d - rustc_query_system[8aad6b4165079392]::query::plumbing::try_execute_query::<rustc_query_impl[8b4b153c5b7de6d8]::DynamicConfig<rustc_query_system[8aad6b4165079392]::query::caches::VecCache<rustc_span[313c88adb0f8cb98]::def_id::LocalDefId, rustc_middle[285106c4fd623be0]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[8b4b153c5b7de6d8]::plumbing::QueryCtxt, false>
  34:     0x7f9ad71949bf - rustc_query_impl[8b4b153c5b7de6d8]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7f9ad6c96492 - rustc_data_structures[5645b6611bae9a6e]::sync::par_for_each_in::<&[rustc_span[313c88adb0f8cb98]::def_id::LocalDefId], <rustc_middle[285106c4fd623be0]::hir::map::Map>::par_body_owners<rustc_hir_analysis[d7fd81714635dce8]::check_crate::{closure#7}>::{closure#0}>
  36:     0x7f9ad6c9549a - rustc_hir_analysis[d7fd81714635dce8]::check_crate
  37:     0x7f9ad6c8fc3a - rustc_interface[f068b61f52e6f5de]::passes::analysis
  38:     0x7f9ad6d021da - rustc_query_impl[8b4b153c5b7de6d8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8b4b153c5b7de6d8]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[285106c4fd623be0]::query::erase::Erased<[u8; 1usize]>>
  39:     0x7f9ad6d021c9 - <rustc_query_impl[8b4b153c5b7de6d8]::query_impl::analysis::dynamic_query::{closure#2} as core[d518b4b6aca24807]::ops::function::FnOnce<(rustc_middle[285106c4fd623be0]::ty::context::TyCtxt, ())>>::call_once
  40:     0x7f9ad6ea9d28 - rustc_query_system[8aad6b4165079392]::query::plumbing::try_execute_query::<rustc_query_impl[8b4b153c5b7de6d8]::DynamicConfig<rustc_query_system[8aad6b4165079392]::query::caches::SingleCache<rustc_middle[285106c4fd623be0]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[8b4b153c5b7de6d8]::plumbing::QueryCtxt, false>
  41:     0x7f9ad6ea9ab7 - rustc_query_impl[8b4b153c5b7de6d8]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7f9ad6a66155 - <rustc_middle[285106c4fd623be0]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[48833e2cf35ff341]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[d518b4b6aca24807]::result::Result<(), rustc_span[313c88adb0f8cb98]::ErrorGuaranteed>>
  43:     0x7f9ad6a65782 - <rustc_interface[f068b61f52e6f5de]::interface::Compiler>::enter::<rustc_driver_impl[48833e2cf35ff341]::run_compiler::{closure#1}::{closure#2}, core[d518b4b6aca24807]::result::Result<core[d518b4b6aca24807]::option::Option<rustc_interface[f068b61f52e6f5de]::queries::Linker>, rustc_span[313c88adb0f8cb98]::ErrorGuaranteed>>
  44:     0x7f9ad6a5e858 - std[bb7e30dda1331a7f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f068b61f52e6f5de]::util::run_in_thread_pool_with_globals<rustc_interface[f068b61f52e6f5de]::interface::run_compiler<core[d518b4b6aca24807]::result::Result<(), rustc_span[313c88adb0f8cb98]::ErrorGuaranteed>, rustc_driver_impl[48833e2cf35ff341]::run_compiler::{closure#1}>::{closure#0}, core[d518b4b6aca24807]::result::Result<(), rustc_span[313c88adb0f8cb98]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d518b4b6aca24807]::result::Result<(), rustc_span[313c88adb0f8cb98]::ErrorGuaranteed>>
  45:     0x7f9ad6a5dfde - <<std[bb7e30dda1331a7f]::thread::Builder>::spawn_unchecked_<rustc_interface[f068b61f52e6f5de]::util::run_in_thread_pool_with_globals<rustc_interface[f068b61f52e6f5de]::interface::run_compiler<core[d518b4b6aca24807]::result::Result<(), rustc_span[313c88adb0f8cb98]::ErrorGuaranteed>, rustc_driver_impl[48833e2cf35ff341]::run_compiler::{closure#1}>::{closure#0}, core[d518b4b6aca24807]::result::Result<(), rustc_span[313c88adb0f8cb98]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d518b4b6aca24807]::result::Result<(), rustc_span[313c88adb0f8cb98]::ErrorGuaranteed>>::{closure#1} as core[d518b4b6aca24807]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  46:     0x7f9ad4571125 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4bfeeb62bde7cabd
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/alloc/src/boxed.rs:2007:9
  47:     0x7f9ad4571125 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2e1d2bae8df88d22
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/alloc/src/boxed.rs:2007:9
  48:     0x7f9ad4571125 - std::sys::unix::thread::Thread::new::thread_start::h11377e8ae9be0f28
                               at /rustc/8131b9774ebcb6c162fcac71545a13543ec369e7/library/std/src/sys/unix/thread.rs:108:17
  49:     0x7f9ad430244b - <unknown>
  50:     0x7f9ad4385e40 - <unknown>
  51:                0x0 - <unknown>

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 attach the file at `/tmp/im/rustc-ice-2023-08-03T15:19:28.644115224Z-1337863.txt` to your bug report

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0308, E0425, E0560.
For more information about an error, try `rustc --explain E0308`.
/tmp/im took 330ms
at 17:19:28 ❯
/tmp/im
at 17:20:35 ❯ treereduce-rust   --passes=10  --min-reduction=10 --interesting-exit-code=101 --source /home/matthias/vcs/github/rust_codegen_grouped/tests/ui/suggestions/icemaker/89176AA59689E7ADD3B0D81AF0C13F399D27555948D80C0657AD6183D75B8230.rs  -- ~/.rustup/toolchains/master/bin/rustc @@.rs
/tmp/im
at 17:20:43 ❯ ~/.rustup/toolchains/master/bin/rustc --version --verbose
rustc 1.73.0-nightly (fcf3006e0 2023-08-03)
binary: rustc
commit-hash: fcf3006e0133365ecd26894689c086387edcbecb
commit-date: 2023-08-03
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions