Closed
Description
Edit: see my first answer for a real minimal repro
```rust
extern crate wayland_server;
use wayland_server::NewResource;
use wayland_server::protocol::wl_callback;
pub fn break(callback: NewResource<wl_callback::WlCallback>) {
callback.implement(|e, _| match e {}, None::<fn(_,_)>);
}
```
using `wayland-server = "0.20.0"` as dependency, and compiled as a lib (otherwise the dead code elimination prevents the ICE to occur)
Possibly useful information: the arguments of the first closure are:
- `e`: an empty enum (never seen this ICE on the same pattern where this argument was a non-empty enum)
- second argument of type `wayland_server::Resource<I>` with this definition:
```rust
pub struct Resource<I: Interface> {
_i: ::std::marker::PhantomData<*const I>,
internal: Option<Arc<ResourceInternal>>,
ptr: *mut wl_resource,
}
```
Causes this ICE on stable, beta, and nightly:
```
error: internal compiler error: librustc_trans/mir/block.rs:638: trans_argument: OperandRef(Immediate(({ i64*, i8* }:{ i64*, i8* } undef)) @ TyLayout { ty: wayland_server::Resource<wayland_server::protocol::wl_callback::WlCallback>, details: LayoutDetails { variants: Single { index: 0 }, fields: Arbitrary { offsets: [Size { raw: 0 }, Size { raw: 0 }, Size { raw: 8 }], memory_index: [0, 1, 2] }, abi: ScalarPair(Scalar { value: Pointer, valid_range: 1..=0 }, Scalar { value: Pointer, valid_range: 0..=18446744073709551615 }), align: Align { abi: 3, pref: 3 }, size: Size { raw: 16 } } }) invalid for pair arugment
thread 'rustc' panicked at 'Box<Any>', librustc_errors/lib.rs:535:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at libstd/sys_common/backtrace.rs:59
at libstd/panicking.rs:380
3: std::panicking::default_hook
at libstd/panicking.rs:396
4: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:576
5: std::panicking::begin_panic
6: rustc_errors::Handler::bug
7: rustc::session::opt_span_bug_fmt::{{closure}}
8: rustc::ty::context::tls::with_opt::{{closure}}
9: <std::thread::local::LocalKey<T>>::try_with
10: <std::thread::local::LocalKey<T>>::with
11: rustc::ty::context::tls::with
12: rustc::ty::context::tls::with_opt
13: rustc::session::opt_span_bug_fmt
14: rustc::session::bug_fmt
15: rustc_trans::mir::block::<impl rustc_trans::mir::FunctionCx<'a, 'tcx>>::trans_argument
16: rustc_trans::mir::block::<impl rustc_trans::mir::FunctionCx<'a, 'tcx>>::trans_terminator
17: rustc_trans::mir::trans_mir
18: rustc_trans::base::trans_instance
19: rustc_trans::base::compile_codegen_unit
20: rustc::dep_graph::graph::DepGraph::with_task_impl
21: rustc::ty::maps::<impl rustc::ty::maps::queries::compile_codegen_unit<'tcx>>::force
22: rustc::ty::maps::<impl rustc::ty::maps::queries::compile_codegen_unit<'tcx>>::try_get
23: rustc::ty::maps::TyCtxtAt::compile_codegen_unit
24: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::compile_codegen_unit
25: rustc_trans::base::trans_crate
26: <rustc_trans::LlvmTransCrate as rustc_trans_utils::trans_crate::TransCrate>::trans_crate
27: rustc_driver::driver::phase_4_translate_to_llvm
28: rustc_driver::driver::compile_input::{{closure}}
29: rustc::ty::context::TyCtxt::create_and_enter
30: rustc_driver::driver::compile_input
31: rustc_driver::run_compiler
```