Skip to content

ICE: Got a scalar pair where a scalar was expected #121363

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(trivial_bounds)]

#[derive(Debug)]
struct TwoStrs(str, str)
where
    str: Sized;

original:

#[derive(Debug)]
struct Foo(i32);

#[derive(Debug)]
struct TwoStrs(str, str) where str: Sized;

Version information

rustc 1.78.0-nightly (bb594538f 2024-02-20)
binary: rustc
commit-hash: bb594538fc6e84213a6b8d5e165442570aa48923
commit-date: 2024-02-20
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zmir-opt-level=5 -Zcrate-attr=feature(trivial_bounds) --crate-type=lib

Program output

warning: struct `TwoStrs` is never constructed
 --> /tmp/icemaker_global_tempdir.d7BGTl8YHHxI/rustc_testrunner_tmpdir_reporting.Zw6CwslhbT5j/mvce.rs:2:8
  |
2 | struct TwoStrs(str, str)
  |        ^^^^^^^
  |
  = note: `TwoStrs` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
  = note: `#[warn(dead_code)]` on by default

warning: trait bound str: Sized does not depend on any type or lifetime parameters
 --> /tmp/icemaker_global_tempdir.d7BGTl8YHHxI/rustc_testrunner_tmpdir_reporting.Zw6CwslhbT5j/mvce.rs:4:10
  |
4 |     str: Sized;
  |          ^^^^^
  |
  = note: `#[warn(trivial_bounds)]` on by default

error: internal compiler error: /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/compiler/rustc_const_eval/src/interpret/operand.rs:82:42: Got a scalar pair where a scalar was expected

thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:35:44:
Box<dyn Any>
stack backtrace:
   0:     0x7ff23b050af6 - std::backtrace_rs::backtrace::libunwind::trace::h1eedb42239d9af6b
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7ff23b050af6 - std::backtrace_rs::backtrace::trace_unsynchronized::hf37e37075d32c152
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ff23b050af6 - std::sys_common::backtrace::_print_fmt::h089ff4e21712e78d
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7ff23b050af6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h249f2f40a85530bd
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ff23b0a1a7c - core::fmt::rt::Argument::fmt::h0aeed2b676ebf5da
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/core/src/fmt/rt.rs:142:9
   5:     0x7ff23b0a1a7c - core::fmt::write::h25b3f5340152b6c4
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/core/src/fmt/mod.rs:1120:17
   6:     0x7ff23b04542f - std::io::Write::write_fmt::h8746a81e0adfe285
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/std/src/io/mod.rs:1846:15
   7:     0x7ff23b0508a4 - std::sys_common::backtrace::_print::hcf22409f3667d346
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7ff23b0508a4 - std::sys_common::backtrace::print::h7d3fd33863df24d3
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7ff23b0535eb - std::panicking::default_hook::{{closure}}::h69f3f4f5b3bceec1
  10:     0x7ff23b053339 - std::panicking::default_hook::hf73563d650f0e118
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/std/src/panicking.rs:292:9
  11:     0x7ff237e1a63c - std[38a2ac7f7aa65357]::panicking::update_hook::<alloc[250c3b7c6f6c60ed]::boxed::Box<rustc_driver_impl[98bdfcf9c8fb7ba2]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7ff23b053d50 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h0f1d4fd9cb21869d
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/alloc/src/boxed.rs:2030:9
  13:     0x7ff23b053d50 - std::panicking::rust_panic_with_hook::h55549baaf7aa2e9c
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/std/src/panicking.rs:786:13
  14:     0x7ff237e47244 - std[38a2ac7f7aa65357]::panicking::begin_panic::<rustc_errors[31b00c9a61d6a627]::ExplicitBug>::{closure#0}
  15:     0x7ff237e43e96 - std[38a2ac7f7aa65357]::sys_common::backtrace::__rust_end_short_backtrace::<std[38a2ac7f7aa65357]::panicking::begin_panic<rustc_errors[31b00c9a61d6a627]::ExplicitBug>::{closure#0}, !>
  16:     0x7ff237e3f626 - std[38a2ac7f7aa65357]::panicking::begin_panic::<rustc_errors[31b00c9a61d6a627]::ExplicitBug>
  17:     0x7ff237e51ad1 - <rustc_errors[31b00c9a61d6a627]::diagnostic_builder::BugAbort as rustc_errors[31b00c9a61d6a627]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7ff2382247ec - <rustc_errors[31b00c9a61d6a627]::DiagCtxt>::bug::<alloc[250c3b7c6f6c60ed]::string::String>
  19:     0x7ff2382c76eb - rustc_middle[cfb3c689534e2244]::util::bug::opt_span_bug_fmt::<rustc_span[39701832932d6f53]::span_encoding::Span>::{closure#0}
  20:     0x7ff2382ac41a - rustc_middle[cfb3c689534e2244]::ty::context::tls::with_opt::<rustc_middle[cfb3c689534e2244]::util::bug::opt_span_bug_fmt<rustc_span[39701832932d6f53]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7ff2382ac2b8 - rustc_middle[cfb3c689534e2244]::ty::context::tls::with_context_opt::<rustc_middle[cfb3c689534e2244]::ty::context::tls::with_opt<rustc_middle[cfb3c689534e2244]::util::bug::opt_span_bug_fmt<rustc_span[39701832932d6f53]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7ff236740bc0 - rustc_middle[cfb3c689534e2244]::util::bug::bug_fmt
  23:     0x7ff2395a8f6b - <rustc_mir_transform[3a9949066bb08602]::gvn::VnState>::simplify_operand
  24:     0x7ff2370be253 - <rustc_mir_transform[3a9949066bb08602]::gvn::GVN as rustc_middle[cfb3c689534e2244]::mir::MirPass>::run_pass
  25:     0x7ff239012649 - rustc_mir_transform[3a9949066bb08602]::pass_manager::run_passes_inner
  26:     0x7ff2394a84bf - rustc_mir_transform[3a9949066bb08602]::optimized_mir
  27:     0x7ff239073c75 - rustc_query_impl[72e671e77ccdc0fd]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[72e671e77ccdc0fd]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfb3c689534e2244]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7ff239074321 - rustc_query_system[eb6d0acd22a0ff82]::query::plumbing::try_execute_query::<rustc_query_impl[72e671e77ccdc0fd]::DynamicConfig<rustc_query_system[eb6d0acd22a0ff82]::query::caches::DefIdCache<rustc_middle[cfb3c689534e2244]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[72e671e77ccdc0fd]::plumbing::QueryCtxt, false>
  29:     0x7ff239073a9e - rustc_query_impl[72e671e77ccdc0fd]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
  30:     0x7ff239453461 - rustc_middle[cfb3c689534e2244]::query::plumbing::query_get_at::<rustc_query_system[eb6d0acd22a0ff82]::query::caches::DefIdCache<rustc_middle[cfb3c689534e2244]::query::erase::Erased<[u8; 8usize]>>>
  31:     0x7ff239f9d7fd - <rustc_metadata[7844668d1f998472]::rmeta::encoder::EncodeContext>::encode_crate_root
  32:     0x7ff239fdf116 - rustc_metadata[7844668d1f998472]::rmeta::encoder::encode_metadata
  33:     0x7ff239fdd2b8 - rustc_metadata[7844668d1f998472]::fs::encode_and_write_metadata
  34:     0x7ff239fdc65d - rustc_interface[d43ea88de449c898]::passes::start_codegen
  35:     0x7ff239fdbed8 - <rustc_interface[d43ea88de449c898]::queries::Queries>::codegen_and_build_linker
  36:     0x7ff239d6482d - rustc_interface[d43ea88de449c898]::interface::run_compiler::<core[9082f35584c4c405]::result::Result<(), rustc_span[39701832932d6f53]::ErrorGuaranteed>, rustc_driver_impl[98bdfcf9c8fb7ba2]::run_compiler::{closure#0}>::{closure#0}
  37:     0x7ff239fc1c05 - std[38a2ac7f7aa65357]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d43ea88de449c898]::util::run_in_thread_with_globals<rustc_interface[d43ea88de449c898]::util::run_in_thread_pool_with_globals<rustc_interface[d43ea88de449c898]::interface::run_compiler<core[9082f35584c4c405]::result::Result<(), rustc_span[39701832932d6f53]::ErrorGuaranteed>, rustc_driver_impl[98bdfcf9c8fb7ba2]::run_compiler::{closure#0}>::{closure#0}, core[9082f35584c4c405]::result::Result<(), rustc_span[39701832932d6f53]::ErrorGuaranteed>>::{closure#0}, core[9082f35584c4c405]::result::Result<(), rustc_span[39701832932d6f53]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9082f35584c4c405]::result::Result<(), rustc_span[39701832932d6f53]::ErrorGuaranteed>>
  38:     0x7ff239fc1a32 - <<std[38a2ac7f7aa65357]::thread::Builder>::spawn_unchecked_<rustc_interface[d43ea88de449c898]::util::run_in_thread_with_globals<rustc_interface[d43ea88de449c898]::util::run_in_thread_pool_with_globals<rustc_interface[d43ea88de449c898]::interface::run_compiler<core[9082f35584c4c405]::result::Result<(), rustc_span[39701832932d6f53]::ErrorGuaranteed>, rustc_driver_impl[98bdfcf9c8fb7ba2]::run_compiler::{closure#0}>::{closure#0}, core[9082f35584c4c405]::result::Result<(), rustc_span[39701832932d6f53]::ErrorGuaranteed>>::{closure#0}, core[9082f35584c4c405]::result::Result<(), rustc_span[39701832932d6f53]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9082f35584c4c405]::result::Result<(), rustc_span[39701832932d6f53]::ErrorGuaranteed>>::{closure#1} as core[9082f35584c4c405]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x7ff23b05d725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8e2928e2096a726d
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/alloc/src/boxed.rs:2016:9
  40:     0x7ff23b05d725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4f25e5317edfd617
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/alloc/src/boxed.rs:2016:9
  41:     0x7ff23b05d725 - std::sys::pal::unix::thread::Thread::new::thread_start::hc7193b55f6b48c9a
                               at /rustc/bb594538fc6e84213a6b8d5e165442570aa48923/library/std/src/sys/pal/unix/thread.rs:108:17
  42:     0x7ff234eaa9eb - <unknown>
  43:     0x7ff234f2e7cc - <unknown>
  44:                0x0 - <unknown>

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: rustc 1.78.0-nightly (bb594538f 2024-02-20) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=5 -Z crate-attr=feature(trivial_bounds) --crate-type lib -Z dump-mir-dir=dir

query stack during panic:
#0 [optimized_mir] optimizing MIR for `<impl at /tmp/icemaker_global_tempdir.d7BGTl8YHHxI/rustc_testrunner_tmpdir_reporting.Zw6CwslhbT5j/mvce.rs:1:10: 1:15>::fmt`
end of query stack
error: aborting due to 1 previous error; 2 warnings emitted


No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-impossible-boundsArea: Issues related to have impossible trait bounds in scope (impossible predicates)A-mir-optArea: MIR optimizationsA-mir-opt-GVNArea: MIR opt Global Value Numbering (GVN)C-bugCategory: This is a bug.F-trivial_bounds`#![feature(trivial_bounds)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.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