Repository: rust
Issue: ICE when using offset_of! in generic_const_exprs
Labels: I-ICE,A-trait-system,T-compiler,C-bug,F-generic_const_exprs,S-has-mcve,S-bug-has-test,F-offset_of,requires-incomplete-features

### Code ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=b3db1ea811f639fa4db8135f2b6bd338))

```rust
#![feature(generic_const_exprs)]
fn foo<T>(_: [(); std::mem::offset_of!((T,), 0)]) {}
```

Produces ICE:

<details>

```
error: internal compiler error: Missing value for constant, but no error reported?
 --> src/lib.rs:2:19
  |
2 | fn foo<T>(_: [(); std::mem::offset_of!((T,), 0)]) {}
  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at compiler/rustc_trait_selection/src/traits/const_evaluatable.rs:74:68
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable.cold
         4: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
         5: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
         6: <rustc_trait_selection::traits::engine::ObligationCtxt>::assumed_wf_types
         7: rustc_hir_analysis::check::wfcheck::check_item_fn
         8: rustc_hir_analysis::check::wfcheck::check_well_formed
         9: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        11: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
        12: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
        13: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        15: rustc_query_impl::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
        16: rustc_hir_analysis::check_crate
        17: rustc_interface::passes::analysis
        18: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        19: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        20: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        21: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        22: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        23: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#2} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        24: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/0d8b3346a3992ab11ea35ff0fb95a6864b91f797/library/alloc/src/boxed.rs:2018:9
        25: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/0d8b3346a3992ab11ea35ff0fb95a6864b91f797/library/alloc/src/boxed.rs:2018:9
        26: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/0d8b3346a3992ab11ea35ff0fb95a6864b91f797/library/std/src/sys/pal/unix/thread.rs:108:17
        27: start_thread
        28: clone
 --> src/lib.rs:2:19
  |
2 | fn foo<T>(_: [(); std::mem::offset_of!((T,), 0)]) {}
  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: this error: internal compiler error originates in the macro `std::mem::offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
```

</details>

Similar looking code [also ICEs on stable](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3d8f12ce73159848a6c195ad5d34f4a7) with different error message and feature enabled:

```rust
#![feature(generic_const_exprs)]

struct Foo<T, const N: usize = { std::mem::size_of::<T>() }>(T) where [(); std::mem::size_of::<T>()]:;

struct Bar<T> {
    foo: Foo<T>,
}
```

Upd.: additionaly, it does not ICE with -Znext-solver enabled for the first provided case, but not the second.