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

thread 'rustc' panicked at 'expression with never type wound up being adjusted' #96335

Closed
Badel2 opened this issue Apr 23, 2022 · 8 comments · Fixed by #96379
Closed

thread 'rustc' panicked at 'expression with never type wound up being adjusted' #96335

Badel2 opened this issue Apr 23, 2022 · 8 comments · Fixed by #96379
Assignees
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Badel2
Copy link
Contributor

Badel2 commented Apr 23, 2022

I'm seeing an internal compiler error on the following input, found by fuzz-rustc:

Code

fn main() {
    0.....{loop{}1}
}

Error output

error: unexpected token: `...`
 --> src/main.rs:2:6
  |
2 |     0.....{loop{}1}
  |      ^^^
  |
help: use `..` for an exclusive range
  |
2 |     0....{loop{}1}
  |      ~~
help: or `..=` for an inclusive range
  |
2 |     0..=..{loop{}1}
  |      ~~~

warning: unreachable expression
 --> src/main.rs:2:18
  |
2 |     0.....{loop{}1}
  |            ------^ unreachable expression
  |            |
  |            any code following this expression is unreachable
  |
  = note: `#[warn(unreachable_code)]` on by default
thread 'rustc' panicked at 'expression with never type wound up being adjusted', compiler/rustc_typeck/src/check/expr.rs:81:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The ICE happens after reporting some other errors, so I guess low priority. Affected versions: nightly 2022-04-22 does show the ICE, but beta 1.61.0-beta.3 does not show the ICE.

Backtrace

Compiling playground v0.0.1 (/playground)
error: unexpected token: `...`
 --> src/main.rs:2:6
  |
2 |     0.....{loop{}1}
  |      ^^^
  |
help: use `..` for an exclusive range
  |
2 |     0....{loop{}1}
  |      ~~
help: or `..=` for an inclusive range
  |
2 |     0..=..{loop{}1}
  |      ~~~

warning: unreachable expression
 --> src/main.rs:2:18
  |
2 |     0.....{loop{}1}
  |            ------^ unreachable expression
  |            |
  |            any code following this expression is unreachable
  |
  = note: `#[warn(unreachable_code)]` on by default

thread 'rustc' panicked at 'expression with never type wound up being adjusted', compiler/rustc_typeck/src/check/expr.rs:81:13
stack backtrace:
   0:     0x7f56b6c4ca1d - std::backtrace_rs::backtrace::libunwind::trace::hd6a59a52e7b1dd59
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f56b6c4ca1d - std::backtrace_rs::backtrace::trace_unsynchronized::hc6bcdfd472eaf870
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f56b6c4ca1d - std::sys_common::backtrace::_print_fmt::h36b5dc9a2ec57a70
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f56b6c4ca1d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4d029b4479317c06
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f56b6ca815c - core::fmt::write::h0c609830781888bc
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/core/src/fmt/mod.rs:1194:17
   5:     0x7f56b6c3e1b1 - std::io::Write::write_fmt::hbc89661190661b99
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/io/mod.rs:1655:15
   6:     0x7f56b6c4f735 - std::sys_common::backtrace::_print::he8c6f6d669996019
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f56b6c4f735 - std::sys_common::backtrace::print::h1592ad495df89a1b
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f56b6c4f735 - std::panicking::default_hook::{{closure}}::h5e12203b936882f8
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/panicking.rs:295:22
   9:     0x7f56b6c4f3a9 - std::panicking::default_hook::h9478b8b8f3ef11ae
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/panicking.rs:314:9
  10:     0x7f56b73edd01 - rustc_driver[15079dfc84a3112]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f56b6c4ff06 - std::panicking::rust_panic_with_hook::he5c0805237a49bfb
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/panicking.rs:702:17
  12:     0x7f56b6c4fcc9 - std::panicking::begin_panic_handler::{{closure}}::he9c58435c507a51a
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/panicking.rs:586:13
  13:     0x7f56b6c4ced4 - std::sys_common::backtrace::__rust_end_short_backtrace::had0581f0f7999998
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f56b6c4fa39 - rust_begin_unwind
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/panicking.rs:584:5
  15:     0x7f56b6c14d33 - core::panicking::panic_fmt::he1176ceec0d9f6c7
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/core/src/panicking.rs:142:14
  16:     0x7f56b889bcc5 - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_stmt
  17:     0x7f56b889c380 - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_block_with_expected
  18:     0x7f56b88adf13 - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_expr_kind
  19:     0x7f56b88acc20 - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  20:     0x7f56b967dcc0 - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_expr_struct_fields
  21:     0x7f56b88af5ea - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_expr_kind
  22:     0x7f56b77ce47d - <core[26ec97baa1f5afe1]::iter::adapters::map::Map<core[26ec97baa1f5afe1]::ops::range::Range<usize>, <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::ArgMatrix>::new<<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_argument_types::{closure#3}>::{closure#0}::{closure#0}> as core[26ec97baa1f5afe1]::iter::traits::iterator::Iterator>::fold::<(), core[26ec97baa1f5afe1]::iter::traits::iterator::Iterator::for_each::call<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::Compatibility, <alloc[6d9f8db8507809ec]::vec::Vec<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::Compatibility> as alloc[6d9f8db8507809ec]::vec::spec_extend::SpecExtend<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::Compatibility, core[26ec97baa1f5afe1]::iter::adapters::map::Map<core[26ec97baa1f5afe1]::ops::range::Range<usize>, <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::ArgMatrix>::new<<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_argument_types::{closure#3}>::{closure#0}::{closure#0}>>>::spec_extend::{closure#0}>::{closure#0}>
  23:     0x7f56b77bdf37 - <alloc[6d9f8db8507809ec]::vec::Vec<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::Compatibility> as alloc[6d9f8db8507809ec]::vec::spec_from_iter::SpecFromIter<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::Compatibility, core[26ec97baa1f5afe1]::iter::adapters::map::Map<core[26ec97baa1f5afe1]::ops::range::Range<usize>, <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::ArgMatrix>::new<<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_argument_types::{closure#3}>::{closure#0}::{closure#0}>>>::from_iter
  24:     0x7f56b77ce2a4 - <core[26ec97baa1f5afe1]::iter::adapters::map::Map<core[26ec97baa1f5afe1]::ops::range::Range<usize>, <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::ArgMatrix>::new<<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_argument_types::{closure#3}>::{closure#0}> as core[26ec97baa1f5afe1]::iter::traits::iterator::Iterator>::fold::<(), core[26ec97baa1f5afe1]::iter::traits::iterator::Iterator::for_each::call<alloc[6d9f8db8507809ec]::vec::Vec<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::Compatibility>, <alloc[6d9f8db8507809ec]::vec::Vec<alloc[6d9f8db8507809ec]::vec::Vec<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::Compatibility>> as alloc[6d9f8db8507809ec]::vec::spec_extend::SpecExtend<alloc[6d9f8db8507809ec]::vec::Vec<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::Compatibility>, core[26ec97baa1f5afe1]::iter::adapters::map::Map<core[26ec97baa1f5afe1]::ops::range::Range<usize>, <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::ArgMatrix>::new<<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_argument_types::{closure#3}>::{closure#0}>>>::spec_extend::{closure#0}>::{closure#0}>
  25:     0x7f56b77b7205 - <alloc[6d9f8db8507809ec]::vec::Vec<alloc[6d9f8db8507809ec]::vec::Vec<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::Compatibility>> as alloc[6d9f8db8507809ec]::vec::spec_from_iter::SpecFromIter<alloc[6d9f8db8507809ec]::vec::Vec<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::Compatibility>, core[26ec97baa1f5afe1]::iter::adapters::map::Map<core[26ec97baa1f5afe1]::ops::range::Range<usize>, <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::ArgMatrix>::new<<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_argument_types::{closure#3}>::{closure#0}>>>::from_iter
  26:     0x7f56b778cb65 - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::arg_matrix::ArgMatrix>::new::<<rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_argument_types::{closure#3}>
  27:     0x7f56b887821f - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_argument_types
  28:     0x7f56b885c17e - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  29:     0x7f56b88585e8 - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_call
  30:     0x7f56b88added - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_expr_kind
  31:     0x7f56b88acc20 - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  32:     0x7f56b889c3bb - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_block_with_expected
  33:     0x7f56b88adf13 - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_expr_kind
  34:     0x7f56b88acc20 - <rustc_typeck[fa7863cc59fb737d]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  35:     0x7f56b88d6f7e - rustc_typeck[fa7863cc59fb737d]::check::check::check_fn
  36:     0x7f56b892ca6d - <rustc_infer[58c7ef1f7122eb2e]::infer::InferCtxtBuilder>::enter::<&rustc_middle[5eaaecf938a50c51]::ty::context::TypeckResults, <rustc_typeck[fa7863cc59fb737d]::check::inherited::InheritedBuilder>::enter<rustc_typeck[fa7863cc59fb737d]::check::typeck_with_fallback<rustc_typeck[fa7863cc59fb737d]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[5eaaecf938a50c51]::ty::context::TypeckResults>::{closure#0}>
  37:     0x7f56b88ff82a - rustc_typeck[fa7863cc59fb737d]::check::typeck
  38:     0x7f56b8dfd790 - rustc_query_system[5199b465427c9459]::query::plumbing::try_execute_query::<rustc_query_impl[542036c3062ad20]::plumbing::QueryCtxt, rustc_query_system[5199b465427c9459]::query::caches::DefaultCache<rustc_span[47366e988d88fc14]::def_id::LocalDefId, &rustc_middle[5eaaecf938a50c51]::ty::context::TypeckResults>>
  39:     0x7f56b8f06028 - <rustc_query_impl[542036c3062ad20]::Queries as rustc_middle[5eaaecf938a50c51]::ty::query::QueryEngine>::typeck
  40:     0x7f56b89af038 - <rustc_middle[5eaaecf938a50c51]::hir::map::Map>::par_body_owners::<rustc_typeck[fa7863cc59fb737d]::check::typeck_item_bodies::{closure#0}>
  41:     0x7f56b96b341c - rustc_typeck[fa7863cc59fb737d]::check::typeck_item_bodies
  42:     0x7f56b990da42 - rustc_query_system[5199b465427c9459]::query::plumbing::try_execute_query::<rustc_query_impl[542036c3062ad20]::plumbing::QueryCtxt, rustc_query_system[5199b465427c9459]::query::caches::DefaultCache<(), ()>>
  43:     0x7f56b9934b81 - rustc_query_system[5199b465427c9459]::query::plumbing::get_query::<rustc_query_impl[542036c3062ad20]::queries::typeck_item_bodies, rustc_query_impl[542036c3062ad20]::plumbing::QueryCtxt>
  44:     0x7f56b96c22f3 - <rustc_session[99383896a68e820c]::session::Session>::time::<(), rustc_typeck[fa7863cc59fb737d]::check_crate::{closure#7}>
  45:     0x7f56b96bfe63 - rustc_typeck[fa7863cc59fb737d]::check_crate
  46:     0x7f56b9442cd7 - rustc_interface[837f243751cb994f]::passes::analysis
  47:     0x7f56b9903b74 - rustc_query_system[5199b465427c9459]::query::plumbing::try_execute_query::<rustc_query_impl[542036c3062ad20]::plumbing::QueryCtxt, rustc_query_system[5199b465427c9459]::query::caches::DefaultCache<(), core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>>>
  48:     0x7f56b994498e - rustc_query_system[5199b465427c9459]::query::plumbing::get_query::<rustc_query_impl[542036c3062ad20]::queries::analysis, rustc_query_impl[542036c3062ad20]::plumbing::QueryCtxt>
  49:     0x7f56b941e7f7 - <rustc_interface[837f243751cb994f]::passes::QueryContext>::enter::<rustc_driver[15079dfc84a3112]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>>
  50:     0x7f56b9409418 - <rustc_interface[837f243751cb994f]::interface::Compiler>::enter::<rustc_driver[15079dfc84a3112]::run_compiler::{closure#1}::{closure#2}, core[26ec97baa1f5afe1]::result::Result<core[26ec97baa1f5afe1]::option::Option<rustc_interface[837f243751cb994f]::queries::Linker>, rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>>
  51:     0x7f56b9432d9f - rustc_span[47366e988d88fc14]::with_source_map::<core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>, rustc_interface[837f243751cb994f]::interface::create_compiler_and_run<core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>, rustc_driver[15079dfc84a3112]::run_compiler::{closure#1}>::{closure#1}>
  52:     0x7f56b941d714 - rustc_interface[837f243751cb994f]::interface::create_compiler_and_run::<core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>, rustc_driver[15079dfc84a3112]::run_compiler::{closure#1}>
  53:     0x7f56b9406921 - <scoped_tls[1a6277c61c1e4f26]::ScopedKey<rustc_span[47366e988d88fc14]::SessionGlobals>>::set::<rustc_interface[837f243751cb994f]::interface::run_compiler<core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>, rustc_driver[15079dfc84a3112]::run_compiler::{closure#1}>::{closure#0}, core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>>
  54:     0x7f56b941feef - std[b00d0cd10ed18eb]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[837f243751cb994f]::util::run_in_thread_pool_with_globals<rustc_interface[837f243751cb994f]::interface::run_compiler<core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>, rustc_driver[15079dfc84a3112]::run_compiler::{closure#1}>::{closure#0}, core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>>::{closure#0}, core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>>
  55:     0x7f56b9420029 - <<std[b00d0cd10ed18eb]::thread::Builder>::spawn_unchecked_<rustc_interface[837f243751cb994f]::util::run_in_thread_pool_with_globals<rustc_interface[837f243751cb994f]::interface::run_compiler<core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>, rustc_driver[15079dfc84a3112]::run_compiler::{closure#1}>::{closure#0}, core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>>::{closure#0}, core[26ec97baa1f5afe1]::result::Result<(), rustc_errors[1cc09afc534cd467]::ErrorGuaranteed>>::{closure#1} as core[26ec97baa1f5afe1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  56:     0x7f56b6c59e53 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4eefbdc6e759aaf9
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/alloc/src/boxed.rs:1866:9
  57:     0x7f56b6c59e53 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h58e12ebf42bc0fa9
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/alloc/src/boxed.rs:1866:9
  58:     0x7f56b6c59e53 - std::sys::unix::thread::Thread::new::thread_start::h9bd57a8145f8d4d0
                               at /rustc/f4ec0e7cff545e932ce30e39087b16687f0affa1/library/std/src/sys/unix/thread.rs:108:17
  59:     0x7f56b6b8a609 - start_thread
  60:     0x7f56b6aa3163 - clone
  61:                0x0 - <unknown>

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, I-ICE, T-compiler&template=ice.md

note: rustc 1.62.0-nightly (f4ec0e7cf 2022-04-22) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

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

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
warning: `playground` (bin "playground") generated 1 warning
error: could not compile `playground` due to previous error; 1 warning emitted

@Badel2 Badel2 added C-bug Category: This is a bug. 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. labels Apr 23, 2022
@Badel2
Copy link
Contributor Author

Badel2 commented Apr 23, 2022

searched nightlies: from nightly-2022-04-01 to nightly-2022-04-22
regressed nightly: nightly-2022-04-17
searched commit range: 3f391b8...878c783
regressed commit: 07bb916

bisected with cargo-bisect-rustc v0.6.2

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --test-dir=. --start=2022-04-01 --end=2022-04-22 --regress ice --access github 

@oli-obk oli-obk added P-low Low priority E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels Apr 23, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Apr 23, 2022

A bug! invocation should be replaced by delay_span_bug and producing an error type as the adjustment result

@PrestonFrom
Copy link
Contributor

I think this is still open and it looks like a fun problem to dig into. Please let me know if I should let someone else work on it though please!

@rustbot claim

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Apr 23, 2022
@PeterWrighten
Copy link

I also found this issue in that version's nightly rustc. I consider that is a nontrival problem worth digging into. @rustbot

@PrestonFrom
Copy link
Contributor

PrestonFrom commented Apr 25, 2022

@oli-obk @PeterWrighten @Badel2
I have opened a PR (#96379) that I believe addresses the ICE. I think I pretty much implemented what Oli described, but I'm a little unclear as to whether this is the actual solution or is the fact that there's an adjustment on a never type at all the real bug?

I also wasn't able to reduce the minimal error case much beyond what Badel2 posted. Do you happen to have a simpler error case, Peter?

@compiler-errors
Copy link
Member

little unclear as to whether this is the actual solution or is the fact that there's an adjustment on a never type at all the real bug

@PrestonFrom I'm assigned to your PR, and looked into this issue really quickly. So this is due to the new argument type compatibility algorithm implemented in #92364 (cc: @jackh726). The check_compatible inner function is calling check_expr_kind after check_expr has been called once before during the "good" path of check_argument_types.

This is somewhat problematic, since this means that typeck code deeper in the stack attemps to apply adjustments twice and sometimes panicks because of this. A similar bug was fixed in #94596 when other diagnostic code called check_expr several times on a bad path.

Since this will only reasonably happen during diagnostic code, I think it's fine for now to delay a bug.

@PrestonFrom
Copy link
Contributor

@compiler-errors Thank you for the background! That helps a lot to clarify things. I clearly need to do a lot more reading.

@PeterWrighten
Copy link

@oli-obk @PeterWrighten @Badel2 I have opened a PR (#96379) that I believe addresses the ICE. I think I pretty much implemented what Oli described, but I'm a little unclear as to whether this is the actual solution or is the fact that there's an adjustment on a never type at all the real bug?

I also wasn't able to reduce the minimal error case much beyond what Badel2 posted. Do you happen to have a simpler error case, Peter?

Yeah, I also just have a simple ICE from rustc. But there has been some expositions from @compiler-errors , so I think maybe this issue would be solved in the future.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Apr 25, 2022
…-errors

delay bug when adjusting `NeverToAny` twice during diagnostic code

Addresses Issue 96335 (rust-lang#96335) by using `delay_span_bug` instead of an assert and returning an error type from `check_expr_meets_expectation_or_error`.

Fixes rust-lang#96335
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Apr 25, 2022
…-errors

delay bug when adjusting `NeverToAny` twice during diagnostic code

Addresses Issue 96335 (rust-lang#96335) by using `delay_span_bug` instead of an assert and returning an error type from `check_expr_meets_expectation_or_error`.

Fixes rust-lang#96335
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Apr 25, 2022
…-errors

delay bug when adjusting `NeverToAny` twice during diagnostic code

Addresses Issue 96335 (rust-lang#96335) by using `delay_span_bug` instead of an assert and returning an error type from `check_expr_meets_expectation_or_error`.

Fixes rust-lang#96335
compiler-errors added a commit to compiler-errors/rust that referenced this issue Apr 25, 2022
…-errors

delay bug when adjusting `NeverToAny` twice during diagnostic code

Addresses Issue 96335 (rust-lang#96335) by using `delay_span_bug` instead of an assert and returning an error type from `check_expr_meets_expectation_or_error`.

Fixes rust-lang#96335
@bors bors closed this as completed in 8038a9e Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants