rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.81k stars 12.5k forks source link

[typeck] type-checking `endpoint_docs::bodies::get_all_rest_call_bodies` #110582

Open matiu2 opened 1 year ago

matiu2 commented 1 year ago

Code

https://github.com/matiu2/oanda_converter/blob/compiler_crash/web_scraper/src/endpoint_docs/bodies.rs#L24

Meta

rustc --version --verbose:

rustc 1.68.2 (9eb3afe9e 2023-03-27)
binary: rustc
commit-hash: 9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0
commit-date: 2023-03-27
host: x86_64-unknown-linux-gnu
release: 1.68.2
LLVM version: 15.0.6```

### Error output
Checking web_scraper v0.1.0 (/home/matt/projects/oanda_generator/web_scraper)

error: internal compiler error: compiler/rustc_infer/src/infer/region_constraints/mod.rs:568:17: cannot relate bound region: ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:504 ~ web_scraper[ad61]::endpoint_docs::bodies::get_rest_callparameters::'#1), ') }) <= '#24r

thread 'rustc' panicked at 'Box', /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/compiler/rustc_errors/src/lib.rs:987:33 stack backtrace: 0: 0x7fc65d7ad59a - std::backtrace_rs::backtrace::libunwind::trace::ha271a8a7e1f3d4ef at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7fc65d7ad59a - std::backtrace_rs::backtrace::trace_unsynchronized::h85739da0352c791a at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7fc65d7ad59a - std::sys_common::backtrace::_print_fmt::hbc6ebcfb2910b329 at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys_common/backtrace.rs:65:5 3: 0x7fc65d7ad59a - ::fmt::he1c117e52d53614f at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7fc65d80f39e - core::fmt::write::h25eb51b9526b8e0c at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/fmt/mod.rs:1213:17 5: 0x7fc65d79dbe5 - std::io::Write::write_fmt::ha9edec5fb1621933 at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/io/mod.rs:1682:15 6: 0x7fc65d7ad365 - std::sys_common::backtrace::_print::hf8657cd429fc3452 at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys_common/backtrace.rs:47:5 7: 0x7fc65d7ad365 - std::sys_common::backtrace::print::h41b9b18ed86f86bd at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys_common/backtrace.rs:34:9 8: 0x7fc65d7b012f - std::panicking::default_hook::{{closure}}::h22a91871f4454152 at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:267:22 9: 0x7fc65d7afe6b - std::panicking::default_hook::h21ddc36de0cd4ae7 at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:286:9 10: 0x7fc660b00324 - rustc_driver[70f63b52fde826b7]::DEFAULT_HOOK::{closure#0}::{closure#0} 11: 0x7fc65d7b096a - <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call::h6f7e3c94ecc52e2f at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/alloc/src/boxed.rs:2002:9 12: 0x7fc65d7b096a - std::panicking::rust_panic_with_hook::h5059419d6d59b3d0 at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:692:13 13: 0x7fc660dbbf81 - std[f8b79e573431a86c]::panicking::begin_panic::<rustc_errors[53e74ce803854a4d]::ExplicitBug>::{closure#0} 14: 0x7fc660db48d6 - std[f8b79e573431a86c]::sys_common::backtrace::__rust_end_short_backtrace::<std[f8b79e573431a86c]::panicking::begin_panic<rustc_errors[53e74ce803854a4d]::ExplicitBug>::{closure#0}, !> 15: 0x7fc660e44da6 - std[f8b79e573431a86c]::panicking::begin_panic::<rustc_errors[53e74ce803854a4d]::ExplicitBug> 16: 0x7fc660e44d96 - std[f8b79e573431a86c]::panic::panic_any::<rustc_errors[53e74ce803854a4d]::ExplicitBug> 17: 0x7fc660e436c2 - <rustc_errors[53e74ce803854a4d]::HandlerInner>::span_bug::<rustc_span[7c23fb27ec020b97]::span_encoding::Span, &alloc[b346c7f99e9347e5]::string::String> 18: 0x7fc660e43567 - <rustc_errors[53e74ce803854a4d]::Handler>::span_bug::<rustc_span[7c23fb27ec020b97]::span_encoding::Span, &alloc[b346c7f99e9347e5]::string::String> 19: 0x7fc660df8acb - rustc_middle[6dfce017f6b7786d]::util::bug::opt_span_bug_fmt::<rustc_span[7c23fb27ec020b97]::span_encoding::Span>::{closure#0} 20: 0x7fc660df8b1a - rustc_middle[6dfce017f6b7786d]::ty::context::tls::with_opt::<rustc_middle[6dfce017f6b7786d]::util::bug::opt_span_bug_fmt<rustc_span[7c23fb27ec020b97]::span_encoding::Span>::{closure#0}, !>::{closure#0} 21: 0x7fc660df7bda - rustc_middle[6dfce017f6b7786d]::ty::context::tls::with_context_opt::<rustc_middle[6dfce017f6b7786d]::ty::context::tls::with_opt<rustc_middle[6dfce017f6b7786d]::util::bug::opt_span_bug_fmt<rustc_span[7c23fb27ec020b97]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !> 22: 0x7fc660df7b06 - rustc_middle[6dfce017f6b7786d]::util::bug::opt_span_bug_fmt::<rustc_span[7c23fb27ec020b97]::span_encoding::Span> 23: 0x7fc660df7ac4 - rustc_middle[6dfce017f6b7786d]::util::bug::span_bug_fmt::<rustc_span[7c23fb27ec020b97]::span_encoding::Span> 24: 0x7fc65ea8b604 - <rustc_middle[6dfce017f6b7786d]::ty::sty::Region as rustc_middle[6dfce017f6b7786d]::ty::relate::Relate>::relate::<rustc_infer[83c7bda8c7ffae41]::infer::equate::Equate> 25: 0x7fc65ea868bf - rustc_middle[6dfce017f6b7786d]::ty::relate::super_relate_tys::<rustc_infer[83c7bda8c7ffae41]::infer::equate::Equate> 26: 0x7fc65ea838be - <rustc_infer[83c7bda8c7ffae41]::infer::equate::Equate as rustc_middle[6dfce017f6b7786d]::ty::relate::TypeRelation>::tys 27: 0x7fc65f315db3 - <rustc_infer[83c7bda8c7ffae41]::infer::InferCtxt>::commit_if_ok::<rustc_infer[83c7bda8c7ffae41]::infer::InferOk<()>, rustc_middle[6dfce017f6b7786d]::ty::error::TypeError, <rustc_infer[83c7bda8c7ffae41]::infer::at::Trace>::eq<rustc_middle[6dfce017f6b7786d]::ty::Ty>::{closure#0}> 28: 0x7fc65f315ca6 - <rustc_infer[83c7bda8c7ffae41]::infer::at::At>::eq::<rustc_middle[6dfce017f6b7786d]::ty::Ty> 29: 0x7fc6616de39e - <rustc_infer[83c7bda8c7ffae41]::infer::InferCtxt>::can_eq::<rustc_middle[6dfce017f6b7786d]::ty::Ty> 30: 0x7fc6616c11d2 - rustc_trait_selection[d385e741675330b5]::traits::error_reporting::suggestions::hint_missing_borrow 31: 0x7fc661764934 - <rustc_infer[83c7bda8c7ffae41]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[d385e741675330b5]::traits::error_reporting::suggestions::TypeErrCtxtExt>::report_closure_arg_mismatch 32: 0x7fc661774788 - <rustc_infer[83c7bda8c7ffae41]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[d385e741675330b5]::traits::error_reporting::TypeErrCtxtExt>::report_selection_error 33: 0x7fc66177e167 - <rustc_infer[83c7bda8c7ffae41]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[d385e741675330b5]::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error 34: 0x7fc6617717cf - <rustc_infer[83c7bda8c7ffae41]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[d385e741675330b5]::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors 35: 0x7fc65ed07535 - <rustc_hir_typeck[698e9809084ff9ec]::fn_ctxt::FnCtxt>::check_argument_types 36: 0x7fc65ec8ea92 - <rustc_hir_typeck[698e9809084ff9ec]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 37: 0x7fc65ec8cd87 - <rustc_hir_typeck[698e9809084ff9ec]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 38: 0x7fc65ed0290d - <rustc_hir_typeck[698e9809084ff9ec]::fn_ctxt::FnCtxt>::check_argument_types 39: 0x7fc65fe0e98b - <rustc_hir_typeck[698e9809084ff9ec]::fn_ctxt::FnCtxt>::check_call 40: 0x7fc65ec8c8b2 - <rustc_hir_typeck[698e9809084ff9ec]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 41: 0x7fc65ecf35cf - <rustc_hir_typeck[698e9809084ff9ec]::fn_ctxt::FnCtxt>::check_match::{closure#0} 42: 0x7fc65ec8ed6e - <rustc_hir_typeck[698e9809084ff9ec]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 43: 0x7fc65ecc566e - <rustc_hir_typeck[698e9809084ff9ec]::fn_ctxt::FnCtxt>::check_decl 44: 0x7fc65ecc2773 - <rustc_hir_typeck[698e9809084ff9ec]::fn_ctxt::FnCtxt>::check_block_with_expected 45: 0x7fc65ec8cd3c - <rustc_hir_typeck[698e9809084ff9ec]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 46: 0x7fc65ec278d1 - <rustc_hir_typeck[698e9809084ff9ec]::fn_ctxt::FnCtxt>::check_return_expr 47: 0x7fc65ec1e802 - rustc_hir_typeck[698e9809084ff9ec]::check::check_fn 48: 0x7fc65ec070be - rustc_hir_typeck[698e9809084ff9ec]::typeck 49: 0x7fc65ebf8797 - <rustc_query_system[59807289ca97d521]::dep_graph::graph::DepGraph<rustc_middle[6dfce017f6b7786d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[6dfce017f6b7786d]::ty::context::TyCtxt, rustc_span[7c23fb27ec020b97]::def_id::LocalDefId, &rustc_middle[6dfce017f6b7786d]::ty::typeck_results::TypeckResults> 50: 0x7fc65ebf02eb - rustc_query_system[59807289ca97d521]::query::plumbing::try_execute_query::<rustc_query_impl[81153385010d7886]::queries::typeck, rustc_query_impl[81153385010d7886]::plumbing::QueryCtxt> 51: 0x7fc66025d3cd - rustc_data_structures[560608da72c35763]::sync::par_for_each_in::<&[rustc_span[7c23fb27ec020b97]::def_id::LocalDefId], <rustc_middle[6dfce017f6b7786d]::hir::map::Map>::par_body_owners<rustc_hir_typeck[698e9809084ff9ec]::typeck_item_bodies::{closure#0}>::{closure#0}> 52: 0x7fc66025d173 - rustc_hir_typeck[698e9809084ff9ec]::typeck_item_bodies 53: 0x7fc6602771d7 - <rustc_query_system[59807289ca97d521]::dep_graph::graph::DepGraph<rustc_middle[6dfce017f6b7786d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[6dfce017f6b7786d]::ty::context::TyCtxt, (), ()> 54: 0x7fc660080c26 - rustc_query_system[59807289ca97d521]::query::plumbing::try_execute_query::<rustc_query_impl[81153385010d7886]::queries::typeck_item_bodies, rustc_query_impl[81153385010d7886]::plumbing::QueryCtxt> 55: 0x7fc6604b8d5b - <rustc_query_impl[81153385010d7886]::Queries as rustc_middle[6dfce017f6b7786d]::ty::query::QueryEngine>::typeck_item_bodies 56: 0x7fc65ef95ee2 - <rustc_session[cd7c78827427c6d6]::session::Session>::time::<(), rustc_hir_analysis[651175ae4d1746c1]::check_crate::{closure#7}> 57: 0x7fc65ef95352 - rustc_hir_analysis[651175ae4d1746c1]::check_crate 58: 0x7fc65ef94fab - rustc_interface[698bad460dbd68d3]::passes::analysis 59: 0x7fc66022bf76 - <rustc_query_system[59807289ca97d521]::dep_graph::graph::DepGraph<rustc_middle[6dfce017f6b7786d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[6dfce017f6b7786d]::ty::context::TyCtxt, (), core[1d432356d8e1e9f1]::result::Result<(), rustc_errors[53e74ce803854a4d]::ErrorGuaranteed>> 60: 0x7fc66022b131 - rustc_query_system[59807289ca97d521]::query::plumbing::try_execute_query::<rustc_query_impl[81153385010d7886]::queries::analysis, rustc_query_impl[81153385010d7886]::plumbing::QueryCtxt> 61: 0x7fc6604b560a - <rustc_query_impl[81153385010d7886]::Queries as rustc_middle[6dfce017f6b7786d]::ty::query::QueryEngine>::analysis 62: 0x7fc65fce1010 - <rustc_interface[698bad460dbd68d3]::passes::QueryContext>::enter::<rustc_driver[70f63b52fde826b7]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[1d432356d8e1e9f1]::result::Result<(), rustc_errors[53e74ce803854a4d]::ErrorGuaranteed>> 63: 0x7fc65fcdea84 - rustc_span[7c23fb27ec020b97]::with_source_map::<core[1d432356d8e1e9f1]::result::Result<(), rustc_errors[53e74ce803854a4d]::ErrorGuaranteed>, rustc_interface[698bad460dbd68d3]::interface::run_compiler<core[1d432356d8e1e9f1]::result::Result<(), rustc_errors[53e74ce803854a4d]::ErrorGuaranteed>, rustc_driver[70f63b52fde826b7]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 64: 0x7fc65fcd72d4 - <scoped_tls[1044df3f3db9be03]::ScopedKey<rustc_span[7c23fb27ec020b97]::SessionGlobals>>::set::<rustc_interface[698bad460dbd68d3]::interface::run_compiler<core[1d432356d8e1e9f1]::result::Result<(), rustc_errors[53e74ce803854a4d]::ErrorGuaranteed>, rustc_driver[70f63b52fde826b7]::run_compiler::{closure#1}>::{closure#0}, core[1d432356d8e1e9f1]::result::Result<(), rustc_errors[53e74ce803854a4d]::ErrorGuaranteed>> 65: 0x7fc65fcd69d2 - std[f8b79e573431a86c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[698bad460dbd68d3]::util::run_in_thread_pool_with_globals<rustc_interface[698bad460dbd68d3]::interface::run_compiler<core[1d432356d8e1e9f1]::result::Result<(), rustc_errors[53e74ce803854a4d]::ErrorGuaranteed>, rustc_driver[70f63b52fde826b7]::run_compiler::{closure#1}>::{closure#0}, core[1d432356d8e1e9f1]::result::Result<(), rustc_errors[53e74ce803854a4d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1d432356d8e1e9f1]::result::Result<(), rustc_errors[53e74ce803854a4d]::ErrorGuaranteed>> 66: 0x7fc65fcd677a - <<std[f8b79e573431a86c]::thread::Builder>::spawnunchecked<rustc_interface[698bad460dbd68d3]::util::run_in_thread_pool_with_globals<rustc_interface[698bad460dbd68d3]::interface::run_compiler<core[1d432356d8e1e9f1]::result::Result<(), rustc_errors[53e74ce803854a4d]::ErrorGuaranteed>, rustc_driver[70f63b52fde826b7]::run_compiler::{closure#1}>::{closure#0}, core[1d432356d8e1e9f1]::result::Result<(), rustc_errors[53e74ce803854a4d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1d432356d8e1e9f1]::result::Result<(), rustc_errors[53e74ce803854a4d]::ErrorGuaranteed>>::{closure#1} as core[1d432356d8e1e9f1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 67: 0x7fc65d7ba823 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once::h3205ec2d7fc232c5 at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/alloc/src/boxed.rs:1988:9 68: 0x7fc65d7ba823 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once::h3bb5daec8177f56b at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/alloc/src/boxed.rs:1988:9 69: 0x7fc65d7ba823 - std::sys::unix::thread::Thread::new::thread_start::had7b8061e306bb5c at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys/unix/thread.rs:108:17 70: 0x7fc65d668609 - start_thread at /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 71: 0x7fc65d58b133 - clone at /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 72: 0x0 -

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%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.68.2 (9eb3afe9e 2023-03-27) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C incremental=[REDACTED] -C link-arg=-fuse-ld=/usr/local/bin/mold

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

query stack during panic:

0 [typeck] type-checking endpoint_docs::bodies::get_all_rest_call_bodies

1 [typeck_item_bodies] type-checking all item bodies

2 [analysis] running analysis passes on this crate

end of query stack error: could not compile web_scraper


<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

Compiling web_scraper v0.1.0 (/home/matt/projects/oanda_generator/web_scraper) error: internal compiler error: compiler/rustc_infer/src/infer/region_constraints/mod.rs:568:17: cannot relate bound region: ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:504 ~ web_scraper[7780]::endpoint_docs::bodies::get_rest_callparameters::'#1), ') }) <= '#24r

thread 'rustc' panicked at 'Box', /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/compiler/rustc_errors/src/lib.rs:987:33 stack backtrace: 0: std::panicking::begin_panic:: 1: std::panic::panic_any:: 2: ::span_bug::<rustc_span::span_encoding::Span, &alloc::string::String> 3: ::span_bug::<rustc_span::span_encoding::Span, &alloc::string::String> 4: rustc_middle::util::bug::opt_span_bug_fmt::::{closure#0} 5: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt::{closure#0}, !>::{closure#0} 6: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt::{closure#0}, !>::{closure#0}, !> 7: rustc_middle::util::bug::opt_span_bug_fmt:: 8: rustc_middle::util::bug::span_bug_fmt:: 9: ::relate:: 10: rustc_middle::ty::relate::super_relate_tys:: 11: ::tys 12: ::commit_if_ok::<rustc_infer::infer::InferOk<()>, rustc_middle::ty::error::TypeError, ::eq::{closure#0}> 13: ::eq:: 14: ::can_eq:: 15: rustc_trait_selection::traits::error_reporting::suggestions::hint_missing_borrow 16: ::report_closure_arg_mismatch 17: ::report_selection_error 18: ::report_fulfillment_error 19: ::report_fulfillment_errors 20: ::check_argument_types 21: ::check_expr_with_expectation_and_args 22: ::check_expr_with_expectation_and_args 23: ::check_argument_types 24: ::check_call 25: ::check_expr_with_expectation_and_args 26: ::check_match::{closure#0} 27: ::check_expr_with_expectation_and_args 28: ::check_decl 29: ::check_block_with_expected 30: ::check_expr_with_expectation_and_args 31: ::check_return_expr 32: rustc_hir_typeck::check::check_fn 33: rustc_hir_typeck::typeck 34: <rustc_query_system::dep_graph::graph::DepGraph>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::typeck_results::TypeckResults> 35: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt> 36: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], ::par_body_owners<rustc_hir_typeck::typeck_item_bodies::{closure#0}>::{closure#0}> 37: rustc_hir_typeck::typeck_item_bodies 38: <rustc_query_system::dep_graph::graph::DepGraph>::with_task::<rustc_middle::ty::context::TyCtxt, (), ()> 39: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt> 40: ::typeck_item_bodies 41: ::time::<(), rustc_hir_analysis::check_crate::{closure#7}> 42: rustc_hir_analysis::check_crate 43: rustc_interface::passes::analysis 44: <rustc_query_system::dep_graph::graph::DepGraph>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>> 45: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt> 46: ::analysis 47: ::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#2}, core::result::Result<(), rustc_errors::ErrorGuaranteed>> 48: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 49: <scoped_tls::ScopedKey>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>> note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

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%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.68.2 (9eb3afe9e 2023-03-27) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C incremental=[REDACTED] -C link-arg=-fuse-ld=/usr/local/bin/mold

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

query stack during panic:

0 [typeck] type-checking endpoint_docs::bodies::get_all_rest_call_bodies

1 [typeck_item_bodies] type-checking all item bodies

2 [analysis] running analysis passes on this crate

end of query stack error: could not compile web_scraper warning: build failed, waiting for other jobs to finish...



</p>
</details>
matiu2 commented 1 year ago

If I comment out these three lines, the error goes away: https://github.com/matiu2/oanda_converter/blob/compiler_crash/web_scraper/src/endpoint_docs/bodies.rs#L31

Also if I apply an & to the body parameter in line 43: https://github.com/matiu2/oanda_converter/blob/compiler_crash/web_scraper/src/endpoint_docs/bodies.rs#L43

Nightly version:

❯ rustc --version --verbose
rustc 1.71.0-nightly (39c6804b9 2023-04-19)
binary: rustc
commit-hash: 39c6804b92aa202369e402525cee329556bc1db0
commit-date: 2023-04-19
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

With nightly I get some more info and it doesn't crash anymore:

error[E0631]: type mismatch in function arguments
   --> web_scraper/src/endpoint_docs/bodies.rs:31:14
    |
31  |         .map(get_rest_call_parameters)
    |          --- ^^^^^^^^^^^^^^^^^^^^^^^^ expected due to this
    |          |
    |          required by a bound introduced by this call
...
43  | pub(crate) fn get_rest_call_parameters(body: ElementRef) -> Result<Vec<RestCallParameter>> {
    | ------------------------------------------------------------------------------------------ found signature defined here
    |
    = note: expected function signature `fn(&ElementRef<'_>) -> _`
               found function signature `for<'a> fn(ElementRef<'a>) -> _`
note: required by a bound in `map`
   --> /home/matt/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:803:12
    |
803 |         F: FnMut(Self::Item) -> B,
    |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::map`
help: consider borrowing the argument
    |
43  | pub(crate) fn get_rest_call_parameters(body: &ElementRef) -> Result<Vec<RestCallParameter>> {
    |                                              +

error[E0599]: the method `collect` exists for struct `Map<Iter<'_, ElementRef<'_>>, fn(ElementRef<'a>) -> Result<Vec<RestCallParameter>, Report<Error>> {get_rest_call_parameters}>`, but its trait bounds were not satisfied
  --> web_scraper/src/endpoint_docs/bodies.rs:32:10
   |
29 |       let all_parameters = bodies
   |  __________________________-
30 | |         .iter()
31 | |         .map(get_rest_call_parameters)
32 | |         .collect::<Result<Vec<Vec<RestCallParameter>>>>()?;
   | |         -^^^^^^^ method cannot be called due to unsatisfied trait bounds
   | |_________|
   |
   |
  ::: /home/matt/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:61:1
   |
61 |   pub struct Map<I, F> {
   |   -------------------- doesn't satisfy `_: Iterator`
   |
   = note: the full type name has been written to '/home/matt/projects/oanda_generator/target/debug/deps/web_scraper-64fa5fcf61b24b32.long-type-12607946688287355720.txt'
   = note: the following trait bounds were not satisfied:
           `<for<'a> fn(ElementRef<'a>) -> std::result::Result<Vec<RestCallParameter>, error_stack::Report<error::Error>> {get_rest_call_parameters} as FnOnce<(&ElementRef<'_>,)>>::Output = _`
           which is required by `Map<std::slice::Iter<'_, ElementRef<'_>>, for<'a> fn(ElementRef<'a>) -> std::result::Result<Vec<RestCallParameter>, error_stack::Report<error::Error>> {get_rest_call_parameters}>: Iterator`
           `for<'a> fn(ElementRef<'a>) -> std::result::Result<Vec<RestCallParameter>, error_stack::Report<error::Error>> {get_rest_call_parameters}: FnMut<(&ElementRef<'_>,)>`
           which is required by `Map<std::slice::Iter<'_, ElementRef<'_>>, for<'a> fn(ElementRef<'a>) -> std::result::Result<Vec<RestCallParameter>, error_stack::Report<error::Error>> {get_rest_call_parameters}>: Iterator`
           `Map<std::slice::Iter<'_, ElementRef<'_>>, for<'a> fn(ElementRef<'a>) -> std::result::Result<Vec<RestCallParameter>, error_stack::Report<error::Error>> {get_rest_call_parameters}>: Iterator`
           which is required by `&mut Map<std::slice::Iter<'_, ElementRef<'_>>, for<'a> fn(ElementRef<'a>) -> std::result::Result<Vec<RestCallParameter>, error_stack::Report<error::Error>> {get_rest_call_parameters}>: Iterator`

Some errors have detailed explanations: E0599, E0631.
For more information about an error, try `rustc --explain E0599`.
error: could not compile `web_scraper` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...