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: body_owned_by: ... has no associated body #110157

Closed
matthiaskrgr opened this issue Apr 10, 2023 · 1 comment · Fixed by #110193
Closed

ICE: body_owned_by: ... has no associated body #110157

matthiaskrgr opened this issue Apr 10, 2023 · 1 comment · Fixed by #110193
Assignees
Labels
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.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Apr 10, 2023

Code

type NeedsDropResult<T> = Result<T, ()>;

struct NeedsDropTypes<'tcx, F> {}

impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
where
    F: Fn(&ty::AdtDef) -> NeedsDropResult<I>,
    I: Iterator<Item = Ty<'tcx>>,
{}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (696aaad58 2023-04-09)
binary: rustc
commit-hash: 696aaad58c57a589f6fb2ecff5bae2eec581cb71
commit-date: 2023-04-09
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 16.0.2

Error output

error[E0433]: failed to resolve: use of undeclared crate or module `ty`
 --> treereduce.out:8:12
  |
8 |     F: Fn(&ty::AdtDef) -> NeedsDropResult<I>,
  |            ^^ use of undeclared crate or module `ty`

error[E0412]: cannot find type `Ty` in this scope
 --> treereduce.out:9:24
  |
9 |     I: Iterator<Item = Ty<'tcx>>,
  |                        ^^ not found in this scope

error[E0601]: `main` function not found in crate `treereduce`
  --> treereduce.out:10:3
   |
10 | {}
   |   ^ consider adding a `main` function to `treereduce.out`

error[E0392]: parameter `'tcx` is never used
 --> treereduce.out:3:23
  |
3 | struct NeedsDropTypes<'tcx, F> {}
  |                       ^^^^ unused parameter
  |
  = help: consider removing `'tcx`, referring to it in a field, or using a marker such as `PhantomData`

error[E0392]: parameter `F` is never used
 --> treereduce.out:3:29
  |
3 | struct NeedsDropTypes<'tcx, F> {}
  |                             ^ unused parameter
  |
  = help: consider removing `F`, referring to it in a field, or using a marker such as `PhantomData`
  = help: if you intended `F` to be a const parameter, use `const F: usize` instead

error: internal compiler error: compiler/rustc_middle/src/hir/map/mod.rs:425:13: body_owned_by: HirId(DefId(0:8 ~ treereduce[55e2]::{impl#0}).0) (impl <NeedsDropTypes<'tcx, F> as Iterator>) has no associated body
 --> treereduce.out:6:1
  |
6 | impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/compiler/rustc_errors/src/lib.rs:995:33
stack backtrace:
   0:     0x7fbcc8c7bf0a - std::backtrace_rs::backtrace::libunwind::trace::hd26deac9c5400510
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fbcc8c7bf0a - std::backtrace_rs::backtrace::trace_unsynchronized::h0d525c5df19c5fb3
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fbcc8c7bf0a - std::sys_common::backtrace::_print_fmt::hfa46a4e5b1417412
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fbcc8c7bf0a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd35deac25c2a2361
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fbcc8cdffcf - core::fmt::write::h57692caee39fe498
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/core/src/fmt/mod.rs:1254:17
   5:     0x7fbcc8c6ea45 - std::io::Write::write_fmt::h3cf8ad4e45a4d8c5
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/io/mod.rs:1698:15
   6:     0x7fbcc8c7bcd5 - std::sys_common::backtrace::_print::hdf25b99ab69d47c1
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fbcc8c7bcd5 - std::sys_common::backtrace::print::hf7d8e454ceffbfe6
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fbcc8c7e97e - std::panicking::default_hook::{{closure}}::hd867f5f971a369e7
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/panicking.rs:269:22
   9:     0x7fbcc8c7e725 - std::panicking::default_hook::habf6eee7b304b436
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/panicking.rs:288:9
  10:     0x7fbcc7a55665 - rustc_driver_impl[2d97b4318b2b8966]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fbcc8c7f174 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h0aac6d981c9df2cb
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/alloc/src/boxed.rs:1990:9
  12:     0x7fbcc8c7f174 - std::panicking::rust_panic_with_hook::h0ae6f6705c097c51
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/panicking.rs:694:13
  13:     0x7fbcc7f75371 - std[3958f564ddc007dc]::panicking::begin_panic::<rustc_errors[ef8aac112547da06]::ExplicitBug>::{closure#0}
  14:     0x7fbcc7f74d16 - std[3958f564ddc007dc]::sys_common::backtrace::__rust_end_short_backtrace::<std[3958f564ddc007dc]::panicking::begin_panic<rustc_errors[ef8aac112547da06]::ExplicitBug>::{closure#0}, !>
  15:     0x7fbcc7fa5d46 - std[3958f564ddc007dc]::panicking::begin_panic::<rustc_errors[ef8aac112547da06]::ExplicitBug>
  16:     0x7fbcc80008d2 - <rustc_errors[ef8aac112547da06]::HandlerInner>::span_bug::<rustc_span[24111c70308d7d50]::span_encoding::Span, &alloc[3819410e73c92c1b]::string::String>
  17:     0x7fbcc80006f7 - <rustc_errors[ef8aac112547da06]::Handler>::span_bug::<rustc_span[24111c70308d7d50]::span_encoding::Span, &alloc[3819410e73c92c1b]::string::String>
  18:     0x7fbcc7fc663b - rustc_middle[9ae9af9eb73fc3b1]::util::bug::opt_span_bug_fmt::<rustc_span[24111c70308d7d50]::span_encoding::Span>::{closure#0}
  19:     0x7fbcc7fc31ba - rustc_middle[9ae9af9eb73fc3b1]::ty::context::tls::with_opt::<rustc_middle[9ae9af9eb73fc3b1]::util::bug::opt_span_bug_fmt<rustc_span[24111c70308d7d50]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7fbcc7fc3186 - rustc_middle[9ae9af9eb73fc3b1]::ty::context::tls::with_context_opt::<rustc_middle[9ae9af9eb73fc3b1]::ty::context::tls::with_opt<rustc_middle[9ae9af9eb73fc3b1]::util::bug::opt_span_bug_fmt<rustc_span[24111c70308d7d50]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7fbcc7fc6576 - rustc_middle[9ae9af9eb73fc3b1]::util::bug::opt_span_bug_fmt::<rustc_span[24111c70308d7d50]::span_encoding::Span>
  22:     0x7fbcc63bbae4 - rustc_middle[9ae9af9eb73fc3b1]::util::bug::span_bug_fmt::<rustc_span[24111c70308d7d50]::span_encoding::Span>
  23:     0x7fbcc63b964e - <rustc_middle[9ae9af9eb73fc3b1]::hir::map::Map>::body_owned_by
  24:     0x7fbcc8738eb2 - <rustc_infer[37e422eb914efaf5]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[726c9a7f6e25929]::traits::error_reporting::InferCtxtPrivExt>::maybe_report_ambiguity
  25:     0x7fbcc872c05b - <rustc_infer[37e422eb914efaf5]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[726c9a7f6e25929]::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors
  26:     0x7fbcc67dbbee - rustc_hir_analysis[2fa568bcc53e911e]::check::wfcheck::check_well_formed
  27:     0x7fbcc5f749ce - rustc_query_system[f15f440fadbc0dc2]::query::plumbing::try_execute_query::<rustc_query_impl[ed927665e84058ad]::queries::check_well_formed, rustc_query_impl[ed927665e84058ad]::plumbing::QueryCtxt>
  28:     0x7fbcc6c9fe57 - rustc_data_structures[6c5f262034998aae]::sync::par_for_each_in::<&[rustc_hir[1fa94aaa058a1f1a]::hir::ImplItemId], <rustc_middle[9ae9af9eb73fc3b1]::hir::ModuleItems>::par_impl_items<rustc_hir_analysis[2fa568bcc53e911e]::check::wfcheck::check_mod_type_wf::{closure#1}>::{closure#0}>
  29:     0x7fbcc6c9f914 - rustc_hir_analysis[2fa568bcc53e911e]::check::wfcheck::check_mod_type_wf
  30:     0x7fbcc707d231 - rustc_query_system[f15f440fadbc0dc2]::query::plumbing::try_execute_query::<rustc_query_impl[ed927665e84058ad]::queries::check_mod_type_wf, rustc_query_impl[ed927665e84058ad]::plumbing::QueryCtxt>
  31:     0x7fbcc707cdd9 - <rustc_query_impl[ed927665e84058ad]::Queries as rustc_middle[9ae9af9eb73fc3b1]::ty::query::QueryEngine>::check_mod_type_wf
  32:     0x7fbcc6f25c37 - rustc_data_structures[6c5f262034998aae]::sync::par_for_each_in::<&[rustc_hir[1fa94aaa058a1f1a]::hir_id::OwnerId], <rustc_middle[9ae9af9eb73fc3b1]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[2fa568bcc53e911e]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
  33:     0x7fbcc6f259f0 - <rustc_session[ca8de67c023859ee]::session::Session>::track_errors::<rustc_hir_analysis[2fa568bcc53e911e]::check_crate::{closure#5}, ()>
  34:     0x7fbcc6f2301f - rustc_hir_analysis[2fa568bcc53e911e]::check_crate
  35:     0x7fbcc6f1d4a1 - rustc_interface[5859b4daf695f246]::passes::analysis
  36:     0x7fbcc71a50c2 - rustc_query_system[f15f440fadbc0dc2]::query::plumbing::try_execute_query::<rustc_query_impl[ed927665e84058ad]::queries::analysis, rustc_query_impl[ed927665e84058ad]::plumbing::QueryCtxt>
  37:     0x7fbcc71a4dd0 - <rustc_query_impl[ed927665e84058ad]::Queries as rustc_middle[9ae9af9eb73fc3b1]::ty::query::QueryEngine>::analysis
  38:     0x7fbcc70d6db6 - <std[3958f564ddc007dc]::thread::local::LocalKey<core[df85f84a2bdb4263]::cell::Cell<*const ()>>>::with::<rustc_middle[9ae9af9eb73fc3b1]::ty::context::tls::enter_context<<rustc_middle[9ae9af9eb73fc3b1]::ty::context::GlobalCtxt>::enter<rustc_driver_impl[2d97b4318b2b8966]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>
  39:     0x7fbcc6ce27ef - <rustc_interface[5859b4daf695f246]::interface::Compiler>::enter::<rustc_driver_impl[2d97b4318b2b8966]::run_compiler::{closure#1}::{closure#2}, core[df85f84a2bdb4263]::result::Result<core[df85f84a2bdb4263]::option::Option<rustc_interface[5859b4daf695f246]::queries::Linker>, rustc_span[24111c70308d7d50]::ErrorGuaranteed>>
  40:     0x7fbcc6cdda41 - rustc_span[24111c70308d7d50]::set_source_map::<core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>, rustc_interface[5859b4daf695f246]::interface::run_compiler<core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>, rustc_driver_impl[2d97b4318b2b8966]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  41:     0x7fbcc6cdd586 - <scoped_tls[5f4f1a448a290364]::ScopedKey<rustc_span[24111c70308d7d50]::SessionGlobals>>::set::<rustc_interface[5859b4daf695f246]::interface::run_compiler<core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>, rustc_driver_impl[2d97b4318b2b8966]::run_compiler::{closure#1}>::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>
  42:     0x7fbcc6cdcc5b - std[3958f564ddc007dc]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5859b4daf695f246]::util::run_in_thread_pool_with_globals<rustc_interface[5859b4daf695f246]::interface::run_compiler<core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>, rustc_driver_impl[2d97b4318b2b8966]::run_compiler::{closure#1}>::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>
  43:     0x7fbcc7320db1 - <<std[3958f564ddc007dc]::thread::Builder>::spawn_unchecked_<rustc_interface[5859b4daf695f246]::util::run_in_thread_pool_with_globals<rustc_interface[5859b4daf695f246]::interface::run_compiler<core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>, rustc_driver_impl[2d97b4318b2b8966]::run_compiler::{closure#1}>::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[df85f84a2bdb4263]::result::Result<(), rustc_span[24111c70308d7d50]::ErrorGuaranteed>>::{closure#1} as core[df85f84a2bdb4263]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7fbcc8c89255 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h40268ec1e3f75121
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/alloc/src/boxed.rs:1976:9
  45:     0x7fbcc8c89255 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb4cdee1772a16528
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/alloc/src/boxed.rs:1976:9
  46:     0x7fbcc8c89255 - std::sys::unix::thread::Thread::new::thread_start::h71a921bd46112f49
                               at /rustc/696aaad58c57a589f6fb2ecff5bae2eec581cb71/library/std/src/sys/unix/thread.rs:108:17
  47:     0x7fbcc465cbb5 - <unknown>
  48:     0x7fbcc46ded90 - <unknown>
  49:                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: rustc 1.70.0-nightly (696aaad58 2023-04-09) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_well_formed] checking that `<impl at treereduce.out:6:1: 6:54>` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors

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

@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 10, 2023
@compiler-errors compiler-errors added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Apr 10, 2023
@Ezrashaw
Copy link
Contributor

Ezrashaw commented Apr 11, 2023

Suspect #108879 Correction: #108960 (fd34549) (cc @compiler-errors). I'd like to work on this but I'm not sure I'll be able to figure it out.


searched nightlies: from nightly-2022-06-01 to nightly-2023-04-11
regressed nightly: nightly-2023-03-11
searched commit range: 39f2657...ff4b772
regressed commit: 35a0961

bisected with cargo-bisect-rustc v0.6.6

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

cargo bisect-rustc --regress=ice --start=2022-06-01

@compiler-errors compiler-errors self-assigned this Apr 11, 2023
@matthiaskrgr matthiaskrgr removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Apr 11, 2023
@bors bors closed this as completed in 232eb69 Apr 13, 2023
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) ❄️ 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