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: node HirId ... cannot be placed in TypeckResults with hir_owner DefId... #124022

Closed
matthiaskrgr opened this issue Apr 16, 2024 · 5 comments · Fixed by #124037
Closed

ICE: node HirId ... cannot be placed in TypeckResults with hir_owner DefId... #124022

matthiaskrgr opened this issue Apr 16, 2024 · 5 comments · Fixed by #124037
Assignees
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Apr 16, 2024

auto-reduced (treereduce-rust):

extern crate serde;
mod issue_4298 {
    use serde::{Deserialize, Deserializer, Serialize};
    use std::borrow::Cow;

    #[derive(Serialize, Deserialize)]
    struct Foo<'a, D> {
        #[serde(deserialize_with = "func")]
        foo: Option<Option<Cow<'a, str>>>,
    }

    fn func<'a, D>(_: D) -> Result<Option<Option<Cow<'a, str>>>, D::Error>
    where
        D: Deserializer<'a>,
    {
    }
}
original code

original:

#![deny(clippy::option_option)]
#![allow(borrow)]

const C: Option<'a, str> = None;
//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if
static S: Option<Option<i32>> = None;
//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if

fn input(_: Option<use std::borrow::Cow;x: Option<Option<u8>>u8>>) {}
// The lint only generates one warning for this

fn output() -> Option<Option<u8>> {
    //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if
    None
}

fn output_nested() -> Vec<Option<Option<u8>>> {
    //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if
    vec![None]
}

// The lint only generates one warning for this
fn output_nested_nested() -> Option<Option<Option<Option<u8>>>> {
    //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if
    None
}

struct Struct {
    x: Option<Option<u8>>,
    //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum
}

impl Struct {
    fn struct_fn() -> Option<Option<u8>> {
        //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum
        None
    }
}

trait Trait {
    fn trait_fn() -> Option<Option<u8>>;
    //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum
}

enum Enum {
    Tuple(Option<Option<u8>>),
    //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum
    Struct { x: Option<Option<u8>> },
    //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum
}

// The lint allows this
type OptionOption = Option<Cow<'a, str>>;

// The lint allows this
fn output_type_alias() -> OptionOption {
    None
}

// The line allows this
impl Trait for Struct {
    fn trait_fn() -> Option<Option<u8>> {
        None
    }
}

fn main() {
    input(None);
    output();
    output_nested();

    // The lint allows this
    let local: Struct<Option<u8>> = None;

    // The lint allows this
    let expr = Some(Some(true));
}

extern crate serde;
mod issue_4298 {
    use serde::{Deserialize, Deserializer, Serialize};
    use std::borrow::Cow;

    #[derive(Serialize, Deserialize)]
    struct Foo<'a, D> {
        #[serde(deserialize_with = "func")]
        #[serde(skip_serializing_if = "Option::is_none")]
        #[serde(default)]
        #[serde(borrow)]
        foo: Option<Option<Cow<'a, str>>>,
        //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom
    }

    #[allow(clippy::option_option)]
    fn func<'a, D>(_: D) -> Result<Option<Option<Cow<'a, str>>>, D::Error>
    where
        D: Deserializer<'a>,
    {
        Ok(Some(Some(Cow::Borrowed("hi"))))
    }
}

Version information

rustc 1.79.0-nightly (63f70b3d1 2024-04-16)
binary: rustc
commit-hash: 63f70b3d104e20289a1a0df82747066c3d85b9a1
commit-date: 2024-04-16
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.3

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

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

error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
 --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:1:1
  |
1 | extern crate serde;
  | ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
  = help: add `#![feature(rustc_private)]` to the crate attributes to enable
  = note: this compiler was built on 2024-04-16; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
 --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:3:17
  |
3 |     use serde::{Deserialize, Deserializer, Serialize};
  |                 ^^^^^^^^^^^
  |
  = note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
  = help: add `#![feature(rustc_private)]` to the crate attributes to enable
  = note: this compiler was built on 2024-04-16; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
 --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:3:30
  |
3 |     use serde::{Deserialize, Deserializer, Serialize};
  |                              ^^^^^^^^^^^^
  |
  = note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
  = help: add `#![feature(rustc_private)]` to the crate attributes to enable
  = note: this compiler was built on 2024-04-16; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
 --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:3:44
  |
3 |     use serde::{Deserialize, Deserializer, Serialize};
  |                                            ^^^^^^^^^
  |
  = note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
  = help: add `#![feature(rustc_private)]` to the crate attributes to enable
  = note: this compiler was built on 2024-04-16; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
 --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:6:14
  |
6 |     #[derive(Serialize, Deserialize)]
  |              ^^^^^^^^^
  |
  = note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
  = help: add `#![feature(rustc_private)]` to the crate attributes to enable
  = note: this compiler was built on 2024-04-16; consider upgrading it if it is out of date
  = note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
 --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:6:25
  |
6 |     #[derive(Serialize, Deserialize)]
  |                         ^^^^^^^^^^^
  |
  = note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
  = help: add `#![feature(rustc_private)]` to the crate attributes to enable
  = note: this compiler was built on 2024-04-16; consider upgrading it if it is out of date
  = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
  --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:14:12
   |
14 |         D: Deserializer<'a>,
   |            ^^^^^^^^^^^^^^^^
   |
   = note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
   = help: add `#![feature(rustc_private)]` to the crate attributes to enable
   = note: this compiler was built on 2024-04-16; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
 --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:8:9
  |
8 |         #[serde(deserialize_with = "func")]
  |         ^
  |
  = note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
  = help: add `#![feature(rustc_private)]` to the crate attributes to enable
  = note: this compiler was built on 2024-04-16; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
  --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:12:66
   |
12 |     fn func<'a, D>(_: D) -> Result<Option<Option<Cow<'a, str>>>, D::Error>
   |                                                                  ^^^^^^^^
   |
   = note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
   = help: add `#![feature(rustc_private)]` to the crate attributes to enable
   = note: this compiler was built on 2024-04-16; consider upgrading it if it is out of date

error[E0392]: type parameter `D` is never used
 --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:7:20
  |
7 |     struct Foo<'a, D> {
  |                    ^ unused type parameter
  |
  = help: consider removing `D`, referring to it in a field, or using a marker such as `PhantomData`
  = help: if you intended `D` to be a const parameter, use `const D: /* Type */` instead

error[E0282]: type annotations needed
 --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:6:25
  |
6 |     #[derive(Serialize, Deserialize)]
  |                         ^^^^^^^^^^^ cannot infer type
  |
  = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
 --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:7:12
  |
7 |     struct Foo<'a, D> {
  |            ^^^ cannot infer type for type parameter `D` declared on the struct `Foo`

error: internal compiler error: compiler/rustc_middle/src/ty/typeck_results.rs:559:9: node HirId(DefId(0:80 ~ mvce[dcdf]::issue_4298::_#1::{impl#0}::deserialize::{impl#2}::visit_map).102) (expr `Deserialize`) cannot be placed in TypeckResults with hir_owner DefId(0:93 ~ mvce[dcdf]::issue_4298::_#1::{impl#0}::deserialize::{impl#2}::visit_map::{impl#0}::deserialize)

thread 'rustc' panicked at compiler/rustc_middle/src/ty/typeck_results.rs:559:9:
Box<dyn Any>
stack backtrace:
   0:     0x712bc9a96cd5 - std::backtrace_rs::backtrace::libunwind::trace::hdd748c7838285883
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x712bc9a96cd5 - std::backtrace_rs::backtrace::trace_unsynchronized::ha1462979ee6a2e4a
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x712bc9a96cd5 - std::sys_common::backtrace::_print_fmt::h423f6c0147b1e726
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x712bc9a96cd5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8781c340849a7502
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x712bc9ae5f9b - core::fmt::rt::Argument::fmt::he5b1af0e8d850256
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/core/src/fmt/rt.rs:165:63
   5:     0x712bc9ae5f9b - core::fmt::write::hcd3c5ccee382395a
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/core/src/fmt/mod.rs:1157:21
   6:     0x712bc9a8b85f - std::io::Write::write_fmt::h7d1e4c46a9034f24
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/std/src/io/mod.rs:1832:15
   7:     0x712bc9a96aae - std::sys_common::backtrace::_print::he7fe8e3f6f78aca7
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x712bc9a96aae - std::sys_common::backtrace::print::h3ca58da6c9bbfe9e
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x712bc9a99429 - std::panicking::default_hook::{{closure}}::h04ae4afc91fb7ed6
  10:     0x712bc9a9916d - std::panicking::default_hook::hb7ac4e3868494960
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/std/src/panicking.rs:291:9
  11:     0x712bc647b1cb - std[cc9b189ccd9d9748]::panicking::update_hook::<alloc[cf0b8628080ef300]::boxed::Box<rustc_driver_impl[e492dcc29030f304]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x712bc9a99b2c - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1bda734d4b3a4644
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/alloc/src/boxed.rs:2032:9
  13:     0x712bc9a99b2c - std::panicking::rust_panic_with_hook::hd0146bfa2503919c
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/std/src/panicking.rs:792:13
  14:     0x712bc64aa9b4 - std[cc9b189ccd9d9748]::panicking::begin_panic::<rustc_errors[32767898de9b63f2]::ExplicitBug>::{closure#0}
  15:     0x712bc64a7726 - std[cc9b189ccd9d9748]::sys_common::backtrace::__rust_end_short_backtrace::<std[cc9b189ccd9d9748]::panicking::begin_panic<rustc_errors[32767898de9b63f2]::ExplicitBug>::{closure#0}, !>
  16:     0x712bc64a7406 - std[cc9b189ccd9d9748]::panicking::begin_panic::<rustc_errors[32767898de9b63f2]::ExplicitBug>
  17:     0x712bc64b39e1 - <rustc_errors[32767898de9b63f2]::diagnostic::BugAbort as rustc_errors[32767898de9b63f2]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x712bc69588cc - rustc_middle[11164a6ce117b708]::util::bug::opt_span_bug_fmt::<rustc_span[1f43cfd63a717c3a]::span_encoding::Span>::{closure#0}
  19:     0x712bc693fe1a - rustc_middle[11164a6ce117b708]::ty::context::tls::with_opt::<rustc_middle[11164a6ce117b708]::util::bug::opt_span_bug_fmt<rustc_span[1f43cfd63a717c3a]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x712bc693fcbb - rustc_middle[11164a6ce117b708]::ty::context::tls::with_context_opt::<rustc_middle[11164a6ce117b708]::ty::context::tls::with_opt<rustc_middle[11164a6ce117b708]::util::bug::opt_span_bug_fmt<rustc_span[1f43cfd63a717c3a]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x712bc4558be0 - rustc_middle[11164a6ce117b708]::util::bug::bug_fmt
  22:     0x712bc6956bfb - rustc_middle[11164a6ce117b708]::ty::typeck_results::invalid_hir_id_for_typeck_results
  23:     0x712bc79a79c7 - <rustc_middle[11164a6ce117b708]::ty::typeck_results::TypeckResults>::expr_ty
  24:     0x712bc7c4af2e - rustc_hir_typeck[abee987f1e1c8266]::typeck
  25:     0x712bc7c47489 - rustc_query_impl[2063281436f076b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2063281436f076b]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[11164a6ce117b708]::query::erase::Erased<[u8; 8usize]>>
  26:     0x712bc7c60eb1 - rustc_query_system[8bdce35ed35c4821]::query::plumbing::try_execute_query::<rustc_query_impl[2063281436f076b]::DynamicConfig<rustc_query_system[8bdce35ed35c4821]::query::caches::VecCache<rustc_span[1f43cfd63a717c3a]::def_id::LocalDefId, rustc_middle[11164a6ce117b708]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[2063281436f076b]::plumbing::QueryCtxt, false>
  27:     0x712bc7c5f7ce - rustc_query_impl[2063281436f076b]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  28:     0x712bc7c5f3ac - <rustc_middle[11164a6ce117b708]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[bcf11c8b5f91f029]::check_crate::{closure#4}>::{closure#0}
  29:     0x712bc7c5e095 - rustc_hir_analysis[bcf11c8b5f91f029]::check_crate
  30:     0x712bc806a3fa - rustc_interface[757df98036431907]::passes::analysis
  31:     0x712bc8069f55 - rustc_query_impl[2063281436f076b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2063281436f076b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[11164a6ce117b708]::query::erase::Erased<[u8; 1usize]>>
  32:     0x712bc8609965 - rustc_query_system[8bdce35ed35c4821]::query::plumbing::try_execute_query::<rustc_query_impl[2063281436f076b]::DynamicConfig<rustc_query_system[8bdce35ed35c4821]::query::caches::SingleCache<rustc_middle[11164a6ce117b708]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2063281436f076b]::plumbing::QueryCtxt, false>
  33:     0x712bc86096c9 - rustc_query_impl[2063281436f076b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  34:     0x712bc8409794 - rustc_interface[757df98036431907]::interface::run_compiler::<core[8ca2cc90ba3a0179]::result::Result<(), rustc_span[1f43cfd63a717c3a]::ErrorGuaranteed>, rustc_driver_impl[e492dcc29030f304]::run_compiler::{closure#0}>::{closure#0}
  35:     0x712bc85c391d - std[cc9b189ccd9d9748]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[757df98036431907]::util::run_in_thread_with_globals<rustc_interface[757df98036431907]::util::run_in_thread_pool_with_globals<rustc_interface[757df98036431907]::interface::run_compiler<core[8ca2cc90ba3a0179]::result::Result<(), rustc_span[1f43cfd63a717c3a]::ErrorGuaranteed>, rustc_driver_impl[e492dcc29030f304]::run_compiler::{closure#0}>::{closure#0}, core[8ca2cc90ba3a0179]::result::Result<(), rustc_span[1f43cfd63a717c3a]::ErrorGuaranteed>>::{closure#0}, core[8ca2cc90ba3a0179]::result::Result<(), rustc_span[1f43cfd63a717c3a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8ca2cc90ba3a0179]::result::Result<(), rustc_span[1f43cfd63a717c3a]::ErrorGuaranteed>>
  36:     0x712bc85c372a - <<std[cc9b189ccd9d9748]::thread::Builder>::spawn_unchecked_<rustc_interface[757df98036431907]::util::run_in_thread_with_globals<rustc_interface[757df98036431907]::util::run_in_thread_pool_with_globals<rustc_interface[757df98036431907]::interface::run_compiler<core[8ca2cc90ba3a0179]::result::Result<(), rustc_span[1f43cfd63a717c3a]::ErrorGuaranteed>, rustc_driver_impl[e492dcc29030f304]::run_compiler::{closure#0}>::{closure#0}, core[8ca2cc90ba3a0179]::result::Result<(), rustc_span[1f43cfd63a717c3a]::ErrorGuaranteed>>::{closure#0}, core[8ca2cc90ba3a0179]::result::Result<(), rustc_span[1f43cfd63a717c3a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8ca2cc90ba3a0179]::result::Result<(), rustc_span[1f43cfd63a717c3a]::ErrorGuaranteed>>::{closure#2} as core[8ca2cc90ba3a0179]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x712bc9aa3a1b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf04c15b7e1b40818
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/alloc/src/boxed.rs:2018:9
  38:     0x712bc9aa3a1b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6efe135dbcc64c78
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/alloc/src/boxed.rs:2018:9
  39:     0x712bc9aa3a1b - std::sys::pal::unix::thread::Thread::new::thread_start::h767b00cfb36de6f0
                               at /rustc/63f70b3d104e20289a1a0df82747066c3d85b9a1/library/std/src/sys/pal/unix/thread.rs:108:17
  40:     0x712bc32a955a - <unknown>
  41:     0x712bc3326a3c - <unknown>
  42:                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.79.0-nightly (63f70b3d1 2024-04-16) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `issue_4298::_::<impl at /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:6:25: 6:36>::deserialize::<impl at /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:6:25: 6:36>::visit_map::<impl at /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:6:25: 6:36>::deserialize`
#1 [analysis] running analysis passes on this crate
end of query stack
error[E0308]: mismatched types
  --> /tmp/icemaker_global_tempdir.H9kfgK6krgPN/rustc_testrunner_tmpdir_reporting.dGeIzKFYjQKE/mvce.rs:12:29
   |
12 |     fn func<'a, D>(_: D) -> Result<Option<Option<Cow<'a, str>>>, D::Error>
   |        ----                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result<Option<Option<...>>, ...>`, found `()`
   |        |
   |        implicitly returns `()` as its body has no tail or `return` expression
   |
   = note:   expected enum `Result<std::option::Option<std::option::Option<Cow<'a, str>>>, <D as Deserializer<'a>>::Error>`
           found unit type `()`

error: aborting due to 15 previous errors

Some errors have detailed explanations: E0282, E0308, E0392, E0601, E0658.
For more information about an error, try `rustc --explain E0282`.

@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 Apr 16, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 16, 2024
@compiler-errors compiler-errors added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Apr 16, 2024
@compiler-errors
Copy link
Member

this really needs minimization -- there's a lot going on in that test that's probably hiding the underlying cause

@matthiaskrgr
Copy link
Member Author

hmm got is as far as

extern crate serde as _serde;

fn visit_map<__A>(self) -> _serde::__private::Result<Self::Value, __A::Error> {

        match __key {
            __Field::__field0 => {
                __field0 = _serde::__private::Some({
                    struct __DeserializeWith<'de, 'a, D> {}
                    impl<'de, 'a, D> _serde::Deserialize<'de> for __DeserializeWith<'de, 'a, D> {
                        fn deserialize<__D>(
                            __deserializer: __D,
                        ) -> _serde::__private::Result<Self, __D::Error>
                        where
                            __D: _serde::Deserializer<'de>,
                        {
                            _serde::__private::Ok(__DeserializeWith {})
                        }
                    }
                });
            }
        }
    
}

@Luk-ESC
Copy link
Contributor

Luk-ESC commented Apr 16, 2024

Minimized further:

struct Type<T>;

fn visit_map() {
    {
        impl<T> Type<T> {
            fn new() -> Type<T> {
                Type
            }
        }
    };
}

@matthiaskrgr
Copy link
Member Author

Regression in nightly-2023-10-24

fetching (via remote github) commits from max(54b0434, 2023-10-21) to cd674d6
ending github query because we found starting sha: 54b0434
get_commits_between returning commits, len: 14
commit[0] 2023-10-22: Auto merge of #117000 - weihanglo:update-cargo, r=weihanglo
commit[1] 2023-10-22: Auto merge of #117062 - Kobzol:update-rustc-perf, r=Mark-Simulacrum
commit[2] 2023-10-23: Auto merge of #115324 - francorbacho:master, r=davidtwco
commit[3] 2023-10-23: Auto merge of #117066 - calebcartwright:rustfmt-sync, r=calebcartwright
commit[4] 2023-10-23: Auto merge of #116606 - ChrisDenton:empty, r=dtolnay
commit[5] 2023-10-23: Auto merge of #117071 - matthiaskrgr:rollup-1tcxdgj, r=matthiaskrgr
commit[6] 2023-10-23: Auto merge of #116849 - oli-obk:error_shenanigans, r=cjgillot
commit[7] 2023-10-23: Auto merge of #116835 - oli-obk:evaluated_static_in_metadata2, r=RalfJung
commit[8] 2023-10-23: Auto merge of #116837 - oli-obk:smir_run_macro, r=spastorino
commit[9] 2023-10-23: Auto merge of #117087 - matthiaskrgr:rollup-08kkjkz, r=matthiaskrgr
commit[10] 2023-10-23: Auto merge of #107009 - cjgillot:jump-threading, r=pnkfelix
commit[11] 2023-10-23: Auto merge of #116033 - bvanjoi:fix-116032, r=petrochenkov
commit[12] 2023-10-23: Auto merge of #117103 - matthiaskrgr:rollup-96zuuom, r=matthiaskrgr
commit[13] 2023-10-24: Auto merge of #116300 - cjgillot:split-move, r=petrochenkov
ERROR: no CI builds available between 54b0434 and cd674d6 within last 167 days

@compiler-errors
Copy link
Member

I found it

@rustbot claim

@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 17, 2024
@bors bors closed this as completed in 72ff1a3 Apr 17, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 17, 2024
Rollup merge of rust-lang#124037 - compiler-errors:dont-parent-body, r=michaelwoerister

Don't ascend into parent bodies when collecting stmts for possible return suggestion

Fixes rust-lang#124022
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-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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.
Projects
None yet
5 participants