Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beta regression: ICE on Tried to access field 0 of union Layout #69191

Closed
Mark-Simulacrum opened this issue Feb 15, 2020 · 12 comments · Fixed by #69753 or #69768
Closed

beta regression: ICE on Tried to access field 0 of union Layout #69191

Mark-Simulacrum opened this issue Feb 15, 2020 · 12 comments · Fixed by #69753 or #69768
Assignees
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Mark-Simulacrum
Copy link
Member

cc @oli-obk

I suspect (but have not verified) that this would be fixed by a backport of #64987.

@Mark-Simulacrum Mark-Simulacrum added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Feb 15, 2020
@oli-obk
Copy link
Contributor

oli-obk commented Feb 15, 2020

#64987 was merged in October, I don't think it's related

@JohnTitor JohnTitor added A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. labels Feb 16, 2020
@hellow554
Copy link
Contributor

Does this need an mcve?

@jonas-schievink
Copy link
Contributor

Yeah, but I think at this point a bisection might be more helpful since we're not yet sure what caused this.

@jonas-schievink jonas-schievink added E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Feb 17, 2020
@hellow554

This comment has been minimized.

@hellow554
Copy link
Contributor

hellow554 commented Feb 18, 2020

Here's a "M"CVE without any dependencies:

pub enum Void {}

pub trait Machine: Sized {
    type Seed: Sized;
    fn create(seed: Self::Seed) -> Response<Self, ()>;
}

pub struct Response<M, N>(std::marker::PhantomData<(M, N)>);
pub struct MyHandler<M>(std::marker::PhantomData<M>);
pub struct Loop<M>(std::marker::PhantomData<M>);

impl<M: Machine> Loop<M> {
    pub fn new() -> Self {
        unimplemented!()
    }

    pub fn add_machine_with<F>(&self, _fun: F)
    where
        F: FnOnce() -> Response<M, Void>,
    {
        unimplemented!()
    }

    pub fn run(self) {
        let handler = MyHandler::<M>::new();
        handler.timeout();
    }
}

impl<M: Machine> MyHandler<M> {
    pub fn new() -> Self {
        unimplemented!()
    }
    fn timeout(self) {
        let creator = None;
        let new = Some(creator.unwrap());
        M::create(new.unwrap());
    }
}

impl<M: Sized, N: Sized> Response<M, N> {
    pub fn map<T, U, S, R>(self, _: S, _: R) -> Response<T, U>
    where
        S: FnOnce(M) -> T,
    {
        unimplemented!()
    }
    pub fn wrap<T, S>(self, _: S) -> Response<T, N>
    where
        S: FnOnce(M) -> T,
    {
        unimplemented!()
    }
}

enum Tcp {}

enum Composed {
    Tcp(Tcp),
}
enum CSeed {
    Tcp(Void),
}

impl Machine for Composed {
    type Seed = CSeed;
    fn create(seed: CSeed) -> Response<Self, ()> {
        match seed {
            CSeed::Tcp(_x) => unimplemented!(),
        }
    }
}

impl Tcp {
    fn new() -> Response<Tcp, Void> {
        unimplemented!()
    }
}

impl Machine for Tcp {
    type Seed = Void;
    fn create(_seed: Void) -> Response<Self, ()> {
        unimplemented!()
    }
}

fn main() {
    let loop_creator = Loop::new();
    loop_creator.add_machine_with(|| Tcp::new().wrap(Composed::Tcp));
    loop_creator.run();
}

regression in nightly-2020-01-11

