Repository: rust
Issue: ICE `immediate Scalar(alloc1) does not fit to layout TyAndLayout`
Labels: I-ICE,T-compiler,C-bug,A-const-eval,A-mir-opt,A-mir-opt-inlining,S-has-mcve,S-bug-has-test,requires-debug-assertions,F-trivial_bounds

<!--
[31mICE[0m: Rustc ./ice.rs '' 'thread 'rustc' panicked at /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_const_eval/src/interpret/operand.rs:195:9: 'immediate Scalar(alloc1) does not fit to layout TyAndLayout { ty: &dyn Debug + Sync, layout: Layout { size: Size(16 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: ScalarPair(Initialized { value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }, Initialized { value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), fields: Arbitrary { offsets: [Size(0 bytes), Size(8 bytes)], memory_index: [0, 1] }, largest_niche: Some(Niche { offset: Size(0 bytes), value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), variants: Single { index: 0 }, max_repr_align: None, unadjusted_abi_align: Align(8 bytes) } }'', 'thread 'rustc' panicked at /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_const_eval/src/interpret/operand.rs:195:9: 'immediate Scalar(alloc1) does not fit to layout TyAndLayout { ty: &dyn Debug + Sync, layout: Layout { size: Size(16 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: ScalarPair(Initialized { value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }, Initialized { value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), fields: Arbitrary { offsets: [Size(0 bytes), Size(8 bytes)], memory_index: [0, 1] }, largest_niche: Some(Niche { offset: Size(0 bytes), value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), variants: Single { index: 0 }, max_repr_align: None, unadjusted_abi_align: Align(8 bytes) } }''
File: /tmp/im/ZWEI/ice.rs
-->

snippet:
````rust
use std::fmt::Debug;

static STATIC_1: dyn Debug + Sync = *();

fn main() {
    println!("{:?}", &STATIC_1);
}


````

Version information
````
rustc 1.78.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.78.0-dev
LLVM version: 18.1.0

````

Command:
`/home/matthias/.rustup/toolchains/local-debug-assertions/bin/rustc `


<!--
query stack:
immediate Scalar(alloc1) does not fit to layout TyAndLayout { ty: &dyn Debug + Sync, layout: Layout { size: Size(16 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: ScalarPair(Initialized { value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }, Initialized { value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), fields: Arbitrary { offsets: [Size(0 bytes), Size(8 bytes)], memory_index: [0, 1] }, largest_niche: Some(Niche { offset: Size(0 bytes), value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), variants: Single { index: 0 }, max_repr_align: None, unadjusted_abi_align: Align(8 bytes) } }
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `main`
#1 [analysis] running analysis passes on this crate

-->