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: error was constructed but not emitted #104870

Closed
matthiaskrgr opened this issue Nov 25, 2022 · 9 comments · Fixed by #104956
Closed

ICE: error was constructed but not emitted #104870

matthiaskrgr opened this issue Nov 25, 2022 · 9 comments · Fixed by #104956
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-untriaged Untriaged performance or correctness regression. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Nov 25, 2022

Code

#![feature(cfg_target_has_atomic, no_core, intrinsics, lang_items)]
#![crate_type="rlib"]
#![no_core]

extern "rust-intrinsic" {
    fn atomic_xadd<T>(dst: *mut T, src: T) -> T;
}

#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}

#[cfg(target_has_atomic = "8")]
pub unsafe fn atomic_u8(x: *mut u8) {
    atomic_xadd(x, 1);
    atomic_xadd(x, 1);
}

rustc 1.67.0-nightly (70f8737b2 2022-11-23) :

error[E0382]: use of moved value: `x`
  --> 023f2218b87ae7e7afaf853e5d953b53363da95e.rs:27:17
   |
25 | pub unsafe fn atomic_u8(x: *mut u8) {
   |                         - move occurs because `x` has type `*mut u8`, which does not implement the `Copy` trait
26 |     atomic_xadd(x, 1);
   |                 - value moved here
27 |     atomic_xadd(x, 1);
   |                 ^ value used here after move

error: aborting due to previous error

For more information about this error, try `rustc --explain E0382`.

rustc 1.67.0-nightly (5dfb4b0af 2022-11-24):

Backtrace

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs:742:17
stack backtrace:
   0:     0x7f7a4d3662aa - std::backtrace_rs::backtrace::libunwind::trace::hb323b1c60fddca93
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f7a4d3662aa - std::backtrace_rs::backtrace::trace_unsynchronized::hc84e7bf61bca2c6e
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f7a4d3662aa - std::sys_common::backtrace::_print_fmt::h6d347369517c3499
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f7a4d3662aa - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha8becfe32371a83b
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f7a4d3c8bae - core::fmt::write::h49d04e24a4a0f5b0
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/core/src/fmt/mod.rs:1208:17
   5:     0x7f7a4d3566e5 - std::io::Write::write_fmt::h51e3e9a867946d92
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/io/mod.rs:1682:15
   6:     0x7f7a4d366075 - std::sys_common::backtrace::_print::hdca39b4597f42be8
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f7a4d366075 - std::sys_common::backtrace::print::h90a45fec0894e48c
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f7a4d368d9f - std::panicking::default_hook::{{closure}}::h33ff658e7827f9cc
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/panicking.rs:267:22
   9:     0x7f7a4d368adb - std::panicking::default_hook::h7b258e9d452b029f
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/panicking.rs:286:9
  10:     0x7f7a4d3695bc - std::panicking::rust_panic_with_hook::hf8e2608dfe7b3876
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/panicking.rs:688:13
  11:     0x7f7a4d369312 - std::panicking::begin_panic_handler::{{closure}}::hf08f8046f55d20d0
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/panicking.rs:577:13
  12:     0x7f7a4d36675c - std::sys_common::backtrace::__rust_end_short_backtrace::h156042f7f0b912a5
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x7f7a4d369062 - rust_begin_unwind
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/panicking.rs:575:5
  14:     0x7f7a4d3c55c3 - core::panicking::panic_fmt::h65ed150133999c5f
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/core/src/panicking.rs:65:14
  15:     0x7f7a4d3c569d - core::panicking::panic::h49fb44491f39587d
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/core/src/panicking.rs:114:5
  16:     0x7f7a504105e2 - <rustc_borrowck[294c6deda030de41]::MirBorrowckCtxt>::suggest_cloning
  17:     0x7f7a5040f389 - <rustc_borrowck[294c6deda030de41]::MirBorrowckCtxt>::report_use_of_moved_or_uninitialized
  18:     0x7f7a4ec6e3ea - <rustc_borrowck[294c6deda030de41]::MirBorrowckCtxt as rustc_mir_dataflow[ca8e193615b72aa8]::framework::visitor::ResultsVisitor>::visit_statement_before_primary_effect
  19:     0x7f7a4f753463 - rustc_mir_dataflow[ca8e193615b72aa8]::framework::visitor::visit_results::<rustc_borrowck[294c6deda030de41]::dataflow::BorrowckAnalyses<rustc_index[348215daae5de83b]::bit_set::BitSet<rustc_borrowck[294c6deda030de41]::dataflow::BorrowIndex>, rustc_index[348215daae5de83b]::bit_set::ChunkedBitSet<rustc_mir_dataflow[ca8e193615b72aa8]::move_paths::MovePathIndex>, rustc_index[348215daae5de83b]::bit_set::ChunkedBitSet<rustc_mir_dataflow[ca8e193615b72aa8]::move_paths::InitIndex>>, rustc_borrowck[294c6deda030de41]::dataflow::BorrowckAnalyses<rustc_mir_dataflow[ca8e193615b72aa8]::framework::engine::Results<rustc_borrowck[294c6deda030de41]::dataflow::Borrows>, rustc_mir_dataflow[ca8e193615b72aa8]::framework::engine::Results<rustc_mir_dataflow[ca8e193615b72aa8]::impls::MaybeUninitializedPlaces>, rustc_mir_dataflow[ca8e193615b72aa8]::framework::engine::Results<rustc_mir_dataflow[ca8e193615b72aa8]::impls::EverInitializedPlaces>>, core[81c431c77b3227e5]::iter::adapters::map::Map<rustc_middle[4086bdcecfc20d80]::mir::traversal::ReversePostorderIter, rustc_borrowck[294c6deda030de41]::do_mir_borrowck::{closure#2}>, rustc_borrowck[294c6deda030de41]::MirBorrowckCtxt>
  20:     0x7f7a4f72c0e7 - rustc_borrowck[294c6deda030de41]::do_mir_borrowck
  21:     0x7f7a4f71677a - rustc_borrowck[294c6deda030de41]::mir_borrowck
  22:     0x7f7a4f6aa6d9 - rustc_query_system[1ad976e1215f3964]::query::plumbing::try_execute_query::<rustc_query_impl[dee4b94ff49e365e]::plumbing::QueryCtxt, rustc_query_system[1ad976e1215f3964]::query::caches::VecCache<rustc_span[9fb21a881f0bdab2]::def_id::LocalDefId, &rustc_middle[4086bdcecfc20d80]::mir::query::BorrowCheckResult>>
  23:     0x7f7a4eb4ab82 - rustc_data_structures[ac380a40d754c2da]::sync::par_for_each_in::<&[rustc_span[9fb21a881f0bdab2]::def_id::LocalDefId], <rustc_middle[4086bdcecfc20d80]::hir::map::Map>::par_body_owners<rustc_interface[5a01d4b645e062e2]::passes::analysis::{closure#2}::{closure#0}>::{closure#0}>
  24:     0x7f7a4eb495b3 - <rustc_session[3662fe595b759729]::session::Session>::time::<(), rustc_interface[5a01d4b645e062e2]::passes::analysis::{closure#2}>
  25:     0x7f7a4eb47857 - rustc_interface[5a01d4b645e062e2]::passes::analysis
  26:     0x7f7a4fded45c - rustc_query_system[1ad976e1215f3964]::query::plumbing::try_execute_query::<rustc_query_impl[dee4b94ff49e365e]::plumbing::QueryCtxt, rustc_query_system[1ad976e1215f3964]::query::caches::DefaultCache<(), core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>>
  27:     0x7f7a4fded14b - rustc_query_system[1ad976e1215f3964]::query::plumbing::get_query::<rustc_query_impl[dee4b94ff49e365e]::queries::analysis, rustc_query_impl[dee4b94ff49e365e]::plumbing::QueryCtxt>
  28:     0x7f7a4f926f0b - <rustc_interface[5a01d4b645e062e2]::passes::QueryContext>::enter::<rustc_driver[49d0649a537a4dce]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>
  29:     0x7f7a4f91f5bf - <rustc_interface[5a01d4b645e062e2]::interface::Compiler>::enter::<rustc_driver[49d0649a537a4dce]::run_compiler::{closure#1}::{closure#2}, core[81c431c77b3227e5]::result::Result<core[81c431c77b3227e5]::option::Option<rustc_interface[5a01d4b645e062e2]::queries::Linker>, rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>
  30:     0x7f7a4f91a5d8 - rustc_span[9fb21a881f0bdab2]::with_source_map::<core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>, rustc_interface[5a01d4b645e062e2]::interface::run_compiler<core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>, rustc_driver[49d0649a537a4dce]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  31:     0x7f7a4f91a0c5 - <scoped_tls[1cce71beeef11336]::ScopedKey<rustc_span[9fb21a881f0bdab2]::SessionGlobals>>::set::<rustc_interface[5a01d4b645e062e2]::interface::run_compiler<core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>, rustc_driver[49d0649a537a4dce]::run_compiler::{closure#1}>::{closure#0}, core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>
  32:     0x7f7a4f9196b2 - std[9f362533f84673f0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5a01d4b645e062e2]::util::run_in_thread_pool_with_globals<rustc_interface[5a01d4b645e062e2]::interface::run_compiler<core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>, rustc_driver[49d0649a537a4dce]::run_compiler::{closure#1}>::{closure#0}, core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>
  33:     0x7f7a4f9193c8 - <<std[9f362533f84673f0]::thread::Builder>::spawn_unchecked_<rustc_interface[5a01d4b645e062e2]::util::run_in_thread_pool_with_globals<rustc_interface[5a01d4b645e062e2]::interface::run_compiler<core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>, rustc_driver[49d0649a537a4dce]::run_compiler::{closure#1}>::{closure#0}, core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>::{closure#1} as core[81c431c77b3227e5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7f7a5144ad93 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9b61d15b0ee557ed
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/alloc/src/boxed.rs:2000:9
  35:     0x7f7a5144ad93 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::haff1f709ebbd1677
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/alloc/src/boxed.rs:2000:9
  36:     0x7f7a5144ad93 - std::sys::unix::thread::Thread::new::thread_start::h98e69f1908d18751
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/sys/unix/thread.rs:108:17
  37:     0x7f7a4d1078fd - <unknown>
  38:     0x7f7a4d189a60 - <unknown>
  39:                0x0 - <unknown>
error: internal compiler error: the following error was constructed but not emitted

error[E0382]: use of moved value: `x`
  --> 023f2218b87ae7e7afaf853e5d953b53363da95e.rs:27:17
   |
27 |     atomic_xadd(x, 1);
   |                 ^

thread '<unnamed>' panicked at 'error was constructed but not emitted', compiler/rustc_errors/src/diagnostic_builder.rs:675:21
stack backtrace:
   0:     0x7f7a4d3662aa - std::backtrace_rs::backtrace::libunwind::trace::hb323b1c60fddca93
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f7a4d3662aa - std::backtrace_rs::backtrace::trace_unsynchronized::hc84e7bf61bca2c6e
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f7a4d3662aa - std::sys_common::backtrace::_print_fmt::h6d347369517c3499
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f7a4d3662aa - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha8becfe32371a83b
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f7a4d3c8bae - core::fmt::write::h49d04e24a4a0f5b0
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/core/src/fmt/mod.rs:1208:17
   5:     0x7f7a4d3566e5 - std::io::Write::write_fmt::h51e3e9a867946d92
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/io/mod.rs:1682:15
   6:     0x7f7a4d366075 - std::sys_common::backtrace::_print::hdca39b4597f42be8
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f7a4d366075 - std::sys_common::backtrace::print::h90a45fec0894e48c
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f7a4d368d9f - std::panicking::default_hook::{{closure}}::h33ff658e7827f9cc
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/panicking.rs:267:22
   9:     0x7f7a4d368adb - std::panicking::default_hook::h7b258e9d452b029f
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/panicking.rs:286:9
  10:     0x7f7a4d3695bc - std::panicking::rust_panic_with_hook::hf8e2608dfe7b3876
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/panicking.rs:688:13
  11:     0x7f7a4d369312 - std::panicking::begin_panic_handler::{{closure}}::hf08f8046f55d20d0
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/panicking.rs:577:13
  12:     0x7f7a4d36675c - std::sys_common::backtrace::__rust_end_short_backtrace::h156042f7f0b912a5
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x7f7a4d369062 - rust_begin_unwind
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/panicking.rs:575:5
  14:     0x7f7a4d3c55c3 - core::panicking::panic_fmt::h65ed150133999c5f
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/core/src/panicking.rs:65:14
  15:     0x7f7a4f4075fd - <rustc_errors[fa90e1d5d2ab9e2c]::diagnostic_builder::DiagnosticBuilderInner as core[81c431c77b3227e5]::ops::drop::Drop>::drop
  16:     0x7f7a5040566d - core[81c431c77b3227e5]::ptr::drop_in_place::<rustc_errors[fa90e1d5d2ab9e2c]::diagnostic_builder::DiagnosticBuilder<rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>
  17:     0x7f7a50410209 - <rustc_borrowck[294c6deda030de41]::MirBorrowckCtxt>::report_use_of_moved_or_uninitialized
  18:     0x7f7a4ec6e3ea - <rustc_borrowck[294c6deda030de41]::MirBorrowckCtxt as rustc_mir_dataflow[ca8e193615b72aa8]::framework::visitor::ResultsVisitor>::visit_statement_before_primary_effect
  19:     0x7f7a4f753463 - rustc_mir_dataflow[ca8e193615b72aa8]::framework::visitor::visit_results::<rustc_borrowck[294c6deda030de41]::dataflow::BorrowckAnalyses<rustc_index[348215daae5de83b]::bit_set::BitSet<rustc_borrowck[294c6deda030de41]::dataflow::BorrowIndex>, rustc_index[348215daae5de83b]::bit_set::ChunkedBitSet<rustc_mir_dataflow[ca8e193615b72aa8]::move_paths::MovePathIndex>, rustc_index[348215daae5de83b]::bit_set::ChunkedBitSet<rustc_mir_dataflow[ca8e193615b72aa8]::move_paths::InitIndex>>, rustc_borrowck[294c6deda030de41]::dataflow::BorrowckAnalyses<rustc_mir_dataflow[ca8e193615b72aa8]::framework::engine::Results<rustc_borrowck[294c6deda030de41]::dataflow::Borrows>, rustc_mir_dataflow[ca8e193615b72aa8]::framework::engine::Results<rustc_mir_dataflow[ca8e193615b72aa8]::impls::MaybeUninitializedPlaces>, rustc_mir_dataflow[ca8e193615b72aa8]::framework::engine::Results<rustc_mir_dataflow[ca8e193615b72aa8]::impls::EverInitializedPlaces>>, core[81c431c77b3227e5]::iter::adapters::map::Map<rustc_middle[4086bdcecfc20d80]::mir::traversal::ReversePostorderIter, rustc_borrowck[294c6deda030de41]::do_mir_borrowck::{closure#2}>, rustc_borrowck[294c6deda030de41]::MirBorrowckCtxt>
  20:     0x7f7a4f72c0e7 - rustc_borrowck[294c6deda030de41]::do_mir_borrowck
  21:     0x7f7a4f71677a - rustc_borrowck[294c6deda030de41]::mir_borrowck
  22:     0x7f7a4f6aa6d9 - rustc_query_system[1ad976e1215f3964]::query::plumbing::try_execute_query::<rustc_query_impl[dee4b94ff49e365e]::plumbing::QueryCtxt, rustc_query_system[1ad976e1215f3964]::query::caches::VecCache<rustc_span[9fb21a881f0bdab2]::def_id::LocalDefId, &rustc_middle[4086bdcecfc20d80]::mir::query::BorrowCheckResult>>
  23:     0x7f7a4eb4ab82 - rustc_data_structures[ac380a40d754c2da]::sync::par_for_each_in::<&[rustc_span[9fb21a881f0bdab2]::def_id::LocalDefId], <rustc_middle[4086bdcecfc20d80]::hir::map::Map>::par_body_owners<rustc_interface[5a01d4b645e062e2]::passes::analysis::{closure#2}::{closure#0}>::{closure#0}>
  24:     0x7f7a4eb495b3 - <rustc_session[3662fe595b759729]::session::Session>::time::<(), rustc_interface[5a01d4b645e062e2]::passes::analysis::{closure#2}>
  25:     0x7f7a4eb47857 - rustc_interface[5a01d4b645e062e2]::passes::analysis
  26:     0x7f7a4fded45c - rustc_query_system[1ad976e1215f3964]::query::plumbing::try_execute_query::<rustc_query_impl[dee4b94ff49e365e]::plumbing::QueryCtxt, rustc_query_system[1ad976e1215f3964]::query::caches::DefaultCache<(), core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>>
  27:     0x7f7a4fded14b - rustc_query_system[1ad976e1215f3964]::query::plumbing::get_query::<rustc_query_impl[dee4b94ff49e365e]::queries::analysis, rustc_query_impl[dee4b94ff49e365e]::plumbing::QueryCtxt>
  28:     0x7f7a4f926f0b - <rustc_interface[5a01d4b645e062e2]::passes::QueryContext>::enter::<rustc_driver[49d0649a537a4dce]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>
  29:     0x7f7a4f91f5bf - <rustc_interface[5a01d4b645e062e2]::interface::Compiler>::enter::<rustc_driver[49d0649a537a4dce]::run_compiler::{closure#1}::{closure#2}, core[81c431c77b3227e5]::result::Result<core[81c431c77b3227e5]::option::Option<rustc_interface[5a01d4b645e062e2]::queries::Linker>, rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>
  30:     0x7f7a4f91a5d8 - rustc_span[9fb21a881f0bdab2]::with_source_map::<core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>, rustc_interface[5a01d4b645e062e2]::interface::run_compiler<core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>, rustc_driver[49d0649a537a4dce]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  31:     0x7f7a4f91a0c5 - <scoped_tls[1cce71beeef11336]::ScopedKey<rustc_span[9fb21a881f0bdab2]::SessionGlobals>>::set::<rustc_interface[5a01d4b645e062e2]::interface::run_compiler<core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>, rustc_driver[49d0649a537a4dce]::run_compiler::{closure#1}>::{closure#0}, core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>
  32:     0x7f7a4f9196b2 - std[9f362533f84673f0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5a01d4b645e062e2]::util::run_in_thread_pool_with_globals<rustc_interface[5a01d4b645e062e2]::interface::run_compiler<core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>, rustc_driver[49d0649a537a4dce]::run_compiler::{closure#1}>::{closure#0}, core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>
  33:     0x7f7a4f9193c8 - <<std[9f362533f84673f0]::thread::Builder>::spawn_unchecked_<rustc_interface[5a01d4b645e062e2]::util::run_in_thread_pool_with_globals<rustc_interface[5a01d4b645e062e2]::interface::run_compiler<core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>, rustc_driver[49d0649a537a4dce]::run_compiler::{closure#1}>::{closure#0}, core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[81c431c77b3227e5]::result::Result<(), rustc_errors[fa90e1d5d2ab9e2c]::ErrorGuaranteed>>::{closure#1} as core[81c431c77b3227e5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7f7a5144ad93 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9b61d15b0ee557ed
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/alloc/src/boxed.rs:2000:9
  35:     0x7f7a5144ad93 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::haff1f709ebbd1677
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/alloc/src/boxed.rs:2000:9
  36:     0x7f7a5144ad93 - std::sys::unix::thread::Thread::new::thread_start::h98e69f1908d18751
                               at /rustc/5dfb4b0afaf6acace0845d00e85a934fb4289d83/library/std/src/sys/unix/thread.rs:108:17
  37:     0x7f7a4d1078fd - <unknown>
  38:     0x7f7a4d189a60 - <unknown>
  39:                0x0 - <unknown>
thread panicked while panicking. aborting.

@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. regression-untriaged Untriaged performance or correctness regression. labels Nov 25, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Nov 25, 2022
@compiler-errors
Copy link
Member

The real error isn't the unemitted diagnostic, it's the unwrap. The unemitted diagnostic only happens bc this unwrap occurs during diagnostics code, I think.

@matthiaskrgr
Copy link
Member Author

cc @estebank I think this might be #103908 and we try to suggest .clone() which is not available for the type though?

@mucinoab
Copy link
Contributor

If you add

#[lang = "clone"]
trait Clone {}

... to the example you no longer ICE and just hit the normal error[E0382]: use of moved value: 'x'

@mucinoab
Copy link
Contributor

@rustbot claim

@compiler-errors
Copy link
Member

Please use this minimized repro:

#![feature(no_core, lang_items)]
#![no_core]

#[lang = "sized"]
trait Sized {}

#[lang = "copy"]
trait Copy {}

fn g<T>(x: T) {}

fn f(x: *mut u8) {
    g(x);
    g(x);
}

@matthiaskrgr
Copy link
Member Author

@estebank
Copy link
Contributor

Every time I think "surely this unwrap will be fine", it bites me in the read as sure as the sun coming up.

@JakobDegen
Copy link
Contributor

Are we fixing #![feature(no_core)] ICEs? Not so sure we should bother...

@compiler-errors
Copy link
Member

@JakobDegen: This one was particularly easy to fix (#104956) and probably shouldn't've have been an unwrap in the first place (unwraps in diagnostics code are generally a code smell, since they should fail gracefully in strange situations) -- but I generally agree, had this fix required some large refactoring or implemented extra checks on a performance-sensitive path, then I think this should've been closed w/ a wontfix.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 27, 2022
…errors

Avoid ICE if the Clone trait is not found while building error suggestions

Fixes rust-lang#104870

r? `@compiler-errors`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 27, 2022
…errors

Avoid ICE if the Clone trait is not found while building error suggestions

Fixes rust-lang#104870

r? ``@compiler-errors``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 27, 2022
…errors

Avoid ICE if the Clone trait is not found while building error suggestions

Fixes rust-lang#104870

r? ```@compiler-errors```
@bors bors closed this as completed in db2850c Nov 28, 2022
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Nov 29, 2022
Aaron1011 pushed a commit to Aaron1011/rust that referenced this issue Jan 6, 2023
…errors

Avoid ICE if the Clone trait is not found while building error suggestions

Fixes rust-lang#104870

r? `@compiler-errors`
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2024
Let InstCombine remove Clone shims inside Clone shims

The Clone shims that we generate tend to recurse into other Clone shims, which gets very silly very quickly. Here's our current state: https://godbolt.org/z/E69YeY8eq

So I've added InstSimplify to the shims optimization passes, and improved `is_trivially_pure_clone_copy` so that it can delete those calls inside the shim. This makes the shim way smaller because most of its size is the required ceremony for unwinding.

This change also completely breaks the UI test added for rust-lang#104870. With this PR, that program ICEs in MIR type checking because `is_trivially_pure_clone_copy` and the trait solver disagree on whether `*mut u8` is `Copy`. And adding the requisite `Copy` impl to make them agree makes the test not generate any diagnostics. Considering that I spent most of my time on this PR fixing `#![no_core]` tests, I would prefer to just delete this one. The maintenance burden of `#![no_core]` is uniquely high because when they break they tend to break in very confusing ways.

try-job: test-various
try-job: armhf-gnu
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2024
Let InstCombine remove Clone shims inside Clone shims

The Clone shims that we generate tend to recurse into other Clone shims, which gets very silly very quickly. Here's our current state: https://godbolt.org/z/E69YeY8eq

So I've added InstSimplify to the shims optimization passes, and improved `is_trivially_pure_clone_copy` so that it can delete those calls inside the shim. This makes the shim way smaller because most of its size is the required ceremony for unwinding.

This change also completely breaks the UI test added for rust-lang#104870. With this PR, that program ICEs in MIR type checking because `is_trivially_pure_clone_copy` and the trait solver disagree on whether `*mut u8` is `Copy`. And adding the requisite `Copy` impl to make them agree makes the test not generate any diagnostics. Considering that I spent most of my time on this PR fixing `#![no_core]` tests, I would prefer to just delete this one. The maintenance burden of `#![no_core]` is uniquely high because when they break they tend to break in very confusing ways.

try-job: test-various
try-job: armhf-gnu
try-job: dist-x86_64-linux
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2024
…piler-errors

Let InstCombine remove Clone shims inside Clone shims

The Clone shims that we generate tend to recurse into other Clone shims, which gets very silly very quickly. Here's our current state: https://godbolt.org/z/E69YeY8eq

So I've added InstSimplify to the shims optimization passes, and improved `is_trivially_pure_clone_copy` so that it can delete those calls inside the shim. This makes the shim way smaller because most of its size is the required ceremony for unwinding.

This change also completely breaks the UI test added for rust-lang#104870. With this PR, that program ICEs in MIR type checking because `is_trivially_pure_clone_copy` and the trait solver disagree on whether `*mut u8` is `Copy`. And adding the requisite `Copy` impl to make them agree makes the test not generate any diagnostics. Considering that I spent most of my time on this PR fixing `#![no_core]` tests, I would prefer to just delete this one. The maintenance burden of `#![no_core]` is uniquely high because when they break they tend to break in very confusing ways.

try-job: test-various
try-job: armhf-gnu
try-job: dist-x86_64-linux
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2024
Let InstCombine remove Clone shims inside Clone shims

The Clone shims that we generate tend to recurse into other Clone shims, which gets very silly very quickly. Here's our current state: https://godbolt.org/z/E69YeY8eq

So I've added InstSimplify to the shims optimization passes, and improved `is_trivially_pure_clone_copy` so that it can delete those calls inside the shim. This makes the shim way smaller because most of its size is the required ceremony for unwinding.

This change also completely breaks the UI test added for rust-lang#104870. With this PR, that program ICEs in MIR type checking because `is_trivially_pure_clone_copy` and the trait solver disagree on whether `*mut u8` is `Copy`. And adding the requisite `Copy` impl to make them agree makes the test not generate any diagnostics. Considering that I spent most of my time on this PR fixing `#![no_core]` tests, I would prefer to just delete this one. The maintenance burden of `#![no_core]` is uniquely high because when they break they tend to break in very confusing ways.

try-job: x86_64-mingw
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2024
Let InstCombine remove Clone shims inside Clone shims

The Clone shims that we generate tend to recurse into other Clone shims, which gets very silly very quickly. Here's our current state: https://godbolt.org/z/E69YeY8eq

So I've added InstSimplify to the shims optimization passes, and improved `is_trivially_pure_clone_copy` so that it can delete those calls inside the shim. This makes the shim way smaller because most of its size is the required ceremony for unwinding.

This change also completely breaks the UI test added for rust-lang#104870. With this PR, that program ICEs in MIR type checking because `is_trivially_pure_clone_copy` and the trait solver disagree on whether `*mut u8` is `Copy`. And adding the requisite `Copy` impl to make them agree makes the test not generate any diagnostics. Considering that I spent most of my time on this PR fixing `#![no_core]` tests, I would prefer to just delete this one. The maintenance burden of `#![no_core]` is uniquely high because when they break they tend to break in very confusing ways.

try-job: x86_64-mingw
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 26, 2024
…piler-errors

Let InstCombine remove Clone shims inside Clone shims

The Clone shims that we generate tend to recurse into other Clone shims, which gets very silly very quickly. Here's our current state: https://godbolt.org/z/E69YeY8eq

So I've added InstSimplify to the shims optimization passes, and improved `is_trivially_pure_clone_copy` so that it can delete those calls inside the shim. This makes the shim way smaller because most of its size is the required ceremony for unwinding.

This change also completely breaks the UI test added for rust-lang#104870. With this PR, that program ICEs in MIR type checking because `is_trivially_pure_clone_copy` and the trait solver disagree on whether `*mut u8` is `Copy`. And adding the requisite `Copy` impl to make them agree makes the test not generate any diagnostics. Considering that I spent most of my time on this PR fixing `#![no_core]` tests, I would prefer to just delete this one. The maintenance burden of `#![no_core]` is uniquely high because when they break they tend to break in very confusing ways.

try-job: x86_64-mingw
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Jul 27, 2024
Let InstCombine remove Clone shims inside Clone shims

The Clone shims that we generate tend to recurse into other Clone shims, which gets very silly very quickly. Here's our current state: https://godbolt.org/z/E69YeY8eq

So I've added InstSimplify to the shims optimization passes, and improved `is_trivially_pure_clone_copy` so that it can delete those calls inside the shim. This makes the shim way smaller because most of its size is the required ceremony for unwinding.

This change also completely breaks the UI test added for rust-lang/rust#104870. With this PR, that program ICEs in MIR type checking because `is_trivially_pure_clone_copy` and the trait solver disagree on whether `*mut u8` is `Copy`. And adding the requisite `Copy` impl to make them agree makes the test not generate any diagnostics. Considering that I spent most of my time on this PR fixing `#![no_core]` tests, I would prefer to just delete this one. The maintenance burden of `#![no_core]` is uniquely high because when they break they tend to break in very confusing ways.

try-job: x86_64-mingw
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) ❄️ regression-untriaged Untriaged performance or correctness regression. 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.

7 participants