Backtrace
thread 'rustc' panicked at 'Tried to access field 0 of union TyLayout {
    ty: CSeed,
    details: LayoutDetails {
        variants: Single {
            index: 0,
        },
        fields: Union(
            0,
        ),
        abi: Uninhabited,
        largest_niche: None,
        align: AbiAndPrefAlign {
            abi: Align {
                pow2: 0,
            },
            pref: Align {
                pow2: 0,
            },
        },
        size: Size {
            raw: 0,
        },
    },
} with 0 fields', src/librustc_mir/interpret/place.rs:413:17
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1428
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
  12: rust_begin_unwind
             at src/libstd/panicking.rs:378
  13: std::panicking::begin_panic_fmt
             at src/libstd/panicking.rs:332
  14: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::operand_field
  15: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_place_to_op
  16: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_operand
  17: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_rvalue_into_place
  18: <rustc_mir::transform::const_prop::ConstPropagator as rustc::mir::visit::MutVisitor>::visit_statement
  19: <rustc_mir::transform::const_prop::ConstProp as rustc_mir::transform::MirPass>::run_pass
  20: rustc_mir::transform::run_passes
  21: rustc_mir::transform::run_optimization_passes
  22: rustc_mir::transform::optimized_mir
  23: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::optimized_mir>::compute
  24: rustc::dep_graph::graph::DepGraph::with_task_impl
  25: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  26: rustc::ty::<impl rustc::ty::context::TyCtxt>::instance_mir
  27: rustc_mir::monomorphize::collector::collect_items_rec
  28: rustc_mir::monomorphize::collector::collect_items_rec
  29: rustc_mir::monomorphize::collector::collect_items_rec
  30: rustc_mir::monomorphize::collector::collect_items_rec
  31: rustc_session::utils::<impl rustc_session::session::Session>::time
  32: rustc_mir::monomorphize::collector::collect_crate_mono_items
  33: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  34: rustc::ty::query::__query_compute::collect_and_partition_mono_items
  35: rustc::dep_graph::graph::DepGraph::with_task_impl
  36: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  37: rustc_codegen_ssa::base::codegen_crate
  38: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  39: rustc_session::utils::<impl rustc_session::session::Session>::time
  40: rustc_interface::passes::QueryContext::enter
  41: rustc_interface::queries::Queries::ongoing_codegen
  42: rustc_interface::interface::run_compiler_in_existing_thread_pool
  43: scoped_tls::ScopedKey<T>::set
  44: syntax::attr::with_globals
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (5e7af4669 2020-02-16) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [optimized_mir] processing `<Composed as Machine>::create`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `foo`.

To learn more, run the command again with --verbose.

@rustbot modify labels: -E-needs-bisection -E-needs-mcve

@rustbot rustbot removed E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Feb 18, 2020
@chrissimpkins
Copy link
Member

chrissimpkins commented Feb 18, 2020

searched nightlies: from nightly-2019-11-01 to nightly-2020-02-16
regressed nightly: nightly-2020-01-11
searched commits: from 72b2bd5 to 1756313
regressed commit: 2d8d559
source code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=b9ff885bb9e3de044e629f93bdbd81fd

Instructions

Reproduce bisection with:

$ cargo bisect-rustc --start 2020-01-10 --end 2020-01-11 --prompt

Error

COLLAPSIBLE ERROR STACKTRACE

warning: variant is never constructed: `Tcp`
  --> src/main.rs:62:5
   |
62 |     Tcp(Void),
   |     ^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

