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: slices are not scalars #121357

Closed
Sky9x opened this issue Feb 20, 2024 · 3 comments
Closed

ICE: slices are not scalars #121357

Sky9x opened this issue Feb 20, 2024 · 3 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

@Sky9x
Copy link
Contributor

Sky9x commented Feb 20, 2024

Code

Playground

trait Clone {
    fn clone(&self) -> Self where Self: Sized;
}

impl<T: Clone> Clone for [T] {
    fn clone(&self) -> Self where Self: Sized {
        unreachable!()
    }
}

Meta

works on stable but not nightly

rustc --version --verbose:

rustc 1.78.0-nightly (3246e7951 2024-02-19)
binary: rustc
commit-hash: 3246e79513cb89ddbfc0f21cb5a877e5b321dcc5
commit-date: 2024-02-19
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Error output

Backtrace

thread 'rustc' panicked at compiler/rustc_mir_dataflow/src/value_analysis.rs:849:13:
slices are not scalars
stack backtrace:
   0:     0x7f2a0e060f4f - std::backtrace_rs::backtrace::libunwind::trace::h8ae4267cbff78cba
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f2a0e060f4f - std::backtrace_rs::backtrace::trace_unsynchronized::h51c412dced35f1df
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f2a0e060f4f - std::backtrace::Backtrace::create::hb5363bc6fe03a147
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/std/src/backtrace.rs:331:13
   3:     0x7f2a0e060e90 - std::backtrace::Backtrace::force_capture::h09cde0b1d72ee122
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/std/src/backtrace.rs:312:9
   4:     0x7f2a0ae2fbd7 - std[88cc13ac5e46237b]::panicking::update_hook::<alloc[c36677dfd055d4b5]::boxed::Box<rustc_driver_impl[43e8f7cc04ab8702]::install_ice_hook::{closure#0}>>::{closure#0}
   5:     0x7f2a0e07bd20 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h16d70f2ac15ce073
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/alloc/src/boxed.rs:2030:9
   6:     0x7f2a0e07bd20 - std::panicking::rust_panic_with_hook::hfcc097815365b485
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/std/src/panicking.rs:786:13
   7:     0x7f2a0e07ba29 - std::panicking::begin_panic_handler::{{closure}}::h8dac30e50803d6dd
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/std/src/panicking.rs:652:13
   8:     0x7f2a0e078fa6 - std::sys_common::backtrace::__rust_end_short_backtrace::h9fe6177cef6e17f8
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/std/src/sys_common/backtrace.rs:171:18
   9:     0x7f2a0e07b794 - rust_begin_unwind
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/std/src/panicking.rs:648:5
  10:     0x7f2a0e0c5f65 - core::panicking::panic_fmt::h9ecf1705441f8b1b
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/core/src/panicking.rs:72:14
  11:     0x7f2a0ccc0b14 - <rustc_mir_dataflow[eb74de6dd7f7f940]::value_analysis::Map>::new
  12:     0x7f2a0c990e56 - <rustc_mir_transform[1ddaf0ad40506e62]::jump_threading::JumpThreading as rustc_middle[27e5e81444fa3f89]::mir::MirPass>::run_pass
  13:     0x7f2a0c012a8f - rustc_mir_transform[1ddaf0ad40506e62]::pass_manager::run_passes_inner
  14:     0x7f2a0c4e7f7f - rustc_mir_transform[1ddaf0ad40506e62]::optimized_mir
  15:     0x7f2a0c0919b5 - rustc_query_impl[8e5c8e12319352c5]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8e5c8e12319352c5]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[27e5e81444fa3f89]::query::erase::Erased<[u8; 8usize]>>
  16:     0x7f2a0c092061 - rustc_query_system[bfc5cdf7ae7702b8]::query::plumbing::try_execute_query::<rustc_query_impl[8e5c8e12319352c5]::DynamicConfig<rustc_query_system[bfc5cdf7ae7702b8]::query::caches::DefIdCache<rustc_middle[27e5e81444fa3f89]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[8e5c8e12319352c5]::plumbing::QueryCtxt, false>
  17:     0x7f2a0c0917de - rustc_query_impl[8e5c8e12319352c5]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
  18:     0x7f2a0cedb295 - rustc_middle[27e5e81444fa3f89]::query::plumbing::query_get_at::<rustc_query_system[bfc5cdf7ae7702b8]::query::caches::DefIdCache<rustc_middle[27e5e81444fa3f89]::query::erase::Erased<[u8; 8usize]>>>
  19:     0x7f2a0cfa0089 - <rustc_metadata[72646f08ecd30116]::rmeta::encoder::EncodeContext>::encode_crate_root
  20:     0x7f2a0cff2756 - rustc_metadata[72646f08ecd30116]::rmeta::encoder::encode_metadata
  21:     0x7f2a0cff08f8 - rustc_metadata[72646f08ecd30116]::fs::encode_and_write_metadata
  22:     0x7f2a0cfefc9d - rustc_interface[6b23f56c014e7e]::passes::start_codegen
  23:     0x7f2a0cfef518 - <rustc_interface[6b23f56c014e7e]::queries::Queries>::codegen_and_build_linker
  24:     0x7f2a0cd4a72a - rustc_interface[6b23f56c014e7e]::interface::run_compiler::<core[9135d4f27aa7f376]::result::Result<(), rustc_span[c3b4d1cce1296ff1]::ErrorGuaranteed>, rustc_driver_impl[43e8f7cc04ab8702]::run_compiler::{closure#0}>::{closure#0}
  25:     0x7f2a0cfd2b05 - std[88cc13ac5e46237b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6b23f56c014e7e]::util::run_in_thread_with_globals<rustc_interface[6b23f56c014e7e]::util::run_in_thread_pool_with_globals<rustc_interface[6b23f56c014e7e]::interface::run_compiler<core[9135d4f27aa7f376]::result::Result<(), rustc_span[c3b4d1cce1296ff1]::ErrorGuaranteed>, rustc_driver_impl[43e8f7cc04ab8702]::run_compiler::{closure#0}>::{closure#0}, core[9135d4f27aa7f376]::result::Result<(), rustc_span[c3b4d1cce1296ff1]::ErrorGuaranteed>>::{closure#0}, core[9135d4f27aa7f376]::result::Result<(), rustc_span[c3b4d1cce1296ff1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9135d4f27aa7f376]::result::Result<(), rustc_span[c3b4d1cce1296ff1]::ErrorGuaranteed>>
  26:     0x7f2a0cfd2932 - <<std[88cc13ac5e46237b]::thread::Builder>::spawn_unchecked_<rustc_interface[6b23f56c014e7e]::util::run_in_thread_with_globals<rustc_interface[6b23f56c014e7e]::util::run_in_thread_pool_with_globals<rustc_interface[6b23f56c014e7e]::interface::run_compiler<core[9135d4f27aa7f376]::result::Result<(), rustc_span[c3b4d1cce1296ff1]::ErrorGuaranteed>, rustc_driver_impl[43e8f7cc04ab8702]::run_compiler::{closure#0}>::{closure#0}, core[9135d4f27aa7f376]::result::Result<(), rustc_span[c3b4d1cce1296ff1]::ErrorGuaranteed>>::{closure#0}, core[9135d4f27aa7f376]::result::Result<(), rustc_span[c3b4d1cce1296ff1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9135d4f27aa7f376]::result::Result<(), rustc_span[c3b4d1cce1296ff1]::ErrorGuaranteed>>::{closure#1} as core[9135d4f27aa7f376]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  27:     0x7f2a0e0856f5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8884f59d39766bcc
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/alloc/src/boxed.rs:2016:9
  28:     0x7f2a0e0856f5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd3cff0ddac56346e
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/alloc/src/boxed.rs:2016:9
  29:     0x7f2a0e0856f5 - std::sys::pal::unix::thread::Thread::new::thread_start::h1990c77eff82b16c
                               at /rustc/3246e79513cb89ddbfc0f21cb5a877e5b321dcc5/library/std/src/sys/pal/unix/thread.rs:108:17
  30:     0x7f2a07c94ac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  31:     0x7f2a07d26850 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  32:                0x0 - <unknown>


rustc version: 1.78.0-nightly (3246e7951 2024-02-19)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [optimized_mir] optimizing MIR for `<impl at unsized_clone.rs:7:1: 7:29>::clone`
end of query stack

@Sky9x Sky9x 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 Feb 20, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 20, 2024
@matthiaskrgr
Copy link
Member

This is probably a duplicate of #116721

@Sky9x
Copy link
Contributor Author

Sky9x commented Feb 20, 2024

searched nightlies: from nightly-2024-02-05 to nightly-2024-02-20
regressed nightly: nightly-2024-02-12
searched commit range: 6cc4843...1a648b3
regressed commit: 42752cb

bisected with cargo-bisect-rustc v0.6.8

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --regress ice -- build --release 

regresses in earlier nightlies with -Zmir-opt-level=3, the regressed commit only seems to have made it show up in -Zmir-opt-level=2 and thus in release mode

@Noratrieb
Copy link
Member

some MIR opt stuff that only regressed it incorrectly, as expected
so it probably is a duplicate of the existing bug

@Sky9x Sky9x closed this as not planned Won't fix, can't repro, duplicate, stale Feb 20, 2024
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 22, 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

5 participants