Repository: rust
Issue: ICE compiling liballoc with -Z randomize-layout in effect
Labels: I-ICE,T-compiler,C-bug,-Zrandomize-layout



### Code

```Rust
fn main(){} // Should occur with any code as it happens in the standard library
```

Occurs while compiling alloc using `-Z build-std` while `-Z randomize-layout` is in effect.


### Meta


`rustc --version --verbose`:
```
rustc 1.58.0-nightly (c390d69a6 2021-10-28)
binary: rustc
commit-hash: c390d69a615f095208ac94841f3310268521b2ee
commit-date: 2021-10-28
host: x86_64-unknown-linux-gnu
release: 1.58.0-nightly
LLVM version: 13.0.0

```

### Error output

```
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `8`,
 right: `0`', /rustc/c390d69a615f095208ac94841f3310268521b2ee/compiler/rustc_codegen_ssa/src/base.rs:212:17
stack backtrace:
   0: rust_begin_unwind
             at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panicking.rs:495:5
   1: core::panicking::panic_fmt
             at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/core/src/panicking.rs:106:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed::<u64, u64>
   4: rustc_codegen_ssa::base::unsize_ptr::<rustc_codegen_llvm::builder::Builder>
   5: <rustc_codegen_ssa::mir::FunctionCx<rustc_codegen_llvm::builder::Builder>>::codegen_rvalue_operand
   6: rustc_codegen_ssa::mir::codegen_mir::<rustc_codegen_llvm::builder::Builder>
   7: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
   8: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::symbol::Symbol, rustc_codegen_ssa::ModuleCodegen<rustc_codegen_llvm::ModuleLlvm>>
   9: rustc_codegen_llvm::base::compile_codegen_unit
  10: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
  11: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  12: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
  13: <rustc_interface::passes::QueryContext>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_errors::ErrorReported>>
  14: <rustc_interface::queries::Queries>::ongoing_codegen
  15: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
  16: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}>
  17: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

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.58.0-nightly (c390d69a6 2021-10-28) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z force-unstable-if-unmarked -Z randomize-layout -C embed-bitcode=no -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `alloc`
```

CC: @Kixiron