thread 'rustc' panicked at 'Tried to access field 0 of union TyLayout {
    ty: CSeed,
    details: LayoutDetails {
        variants: Single {
            index: 0,
        },
        fields: Union(
            0,
        ),
        abi: Uninhabited,
        largest_niche: None,
        align: AbiAndPrefAlign {
            abi: Align {
                pow2: 0,
            },
            pref: Align {
                pow2: 0,
            },
        },
        size: Size {
            raw: 0,
        },
    },
} with 0 fields', src/librustc_mir/interpret/place.rs:413:17
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1428
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
  12: rust_begin_unwind
             at src/libstd/panicking.rs:378
  13: std::panicking::begin_panic_fmt
             at src/libstd/panicking.rs:332
  14: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::operand_field
  15: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_place_to_op
  16: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_operand
  17: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_rvalue_into_place
  18: <rustc_mir::transform::const_prop::ConstPropagator as rustc::mir::visit::MutVisitor>::visit_statement
  19: <rustc_mir::transform::const_prop::ConstProp as rustc_mir::transform::MirPass>::run_pass
  20: rustc_mir::transform::run_passes
  21: rustc_mir::transform::run_optimization_passes
  22: rustc_mir::transform::optimized_mir
  23: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::optimized_mir>::compute
  24: rustc::dep_graph::graph::DepGraph::with_task_impl
  25: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  26: rustc::ty::<impl rustc::ty::context::TyCtxt>::instance_mir
  27: rustc_mir::monomorphize::collector::collect_items_rec
  28: rustc_mir::monomorphize::collector::collect_items_rec
  29: rustc_mir::monomorphize::collector::collect_items_rec
  30: rustc_mir::monomorphize::collector::collect_items_rec
  31: rustc_session::utils::<impl rustc_session::session::Session>::time
  32: rustc_mir::monomorphize::collector::collect_crate_mono_items
  33: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  34: rustc::ty::query::__query_compute::collect_and_partition_mono_items
  35: rustc::dep_graph::graph::DepGraph::with_task_impl
  36: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  37: rustc_codegen_ssa::base::codegen_crate
  38: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  39: rustc_session::utils::<impl rustc_session::session::Session>::time
  40: rustc_interface::passes::QueryContext::enter
  41: rustc_interface::queries::Queries::ongoing_codegen
  42: rustc_interface::interface::run_compiler_in_existing_thread_pool
  43: scoped_tls::ScopedKey<T>::set
  44: syntax::attr::with_globals
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (0176a9eef 2020-02-17) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [optimized_mir] processing `<Composed as Machine>::create`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack

ERROR BEFORE ICE REGRESSION

warning: variant is never constructed: `Tcp`
  --> src/main.rs:62:5
   |
62 |     Tcp(Void),
   |     ^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

    Finished dev [unoptimized + debuginfo] target(s) in 0.23s


nightly-2020-01-10 finished with exit code Some(0).

@pnkfelix
Copy link
Member

It would be good to continue the bisection into the rollup PR, among the following PRs:

@pnkfelix
Copy link
Member

triage: P-high, removing nomination, assigning to self.

@pnkfelix pnkfelix added the P-high High priority label Feb 20, 2020
@pnkfelix pnkfelix self-assigned this Feb 20, 2020
@wesleywiser
Copy link
Member

Given the backtrace, I think it's probably

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Feb 21, 2020
@LeSeulArtichaut
Copy link
Contributor

I can indeed reproduce the ICE at c5c4fa8, #67501 seems to be the culprit.
cc @oli-obk @pnkfelix

Backtrace
thread 'rustc' panicked at 'Tried to access field 0 of union TyLayout {
    ty: CSeed,
    details: LayoutDetails {
        variants: Single {
            index: 0,
        },
        fields: Union(
            0,
        ),
        abi: Uninhabited,
        largest_niche: None,
        align: AbiAndPrefAlign {
            abi: Align {
                pow2: 0,
            },
            pref: Align {
                pow2: 0,
            },
        },
        size: Size {
            raw: 0,
        },
    },
} with 0 fields', src/librustc_mir/interpret/place.rs:414:17
stack backtrace:
   0:        0x110b37025 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h69a1e3d2ca9c1e11
   1:        0x110b535f1 - core::fmt::write::hf3458d798296d204
   2:        0x110b2bf79 - std::io::Write::write_fmt::h66a47365b38681ee
   3:        0x110b36ddb - std::sys_common::backtrace::print::h02498af503ed0c92
   4:        0x110b04a0e - std::panicking::default_hook::{{closure}}::h34e746f1db241fc9
   5:        0x110b04791 - std::panicking::default_hook::h2e4333a70604ecb2
   6:        0x106060dd4 - rustc_driver::report_ice::he4e28a13284da972
   7:        0x110b05040 - std::panicking::rust_panic_with_hook::h877c0d796963b6c1
   8:        0x110b04b6a - rust_begin_unwind
   9:        0x110b729d8 - std::panicking::begin_panic_fmt::h71f3a4b90a95f3d3
  10:        0x108f0858c - rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::operand_field::h87b529a0597d5280
  11:        0x108f09aa1 - rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_place_to_op::h0badc7f16a061eb7
  12:        0x108f0aad3 - rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_operand::h388bdbfc5c47bf0c
  13:        0x108f2ea3a - rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_rvalue_into_place::h4f24d1525a1f30d8
  14:        0x108fcea9d - rustc_mir::transform::const_prop::ConstPropagator::use_ecx::h9e82b3a972541897
  15:        0x108ec9f11 - <rustc_mir::transform::const_prop::ConstPropagator as rustc::mir::visit::MutVisitor>::visit_statement::hbcbb76349a1b2af8
  16:        0x108fcc172 - rustc::mir::visit::MutVisitor::visit_body::hed185033fa2d801d
  17:        0x108ec820c - <rustc_mir::transform::const_prop::ConstProp as rustc_mir::transform::MirPass>::run_pass::h3e923c7c053214b4
  18:        0x10910c911 - rustc_mir::transform::run_passes::hb67a5bf194d0c50b
  19:        0x10910d456 - rustc_mir::transform::run_optimization_passes::h4d95f5ca8063715d
  20:        0x10910d733 - rustc_mir::transform::optimized_mir::h2eea86349c4420ec
  21:        0x109dd673b - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::optimized_mir>::compute::h3776afa08b9955c7
  22:        0x109eaf462 - rustc::dep_graph::graph::DepGraph::with_task_impl::h3bcd274945700fd0
  23:        0x109ca6d3d - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h1f6b8e5f14eef5bb
  24:        0x109e5dfee - rustc::ty::<impl rustc::ty::context::TyCtxt>::instance_mir::hf27ba3a3da6bb109
  25:        0x108ddf208 - rustc_mir::monomorphize::collector::collect_items_rec::h3d134124ea30f5b1
  26:        0x108ddf449 - rustc_mir::monomorphize::collector::collect_items_rec::h3d134124ea30f5b1
  27:        0x108ddf449 - rustc_mir::monomorphize::collector::collect_items_rec::h3d134124ea30f5b1
  28:        0x108ddf449 - rustc_mir::monomorphize::collector::collect_items_rec::h3d134124ea30f5b1
  29:        0x108c2159e - rustc_session::utils::<impl rustc_session::session::Session>::time::h3d5518a7f37fd9d1
  30:        0x108dde585 - rustc_mir::monomorphize::collector::collect_crate_mono_items::h0d91d5b14a52cb4b
  31:        0x108c21a80 - rustc_session::utils::<impl rustc_session::session::Session>::time::hb1832d4b48f9a79c
  32:        0x10909de3f - rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items::h96d8f9e8b1696162
  33:        0x10639ab5c - rustc::ty::query::__query_compute::collect_and_partition_mono_items::h8b7e8e7a35df0e0f
  34:        0x10649fe56 - rustc::dep_graph::graph::DepGraph::with_task_impl::hbb6e03c47e6ffedc
  35:        0x1063d3267 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::ha0e0a8abfcf6451c
  36:        0x10638c0cd - rustc_codegen_ssa::base::codegen_crate::h3768de7321d0405f
  37:        0x106342ab9 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate::hd0d92b55e53ebbcb
  38:        0x106337090 - rustc_session::utils::<impl rustc_session::session::Session>::time::hdb245d4656aad9d6
  39:        0x106329c23 - rustc_interface::passes::start_codegen::h21caada137f8cf2e
  40:        0x10632a0ae - rustc::ty::context::tls::enter_global::h125d9d08f1491fc8
  41:        0x1061eb87f - rustc_interface::queries::Query<T>::compute::h8afa9a79dfe3203f
  42:        0x1061e7edc - rustc_interface::queries::Queries::ongoing_codegen::h8f7e07e1dac4f6c6
  43:        0x1060a8cae - rustc_interface::interface::run_compiler_in_existing_thread_pool::h424d11116d6dbfb6
  44:        0x1060935dd - scoped_tls::ScopedKey<T>::set::h56349b514de6b8d6
  45:        0x10606fb45 - syntax::with_globals::hd4aec9efb871578a
  46:        0x1060a616e - std::sys_common::backtrace::__rust_begin_short_backtrace::h9eeb9c817fb78bb0
  47:        0x1060e8b62 - std::panicking::try::do_call::h0d69788ad8d7e60a
  48:        0x110b37aca - __rust_maybe_catch_panic
  49:        0x1060e8919 - std::panicking::try::h0817a7b1e46e110f
  50:        0x10607c8ec - core::ops::function::FnOnce::call_once{{vtable.shim}}::h138312dfe0ed3c99
  51:        0x110b0c61e - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hf14a404fd9d2e584
  52:        0x110b0c5a6 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h8607d8336ffda5c8
  53:        0x110b2ce3a - std::sys_common::thread::start_thread::h83b37fb852a26050
  54:        0x110b20529 - std::sys::unix::thread::Thread::new::thread_start::h843727c91d6328f4
  55:     0x7fff6b060d76 - _pthread_start

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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.42.0-dev running on x86_64-apple-darwin

