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

ICE: unhandled type: {type error} #125185

Open
matthiaskrgr opened this issue May 16, 2024 · 0 comments
Open

ICE: unhandled type: {type error} #125185

matthiaskrgr opened this issue May 16, 2024 · 0 comments
Labels
-Zvalidate-mir Unstable option: MIR validation C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

type Foo = impl Send;

struct A;

const VALUE: Foo = value();

fn test(foo: Foo<'a>, f: impl for<'b> FnMut()) {
    match VALUE {
        0 | 0 => {}

        _ => (),
    }
}

original:

type Foo = impl Send;

struct A;

const VALUE: Foo = value();

fn test(
        foo: Foo<'a>,
        f: impl for<'b> FnMut(Self::FooRef<'b>),
    ) {
    match VALUE {
        0 | 0 => {}

        _ => (),
    }
}

Version information

rustc 1.80.0-nightly (97bf25c8c 2024-05-16)
binary: rustc
commit-hash: 97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f
commit-date: 2024-05-16
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.4

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zvalidate-mir

Program output

error[E0261]: use of undeclared lifetime name `'a`
 --> /tmp/icemaker_global_tempdir.6IiXJq3YtRlA/rustc_testrunner_tmpdir_reporting.KGuZhLmwhEmD/mvce.rs:7:18
  |
7 | fn test(foo: Foo<'a>, f: impl for<'b> FnMut()) {
  |        -         ^^ undeclared lifetime
  |        |
  |        help: consider introducing lifetime `'a` here: `<'a>`

error[E0658]: `impl Trait` in type aliases is unstable
 --> /tmp/icemaker_global_tempdir.6IiXJq3YtRlA/rustc_testrunner_tmpdir_reporting.KGuZhLmwhEmD/mvce.rs:1:12
  |
1 | type Foo = impl Send;
  |            ^^^^^^^^^
  |
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
  = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
  = note: this compiler was built on 2024-05-16; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.6IiXJq3YtRlA/rustc_testrunner_tmpdir_reporting.KGuZhLmwhEmD/mvce.rs:13:2
   |
13 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.6IiXJq3YtRlA/rustc_testrunner_tmpdir_reporting.KGuZhLmwhEmD/mvce.rs`

error[E0425]: cannot find function `value` in this scope
 --> /tmp/icemaker_global_tempdir.6IiXJq3YtRlA/rustc_testrunner_tmpdir_reporting.KGuZhLmwhEmD/mvce.rs:5:20
  |
5 | const VALUE: Foo = value();
  |                    ^^^^^ not found in this scope

error[E0107]: type alias takes 0 lifetime arguments but 1 lifetime argument was supplied
 --> /tmp/icemaker_global_tempdir.6IiXJq3YtRlA/rustc_testrunner_tmpdir_reporting.KGuZhLmwhEmD/mvce.rs:7:14
  |
7 | fn test(foo: Foo<'a>, f: impl for<'b> FnMut()) {
  |              ^^^---- help: remove these generics
  |              |
  |              expected 0 lifetime arguments
  |
note: type alias defined here, with 0 lifetime parameters
 --> /tmp/icemaker_global_tempdir.6IiXJq3YtRlA/rustc_testrunner_tmpdir_reporting.KGuZhLmwhEmD/mvce.rs:1:6
  |
1 | type Foo = impl Send;
  |      ^^^

warning: unreachable pattern
 --> /tmp/icemaker_global_tempdir.6IiXJq3YtRlA/rustc_testrunner_tmpdir_reporting.KGuZhLmwhEmD/mvce.rs:9:13
  |
9 |         0 | 0 => {}
  |             ^
  |
  = note: `#[warn(unreachable_patterns)]` on by default

warning: unused variable: `foo`
 --> /tmp/icemaker_global_tempdir.6IiXJq3YtRlA/rustc_testrunner_tmpdir_reporting.KGuZhLmwhEmD/mvce.rs:7:9
  |
7 | fn test(foo: Foo<'a>, f: impl for<'b> FnMut()) {
  |         ^^^ help: if this is intentional, prefix it with an underscore: `_foo`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `f`
 --> /tmp/icemaker_global_tempdir.6IiXJq3YtRlA/rustc_testrunner_tmpdir_reporting.KGuZhLmwhEmD/mvce.rs:7:23
  |
7 | fn test(foo: Foo<'a>, f: impl for<'b> FnMut()) {
  |                       ^ help: if this is intentional, prefix it with an underscore: `_f`

error: internal compiler error: compiler/rustc_const_eval/src/transform/validate.rs:1374:30: unhandled type: {type error}

thread 'rustc' panicked at compiler/rustc_const_eval/src/transform/validate.rs:1374:30:
Box<dyn Any>
stack backtrace:
   0:     0x733ec3d339e5 - std::backtrace_rs::backtrace::libunwind::trace::h5fef6a8b33f07067
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x733ec3d339e5 - std::backtrace_rs::backtrace::trace_unsynchronized::h6b8a04457810b752
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x733ec3d339e5 - std::sys_common::backtrace::_print_fmt::h77d7d1bbbc4229b7
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x733ec3d339e5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf20574f93e14a2f1
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x733ec3d82b9b - core::fmt::rt::Argument::fmt::h23348174c5722978
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/core/src/fmt/rt.rs:165:63
   5:     0x733ec3d82b9b - core::fmt::write::hd7cce5a4518d8fcc
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/core/src/fmt/mod.rs:1169:21
   6:     0x733ec3d286cf - std::io::Write::write_fmt::he0dc0196eacbf547
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/std/src/io/mod.rs:1835:15
   7:     0x733ec3d337be - std::sys_common::backtrace::_print::h8c8ac3edb452e461
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x733ec3d337be - std::sys_common::backtrace::print::h585b780817d313e4
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x733ec3d361b9 - std::panicking::default_hook::{{closure}}::h6f51b42428cf3ee0
  10:     0x733ec3d35efd - std::panicking::default_hook::h7c2d4035884dc1c0
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/std/src/panicking.rs:298:9
  11:     0x733ec06fd2ff - std[9df4ad2bb6f4fdc9]::panicking::update_hook::<alloc[66fd9561b21ccf21]::boxed::Box<rustc_driver_impl[aefe405b0e9c583e]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x733ec3d368eb - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h61418e85d4bc7a4f
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/alloc/src/boxed.rs:2036:9
  13:     0x733ec3d368eb - std::panicking::rust_panic_with_hook::hf60a62c858a4a3e2
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/std/src/panicking.rs:799:13
  14:     0x733ec072d084 - std[9df4ad2bb6f4fdc9]::panicking::begin_panic::<rustc_errors[416f919b3054adbc]::ExplicitBug>::{closure#0}
  15:     0x733ec0729c86 - std[9df4ad2bb6f4fdc9]::sys_common::backtrace::__rust_end_short_backtrace::<std[9df4ad2bb6f4fdc9]::panicking::begin_panic<rustc_errors[416f919b3054adbc]::ExplicitBug>::{closure#0}, !>
  16:     0x733ec0729966 - std[9df4ad2bb6f4fdc9]::panicking::begin_panic::<rustc_errors[416f919b3054adbc]::ExplicitBug>
  17:     0x733ec0736321 - <rustc_errors[416f919b3054adbc]::diagnostic::BugAbort as rustc_errors[416f919b3054adbc]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x733ec0bfc88c - rustc_middle[6382b0f0af84a456]::util::bug::opt_span_bug_fmt::<rustc_span[c8a197c6866abc7b]::span_encoding::Span>::{closure#0}
  19:     0x733ec0be175a - rustc_middle[6382b0f0af84a456]::ty::context::tls::with_opt::<rustc_middle[6382b0f0af84a456]::util::bug::opt_span_bug_fmt<rustc_span[c8a197c6866abc7b]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x733ec0be15fb - rustc_middle[6382b0f0af84a456]::ty::context::tls::with_context_opt::<rustc_middle[6382b0f0af84a456]::ty::context::tls::with_opt<rustc_middle[6382b0f0af84a456]::util::bug::opt_span_bug_fmt<rustc_span[c8a197c6866abc7b]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x733ebeeeaef0 - rustc_middle[6382b0f0af84a456]::util::bug::bug_fmt
  22:     0x733ebf5778cd - <rustc_const_eval[ec18fc4bc70e7081]::transform::validate::TypeChecker as rustc_middle[6382b0f0af84a456]::mir::visit::Visitor>::visit_terminator
  23:     0x733ec233096c - rustc_const_eval[ec18fc4bc70e7081]::transform::validate::validate_types
  24:     0x733ebfb57e18 - <rustc_const_eval[ec18fc4bc70e7081]::transform::validate::Validator as rustc_middle[6382b0f0af84a456]::mir::MirPass>::run_pass
  25:     0x733ebfbf7100 - rustc_mir_transform[598a3370fed2ea16]::pass_manager::validate_body
  26:     0x733ec1a01c85 - rustc_mir_transform[598a3370fed2ea16]::pass_manager::run_passes_inner
  27:     0x733ec1ea4850 - rustc_mir_transform[598a3370fed2ea16]::mir_drops_elaborated_and_const_checked
  28:     0x733ec1ea407d - rustc_query_impl[f76ee426649ffec0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f76ee426649ffec0]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6382b0f0af84a456]::query::erase::Erased<[u8; 8usize]>>
  29:     0x733ec2109bf1 - rustc_query_system[67be369387497d6c]::query::plumbing::try_execute_query::<rustc_query_impl[f76ee426649ffec0]::DynamicConfig<rustc_query_system[67be369387497d6c]::query::caches::VecCache<rustc_span[c8a197c6866abc7b]::def_id::LocalDefId, rustc_middle[6382b0f0af84a456]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f76ee426649ffec0]::plumbing::QueryCtxt, false>
  30:     0x733ec210958c - rustc_query_impl[f76ee426649ffec0]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  31:     0x733ec258cd88 - rustc_interface[8a51f960ec385412]::passes::analysis
  32:     0x733ec258bb5b - rustc_query_impl[f76ee426649ffec0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f76ee426649ffec0]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6382b0f0af84a456]::query::erase::Erased<[u8; 1usize]>>
  33:     0x733ec27e1525 - rustc_query_system[67be369387497d6c]::query::plumbing::try_execute_query::<rustc_query_impl[f76ee426649ffec0]::DynamicConfig<rustc_query_system[67be369387497d6c]::query::caches::SingleCache<rustc_middle[6382b0f0af84a456]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[f76ee426649ffec0]::plumbing::QueryCtxt, false>
  34:     0x733ec27e1289 - rustc_query_impl[f76ee426649ffec0]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  35:     0x733ec2672c0e - rustc_interface[8a51f960ec385412]::interface::run_compiler::<core[29d7d95333d708ae]::result::Result<(), rustc_span[c8a197c6866abc7b]::ErrorGuaranteed>, rustc_driver_impl[aefe405b0e9c583e]::run_compiler::{closure#0}>::{closure#1}
  36:     0x733ec265e5c9 - std[9df4ad2bb6f4fdc9]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[8a51f960ec385412]::util::run_in_thread_with_globals<rustc_interface[8a51f960ec385412]::util::run_in_thread_pool_with_globals<rustc_interface[8a51f960ec385412]::interface::run_compiler<core[29d7d95333d708ae]::result::Result<(), rustc_span[c8a197c6866abc7b]::ErrorGuaranteed>, rustc_driver_impl[aefe405b0e9c583e]::run_compiler::{closure#0}>::{closure#1}, core[29d7d95333d708ae]::result::Result<(), rustc_span[c8a197c6866abc7b]::ErrorGuaranteed>>::{closure#0}, core[29d7d95333d708ae]::result::Result<(), rustc_span[c8a197c6866abc7b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[29d7d95333d708ae]::result::Result<(), rustc_span[c8a197c6866abc7b]::ErrorGuaranteed>>
  37:     0x733ec265e376 - <<std[9df4ad2bb6f4fdc9]::thread::Builder>::spawn_unchecked_<rustc_interface[8a51f960ec385412]::util::run_in_thread_with_globals<rustc_interface[8a51f960ec385412]::util::run_in_thread_pool_with_globals<rustc_interface[8a51f960ec385412]::interface::run_compiler<core[29d7d95333d708ae]::result::Result<(), rustc_span[c8a197c6866abc7b]::ErrorGuaranteed>, rustc_driver_impl[aefe405b0e9c583e]::run_compiler::{closure#0}>::{closure#1}, core[29d7d95333d708ae]::result::Result<(), rustc_span[c8a197c6866abc7b]::ErrorGuaranteed>>::{closure#0}, core[29d7d95333d708ae]::result::Result<(), rustc_span[c8a197c6866abc7b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[29d7d95333d708ae]::result::Result<(), rustc_span[c8a197c6866abc7b]::ErrorGuaranteed>>::{closure#2} as core[29d7d95333d708ae]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x733ec3d4078b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf256b52a0d01de19
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/alloc/src/boxed.rs:2022:9
  39:     0x733ec3d4078b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hae70927392e12d5f
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/alloc/src/boxed.rs:2022:9
  40:     0x733ec3d4078b - std::sys::pal::unix::thread::Thread::new::thread_start::h5749d225aca46043
                               at /rustc/97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f/library/std/src/sys/pal/unix/thread.rs:108:17
  41:     0x733ebd4a955a - <unknown>
  42:     0x733ebd526a3c - <unknown>
  43:                0x0 - <unknown>

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.80.0-nightly (97bf25c8c 2024-05-16) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z validate-mir -Z dump-mir-dir=dir

query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `test`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors; 3 warnings emitted

Some errors have detailed explanations: E0107, E0261, E0425, E0601, E0658.
For more information about an error, try `rustc --explain E0107`.

@matthiaskrgr matthiaskrgr 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. C-bug Category: This is a bug. labels May 16, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 16, 2024
@fmease fmease added -Zvalidate-mir Unstable option: MIR validation F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 16, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Zvalidate-mir Unstable option: MIR validation C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants