Repository: rust
Issue: ICE: CFI: `encode_const: unexpected type '[[usize; 4]; 4]'`
Labels: I-ICE,T-compiler,A-sanitizers,C-bug,requires-nightly,PG-exploit-mitigations

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.
http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
-->

### Code
`rustc treereduce.out -Zsanitizer=cfi  --crate-type lib -Clto`
```Rust
#![feature(adt_const_params)]

mod lib {
    const N_ISLANDS: usize = 4;
    const N_BRIDGES: usize = 7;
    const BRIDGES: [(usize, usize); 7] = [(0, 1), (0, 1), (0, 2), (0, 3), (0, 3), (1, 2), (2, 3)];

    pub type Matrix = [[usize; N_ISLANDS]; N_ISLANDS];

    const EMPTY_MATRIX: Matrix = [[0; N_ISLANDS]; N_ISLANDS];

    const fn to_matrix(bridges: [(usize, usize); N_BRIDGES]) -> Matrix {
        let matrix = EMPTY_MATRIX;

        matrix
    }

    const BRIDGE_MATRIX: [[usize; N_ISLANDS]; N_ISLANDS] = to_matrix(BRIDGES);

    pub struct Walk<const CURRENT: usize, const REMAINING: Matrix> {
        _p: (),
    }

    impl Walk<0, BRIDGE_MATRIX> {
        pub const fn new() -> Self {
            Self { _p: () }
        }
    }

    pub struct Trophy {
        _p: (),
    }
}

pub use lib::{Trophy, Walk};
```


### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.73.0-nightly (0be115231 2023-07-27)
binary: rustc
commit-hash: 0be11523110a8354120068cd5c69434fdec2dc87
commit-date: 2023-07-27
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5
```

### Error output

```
<output>
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
error: internal compiler error: compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs:137:21: encode_const: unexpected type `[[usize; 4]; 4]`

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0be11523110a8354120068cd5c69434fdec2dc87/compiler/rustc_errors/src/lib.rs:1645:9
stack backtrace:
   0:     0x7fe839d61fc1 - std::backtrace_rs::backtrace::libunwind::trace::h11251a01d1f7368f
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fe839d61fc1 - std::backtrace_rs::backtrace::trace_unsynchronized::h8c7e9c161dec6ceb
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe839d61fc1 - std::sys_common::backtrace::_print_fmt::h3dbd85d6c7b23aee
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fe839d61fc1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0d3e596e8094daf5
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fe839dc849c - core::fmt::rt::Argument::fmt::h4fcb9ccc4ae8b178
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/core/src/fmt/rt.rs:138:9
   5:     0x7fe839dc849c - core::fmt::write::hde6b07169611e983
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fe839d547ae - std::io::Write::write_fmt::hadeda9f51824c419
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/io/mod.rs:1714:15
   7:     0x7fe839d61dd5 - std::sys_common::backtrace::_print::h16e96fa77560cf6c
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fe839d61dd5 - std::sys_common::backtrace::print::hd2b25c630669a41b
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fe839d64e2a - std::panicking::panic_hook_with_disk_dump::{{closure}}::h820f75f8c35ebc61
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/panicking.rs:278:22
  10:     0x7fe839d64ac3 - std::panicking::panic_hook_with_disk_dump::h254fc8cd4ac07a17
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/panicking.rs:312:9
  11:     0x7fe838b83859 - <rustc_driver_impl[23d24208d96aabf1]::install_ice_hook::{closure#0} as core[446b5c3084867e6e]::ops::function::FnOnce<(&core[446b5c3084867e6e]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7fe839d656d0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h6b21a74b9087088a
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/alloc/src/boxed.rs:2021:9
  13:     0x7fe839d656d0 - std::panicking::rust_panic_with_hook::h88d69e7f62e6ab00
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/panicking.rs:733:13
  14:     0x7fe839104621 - std[f8657784229daa3e]::panicking::begin_panic::<rustc_errors[fda530a411b01ce3]::ExplicitBug>::{closure#0}
  15:     0x7fe8391028b6 - std[f8657784229daa3e]::sys_common::backtrace::__rust_end_short_backtrace::<std[f8657784229daa3e]::panicking::begin_panic<rustc_errors[fda530a411b01ce3]::ExplicitBug>::{closure#0}, !>
  16:     0x7fe8390bf676 - std[f8657784229daa3e]::panicking::begin_panic::<rustc_errors[fda530a411b01ce3]::ExplicitBug>
  17:     0x7fe83915ebb4 - <rustc_errors[fda530a411b01ce3]::HandlerInner>::bug::<alloc[da36cf216491d02e]::string::String>
  18:     0x7fe83915ea38 - <rustc_errors[fda530a411b01ce3]::Handler>::bug::<alloc[da36cf216491d02e]::string::String>
  19:     0x7fe83918264c - rustc_middle[9ff9a8da46dab689]::util::bug::opt_span_bug_fmt::<rustc_span[ae27aa9cbbacfb85]::span_encoding::Span>::{closure#0}
  20:     0x7fe83918144a - rustc_middle[9ff9a8da46dab689]::ty::context::tls::with_opt::<rustc_middle[9ff9a8da46dab689]::util::bug::opt_span_bug_fmt<rustc_span[ae27aa9cbbacfb85]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fe839181418 - rustc_middle[9ff9a8da46dab689]::ty::context::tls::with_context_opt::<rustc_middle[9ff9a8da46dab689]::ty::context::tls::with_opt<rustc_middle[9ff9a8da46dab689]::util::bug::opt_span_bug_fmt<rustc_span[ae27aa9cbbacfb85]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fe83763d7c0 - rustc_middle[9ff9a8da46dab689]::util::bug::bug_fmt
  23:     0x7fe8396338e6 - rustc_symbol_mangling[db9110d89b8803cd]::typeid::typeid_itanium_cxx_abi::encode_const
  24:     0x7fe8396341f0 - rustc_symbol_mangling[db9110d89b8803cd]::typeid::typeid_itanium_cxx_abi::encode_args
  25:     0x7fe839635ef6 - rustc_symbol_mangling[db9110d89b8803cd]::typeid::typeid_itanium_cxx_abi::encode_ty
  26:     0x7fe839637ed6 - rustc_symbol_mangling[db9110d89b8803cd]::typeid::typeid_itanium_cxx_abi::typeid_for_fnabi
  27:     0x7fe839637557 - rustc_symbol_mangling[db9110d89b8803cd]::typeid::typeid_itanium_cxx_abi::typeid_for_instance
  28:     0x7fe8373afd9c - <rustc_codegen_llvm[9be676f5ea734376]::context::CodegenCx as rustc_codegen_ssa[4f9ac761dca802d4]::traits::declare::PreDefineMethods>::predefine_fn
  29:     0x7fe837c6f67c - rustc_codegen_llvm[9be676f5ea734376]::base::compile_codegen_unit::module_codegen
  30:     0x7fe837c6d2d9 - rustc_codegen_llvm[9be676f5ea734376]::base::compile_codegen_unit
  31:     0x7fe837c69ac4 - rustc_codegen_ssa[4f9ac761dca802d4]::base::codegen_crate::<rustc_codegen_llvm[9be676f5ea734376]::LlvmCodegenBackend>
  32:     0x7fe837c694bb - <rustc_codegen_llvm[9be676f5ea734376]::LlvmCodegenBackend as rustc_codegen_ssa[4f9ac761dca802d4]::traits::backend::CodegenBackend>::codegen_crate
  33:     0x7fe837dac5a2 - <rustc_session[fd244e4ad4d5b785]::session::Session>::time::<alloc[da36cf216491d02e]::boxed::Box<dyn core[446b5c3084867e6e]::any::Any>, rustc_interface[107315fc4480df53]::passes::start_codegen::{closure#0}>
  34:     0x7fe837dac11b - rustc_interface[107315fc4480df53]::passes::start_codegen
  35:     0x7fe837da6daa - <rustc_middle[9ff9a8da46dab689]::ty::context::GlobalCtxt>::enter::<<rustc_interface[107315fc4480df53]::queries::Queries>::ongoing_codegen::{closure#0}, core[446b5c3084867e6e]::result::Result<alloc[da36cf216491d02e]::boxed::Box<dyn core[446b5c3084867e6e]::any::Any>, rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>>
  36:     0x7fe837da5de3 - <rustc_interface[107315fc4480df53]::interface::Compiler>::enter::<rustc_driver_impl[23d24208d96aabf1]::run_compiler::{closure#1}::{closure#2}, core[446b5c3084867e6e]::result::Result<core[446b5c3084867e6e]::option::Option<rustc_interface[107315fc4480df53]::queries::Linker>, rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>>
  37:     0x7fe837d9ee38 - std[f8657784229daa3e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[107315fc4480df53]::util::run_in_thread_pool_with_globals<rustc_interface[107315fc4480df53]::interface::run_compiler<core[446b5c3084867e6e]::result::Result<(), rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>, rustc_driver_impl[23d24208d96aabf1]::run_compiler::{closure#1}>::{closure#0}, core[446b5c3084867e6e]::result::Result<(), rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[446b5c3084867e6e]::result::Result<(), rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>>
  38:     0x7fe837d9e5be - <<std[f8657784229daa3e]::thread::Builder>::spawn_unchecked_<rustc_interface[107315fc4480df53]::util::run_in_thread_pool_with_globals<rustc_interface[107315fc4480df53]::interface::run_compiler<core[446b5c3084867e6e]::result::Result<(), rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>, rustc_driver_impl[23d24208d96aabf1]::run_compiler::{closure#1}>::{closure#0}, core[446b5c3084867e6e]::result::Result<(), rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[446b5c3084867e6e]::result::Result<(), rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>>::{closure#1} as core[446b5c3084867e6e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x7fe839d6fdc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9a82d72b2d10ea03
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/alloc/src/boxed.rs:2007:9
  40:     0x7fe839d6fdc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9f222f89042b2a16
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/alloc/src/boxed.rs:2007:9
  41:     0x7fe839d6fdc5 - std::sys::unix::thread::Thread::new::thread_start::ha2f5b7c44359c19a
                               at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/sys/unix/thread.rs:108:17
  42:     0x7fe83589344b - <unknown>
  43:     0x7fe835916e40 - <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: please attach the file at `/home/matthias/vcs/github/rust_bisect/rustc-ice-2023-07-28T05:14:57.200620104Z-1831474.txt` to your bug report

note: compiler flags: -Z sanitizer=cfi --crate-type lib -C lto

query stack during panic:
end of query stack
error: aborting due to previous error; 2 warnings emitted
```

</p>
</details>


<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":"rcvalle"}$$TRIAGEBOT_ASSIGN_DATA_END -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->