query stack during panic:
#0 [optimized_mir] processing `<Composed as Machine>::create`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack

@pnkfelix
Copy link
Member

pnkfelix commented Mar 5, 2020

Here is a more minimal MCVE:

pub enum Void {}

enum UninhabitedUnivariant {
    Variant(Void),
}

fn main() {
    let seed: UninhabitedUnivariant = None.unwrap();
    match seed {
        UninhabitedUnivariant::Variant(_x) => {}
    }
}

/me needs to invest some time in tools like rust-reduce or creduce...

Centril added a commit to Centril/rust that referenced this issue Mar 6, 2020
…ited-enum-field, r=oli-obk

Do not ICE when matching an uninhabited enum's field

Fix rust-lang#69191
@pnkfelix
Copy link
Member

pnkfelix commented Mar 6, 2020

Okay so now we have two different PR's to fix this.

PR #69768 is almost certainly the right call for nightly itself.

My only Question is whether we should also land PR #69753 and also then backport that to beta. My argument for why is that it is "obviously" less risky, which is important because the beta is going to be imminently promoted to stable.

bors added a commit that referenced this issue Mar 6, 2020
…ield, r=oli

Do not ICE when matching an uninhabited enum's field

Fix #69191
@bors bors closed this as completed in 9712fa4 Mar 6, 2020
pietroalbini pushed a commit to pietroalbini/rust that referenced this issue Mar 9, 2020
Centril added a commit to Centril/rust that referenced this issue Mar 11, 2020
…lfJung

Compute the correct layout for variants of uninhabited enums

r? @eddyb
cc @RalfJung

fixes rust-lang#69191
cc rust-lang#69763
Centril added a commit to Centril/rust that referenced this issue Mar 11, 2020
…lfJung

Compute the correct layout for variants of uninhabited enums

r? @eddyb
cc @RalfJung

fixes rust-lang#69191
cc rust-lang#69763
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 14, 2020
…lfJung

Compute the correct layout for variants of uninhabited enums

r? @eddyb
cc @RalfJung

fixes rust-lang#69191
cc rust-lang#69763
JohnTitor added a commit to JohnTitor/rust that referenced this issue Mar 14, 2020
…lfJung

Compute the correct layout for variants of uninhabited enums

r? @eddyb
cc @RalfJung

fixes rust-lang#69191
cc rust-lang#69763
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 17, 2020
…lfJung

Compute the correct layout for variants of uninhabited enums

r? @eddyb
cc @RalfJung

fixes rust-lang#69191
cc rust-lang#69763
Manishearth added a commit to Manishearth/rust that referenced this issue Mar 17, 2020
…lfJung

Compute the correct layout for variants of uninhabited enums

r? @eddyb
cc @RalfJung

fixes rust-lang#69191
cc rust-lang#69763
Centril added a commit to Centril/rust that referenced this issue Mar 19, 2020
…lfJung

Compute the correct layout for variants of uninhabited enums

r? @eddyb
cc @RalfJung

fixes rust-lang#69191
cc rust-lang#69763
JohnTitor added a commit to JohnTitor/rust that referenced this issue Mar 20, 2020
…lfJung

Compute the correct layout for variants of uninhabited enums

r? @eddyb
cc @RalfJung

fixes rust-lang#69191
cc rust-lang#69763
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet