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: unmatched arg and hir arg: found '?1 vs Type #126385

Closed
matthiaskrgr opened this issue Jun 13, 2024 · 1 comment · Fixed by #126570
Closed

ICE: unmatched arg and hir arg: found '?1 vs Type #126385

matthiaskrgr opened this issue Jun 13, 2024 · 1 comment · Fixed by #126570
Labels
C-bug Category: This is a bug. 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):

pub struct MyStruct<'field> {
    field: &'_ [u32],
}

impl MyStruct<'_> {
    pub fn _<'a>(field: &'a[u32]) -> Self<new> {
    Self{field}
    }
}


original:

pub struct MyStruct<'field> {
    field: &'_ [u32],
}

impl MyStruct<'_> {
    pub fn _<'a>(field: &'a[u32]) -> Self<new> {
    Self{field}
    }
}

fn main() {}

Version information

rustc 1.81.0-nightly (56e112afb 2024-06-13)
binary: rustc
commit-hash: 56e112afb6bd92698fca44a83b4f116b3e51552c
commit-date: 2024-06-13
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Command:
/home/gh-matthiaskrgr/.rustup/toolchains/master/bin/rustc

Program output

error: expected identifier, found reserved identifier `_`
 --> /tmp/icemaker_global_tempdir.s9OfZSju6G4k/rustc_testrunner_tmpdir_reporting.BbIVyHSOzu5I/mvce.rs:6:12
  |
6 |     pub fn _<'a>(field: &'a[u32]) -> Self<new> {
  |            ^ expected identifier, found reserved identifier

error[E0106]: missing lifetime specifier
 --> /tmp/icemaker_global_tempdir.s9OfZSju6G4k/rustc_testrunner_tmpdir_reporting.BbIVyHSOzu5I/mvce.rs:2:13
  |
2 |     field: &'_ [u32],
  |             ^^ expected named lifetime parameter
  |
help: consider using the `'field` lifetime
  |
2 |     field: &'field [u32],
  |             ~~~~~~

error[E0412]: cannot find type `new` in this scope
 --> /tmp/icemaker_global_tempdir.s9OfZSju6G4k/rustc_testrunner_tmpdir_reporting.BbIVyHSOzu5I/mvce.rs:6:43
  |
6 |     pub fn _<'a>(field: &'a[u32]) -> Self<new> {
  |                                           ^^^ not found in this scope
  |
help: you might be missing a type parameter
  |
5 | impl<new> MyStruct<'_> {
  |     +++++

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

error[E0109]: type arguments are not allowed on self type
 --> /tmp/icemaker_global_tempdir.s9OfZSju6G4k/rustc_testrunner_tmpdir_reporting.BbIVyHSOzu5I/mvce.rs:6:43
  |
6 |     pub fn _<'a>(field: &'a[u32]) -> Self<new> {
  |                                      ---- ^^^ type argument not allowed
  |                                      |
  |                                      not allowed on self type
  |
note: `Self` is of type `MyStruct<'_>`
 --> /tmp/icemaker_global_tempdir.s9OfZSju6G4k/rustc_testrunner_tmpdir_reporting.BbIVyHSOzu5I/mvce.rs:1:12
  |
1 | pub struct MyStruct<'field> {
  |            ^^^^^^^^ `Self` corresponds to this type
...
5 | impl MyStruct<'_> {
  | ----------------- `Self` is on type `MyStruct` in this `impl`
help: the `Self` type doesn't accept type parameters, use the concrete type's name `MyStruct` instead if you want to specify its type parameters
  |
6 |     pub fn _<'a>(field: &'a[u32]) -> MyStruct<new> {
  |                                      ~~~~~~~~

error: internal compiler error: unmatched arg and hir arg: found '?1 vs Type(Ty { hir_id: HirId(DefId(0:7 ~ mvce[cd9a]::{impl#0}::_).17), kind: Path(Resolved(None, Path { span: /tmp/icemaker_global_tempdir.s9OfZSju6G4k/rustc_testrunner_tmpdir_reporting.BbIVyHSOzu5I/mvce.rs:6:43: 6:46 (#0), res: Err, segments: [PathSegment { ident: new#0, hir_id: HirId(DefId(0:7 ~ mvce[cd9a]::{impl#0}::_).18), res: Err, args: None, infer_args: false }] })), span: /tmp/icemaker_global_tempdir.s9OfZSju6G4k/rustc_testrunner_tmpdir_reporting.BbIVyHSOzu5I/mvce.rs:6:43: 6:46 (#0) })
 --> /tmp/icemaker_global_tempdir.s9OfZSju6G4k/rustc_testrunner_tmpdir_reporting.BbIVyHSOzu5I/mvce.rs:6:43
  |
6 |     pub fn _<'a>(field: &'a[u32]) -> Self<new> {
  |                                           ^^^

thread 'rustc' panicked at compiler/rustc_borrowck/src/diagnostics/region_name.rs:633:32:
Box<dyn Any>
stack backtrace:
   0:     0x716e7e4a1ae5 - std::backtrace_rs::backtrace::libunwind::trace::h0dba46765fbebcad
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x716e7e4a1ae5 - std::backtrace_rs::backtrace::trace_unsynchronized::hd65ea145baac0dab
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x716e7e4a1ae5 - std::sys_common::backtrace::_print_fmt::h561009fd732ba143
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x716e7e4a1ae5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6fda2ee1a8f1d266
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x716e7e4f277b - core::fmt::rt::Argument::fmt::h7a0ed69791a32b55
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/core/src/fmt/rt.rs:165:63
   5:     0x716e7e4f277b - core::fmt::write::h57dfd108b14ad10b
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/core/src/fmt/mod.rs:1168:21
   6:     0x716e7e4966bf - std::io::Write::write_fmt::h9d3bdd648c67cb6b
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/std/src/io/mod.rs:1835:15
   7:     0x716e7e4a18be - std::sys_common::backtrace::_print::h607aa74865995fc9
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x716e7e4a18be - std::sys_common::backtrace::print::hbb73760bcc7a59fa
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x716e7e4a42f9 - std::panicking::default_hook::{{closure}}::h0e7841610841a6fb
  10:     0x716e7e4a409c - std::panicking::default_hook::h21d0d3e8d29613cb
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/std/src/panicking.rs:292:9
  11:     0x716e7aeb8420 - std[830b1dfb5c6a07e2]::panicking::update_hook::<alloc[b2cefb6eec695489]::boxed::Box<rustc_driver_impl[3d0c464232808fb2]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x716e7e4a4bff - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hafbdfb56c932753a
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/alloc/src/boxed.rs:2076:9
  13:     0x716e7e4a4bff - std::panicking::rust_panic_with_hook::ha5df6757d8c5e469
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/std/src/panicking.rs:801:13
  14:     0x716e7aee8db1 - std[830b1dfb5c6a07e2]::panicking::begin_panic::<rustc_errors[88bd50f1b24c66d9]::ExplicitBug>::{closure#0}
  15:     0x716e7aee5896 - std[830b1dfb5c6a07e2]::sys_common::backtrace::__rust_end_short_backtrace::<std[830b1dfb5c6a07e2]::panicking::begin_panic<rustc_errors[88bd50f1b24c66d9]::ExplicitBug>::{closure#0}, !>
  16:     0x716e7aee0ca6 - std[830b1dfb5c6a07e2]::panicking::begin_panic::<rustc_errors[88bd50f1b24c66d9]::ExplicitBug>
  17:     0x716e7aef2301 - <rustc_errors[88bd50f1b24c66d9]::diagnostic::BugAbort as rustc_errors[88bd50f1b24c66d9]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x716e7abd33f8 - <rustc_errors[88bd50f1b24c66d9]::DiagCtxt>::span_bug::<rustc_span[e6cd05f6aceff9d0]::span_encoding::Span, alloc[b2cefb6eec695489]::string::String>
  19:     0x716e7ac89717 - <rustc_borrowck[352dd9c98fc78329]::MirBorrowckCtxt>::highlight_if_we_can_match_hir_ty
  20:     0x716e7ac88020 - <rustc_borrowck[352dd9c98fc78329]::MirBorrowckCtxt>::give_region_a_name
  21:     0x716e7acb39e9 - <rustc_borrowck[352dd9c98fc78329]::MirBorrowckCtxt>::report_general_error
  22:     0x716e7acb122b - <rustc_borrowck[352dd9c98fc78329]::MirBorrowckCtxt>::report_region_error
  23:     0x716e7d18b91f - rustc_borrowck[352dd9c98fc78329]::do_mir_borrowck
  24:     0x716e7d1556be - rustc_query_impl[d06663d9d38d2cbe]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d06663d9d38d2cbe]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[bdc60ded8a7c8d31]::query::erase::Erased<[u8; 8usize]>>
  25:     0x716e7c4e71ae - rustc_query_system[3d4bb05ea208a1a9]::query::plumbing::try_execute_query::<rustc_query_impl[d06663d9d38d2cbe]::DynamicConfig<rustc_query_system[3d4bb05ea208a1a9]::query::caches::VecCache<rustc_span[e6cd05f6aceff9d0]::def_id::LocalDefId, rustc_middle[bdc60ded8a7c8d31]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[d06663d9d38d2cbe]::plumbing::QueryCtxt, false>
  26:     0x716e7c4e6c0d - rustc_query_impl[d06663d9d38d2cbe]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  27:     0x716e7cc63553 - rustc_interface[9a10d89c4c9af93d]::passes::analysis
  28:     0x716e7cc626c7 - rustc_query_impl[d06663d9d38d2cbe]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d06663d9d38d2cbe]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[bdc60ded8a7c8d31]::query::erase::Erased<[u8; 1usize]>>
  29:     0x716e7cffaf65 - rustc_query_system[3d4bb05ea208a1a9]::query::plumbing::try_execute_query::<rustc_query_impl[d06663d9d38d2cbe]::DynamicConfig<rustc_query_system[3d4bb05ea208a1a9]::query::caches::SingleCache<rustc_middle[bdc60ded8a7c8d31]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d06663d9d38d2cbe]::plumbing::QueryCtxt, false>
  30:     0x716e7cffaccf - rustc_query_impl[d06663d9d38d2cbe]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  31:     0x716e7cea3fd2 - rustc_interface[9a10d89c4c9af93d]::interface::run_compiler::<core[ca0fe73d73e01744]::result::Result<(), rustc_span[e6cd05f6aceff9d0]::ErrorGuaranteed>, rustc_driver_impl[3d0c464232808fb2]::run_compiler::{closure#0}>::{closure#1}
  32:     0x716e7ce64609 - std[830b1dfb5c6a07e2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9a10d89c4c9af93d]::util::run_in_thread_with_globals<rustc_interface[9a10d89c4c9af93d]::util::run_in_thread_pool_with_globals<rustc_interface[9a10d89c4c9af93d]::interface::run_compiler<core[ca0fe73d73e01744]::result::Result<(), rustc_span[e6cd05f6aceff9d0]::ErrorGuaranteed>, rustc_driver_impl[3d0c464232808fb2]::run_compiler::{closure#0}>::{closure#1}, core[ca0fe73d73e01744]::result::Result<(), rustc_span[e6cd05f6aceff9d0]::ErrorGuaranteed>>::{closure#0}, core[ca0fe73d73e01744]::result::Result<(), rustc_span[e6cd05f6aceff9d0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ca0fe73d73e01744]::result::Result<(), rustc_span[e6cd05f6aceff9d0]::ErrorGuaranteed>>
  33:     0x716e7ce643ba - <<std[830b1dfb5c6a07e2]::thread::Builder>::spawn_unchecked_<rustc_interface[9a10d89c4c9af93d]::util::run_in_thread_with_globals<rustc_interface[9a10d89c4c9af93d]::util::run_in_thread_pool_with_globals<rustc_interface[9a10d89c4c9af93d]::interface::run_compiler<core[ca0fe73d73e01744]::result::Result<(), rustc_span[e6cd05f6aceff9d0]::ErrorGuaranteed>, rustc_driver_impl[3d0c464232808fb2]::run_compiler::{closure#0}>::{closure#1}, core[ca0fe73d73e01744]::result::Result<(), rustc_span[e6cd05f6aceff9d0]::ErrorGuaranteed>>::{closure#0}, core[ca0fe73d73e01744]::result::Result<(), rustc_span[e6cd05f6aceff9d0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ca0fe73d73e01744]::result::Result<(), rustc_span[e6cd05f6aceff9d0]::ErrorGuaranteed>>::{closure#2} as core[ca0fe73d73e01744]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x716e7e4aea7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5f0b77915d0bb466
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/alloc/src/boxed.rs:2062:9
  35:     0x716e7e4aea7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h177a6fd9d106b140
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/alloc/src/boxed.rs:2062:9
  36:     0x716e7e4aea7b - std::sys::pal::unix::thread::Thread::new::thread_start::haf94e100ee8b639b
                               at /rustc/56e112afb6bd92698fca44a83b4f116b3e51552c/library/std/src/sys/pal/unix/thread.rs:108:17
  37:     0x716e77894ac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  38:     0x716e77926850 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  39:                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.81.0-nightly (56e112afb 2024-06-13) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at /tmp/icemaker_global_tempdir.s9OfZSju6G4k/rustc_testrunner_tmpdir_reporting.BbIVyHSOzu5I/mvce.rs:5:1: 5:18>::_`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors

Some errors have detailed explanations: E0106, E0109, E0412, E0601.
For more information about an error, try `rustc --explain E0106`.

@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 Jun 13, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 13, 2024
@matthiaskrgr
Copy link
Member Author

Regression in nightly-2024-02-22
#121208 cc @nnethercote

nnethercote added a commit to nnethercote/rust that referenced this issue Jun 17, 2024
PR rust-lang#121208 converted this from a `span_delayed_bug` to a `span_bug`
because nothing in the test suite caused execution to hit this path. But
now fuzzing has found a test case that does hit it. So this commit
converts it back to `span_delayed_bug` and adds the relevant test.

Fixes rust-lang#126385.
nnethercote added a commit to nnethercote/rust that referenced this issue Jun 17, 2024
PR rust-lang#121208 converted this from a `span_delayed_bug` to a `span_bug`
because nothing in the test suite caused execution to hit this path. But
now fuzzing has found a test case that does hit it. So this commit
converts it back to `span_delayed_bug` and adds the relevant test.

Fixes rust-lang#126385.
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Jun 17, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jun 17, 2024
Convert a `span_bug` to a `span_delayed_bug`.

PR rust-lang#121208 converted this from a `span_delayed_bug` to a `span_bug` because nothing in the test suite caused execution to hit this path. But now fuzzing has found a test case that does hit it. So this commit converts it back to `span_delayed_bug` and adds the relevant test.

Fixes rust-lang#126385.

r? `@lcnr`
@bors bors closed this as completed in bd32c4c Jun 17, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 17, 2024
Rollup merge of rust-lang#126570 - nnethercote:fix-126385, r=lcnr

Convert a `span_bug` to a `span_delayed_bug`.

PR rust-lang#121208 converted this from a `span_delayed_bug` to a `span_bug` because nothing in the test suite caused execution to hit this path. But now fuzzing has found a test case that does hit it. So this commit converts it back to `span_delayed_bug` and adds the relevant test.

Fixes rust-lang#126385.

r? `@lcnr`
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 17, 2024
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. 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

Successfully merging a pull request may close this issue.

3 participants