rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.16k stars 12.69k forks source link

ICE when match arms have incompatible types #67273

Closed JuanSamuelVB closed 4 years ago

JuanSamuelVB commented 4 years ago

Code:

struct A { }

impl A {
    fn f(self) {
        let mut i: i64 = 0;

        match i {
            1 => true,
            2 => true,
            3 => i = 1,
            _ => (),
        }

        println!("{}", i);
    }
}

fn main() { }

Playground

Backtrace ``` Compiling playground v0.0.1 (/playground) warning: value assigned to `i` is never read --> src/main.rs:10:18 | 10 | 3 => i = 1, | ^ | = note: `#[warn(unused_assignments)]` on by default = help: maybe it is overwritten before being read? thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/slice/mod.rs:2717:10 stack backtrace: 0: backtrace::backtrace::libunwind::trace at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88 1: backtrace::backtrace::trace_unsynchronized at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66 2: std::sys_common::backtrace::_print_fmt at src/libstd/sys_common/backtrace.rs:76 3: ::fmt at src/libstd/sys_common/backtrace.rs:60 4: core::fmt::write at src/libcore/fmt/mod.rs:1030 5: std::io::Write::write_fmt at src/libstd/io/mod.rs:1412 6: std::sys_common::backtrace::_print at src/libstd/sys_common/backtrace.rs:64 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:196 9: std::panicking::default_hook at src/libstd/panicking.rs:210 10: rustc_driver::report_ice 11: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:477 12: std::panicking::continue_panic_fmt at src/libstd/panicking.rs:380 13: rust_begin_unwind at src/libstd/panicking.rs:307 14: core::panicking::panic_fmt at src/libcore/panicking.rs:85 15: core::panicking::panic_bounds_check at src/libcore/panicking.rs:61 16: rustc_mir::borrow_check::nll::type_check::type_check 17: rustc_mir::borrow_check::nll::compute_regions 18: rustc_mir::borrow_check::do_mir_borrowck 19: rustc::ty::context::GlobalCtxt::enter_local 20: rustc_mir::borrow_check::mir_borrowck 21: rustc::ty::query::__query_compute::mir_borrowck 22: rustc::ty::query::::compute 23: rustc::dep_graph::graph::DepGraph::with_task_impl 24: rustc::ty::query::plumbing::::get_query 25: rustc::ty::::par_body_owners 26: rustc::util::common::time 27: rustc_interface::passes::analysis 28: rustc::ty::query::__query_compute::analysis 29: rustc::ty::query::plumbing::::get_query 30: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}} 31: rustc_interface::passes::create_global_ctxt::{{closure}} 32: rustc_interface::interface::run_compiler_in_existing_thread_pool 33: std::thread::local::LocalKey::with 34: scoped_tls::ScopedKey::set 35: syntax::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.39.0 (4560ea788 2019-11-04) running on x86_64-unknown-linux-gnu note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [mir_borrowck] processing `A::f` #1 [analysis] running analysis passes on this crate end of query stack error: internal compiler error[E0308]: match arms have incompatible types --> src/main.rs:10:18 | 7 | / match i { 8 | | 1 => true, | | ---- this is found to be of type `bool` 9 | | 2 => true, | | ---- this is found to be of type `bool` 10 | | 3 => i = 1, | | ^^^^^ expected bool, found () 11 | | _ => (), 12 | | } | |_________- `match` arms have incompatible types | = note: expected type `bool` found type `()` error: internal compiler error: cat_expr Errd --> src/main.rs:4:16 | 4 | fn f(self) { | ________________^ 5 | | let mut i: i64; 6 | | 7 | | match i { ... | 12 | | } 13 | | } | |_____^ error: internal compiler error: cat_expr Errd --> src/main.rs:7:9 | 7 | / match i { 8 | | 1 => true, 9 | | 2 => true, 10 | | 3 => i = 1, 11 | | _ => (), 12 | | } | |_________^ error: internal compiler error: QualifyAndPromoteConstants: MIR had errors --> src/main.rs:4:5 | 4 | / fn f(self) { 5 | | let mut i: i64; 6 | | 7 | | match i { ... | 12 | | } 13 | | } | |_____^ error: internal compiler error: broken MIR in DefId(0:14 ~ playground[4d70]::{{impl}}[0]::f[0]) ("return type"): bad type [type error] --> src/main.rs:4:5 | 4 | / fn f(self) { 5 | | let mut i: i64; 6 | | 7 | | match i { ... | 12 | | } 13 | | } | |_____^ error: internal compiler error: broken MIR in DefId(0:14 ~ playground[4d70]::{{impl}}[0]::f[0]) (LocalDecl { mutability: Mut, is_user_variable: None, internal: false, is_block_tail: None, ty: [type error], user_ty: UserTypeProjections { contents: [] }, name: None, source_info: SourceInfo { span: src/main.rs:4:5: 13:6, scope: scope[0] }, visibility_scope: scope[0] }): bad type [type error] --> src/main.rs:4:5 | 4 | / fn f(self) { 5 | | let mut i: i64; 6 | | 7 | | match i { ... | 12 | | } 13 | | } | |_____^ thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:364:17 stack backtrace: 0: 0x7f7469dfeaf4 - backtrace::backtrace::libunwind::trace::hda41dbcdfba36aa0 at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88 1: 0x7f7469dfeaf4 - backtrace::backtrace::trace_unsynchronized::h1a8d6e1f8cb3f5d4 at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66 2: 0x7f7469dfeaf4 - std::sys_common::backtrace::_print_fmt::h610c4127487e10da at src/libstd/sys_common/backtrace.rs:76 3: 0x7f7469dfeaf4 - ::fmt::h0722dc552e01bd1d at src/libstd/sys_common/backtrace.rs:60 4: 0x7f7469e3712c - core::fmt::write::h01edf6dd68a42c9c at src/libcore/fmt/mod.rs:1030 5: 0x7f7469df2d17 - std::io::Write::write_fmt::hf15985f193f03c04 at src/libstd/io/mod.rs:1412 6: 0x7f7469e03325 - std::sys_common::backtrace::_print::hd8d5d08a1795e743 at src/libstd/sys_common/backtrace.rs:64 7: 0x7f7469e03325 - std::sys_common::backtrace::print::hf89a79e3921a2366 at src/libstd/sys_common/backtrace.rs:49 8: 0x7f7469e03325 - std::panicking::default_hook::{{closure}}::h3a8f42beb3bb8ae3 at src/libstd/panicking.rs:196 9: 0x7f7469e03016 - std::panicking::default_hook::h8f803b0bc31a5c37 at src/libstd/panicking.rs:210 10: 0x7f746a33a483 - rustc_driver::report_ice::he98718c53edc6d3d 11: 0x7f7469e03b0c - std::panicking::rust_panic_with_hook::h825f041245da8739 at src/libstd/panicking.rs:477 12: 0x7f746c0fd305 - std::panicking::begin_panic::h24bff3e7c9e5f401 13: 0x7f746c114325 - ::drop::h7d67f92828aa4921 14: 0x7f746a349036 - core::ptr::real_drop_in_place::h4cc016bb9c12dcfd 15: 0x7f746a353256 - as core::ops::drop::Drop>::drop::he3ba9625aa54e867 16: 0x7f746a30e63c - core::ptr::real_drop_in_place::hc71a3d54dd0b0dda 17: 0x7f746a306c9c - rustc_interface::interface::run_compiler_in_existing_thread_pool::ha009ae4607895a11 18: 0x7f746a33c362 - std::thread::local::LocalKey::with::h30eaff0b6e71bc49 19: 0x7f746a3413ce - scoped_tls::ScopedKey::set::h6ab0051cc42102a7 20: 0x7f746a3621a2 - syntax::with_globals::h9994c1c3242d3263 21: 0x7f746a2cee10 - std::sys_common::backtrace::__rust_begin_short_backtrace::h229c554686840b66 22: 0x7f7469e1425a - __rust_maybe_catch_panic at src/libpanic_unwind/lib.rs:80 23: 0x7f746a2f8879 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hf2e117c529f2753f 24: 0x7f7469de51ff - as core::ops::function::FnOnce>::call_once::h483711add4ba2330 at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/boxed.rs:922 25: 0x7f7469e12f00 - as core::ops::function::FnOnce>::call_once::h7605b45eb29ed0be at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/boxed.rs:922 26: 0x7f7469e12f00 - std::sys_common::thread::start_thread::h557b0c2dc4449562 at src/libstd/sys_common/thread.rs:13 27: 0x7f7469e12f00 - std::sys::unix::thread::Thread::new::thread_start::h7c2a7f9b68fe4bba at src/libstd/sys/unix/thread.rs:79 28: 0x7f7469b7f6db - start_thread 29: 0x7f746949c88f - __clone 30: 0x0 - 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.39.0 (4560ea788 2019-11-04) running on x86_64-unknown-linux-gnu note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin note: some of the compiler flags provided by cargo are hidden query stack during panic: end of query stack thread panicked while panicking. aborting. error: could not compile `playground`. Caused by: process didn't exit successfully: `rustc --edition=2018 --crate-name playground src/main.rs --color never --crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 -C metadata=56f040b7fea6bfb6 -C extra-filename=-56f040b7fea6bfb6 --out-dir /playground/target/debug/deps -L dependency=/playground/target/debug/deps --extern adler32=/playground/target/debug/deps/libadler32-5d82cfb9a09f47d7.rlib --extern aho_corasick=/playground/target/debug/deps/libaho_corasick-21766d301a15121c.rlib --extern alga=/playground/target/debug/deps/libalga-2d0ce67109901bda.rlib --extern ansi_term_0_11_0=/playground/target/debug/deps/libansi_term-d7671ab7608885b6.rlib --extern ansi_term=/playground/target/debug/deps/libansi_term-1d131fbde626e8b3.rlib --extern antidote=/playground/target/debug/deps/libantidote-51015a3ab6d45258.rlib --extern approx=/playground/target/debug/deps/libapprox-6135d7cae101f638.rlib --extern arc_swap=/playground/target/debug/deps/libarc_swap-b6c4c14f05faf2a6.rlib --extern arrayref=/playground/target/debug/deps/libarrayref-45d8b0522fe5f579.rlib --extern arrayvec=/playground/target/debug/deps/libarrayvec-aab9d0ce32063885.rlib --extern atty=/playground/target/debug/deps/libatty-e940531f6d0cdbe8.rlib --extern autocfg=/playground/target/debug/deps/libautocfg-0e3b07a1d37460a2.rlib --extern backtrace=/playground/target/debug/deps/libbacktrace-6eea7936bd3f3261.rlib --extern backtrace_sys=/playground/target/debug/deps/libbacktrace_sys-997aad13afdb69e1.rlib --extern base64_0_6_0=/playground/target/debug/deps/libbase64-ccf5f1dc9426db53.rlib --extern base64_0_10_1=/playground/target/debug/deps/libbase64-060854b40c47dbe9.rlib --extern base64=/playground/target/debug/deps/libbase64-0cc9d35783f62ac1.rlib --extern bit_set=/playground/target/debug/deps/libbit_set-1b27f64f34645126.rlib --extern bit_vec=/playground/target/debug/deps/libbit_vec-224af343a6bc5b3b.rlib --extern bitflags=/playground/target/debug/deps/libbitflags-b5f15748d98f19de.rlib --extern blake2b_simd=/playground/target/debug/deps/libblake2b_simd-19ed1c90ce9c1d05.rlib --extern block_buffer=/playground/target/debug/deps/libblock_buffer-e320ece03519b5d4.rlib --extern bstr=/playground/target/debug/deps/libbstr-0a6daf7853b6ec11.rlib --extern bumpalo=/playground/target/debug/deps/libbumpalo-8dcde7941fbfb750.rlib --extern byte_tools=/playground/target/debug/deps/libbyte_tools-b8cc6d8f58ca0b5d.rlib --extern byteorder=/playground/target/debug/deps/libbyteorder-2b291db6f890eb54.rlib --extern bytes=/playground/target/debug/deps/libbytes-b0cc92de59f50534.rlib --extern c2_chacha=/playground/target/debug/deps/libc2_chacha-963faaff3cb5c906.rlib --extern cc=/playground/target/debug/deps/libcc-f968b2f8e40753dd.rlib --extern cfg_if=/playground/target/debug/deps/libcfg_if-6ebef082869a9da3.rlib --extern chrono=/playground/target/debug/deps/libchrono-32534faf07f8ad34.rlib --extern clap=/playground/target/debug/deps/libclap-3e122b18be13b0c1.rlib --extern cloudabi=/playground/target/debug/deps/libcloudabi-7fdd58513f9aacf9.rlib --extern color_quant=/playground/target/debug/deps/libcolor_quant-9247d9bf34f8bf10.rlib --extern constant_time_eq=/playground/target/debug/deps/libconstant_time_eq-c27891695517a62a.rlib --extern cookie=/playground/target/debug/deps/libcookie-72c8aad6e3f3c4bd.rlib --extern cookie_store=/playground/target/debug/deps/libcookie_store-1ffa85d59872ce6f.rlib --extern crc32fast=/playground/target/debug/deps/libcrc32fast-a8a846b5c8e3739b.rlib --extern crossbeam=/playground/target/debug/deps/libcrossbeam-e8a5c9a67f145b64.rlib --extern crossbeam_channel=/playground/target/debug/deps/libcrossbeam_channel-f85b44f2656c8e28.rlib --extern crossbeam_deque=/playground/target/debug/deps/libcrossbeam_deque-87fe127b285b1fcd.rlib --extern crossbeam_epoch=/playground/target/debug/deps/libcrossbeam_epoch-5209525b25675d01.rlib --extern crossbeam_queue_0_1_2=/playground/target/debug/deps/libcrossbeam_queue-b3744884c22846fa.rlib --extern crossbeam_queue=/playground/target/debug/deps/libcrossbeam_queue-8f80716e72782357.rlib --extern crossbeam_utils_0_6_6=/playground/target/debug/deps/libcrossbeam_utils-4f50391084f20b3b.rlib --extern crossbeam_utils=/playground/target/debug/deps/libcrossbeam_utils-e230d342fe004ecb.rlib --extern crypto_mac=/playground/target/debug/deps/libcrypto_mac-6abe3089491ce1bc.rlib --extern csv=/playground/target/debug/deps/libcsv-efa903b847224025.rlib --extern csv_core=/playground/target/debug/deps/libcsv_core-22075854810997e9.rlib --extern data_encoding=/playground/target/debug/deps/libdata_encoding-706bfd42ec450af5.rlib --extern deflate=/playground/target/debug/deps/libdeflate-e714a26a97bedc71.rlib --extern digest=/playground/target/debug/deps/libdigest-b754f4bdbffb3178.rlib --extern dirs=/playground/target/debug/deps/libdirs-4e6b4b6b8253e7b8.rlib --extern dirs_sys=/playground/target/debug/deps/libdirs_sys-01e0b1e1a8a9ef9e.rlib --extern dtoa=/playground/target/debug/deps/libdtoa-809814e5056d15fc.rlib --extern either=/playground/target/debug/deps/libeither-0eccdb6136d4d8b1.rlib --extern encoding_rs=/playground/target/debug/deps/libencoding_rs-be9a00e8c0064b8d.rlib --extern env_logger=/playground/target/debug/deps/libenv_logger-61b6c1b72bf86420.rlib --extern error_chain=/playground/target/debug/deps/liberror_chain-c07a089b5f172fac.rlib --extern failure=/playground/target/debug/deps/libfailure-9f127318cf900800.rlib --extern failure_derive=/playground/target/debug/deps/libfailure_derive-621803c79de1723c.so --extern fake_simd=/playground/target/debug/deps/libfake_simd-cbbabcd839a4731e.rlib --extern fallible_iterator_0_1_6=/playground/target/debug/deps/libfallible_iterator-8d4cb15b4857ef37.rlib --extern fallible_iterator=/playground/target/debug/deps/libfallible_iterator-e610421ac255c9dd.rlib --extern fallible_streaming_iterator=/playground/target/debug/deps/libfallible_streaming_iterator-4bfc453b16d5a6f6.rlib --extern filetime=/playground/target/debug/deps/libfiletime-df72f7699482a783.rlib --extern fixedbitset=/playground/target/debug/deps/libfixedbitset-ee23908ba4c2daeb.rlib --extern flate2=/playground/target/debug/deps/libflate2-5d3db07b7be83e1d.rlib --extern fnv=/playground/target/debug/deps/libfnv-d1b06644b07426d4.rlib --extern foreign_types=/playground/target/debug/deps/libforeign_types-217341a8c2d025d1.rlib --extern foreign_types_shared=/playground/target/debug/deps/libforeign_types_shared-e49e3981fe51084a.rlib --extern fuchsia_cprng=/playground/target/debug/deps/libfuchsia_cprng-d34bb9b2b14607c2.rlib --extern fuchsia_zircon=/playground/target/debug/deps/libfuchsia_zircon-74fbedc304029508.rlib --extern fuchsia_zircon_sys=/playground/target/debug/deps/libfuchsia_zircon_sys-5f305c720b120954.rlib --extern futf=/playground/target/debug/deps/libfutf-105cc6d6b40253b3.rlib --extern futures_0_1_29=/playground/target/debug/deps/libfutures-5d6d1088fa48f32d.rlib --extern futures=/playground/target/debug/deps/libfutures-104dbb2af3f0b4a1.rlib --extern futures_channel=/playground/target/debug/deps/libfutures_channel-d1fb0a0b6645385c.rlib --extern futures_core=/playground/target/debug/deps/libfutures_core-269bd3e8a73ec2e2.rlib --extern futures_cpupool=/playground/target/debug/deps/libfutures_cpupool-6c6cbb1d60bcb13b.rlib --extern futures_executor=/playground/target/debug/deps/libfutures_executor-865cffee71e383cf.rlib --extern futures_io=/playground/target/debug/deps/libfutures_io-635183b1964beedc.rlib --extern futures_macro=/playground/target/debug/deps/libfutures_macro-f1a8816be1b4eae5.so --extern futures_sink=/playground/target/debug/deps/libfutures_sink-06c837f455e44c5e.rlib --extern futures_task=/playground/target/debug/deps/libfutures_task-2f144dbc7cfef256.rlib --extern futures_util=/playground/target/debug/deps/libfutures_util-96227f7a3bb34aad.rlib --extern gcc=/playground/target/debug/deps/libgcc-dd86ec7591a007d2.rlib --extern generic_array_0_9_0=/playground/target/debug/deps/libgeneric_array-55da6589985272e3.rlib --extern generic_array=/playground/target/debug/deps/libgeneric_array-d79ef4a7dcd1914c.rlib --extern getrandom=/playground/target/debug/deps/libgetrandom-297a5d5753fa558d.rlib --extern gif=/playground/target/debug/deps/libgif-666ce3537dc6099d.rlib --extern glob=/playground/target/debug/deps/libglob-a6498cc1b9a1544f.rlib --extern h2=/playground/target/debug/deps/libh2-8760ee992db08471.rlib --extern heck=/playground/target/debug/deps/libheck-7121e15b59efb9c1.rlib --extern hermit_abi=/playground/target/debug/deps/libhermit_abi-50e16fa9e62ee17c.rlib --extern hex=/playground/target/debug/deps/libhex-35ea4f83eae50dcb.rlib --extern hmac=/playground/target/debug/deps/libhmac-776f31716b87a65f.rlib --extern html5ever=/playground/target/debug/deps/libhtml5ever-9430c199249eaaa7.rlib --extern http=/playground/target/debug/deps/libhttp-2bba9e0f9e132ce3.rlib --extern http_body=/playground/target/debug/deps/libhttp_body-bdec49fb220c0c08.rlib --extern httparse=/playground/target/debug/deps/libhttparse-38ccc42088caf1d6.rlib --extern humantime=/playground/target/debug/deps/libhumantime-decdc09aa09c0885.rlib --extern hyper=/playground/target/debug/deps/libhyper-16c2894c6c84d4d7.rlib --extern hyper_tls=/playground/target/debug/deps/libhyper_tls-40f7ca44a80cbc69.rlib --extern idna_0_1_5=/playground/target/debug/deps/libidna-5d2bb1b01a8d1041.rlib --extern idna=/playground/target/debug/deps/libidna-f9e3552122d5ff46.rlib --extern image=/playground/target/debug/deps/libimage-c3c7cfe7be76a3dd.rlib --extern indexmap=/playground/target/debug/deps/libindexmap-10d530df1cb3c54d.rlib --extern inflate=/playground/target/debug/deps/libinflate-8aa676e2c904293c.rlib --extern iovec=/playground/target/debug/deps/libiovec-1126583d80f3e13a.rlib --extern itertools=/playground/target/debug/deps/libitertools-d3ab5c456584f4dd.rlib --extern itoa=/playground/target/debug/deps/libitoa-61617de871663db3.rlib --extern jpeg_decoder=/playground/target/debug/deps/libjpeg_decoder-1e4ef7de0721cd83.rlib --extern js_sys=/playground/target/debug/deps/libjs_sys-5e033931f76aa593.rlib --extern kernel32=/playground/target/debug/deps/libkernel32-6844a86cafc3d16c.rlib --extern lazy_static=/playground/target/debug/deps/liblazy_static-580a082194738557.rlib --extern lazycell=/playground/target/debug/deps/liblazycell-3b36cd1b6869ce96.rlib --extern libc=/playground/target/debug/deps/liblibc-feba222c61531579.rlib --extern libm=/playground/target/debug/deps/liblibm-dfc60f5409c8ce02.rlib --extern libsqlite3_sys=/playground/target/debug/deps/liblibsqlite3_sys-caf02c3a82ed4118.rlib --extern linked_hash_map=/playground/target/debug/deps/liblinked_hash_map-a07d956fc7413489.rlib --extern lock_api=/playground/target/debug/deps/liblock_api-7afe1538cbd3b533.rlib --extern log=/playground/target/debug/deps/liblog-f17ce6201fe2e860.rlib --extern log_mdc=/playground/target/debug/deps/liblog_mdc-cb5af6fb83fa4f1f.rlib --extern log4rs=/playground/target/debug/deps/liblog4rs-473702c3fd408575.rlib --extern lru_cache=/playground/target/debug/deps/liblru_cache-f20cc7bf5c531ed0.rlib --extern lzw=/playground/target/debug/deps/liblzw-30656ca8d0eea7a1.rlib --extern mac=/playground/target/debug/deps/libmac-7eb9ad2ac0be661d.rlib --extern markup5ever=/playground/target/debug/deps/libmarkup5ever-9c5cb049919981e5.rlib --extern matches=/playground/target/debug/deps/libmatches-7db799e955bd57e6.rlib --extern matrixmultiply=/playground/target/debug/deps/libmatrixmultiply-fffa685d35743135.rlib --extern maybe_uninit=/playground/target/debug/deps/libmaybe_uninit-c2f43cc88cdff2ff.rlib --extern md5=/playground/target/debug/deps/libmd5-fa7ddb4fc95badf1.rlib --extern memchr_1_0_2=/playground/target/debug/deps/libmemchr-2e377479b81ccbea.rlib --extern memchr=/playground/target/debug/deps/libmemchr-ac022b565d5d538b.rlib --extern memmap=/playground/target/debug/deps/libmemmap-bca95e63cf6b6ef8.rlib --extern memoffset=/playground/target/debug/deps/libmemoffset-31281cdf2ef2b69c.rlib --extern mime=/playground/target/debug/deps/libmime-0b94d08f08fdb2d8.rlib --extern mime_guess=/playground/target/debug/deps/libmime_guess-66f3babf174eb888.rlib --extern miniz_oxide=/playground/target/debug/deps/libminiz_oxide-508db33c89d1499e.rlib --extern mio=/playground/target/debug/deps/libmio-40838563a9129a1c.rlib --extern miow=/playground/target/debug/deps/libmiow-75d17e8ee8815325.rlib --extern nalgebra=/playground/target/debug/deps/libnalgebra-9790e2adfb7ae89c.rlib --extern native_tls=/playground/target/debug/deps/libnative_tls-ac2da05c2e6f5e82.rlib --extern ndarray=/playground/target/debug/deps/libndarray-53e2338dac47cccd.rlib --extern net2=/playground/target/debug/deps/libnet2-1b2cd845d4b4440d.rlib --extern debug_unreachable=/playground/target/debug/deps/libdebug_unreachable-64013e659ff2d32e.rlib --extern nodrop=/playground/target/debug/deps/libnodrop-d90c764df77d5c57.rlib --extern nom=/playground/target/debug/deps/libnom-964d3529e6dc54d1.rlib --extern num=/playground/target/debug/deps/libnum-c59bb87132d7ef59.rlib --extern num_bigint=/playground/target/debug/deps/libnum_bigint-6c8e8135d30916ec.rlib --extern num_complex=/playground/target/debug/deps/libnum_complex-3f557a6920659037.rlib --extern num_derive=/playground/target/debug/deps/libnum_derive-fed3732f1459dd23.so --extern num_integer=/playground/target/debug/deps/libnum_integer-bcc6ab9d88beda48.rlib --extern num_iter=/playground/target/debug/deps/libnum_iter-0dc6d2ef52ac1e89.rlib --extern num_rational=/playground/target/debug/deps/libnum_rational-676ad807e90d034d.rlib --extern num_traits=/playground/target/debug/deps/libnum_traits-bf8ea91aada3848a.rlib --extern num_cpus=/playground/target/debug/deps/libnum_cpus-865e2b3275d3237d.rlib --extern openssl=/playground/target/debug/deps/libopenssl-778be5769f2666d5.rlib --extern openssl_probe=/playground/target/debug/deps/libopenssl_probe-168cc43639206ac6.rlib --extern openssl_sys=/playground/target/debug/deps/libopenssl_sys-af4913e8ec8883ef.rlib --extern ordered_float=/playground/target/debug/deps/libordered_float-b92a36e23a8bd10d.rlib --extern ordermap=/playground/target/debug/deps/libordermap-75325103df96f1b5.rlib --extern parking_lot=/playground/target/debug/deps/libparking_lot-58fccaf1caa35581.rlib --extern parking_lot_core=/playground/target/debug/deps/libparking_lot_core-8a1712387632db0a.rlib --extern percent_encoding_1_0_1=/playground/target/debug/deps/libpercent_encoding-112187878f14594f.rlib --extern percent_encoding=/playground/target/debug/deps/libpercent_encoding-fa23cb1f51ac2fa3.rlib --extern petgraph=/playground/target/debug/deps/libpetgraph-524176ba828d7f9b.rlib --extern phf=/playground/target/debug/deps/libphf-072a0941359dc10b.rlib --extern phf_codegen=/playground/target/debug/deps/libphf_codegen-391d2e32fc6bc5c1.rlib --extern phf_generator=/playground/target/debug/deps/libphf_generator-4f1976649afd1daa.rlib --extern phf_shared=/playground/target/debug/deps/libphf_shared-74bfcfd1e9498bd8.rlib --extern pin_utils=/playground/target/debug/deps/libpin_utils-01ca7a1dde63ffaf.rlib --extern pkg_config=/playground/target/debug/deps/libpkg_config-b809c1d69aff1cef.rlib --extern png=/playground/target/debug/deps/libpng-d7f764dab09bb626.rlib --extern postgres=/playground/target/debug/deps/libpostgres-0ce4bdc7290c1ac0.rlib --extern postgres_protocol=/playground/target/debug/deps/libpostgres_protocol-d03a3589f6490a04.rlib --extern postgres_shared=/playground/target/debug/deps/libpostgres_shared-8606b6f1a19febc3.rlib --extern ppv_lite86=/playground/target/debug/deps/libppv_lite86-58e516a28e1f7331.rlib --extern precomputed_hash=/playground/target/debug/deps/libprecomputed_hash-5bf94635bd5831bb.rlib --extern proc_macro_hack=/playground/target/debug/deps/libproc_macro_hack-14926d0b14d1fa7d.so --extern proc_macro_nested=/playground/target/debug/deps/libproc_macro_nested-a3c011e8d25d219b.rlib --extern proc_macro2_0_4_30=/playground/target/debug/deps/libproc_macro2-33eb445af2c1ada9.rlib --extern proc_macro2=/playground/target/debug/deps/libproc_macro2-f0d6a6433a3a6173.rlib --extern publicsuffix=/playground/target/debug/deps/libpublicsuffix-f6a1ee28e2389c7a.rlib --extern quick_error=/playground/target/debug/deps/libquick_error-6d8b37061106fac6.rlib --extern quote_0_6_13=/playground/target/debug/deps/libquote-6c15fb0dd08ab17a.rlib --extern quote=/playground/target/debug/deps/libquote-e58b133dded72752.rlib --extern rand_0_3_23=/playground/target/debug/deps/librand-c1ad83a4c392d0fe.rlib --extern rand_0_4_6=/playground/target/debug/deps/librand-aaf2a59e83254736.rlib --extern rand_0_6_5=/playground/target/debug/deps/librand-badec6471d5a85e9.rlib --extern rand=/playground/target/debug/deps/librand-f6217ccea28ec140.rlib --extern rand_chacha_0_1_1=/playground/target/debug/deps/librand_chacha-f8ad254486412c95.rlib --extern rand_chacha=/playground/target/debug/deps/librand_chacha-7438db7d2e5ccb1d.rlib --extern rand_core_0_3_1=/playground/target/debug/deps/librand_core-dea5354673d26513.rlib --extern rand_core_0_4_2=/playground/target/debug/deps/librand_core-73b904dcf8ff8020.rlib --extern rand_core=/playground/target/debug/deps/librand_core-e6e59122ae493274.rlib --extern rand_distr=/playground/target/debug/deps/librand_distr-25508085a8103bac.rlib --extern rand_hc_0_1_0=/playground/target/debug/deps/librand_hc-da00e1b306303313.rlib --extern rand_hc=/playground/target/debug/deps/librand_hc-201577978366304b.rlib --extern rand_isaac=/playground/target/debug/deps/librand_isaac-47c10c7c242c9e59.rlib --extern rand_jitter=/playground/target/debug/deps/librand_jitter-01ee220fb7b8af30.rlib --extern rand_os=/playground/target/debug/deps/librand_os-5000b3681ca5503c.rlib --extern rand_pcg=/playground/target/debug/deps/librand_pcg-f1e6b8cb006b1ff4.rlib --extern rand_xorshift=/playground/target/debug/deps/librand_xorshift-802185c549fdaf34.rlib --extern rawpointer=/playground/target/debug/deps/librawpointer-3bb188a4c54aba6e.rlib --extern rayon=/playground/target/debug/deps/librayon-ea85f3f821d7e2d7.rlib --extern rayon_core=/playground/target/debug/deps/librayon_core-6c6c412c78166ed2.rlib --extern rdrand=/playground/target/debug/deps/librdrand-e2d0c06cb70a72f6.rlib --extern regex=/playground/target/debug/deps/libregex-14277ea4ac10e86b.rlib --extern regex_automata=/playground/target/debug/deps/libregex_automata-2623e9ed59935d8c.rlib --extern regex_syntax=/playground/target/debug/deps/libregex_syntax-cb0d58591aec5a83.rlib --extern remove_dir_all=/playground/target/debug/deps/libremove_dir_all-636cc3537cbf5095.rlib --extern reqwest=/playground/target/debug/deps/libreqwest-d522ab7bf67219af.rlib --extern ring=/playground/target/debug/deps/libring-d5994a8221d67da8.rlib --extern rusqlite=/playground/target/debug/deps/librusqlite-648ce69081b29a2e.rlib --extern argon2=/playground/target/debug/deps/libargon2-288bf45e0888bb41.rlib --extern rustc_demangle=/playground/target/debug/deps/librustc_demangle-a467182e4bd736a9.rlib --extern rustc_serialize=/playground/target/debug/deps/librustc_serialize-21cec549c021cedb.rlib --extern rustc_version=/playground/target/debug/deps/librustc_version-3de811573bc5fd93.rlib --extern ryu=/playground/target/debug/deps/libryu-49d3933362d4e712.rlib --extern safemem=/playground/target/debug/deps/libsafemem-189536e76b04056e.rlib --extern same_file=/playground/target/debug/deps/libsame_file-9dd12da5643140c5.rlib --extern schannel=/playground/target/debug/deps/libschannel-4523484f761ac845.rlib --extern scoped_threadpool=/playground/target/debug/deps/libscoped_threadpool-8cec12d7ee63a038.rlib --extern scopeguard=/playground/target/debug/deps/libscopeguard-6efa77d7f688f2a9.rlib --extern select=/playground/target/debug/deps/libselect-e2f1a375b3359f15.rlib --extern semver=/playground/target/debug/deps/libsemver-65b944c9c0b8bd13.rlib --extern semver_parser_0_7_0=/playground/target/debug/deps/libsemver_parser-2035cb438a755102.rlib --extern semver_parser=/playground/target/debug/deps/libsemver_parser-642c97626416c354.rlib --extern serde=/playground/target/debug/deps/libserde-f4d01dff2f20a347.rlib --extern serde_value=/playground/target/debug/deps/libserde_value-365993b6a23e644c.rlib --extern serde_derive=/playground/target/debug/deps/libserde_derive-e24e8c966298ef81.so --extern serde_json=/playground/target/debug/deps/libserde_json-17c16039e3d8961b.rlib --extern serde_urlencoded=/playground/target/debug/deps/libserde_urlencoded-483ef1e211aaa68b.rlib --extern serde_yaml=/playground/target/debug/deps/libserde_yaml-8396f31ed0792e18.rlib --extern sha2=/playground/target/debug/deps/libsha2-7558570c7452451c.rlib --extern siphasher=/playground/target/debug/deps/libsiphasher-0ad4d6340294e96b.rlib --extern slab=/playground/target/debug/deps/libslab-5cba3c4cb995a01a.rlib --extern smallvec_0_6_13=/playground/target/debug/deps/libsmallvec-b539a4a7a7ba39d8.rlib --extern smallvec=/playground/target/debug/deps/libsmallvec-7a50b0d87f2a8d12.rlib --extern socket2=/playground/target/debug/deps/libsocket2-f8d6564472614755.rlib --extern sourcefile=/playground/target/debug/deps/libsourcefile-f669f8fca8b5ffa6.rlib --extern spin=/playground/target/debug/deps/libspin-fa299c8d17580792.rlib --extern string=/playground/target/debug/deps/libstring-effe241ced0202bd.rlib --extern string_cache=/playground/target/debug/deps/libstring_cache-99c63bfa3731eb60.rlib --extern string_cache_codegen=/playground/target/debug/deps/libstring_cache_codegen-83362896fe7f19d2.rlib --extern string_cache_shared=/playground/target/debug/deps/libstring_cache_shared-ec84cf9c2bca9130.rlib --extern stringprep=/playground/target/debug/deps/libstringprep-976aec77678081aa.rlib --extern strsim_0_8_0=/playground/target/debug/deps/libstrsim-b70ae8dfab12e285.rlib --extern strsim=/playground/target/debug/deps/libstrsim-6ab202c711dfaf40.rlib --extern syn_0_15_44=/playground/target/debug/deps/libsyn-806bd9b590dcdd9b.rlib --extern syn=/playground/target/debug/deps/libsyn-e25582cfde376c14.rlib --extern synstructure=/playground/target/debug/deps/libsynstructure-722976182ae0615c.rlib --extern tar=/playground/target/debug/deps/libtar-6f1e77800298fed1.rlib --extern tempfile=/playground/target/debug/deps/libtempfile-bcef58f9f35afa16.rlib --extern tendril=/playground/target/debug/deps/libtendril-088a3970725c3331.rlib --extern term=/playground/target/debug/deps/libterm-63202a9916dedf22.rlib --extern termcolor=/playground/target/debug/deps/libtermcolor-5bd31b3b9f50457e.rlib --extern textwrap=/playground/target/debug/deps/libtextwrap-0f9a747e40ddead3.rlib --extern thread_id=/playground/target/debug/deps/libthread_id-5dce39f3f0446b60.rlib --extern thread_local_0_3_6=/playground/target/debug/deps/libthread_local-a682dbc990499756.rlib --extern thread_local=/playground/target/debug/deps/libthread_local-dc2de4144453150f.rlib --extern threadpool=/playground/target/debug/deps/libthreadpool-a3816e1082fa6a6e.rlib --extern tiff=/playground/target/debug/deps/libtiff-fe1f9f737334265c.rlib --extern time=/playground/target/debug/deps/libtime-de9914ac1a2966f3.rlib --extern tokio=/playground/target/debug/deps/libtokio-04f152e71203e50c.rlib --extern tokio_buf=/playground/target/debug/deps/libtokio_buf-2af4569a66bdf13e.rlib --extern tokio_current_thread=/playground/target/debug/deps/libtokio_current_thread-a3480c4e359d72cd.rlib --extern tokio_executor=/playground/target/debug/deps/libtokio_executor-62004e364548793b.rlib --extern tokio_io=/playground/target/debug/deps/libtokio_io-38c668ca4282b315.rlib --extern tokio_reactor=/playground/target/debug/deps/libtokio_reactor-9fa9bb792a1cf688.rlib --extern tokio_sync=/playground/target/debug/deps/libtokio_sync-62f9ac03c80bc5e3.rlib --extern tokio_tcp=/playground/target/debug/deps/libtokio_tcp-0316a4a700705d57.rlib --extern tokio_threadpool=/playground/target/debug/deps/libtokio_threadpool-b619e8db5d3857e4.rlib --extern tokio_timer=/playground/target/debug/deps/libtokio_timer-8b6f3c340763f80f.rlib --extern toml=/playground/target/debug/deps/libtoml-e45d3b0a233209d8.rlib --extern traitobject=/playground/target/debug/deps/libtraitobject-3b38072774912a34.rlib --extern try_lock=/playground/target/debug/deps/libtry_lock-a466596443d7f5b8.rlib --extern try_from=/playground/target/debug/deps/libtry_from-339b0f9583c8000d.rlib --extern typemap=/playground/target/debug/deps/libtypemap-18154729afcb84ad.rlib --extern typenum=/playground/target/debug/deps/libtypenum-34a910164f95b514.rlib --extern ucd_util=/playground/target/debug/deps/libucd_util-597df9e7dc39f5b7.rlib --extern unicase=/playground/target/debug/deps/libunicase-215c858800ed03dc.rlib --extern unicode_bidi=/playground/target/debug/deps/libunicode_bidi-c79b84255be73d16.rlib --extern unicode_normalization=/playground/target/debug/deps/libunicode_normalization-c455aa4d68b57fe1.rlib --extern unicode_segmentation=/playground/target/debug/deps/libunicode_segmentation-5c87bae83057e167.rlib --extern unicode_width=/playground/target/debug/deps/libunicode_width-e7607231443570ac.rlib --extern unicode_xid_0_1_0=/playground/target/debug/deps/libunicode_xid-299d9e1ee6dd0391.rlib --extern unicode_xid=/playground/target/debug/deps/libunicode_xid-c1e884d4eee51234.rlib --extern unreachable=/playground/target/debug/deps/libunreachable-65ded838da8c9e63.rlib --extern unsafe_any=/playground/target/debug/deps/libunsafe_any-7cbc2c2eedcd27da.rlib --extern untrusted=/playground/target/debug/deps/libuntrusted-b056ae5e113ba007.rlib --extern url_1_7_2=/playground/target/debug/deps/liburl-d495f9d189d12f24.rlib --extern url=/playground/target/debug/deps/liburl-304d8dde0da0f90e.rlib --extern utf8=/playground/target/debug/deps/libutf8-2cd56a4dad442b68.rlib --extern utf8_ranges=/playground/target/debug/deps/libutf8_ranges-f13a1b10efec74dc.rlib --extern uuid_0_7_4=/playground/target/debug/deps/libuuid-f3f2933e37a9fdeb.rlib --extern uuid=/playground/target/debug/deps/libuuid-8efcc52946f87011.rlib --extern vcpkg=/playground/target/debug/deps/libvcpkg-b78061a1d7b7d49e.rlib --extern vec_map=/playground/target/debug/deps/libvec_map-f951fefc7b544781.rlib --extern version_check_0_1_5=/playground/target/debug/deps/libversion_check-b001487e117a0155.rlib --extern version_check=/playground/target/debug/deps/libversion_check-4ddfe32fd761fd73.rlib --extern void=/playground/target/debug/deps/libvoid-a37487555d245655.rlib --extern walkdir=/playground/target/debug/deps/libwalkdir-ecfb408e9d8adb4e.rlib --extern want=/playground/target/debug/deps/libwant-94ca22928bb152d4.rlib --extern wasi=/playground/target/debug/deps/libwasi-2fba42001fdd734a.rlib --extern wasm_bindgen=/playground/target/debug/deps/libwasm_bindgen-06fb9b104b7a7850.rlib --extern wasm_bindgen_backend=/playground/target/debug/deps/libwasm_bindgen_backend-6805427ac65b1995.rlib --extern wasm_bindgen_macro=/playground/target/debug/deps/libwasm_bindgen_macro-8ad881d44587e5b3.so --extern wasm_bindgen_macro_support=/playground/target/debug/deps/libwasm_bindgen_macro_support-fa53a3e762fd14b9.rlib --extern wasm_bindgen_shared=/playground/target/debug/deps/libwasm_bindgen_shared-a3ecd9c02db95d13.rlib --extern wasm_bindgen_webidl=/playground/target/debug/deps/libwasm_bindgen_webidl-0d4b16347a676b5d.rlib --extern web_sys=/playground/target/debug/deps/libweb_sys-3040d21befea3479.rlib --extern weedle=/playground/target/debug/deps/libweedle-2add30449293fdfd.rlib --extern winapi_0_2_8=/playground/target/debug/deps/libwinapi-a29ff7a7919392ca.rlib --extern winapi=/playground/target/debug/deps/libwinapi-f66394efa466929c.rlib --extern build=/playground/target/debug/deps/libbuild-8c40e250767a3b05.rlib --extern winapi_i686_pc_windows_gnu=/playground/target/debug/deps/libwinapi_i686_pc_windows_gnu-b09a9f40bf36b1af.rlib --extern winapi_util=/playground/target/debug/deps/libwinapi_util-2d6c590466b2e9c8.rlib --extern winapi_x86_64_pc_windows_gnu=/playground/target/debug/deps/libwinapi_x86_64_pc_windows_gnu-75a2fb18fb146241.rlib --extern wincolor=/playground/target/debug/deps/libwincolor-f5931f5d5dd2043c.rlib --extern ws2_32=/playground/target/debug/deps/libws2_32-33c850d94af1c3f1.rlib --extern xattr=/playground/target/debug/deps/libxattr-d5c42baf246aba11.rlib --extern yaml_rust=/playground/target/debug/deps/libyaml_rust-f6cb400efad06620.rlib -L native=/playground/target/debug/build/backtrace-sys-a29558175480207f/out -L native=/playground/target/debug/build/ring-de6438f81fb847b0/out` (signal: 4, SIGILL: illegal instruction) ```
hellow554 commented 4 years ago

@rustbot modify labels: I-ICE C-Bug T-compiler A-mir

Regression from 1.34 to 1.35

Patryk27 commented 4 years ago

Additionally, this one ICEs with different error message:

fn main() {
    let mut i: i64;

    match i {
        1 => true,
        2 => true,
        3 => i = 1,
        _ => (),
    }
}

(playground)

Backtrace ``` warning: value assigned to `i` is never read --> src/main.rs:7:14 | 7 | 3 => i = 1, | ^ | = note: `#[warn(unused_assignments)]` on by default = help: maybe it is overwritten before being read? error: internal compiler error: src/librustc_codegen_llvm/context.rs:872: failed to get layout for `[type error]`: the type `[type error]` has an unknown layout thread 'rustc' panicked at 'Box', src/librustc_errors/lib.rs:812:9 stack backtrace: 0: backtrace::backtrace::libunwind::trace at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88 1: backtrace::backtrace::trace_unsynchronized at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66 2: std::sys_common::backtrace::_print_fmt at src/libstd/sys_common/backtrace.rs:76 3: ::fmt at src/libstd/sys_common/backtrace.rs:60 4: core::fmt::write at src/libcore/fmt/mod.rs:1030 5: std::io::Write::write_fmt at src/libstd/io/mod.rs:1412 6: std::sys_common::backtrace::_print at src/libstd/sys_common/backtrace.rs:64 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:196 9: std::panicking::default_hook at src/libstd/panicking.rs:210 10: rustc_driver::report_ice 11: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:477 12: std::panicking::begin_panic 13: rustc_errors::HandlerInner::bug 14: rustc_errors::Handler::bug 15: rustc::util::bug::opt_span_bug_fmt::{{closure}} 16: rustc::ty::context::tls::with_opt::{{closure}} 17: rustc::ty::context::tls::with_context_opt 18: rustc::ty::context::tls::with_opt 19: rustc::util::bug::opt_span_bug_fmt 20: rustc::util::bug::bug_fmt 21: ::spanned_layout_of::{{closure}} 22: ::spanned_layout_of 23: rustc_codegen_ssa::mir::analyze::non_ssa_locals 24: rustc_codegen_ssa::mir::codegen_mir 25: rustc_codegen_ssa::base::codegen_instance 26: ::define 27: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen 28: rustc::dep_graph::graph::DepGraph::with_task 29: rustc_codegen_llvm::base::compile_codegen_unit 30: rustc_codegen_ssa::base::codegen_crate 31: ::codegen_crate 32: rustc::util::common::time 33: rustc_interface::passes::start_codegen 34: rustc::ty::context::tls::enter_global 35: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}} 36: rustc_interface::passes::create_global_ctxt::{{closure}} 37: rustc_interface::passes::BoxedGlobalCtxt::enter 38: rustc_interface::queries::Query::compute 39: rustc_interface::queries::::ongoing_codegen 40: rustc_interface::interface::run_compiler_in_existing_thread_pool 41: std::thread::local::LocalKey::with 42: scoped_tls::ScopedKey::set 43: syntax::with_globals note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. 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.39.0 (4560ea788 2019-11-04) running on x86_64-unknown-linux-gnu note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin note: some of the compiler flags provided by cargo are hidden query stack during panic: end of query stack error: aborting due to previous error error: could not compile `playground`. To learn more, run the command again with --verbose.. ```
jonas-schievink commented 4 years ago

This code should not get all the way to codegen without an error

hellow554 commented 4 years ago

Another, different ICE?

Backtrace ``` error: internal compiler error[E0308]: match arms have incompatible types --> src/main.rs:6:14 | 3 | / match 0_i32 { 4 | | 0 => true, | | ---- this is found to be of type `bool` 5 | | 1 => true, | | ---- this is found to be of type `bool` 6 | | _ => i = (), | | ^^^^^^ expected `bool`, found `()` 7 | | }; | |_____- `match` arms have incompatible types error: internal compiler error: cat_expr Errd --> src/main.rs:1:11 | 1 | fn main() { | ___________^ 2 | | let i; 3 | | match 0_i32 { 4 | | 0 => true, ... | 7 | | }; 8 | | } | |_^ error: internal compiler error: cat_expr Errd --> src/main.rs:3:5 | 3 | / match 0_i32 { 4 | | 0 => true, 5 | | 1 => true, 6 | | _ => i = (), 7 | | }; | |_____^ error: internal compiler error: PromoteTemps: MIR had errors --> src/main.rs:1:1 | 1 | / fn main() { 2 | | let i; 3 | | match 0_i32 { 4 | | 0 => true, ... | 7 | | }; 8 | | } | |_^ error: internal compiler error: broken MIR in DefId(0:3 ~ foo[a7ed]::main[0]) ("return type"): bad type [type error] --> src/main.rs:1:1 | 1 | / fn main() { 2 | | let i; 3 | | match 0_i32 { 4 | | 0 => true, ... | 7 | | }; 8 | | } | |_^ error: internal compiler error: broken MIR in DefId(0:3 ~ foo[a7ed]::main[0]) (LocalDecl { mutability: Mut, local_info: Other, internal: false, is_block_tail: None, ty: [type error], user_ty: UserTypeProjections { contents: [] }, source_info: SourceInfo { span: src/main.rs:1:1: 8:2, scope: scope[0] } }): bad type [type error] --> src/main.rs:1:1 | 1 | / fn main() { 2 | | let i; 3 | | match 0_i32 { 4 | | 0 => true, ... | 7 | | }; 8 | | } | |_^ thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:347:17 note: run with `RUST_BACKTRACE=1` environment variable to display a 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.41.0-nightly (27d6f55f4 2019-12-11) 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 ```
hellow554 commented 4 years ago

Regression somewhere between 33ef0bad2...237bf3244

jonas-schievink commented 4 years ago

https://github.com/rust-lang/rust/pull/59439 looks suspicious, cc @Centril

In particular, maybe is_assign_to_bool is falsly returning true here since the expected type is bool due to the other match arms?

    pub fn is_assign_to_bool(&self, expr: &hir::Expr, expected: Ty<'tcx>) -> bool {
        if let hir::ExprKind::Assign(..) = expr.node {
            return expected == self.tcx.types.bool;
        }
        false
    }
Centril commented 4 years ago
$ RUST_BACKTRACE=1 rustc +gamma-stage1 foo.rs -Z no-codegen -Z report-delayed-bugs -Z treat-err-as-bug=1
error: internal compiler error[E0308]: match arms have incompatible types
 --> foo.rs:7:14
  |
4 | /     match i {
5 | |         1 => true,
  | |              ---- this is found to be of type `bool`
6 | |         2 => true,
  | |              ---- this is found to be of type `bool`
7 | |         3 => i = 1,
  | |              ^^^^^ expected `bool`, found `()`
8 | |         _ => (),
9 | |     }
  | |_____- `match` arms have incompatible types

thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', src/librustc_errors/lib.rs:921:13stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: rustc_driver::report_ice
   6: std::panicking::rust_panic_with_hook
   7: std::panicking::begin_panic
   8: rustc_errors::HandlerInner::emit_diagnostic
   9: rustc_errors::HandlerInner::delay_as_bug
  10: rustc_errors::Handler::delay_as_bug
  11: rustc_errors::diagnostic_builder::DiagnosticBuilder::delay_as_bug
  12: rustc_typeck::check::coercion::CoerceMany<E>::coerce_inner
  13: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match
  14: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  15: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  16: rustc_typeck::check::FnCtxt::with_breakable_ctxt
  17: rustc_typeck::check::FnCtxt::check_block_with_expected
  18: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  19: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  20: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
  21: rustc_typeck::check::check_fn
  22: rustc::ty::context::tls::with_context::{{closure}}
  23: rustc::ty::context::GlobalCtxt::enter_local
  24: rustc_typeck::check::typeck_tables_of
  25: rustc::ty::query::__query_compute::typeck_tables_of
  26: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  27: rustc::dep_graph::graph::DepGraph::with_task_impl
  28: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  29: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners
  30: rustc_typeck::check::typeck_item_bodies
  31: rustc::ty::query::__query_compute::typeck_item_bodies
  32: rustc::dep_graph::graph::DepGraph::with_task_impl
  33: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  34: rustc::util::common::time
  35: rustc_typeck::check_crate
  36: rustc_interface::passes::analysis
  37: rustc::ty::query::__query_compute::analysis
  38: rustc::dep_graph::graph::DepGraph::with_task_impl
  39: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  40: rustc::ty::context::tls::enter_global
  41: rustc_interface::interface::run_compiler_in_existing_thread_pool
  42: std::thread::local::LocalKey<T>::with
  43: scoped_tls::ScopedKey<T>::set
  44: syntax::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.41.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z no-codegen -Z report-delayed-bugs -Z treat-err-as-bug=1

query stack during panic:
#0 [typeck_tables_of] processing `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack