Repository: rust
Issue: ICE: `invalid asymmetric binary op Lt`
Labels: I-ICE,T-compiler,C-bug

<!--
[31mICE[0m: Rustc ./a.rs '' 'error: internal compiler error: /rustc/d18506299bfb20488aba466a69641a2bab6f7a4a/compiler/rustc_const_eval/src/interpret/operator.rs:163:13: invalid asymmetric binary op Lt: 0x0000000000000000 (usize), 0x0000000000000003 (i64)', 'error: internal compiler error: /rustc/d18506299bfb20488aba466a69641a2bab6f7a4a/compiler/rustc_const_eval/src/interpret/operator.rs:163:13: invalid asymmetric binary op Lt: 0x0000000000000000 (usize), 0x0000000000000003 (i64)'
File: /tmp/im/a.rs
-->

auto-reduced (treereduce-rust):
````rust
pub struct Struct<const N: i64>(pub [u8; N]);

pub fn function(value: Struct<3>) -> u8 {
    value.0[0]
}

````

original:
````rust
pub struct Struct<const N: i64>(pub [u8; N]);

pub type Alias = Struct<2>;

pub fn function(value: Struct<3>) -> u8 {
    value.0[0]
}

````

Version information
````
rustc 1.85.0-nightly (d18506299 2024-12-15)
binary: rustc
commit-hash: d18506299bfb20488aba466a69641a2bab6f7a4a
commit-date: 2024-12-15
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5

````



Command:
`/home/matthias/.rustup/toolchains/master/bin/rustc `

<details><summary><strong>Program output</strong></summary>
<p>

```
error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.YagNzzKWUw8B/rustc_testrunner_tmpdir_reporting.w16l0x3yyxRt/mvce.rs:5:2
  |
5 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.YagNzzKWUw8B/rustc_testrunner_tmpdir_reporting.w16l0x3yyxRt/mvce.rs`

error: the constant `N` is not of type `usize`
 --> /tmp/icemaker_global_tempdir.YagNzzKWUw8B/rustc_testrunner_tmpdir_reporting.w16l0x3yyxRt/mvce.rs:1:37
  |
1 | pub struct Struct<const N: i64>(pub [u8; N]);
  |                                     ^^^^^^^ expected `usize`, found `i64`

error: internal compiler error: /rustc/d18506299bfb20488aba466a69641a2bab6f7a4a/compiler/rustc_const_eval/src/interpret/operator.rs:163:13: invalid asymmetric binary op Lt: 0x0000000000000000 (usize), 0x0000000000000003 (i64)
 --> /tmp/icemaker_global_tempdir.YagNzzKWUw8B/rustc_testrunner_tmpdir_reporting.w16l0x3yyxRt/mvce.rs:3:1
  |
3 | pub fn function(value: Struct<3>) -> u8 {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at /rustc/d18506299bfb20488aba466a69641a2bab6f7a4a/compiler/rustc_const_eval/src/interpret/operator.rs:163:13:
Box<dyn Any>
stack backtrace:
   0:     0x7793221a842a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h3ec6acdc8021b780
   1:     0x779322a13d26 - core::fmt::write::ha1e51f9ad754b246
   2:     0x7793239e9fd1 - std::io::Write::write_fmt::h447409d450220636
   3:     0x7793221a8282 - std::sys::backtrace::BacktraceLock::print::h0c9f47621987f564
   4:     0x7793221aa77a - std::panicking::default_hook::{{closure}}::h32dab02cf4eb3fec
   5:     0x7793221aa5c3 - std::panicking::default_hook::h977c01aba3fe59ba
   6:     0x7793212fd1e8 - std[8a615549bd1790e3]::panicking::update_hook::<alloc[3a7c820246e0185d]::boxed::Box<rustc_driver_impl[8936f116e8865c1]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7793221aaf38 - std::panicking::rust_panic_with_hook::hba51aacb56857061
   8:     0x779321333051 - std[8a615549bd1790e3]::panicking::begin_panic::<rustc_errors[16504968b0874da0]::ExplicitBug>::{closure#0}
   9:     0x779321328236 - std[8a615549bd1790e3]::sys::backtrace::__rust_end_short_backtrace::<std[8a615549bd1790e3]::panicking::begin_panic<rustc_errors[16504968b0874da0]::ExplicitBug>::{closure#0}, !>
  10:     0x779321328223 - std[8a615549bd1790e3]::panicking::begin_panic::<rustc_errors[16504968b0874da0]::ExplicitBug>
  11:     0x77932133cfb1 - <rustc_errors[16504968b0874da0]::diagnostic::BugAbort as rustc_errors[16504968b0874da0]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x77932189c9cc - <rustc_errors[16504968b0874da0]::DiagCtxtHandle>::span_bug::<rustc_span[75c3ac87255cc802]::span_encoding::Span, alloc[3a7c820246e0185d]::string::String>
  13:     0x779321933a07 - rustc_middle[80851824623efb4c]::util::bug::opt_span_bug_fmt::<rustc_span[75c3ac87255cc802]::span_encoding::Span>::{closure#0}
  14:     0x7793219193aa - rustc_middle[80851824623efb4c]::ty::context::tls::with_opt::<rustc_middle[80851824623efb4c]::util::bug::opt_span_bug_fmt<rustc_span[75c3ac87255cc802]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  15:     0x77932191923b - rustc_middle[80851824623efb4c]::ty::context::tls::with_context_opt::<rustc_middle[80851824623efb4c]::ty::context::tls::with_opt<rustc_middle[80851824623efb4c]::util::bug::opt_span_bug_fmt<rustc_span[75c3ac87255cc802]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  16:     0x77931fcf4527 - rustc_middle[80851824623efb4c]::util::bug::span_bug_fmt::<rustc_span[75c3ac87255cc802]::span_encoding::Span>
  17:     0x7793244c6219 - <rustc_const_eval[ebb6297578ee0f46]::interpret::eval_context::InterpCx<rustc_const_eval[ebb6297578ee0f46]::const_eval::dummy_machine::DummyMachine>>::binary_op.cold
  18:     0x77931f9b9b96 - <rustc_mir_transform[2781f817185d0af4]::known_panics_lint::ConstPropagator as rustc_middle[80851824623efb4c]::mir::visit::Visitor>::visit_assign
  19:     0x77931f9b687b - <rustc_mir_transform[2781f817185d0af4]::known_panics_lint::ConstPropagator as rustc_middle[80851824623efb4c]::mir::visit::Visitor>::visit_body
  20:     0x7793238d7650 - <rustc_mir_transform[2781f817185d0af4]::known_panics_lint::KnownPanicsLint as rustc_mir_transform[2781f817185d0af4]::pass_manager::MirLint>::run_lint
  21:     0x779322a099a5 - rustc_mir_transform[2781f817185d0af4]::run_analysis_to_runtime_passes
  22:     0x77931ffe16a0 - rustc_mir_transform[2781f817185d0af4]::mir_drops_elaborated_and_const_checked
  23:     0x779322cd1c39 - rustc_query_impl[4e0376acc8b13a14]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4e0376acc8b13a14]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[80851824623efb4c]::query::erase::Erased<[u8; 8usize]>>
  24:     0x779322cd1f91 - rustc_query_system[20737a1fda201ff5]::query::plumbing::try_execute_query::<rustc_query_impl[4e0376acc8b13a14]::DynamicConfig<rustc_data_structures[57370b606fe3e33d]::vec_cache::VecCache<rustc_span[75c3ac87255cc802]::def_id::LocalDefId, rustc_middle[80851824623efb4c]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[20737a1fda201ff5]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[4e0376acc8b13a14]::plumbing::QueryCtxt, false>
  25:     0x779322cd19e7 - rustc_query_impl[4e0376acc8b13a14]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  26:     0x779322e8f146 - rustc_interface[c7a5d74730d5794b]::passes::run_required_analyses
  27:     0x7793239d9c5e - rustc_interface[c7a5d74730d5794b]::passes::analysis
  28:     0x7793239d9c2f - rustc_query_impl[4e0376acc8b13a14]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4e0376acc8b13a14]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[80851824623efb4c]::query::erase::Erased<[u8; 0usize]>>
  29:     0x779323a2ca55 - rustc_query_system[20737a1fda201ff5]::query::plumbing::try_execute_query::<rustc_query_impl[4e0376acc8b13a14]::DynamicConfig<rustc_query_system[20737a1fda201ff5]::query::caches::SingleCache<rustc_middle[80851824623efb4c]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[4e0376acc8b13a14]::plumbing::QueryCtxt, false>
  30:     0x779323a2c78e - rustc_query_impl[4e0376acc8b13a14]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  31:     0x779323a7ff74 - rustc_interface[c7a5d74730d5794b]::interface::run_compiler::<(), rustc_driver_impl[8936f116e8865c1]::run_compiler::{closure#0}>::{closure#1}
  32:     0x7793239a7187 - std[8a615549bd1790e3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c7a5d74730d5794b]::util::run_in_thread_with_globals<rustc_interface[c7a5d74730d5794b]::util::run_in_thread_pool_with_globals<rustc_interface[c7a5d74730d5794b]::interface::run_compiler<(), rustc_driver_impl[8936f116e8865c1]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  33:     0x7793239a6e20 - <<std[8a615549bd1790e3]::thread::Builder>::spawn_unchecked_<rustc_interface[c7a5d74730d5794b]::util::run_in_thread_with_globals<rustc_interface[c7a5d74730d5794b]::util::run_in_thread_pool_with_globals<rustc_interface[c7a5d74730d5794b]::interface::run_compiler<(), rustc_driver_impl[8936f116e8865c1]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[4d4c849bd23b5fc3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7793239a61c1 - std::sys::pal::unix::thread::Thread::new::thread_start::hb315ab60bee23a2e
  35:     0x77931daa339d - <unknown>
  36:     0x77931db2849c - <unknown>
  37:                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: please make sure that you have updated to the latest nightly

note: rustc 1.85.0-nightly (d18506299 2024-12-15) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `function`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

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

```

</p>
</details>

<!--
query stack:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `function`
#1 [analysis] running analysis passes on this crate

-->