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

Clippy ICE due to async gen block support #11965

Closed
P1n3appl3 opened this issue Dec 15, 2023 · 8 comments
Closed

Clippy ICE due to async gen block support #11965

P1n3appl3 opened this issue Dec 15, 2023 · 8 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@P1n3appl3
Copy link

Fuchsia's CI has picked up an ICE in clippy (that doesn't happen in rustc when run on the same code). It appeared when rust-lang/rust#118420 landed and I've confirmed that it consistently reproduces after that commit and doesn't happen before it.

We're still working on pulling out a minimal reproducer (here's the code it fails on) and either I or @tmandry will add that as a followup once we've got it.

Meta

rustc --version --verbose:

rustc 1.76.0-nightly (f967532a4 2023-12-08)
binary: rustc
commit-hash: f967532a47eb728ada44473a5c4c2eca1a45fe30
commit-date: 2023-12-08
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.5

clippy-driver --version:

clippy 0.1.76 (f967532a47e 2023-12-08)

Error output

thread 'rustc' panicked at compiler/rustc_infer/src/infer/at.rs:453:17:
`<impl futures::Future<Output = std::result::Result<(), anyhow::Error>> as std::future::IntoFuture>` has escaping bound vars, so it cannot be wrapped in a dummy binder.
Backtrace

thread 'rustc' panicked at compiler/rustc_infer/src/infer/at.rs:453:17:
`<impl futures::Future<Output = std::result::Result<(), anyhow::Error>> as std::future::IntoFuture>` has escaping bound vars, so it cannot be wrapped in a dummy binder.
stack backtrace:
   0:     0x7efd79b8407c - std::backtrace_rs::backtrace::libunwind::trace::hf094a8cb04ffe7ab
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7efd79b8407c - std::backtrace_rs::backtrace::trace_unsynchronized::h636c09fb98db1a35
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7efd79b8407c - std::sys_common::backtrace::_print_fmt::h1eada59befc0fcfd
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7efd79b8407c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4e01ec961f23fdc9
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7efd79bddf10 - core::fmt::rt::Argument::fmt::ha10887a36292f35e
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/core/src/fmt/rt.rs:142:9
   5:     0x7efd79bddf10 - core::fmt::write::hbee07cdecf385aa8
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/core/src/fmt/mod.rs:1120:17
   6:     0x7efd79b77b9d - std::io::Write::write_fmt::h04aec15ab1f7c8bf
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/io/mod.rs:1810:15
   7:     0x7efd79b83e64 - std::sys_common::backtrace::_print::hef7dadde3c7c991b
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7efd79b83e64 - std::sys_common::backtrace::print::hfc706a679f1cb22d
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7efd79b86b47 - std::panicking::default_hook::{{closure}}::h6f2fb643790d779b
  10:     0x7efd79b868af - std::panicking::default_hook::h31d54eb9a87975c1
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/panicking.rs:292:9
  11:     0x7efd7c9359e8 - std[8e4e87a28c8e62a9]::panicking::update_hook::<alloc[c6438ab7a80186a6]::boxed::Box<rustc_driver_impl[ba9e648a54e14925]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7efd79b872b0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h71209ca141e025a7
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/alloc/src/boxed.rs:2029:9
  13:     0x7efd79b872b0 - std::panicking::rust_panic_with_hook::h437f058ecb25b82b
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/panicking.rs:783:13
  14:     0x7efd79b86fde - std::panicking::begin_panic_handler::{{closure}}::ha4b5f1c9147f1986
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/panicking.rs:657:13
  15:     0x7efd79b84546 - std::sys_common::backtrace::__rust_end_short_backtrace::hc38ecdd5f148e9db
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7efd79b86d42 - rust_begin_unwind
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/panicking.rs:645:5
  17:     0x7efd79bda5b5 - core::panicking::panic_fmt::hfaf949eaaf4decf4
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/core/src/panicking.rs:72:14
  18:     0x7efd80b5cb79 - <rustc_middle[99b5bdc542dd2f83]::ty::sty::TraitRef as rustc_infer[c4a55945a2525b]::infer::at::ToTrace>::to_trace
  19:     0x7efd809e9550 - <rustc_infer[c4a55945a2525b]::infer::at::At>::eq::<rustc_middle[99b5bdc542dd2f83]::ty::sty::TraitRef>
  20:     0x7efd808295e2 - <rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::match_impl
  21:     0x7efd809e2702 - <rustc_infer[c4a55945a2525b]::infer::InferCtxt>::probe::<(), <rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::assemble_candidates_from_impls::{closure#0}::{closure#0}>
  22:     0x7efd8092f69e - <rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::assemble_candidates_from_impls::{closure#0}
  23:     0x7efd8090df80 - <rustc_middle[99b5bdc542dd2f83]::ty::context::TyCtxt>::for_each_relevant_impl_treating_projections::<<rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::assemble_candidates_from_impls::{closure#0}>
  24:     0x7efd8081b37b - <rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::assemble_candidates_from_impls
  25:     0x7efd8081aea8 - <rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::assemble_candidates
  26:     0x7efd80816218 - <rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::in_task::<<rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}::{closure#0}, core[f375a3a92198feb1]::result::Result<core[f375a3a92198feb1]::option::Option<rustc_middle[99b5bdc542dd2f83]::traits::select::SelectionCandidate>, rustc_middle[99b5bdc542dd2f83]::traits::SelectionError>>::{closure#0}
  27:     0x7efd808243fd - <rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::candidate_from_obligation
  28:     0x7efd808287ba - <rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively::{closure#0}::{closure#1}
  29:     0x7efd8082741b - <rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively
  30:     0x7efd80825d6a - <rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::evaluate_predicate_recursively
  31:     0x7efd809deef2 - <rustc_infer[c4a55945a2525b]::infer::InferCtxt>::probe::<core[f375a3a92198feb1]::result::Result<rustc_middle[99b5bdc542dd2f83]::traits::select::EvaluationResult, rustc_middle[99b5bdc542dd2f83]::traits::select::OverflowError>, <rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::evaluation_probe<<rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::evaluate_root_obligation::{closure#0}>::{closure#0}>
  32:     0x7efd80815f53 - <rustc_trait_selection[f4790c9683b07384]::traits::select::SelectionContext>::evaluate_root_obligation
  33:     0x7efd8027325b - rustc_traits[3a8bba52f79d26bd]::evaluate_obligation::evaluate_obligation
  34:     0x7efd80346743 - rustc_query_impl[d7288d3d15e9da38]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d7288d3d15e9da38]::query_impl::evaluate_obligation::dynamic_query::{closure#2}::{closure#0}, rustc_middle[99b5bdc542dd2f83]::query::erase::Erased<[u8; 2usize]>>
  35:     0x7efd806d6651 - <rustc_query_impl[d7288d3d15e9da38]::query_impl::evaluate_obligation::dynamic_query::{closure#2} as core[f375a3a92198feb1]::ops::function::FnOnce<(rustc_middle[99b5bdc542dd2f83]::ty::context::TyCtxt, rustc_type_ir[ca6bfb6fc13bdc92]::canonical::Canonical<rustc_middle[99b5bdc542dd2f83]::ty::context::TyCtxt, rustc_middle[99b5bdc542dd2f83]::ty::ParamEnvAnd<rustc_middle[99b5bdc542dd2f83]::ty::Predicate>>)>>::call_once
  36:     0x7efd803ac60d - rustc_query_system[7ec1cb1a41ff8417]::query::plumbing::try_execute_query::<rustc_query_impl[d7288d3d15e9da38]::DynamicConfig<rustc_query_system[7ec1cb1a41ff8417]::query::caches::DefaultCache<rustc_type_ir[ca6bfb6fc13bdc92]::canonical::Canonical<rustc_middle[99b5bdc542dd2f83]::ty::context::TyCtxt, rustc_middle[99b5bdc542dd2f83]::ty::ParamEnvAnd<rustc_middle[99b5bdc542dd2f83]::ty::Predicate>>, rustc_middle[99b5bdc542dd2f83]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[d7288d3d15e9da38]::plumbing::QueryCtxt, true>
  37:     0x7efd80663cde - rustc_query_impl[d7288d3d15e9da38]::query_impl::evaluate_obligation::get_query_incr::__rust_end_short_backtrace
  38:     0x7efd809fa10d - <rustc_infer[c4a55945a2525b]::infer::InferCtxt as rustc_trait_selection[f4790c9683b07384]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  39:     0x7efd809fa51d - <rustc_infer[c4a55945a2525b]::infer::InferCtxt as rustc_trait_selection[f4790c9683b07384]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  40:     0x7efd809f9b17 - <rustc_infer[c4a55945a2525b]::infer::InferCtxt as rustc_trait_selection[f4790c9683b07384]::traits::query::evaluate_obligation::InferCtxtExt>::predicate_must_hold_modulo_regions
  41:     0x5607cad1ccbb - <core[f375a3a92198feb1]::iter::adapters::copied::Copied<core[f375a3a92198feb1]::slice::iter::Iter<rustc_middle[99b5bdc542dd2f83]::ty::Clause>> as core[f375a3a92198feb1]::iter::traits::iterator::Iterator>::try_fold::<(), core[f375a3a92198feb1]::iter::adapters::filter::filter_try_fold<rustc_middle[99b5bdc542dd2f83]::ty::Clause, (), core[f375a3a92198feb1]::ops::control_flow::ControlFlow<()>, clippy_lints[c0c4b2ad4dbda2a4]::methods::unnecessary_to_owned::can_change_type::{closure#4}, core[f375a3a92198feb1]::iter::traits::iterator::Iterator::any::check<rustc_middle[99b5bdc542dd2f83]::ty::Clause, clippy_lints[c0c4b2ad4dbda2a4]::methods::unnecessary_to_owned::can_change_type::{closure#6}>::{closure#0}>::{closure#0}, core[f375a3a92198feb1]::ops::control_flow::ControlFlow<()>>
  42:     0x5607cadcad74 - clippy_lints[c0c4b2ad4dbda2a4]::methods::unnecessary_to_owned::can_change_type
  43:     0x5607cadccace - <clippy_lints[c0c4b2ad4dbda2a4]::methods::Methods as rustc_lint[41987eacc644a84f]::passes::LateLintPass>::check_expr
  44:     0x7efd807cd993 - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
  45:     0x7efd8073e903 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_expr::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  46:     0x7efd807cd9ac - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
  47:     0x7efd8073e7f3 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_expr::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  48:     0x7efd807cd9ac - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
  49:     0x7efd8073e213 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_expr::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  50:     0x7efd807cd9ac - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
  51:     0x7efd8073e7f3 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_expr::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  52:     0x7efd807cd9ac - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
  53:     0x7efd8073e213 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_expr::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  54:     0x7efd807cd9ac - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
  55:     0x7efd807ce656 - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_stmt
  56:     0x7efd8072ccdc - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_block::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  57:     0x7efd8073e386 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_expr::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  58:     0x7efd807cd9ac - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
  59:     0x7efd8073e68f - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_expr::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  60:     0x7efd807cd9ac - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
  61:     0x7efd8072cd1b - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_block::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  62:     0x7efd8073e386 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_expr::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  63:     0x7efd807cd9ac - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
  64:     0x7efd8073db86 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_body::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  65:     0x7efd807cdb95 - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_nested_body
  66:     0x7efd8073e325 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_expr::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  67:     0x7efd807cd9ac - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
  68:     0x7efd8073db86 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_body::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  69:     0x7efd807cdb95 - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_nested_body
  70:     0x7efd80740579 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_item::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  71:     0x7efd807c8e16 - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_nested_item
  72:     0x7efd8072ccdc - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_block::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  73:     0x7efd8073e386 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_expr::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  74:     0x7efd807cd9ac - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
  75:     0x7efd8073db86 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_body::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  76:     0x7efd807cdb95 - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_nested_body
  77:     0x7efd80740579 - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_item::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  78:     0x7efd807c8e16 - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_nested_item
  79:     0x7efd8074060c - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_item::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  80:     0x7efd807c8e16 - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_nested_item
  81:     0x7efd8074060c - rustc_hir[c72dca54a63ff1f5]::intravisit::walk_item::<rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass>>
  82:     0x7efd807c8e16 - <rustc_lint[41987eacc644a84f]::late::LateContextAndPass<rustc_lint[41987eacc644a84f]::late::RuntimeCombinedLateLintPass> as rustc_hir[c72dca54a63ff1f5]::intravisit::Visitor>::visit_nested_item
  83:     0x7efd807d110c - rustc_lint[41987eacc644a84f]::late::check_crate::{closure#0}
  84:     0x7efd80798629 - rustc_data_structures[1627bcfcb21e4def]::sync::parallel::disabled::join::<rustc_lint[41987eacc644a84f]::late::check_crate::{closure#0}, rustc_lint[41987eacc644a84f]::late::check_crate::{closure#1}, (), ()>
  85:     0x7efd807d0caa - rustc_lint[41987eacc644a84f]::late::check_crate
  86:     0x7efd7caefc6d - std[8e4e87a28c8e62a9]::panicking::try::<(), core[f375a3a92198feb1]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[775976246e434a93]::passes::analysis::{closure#6}::{closure#1}::{closure#0}::{closure#0}::{closure#2}>>
  87:     0x7efd7caa98b9 - <rustc_data_structures[1627bcfcb21e4def]::sync::parallel::ParallelGuard>::run::<(), rustc_interface[775976246e434a93]::passes::analysis::{closure#6}::{closure#1}::{closure#0}::{closure#0}::{closure#2}>
  88:     0x7efd7caf13b3 - std[8e4e87a28c8e62a9]::panicking::try::<(), core[f375a3a92198feb1]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[775976246e434a93]::passes::analysis::{closure#6}::{closure#1}::{closure#0}>>
  89:     0x7efd7caa6786 - <rustc_session[fc9c4eccb5e976b]::session::Session>::time::<(), rustc_interface[775976246e434a93]::passes::analysis::{closure#6}>
  90:     0x7efd7cb20328 - rustc_interface[775976246e434a93]::passes::analysis
  91:     0x7efd80348dfa - rustc_query_impl[d7288d3d15e9da38]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d7288d3d15e9da38]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[99b5bdc542dd2f83]::query::erase::Erased<[u8; 1usize]>>
  92:     0x7efd80564688 - <rustc_query_impl[d7288d3d15e9da38]::query_impl::analysis::dynamic_query::{closure#2} as core[f375a3a92198feb1]::ops::function::FnOnce<(rustc_middle[99b5bdc542dd2f83]::ty::context::TyCtxt, ())>>::call_once
  93:     0x7efd80382c04 - rustc_query_system[7ec1cb1a41ff8417]::query::plumbing::try_execute_query::<rustc_query_impl[d7288d3d15e9da38]::DynamicConfig<rustc_query_system[7ec1cb1a41ff8417]::query::caches::SingleCache<rustc_middle[99b5bdc542dd2f83]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d7288d3d15e9da38]::plumbing::QueryCtxt, true>
  94:     0x7efd80529f6b - rustc_query_impl[d7288d3d15e9da38]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  95:     0x7efd7c8da2eb - <rustc_middle[99b5bdc542dd2f83]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[ba9e648a54e14925]::run_compiler::{closure#0}::{closure#0}::{closure#3}, core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>>
  96:     0x7efd7c8f1b9c - <rustc_interface[775976246e434a93]::interface::Compiler>::enter::<rustc_driver_impl[ba9e648a54e14925]::run_compiler::{closure#0}::{closure#0}, core[f375a3a92198feb1]::result::Result<core[f375a3a92198feb1]::option::Option<rustc_interface[775976246e434a93]::queries::Linker>, rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>>
  97:     0x7efd7c93b537 - rustc_span[30e96fe221b2db3f]::set_source_map::<core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>, rustc_interface[775976246e434a93]::interface::run_compiler<core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>, rustc_driver_impl[ba9e648a54e14925]::run_compiler::{closure#0}>::{closure#0}::{closure#0}>
  98:     0x7efd7c968555 - <scoped_tls[aae13a65dedca084]::ScopedKey<rustc_span[30e96fe221b2db3f]::SessionGlobals>>::set::<rustc_interface[775976246e434a93]::util::run_in_thread_pool_with_globals<rustc_interface[775976246e434a93]::interface::run_compiler<core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>, rustc_driver_impl[ba9e648a54e14925]::run_compiler::{closure#0}>::{closure#0}, core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>>::{closure#0}, core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>>
  99:     0x7efd7c93ba21 - rustc_span[30e96fe221b2db3f]::create_session_globals_then::<core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>, rustc_interface[775976246e434a93]::util::run_in_thread_pool_with_globals<rustc_interface[775976246e434a93]::interface::run_compiler<core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>, rustc_driver_impl[ba9e648a54e14925]::run_compiler::{closure#0}>::{closure#0}, core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>>::{closure#0}>
 100:     0x7efd7c96fe30 - std[8e4e87a28c8e62a9]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[775976246e434a93]::util::run_in_thread_with_globals<rustc_interface[775976246e434a93]::util::run_in_thread_pool_with_globals<rustc_interface[775976246e434a93]::interface::run_compiler<core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>, rustc_driver_impl[ba9e648a54e14925]::run_compiler::{closure#0}>::{closure#0}, core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>>::{closure#0}, core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>>
 101:     0x7efd7c972641 - <<std[8e4e87a28c8e62a9]::thread::Builder>::spawn_unchecked_<rustc_interface[775976246e434a93]::util::run_in_thread_with_globals<rustc_interface[775976246e434a93]::util::run_in_thread_pool_with_globals<rustc_interface[775976246e434a93]::interface::run_compiler<core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>, rustc_driver_impl[ba9e648a54e14925]::run_compiler::{closure#0}>::{closure#0}, core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>>::{closure#0}, core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f375a3a92198feb1]::result::Result<(), rustc_span[30e96fe221b2db3f]::ErrorGuaranteed>>::{closure#1} as core[f375a3a92198feb1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
 102:     0x7efd79b91265 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1e97f54b7cd855fa
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/alloc/src/boxed.rs:2015:9
 103:     0x7efd79b91265 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6131a2913c812b64
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/alloc/src/boxed.rs:2015:9
 104:     0x7efd79b91265 - std::sys::unix::thread::Thread::new::thread_start::he0eff1607c6cd732
                               at /b/s/w/ir/x/w/fuchsia-third_party-rust/library/std/src/sys/unix/thread.rs:108:17
 105:     0x7efd798983ec - start_thread
                               at ./nptl/pthread_create.c:444:8
 106:     0x7efd79918a4c - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new?template=ice.yml

note: please attach the file at `/mnt/fuchsia/out/default/rustc-ice-2023-12-15T19_17_16-1821745.txt` to your bug report

note: compiler flags: --crate-type bin -C linker=../../prebuilt/third_party/clang/linux-x64/bin/clang++ -C default-linker-libraries -C link-arg=--sysroot=../../prebuilt/third_party/sysroot/linux -C link-arg=--target=x86_64-unknown-linux-gnu -C link-arg=-stdlib=libc++ -C link-arg=--start-no-unused-arguments -C link-arg=-unwindlib=libunwind -C link-arg=-rtlib=compiler-rt -C link-arg=--end-no-unused-arguments -C link-arg=-fuse-ld=lld -C link-arg=-Wl,--build-id -Z remap-cwd-prefix=. -C opt-level=0 -C debuginfo=2 -C link-arg=-gz=zstd -C incremental=[REDACTED] -Z allow-features= -C debug-assertions=yes -C linker=../../prebuilt/third_party/clang/linux-x64/bin/clang++ -C default-linker-libraries -C link-arg=--sysroot=../../prebuilt/third_party/sysroot/linux -C link-arg=--target=x86_64-unknown-linux-gnu -C link-arg=-stdlib=libc++ -C link-arg=--start-no-unused-arguments -C link-arg=-unwindlib=libunwind -C link-arg=-rtlib=compiler-rt -C link-arg=--end-no-unused-arguments -C link-arg=-fuse-ld=lld -C link-arg=-Wl,--build-id -C link-arg=-fPIE -C link-arg=-pie -C link-arg=-static-libstdc++ -C link-arg=-Wl,-rpath=$ORIGIN/ -Z no_codegen

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `fuzzer::<impl at ../../src/developer/ffx/plugins/fuzz/src/fuzzer.rs:27:1: 27:30>::add::{opaque#0}: core::future::into_future::IntoFuture`
rust-lang/rust#1 [analysis] running analysis passes on this crate
end of query stack

@P1n3appl3 P1n3appl3 added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Dec 15, 2023
@matthiaskrgr matthiaskrgr transferred this issue from rust-lang/rust Dec 15, 2023
@Jarcho
Copy link
Contributor

Jarcho commented Dec 15, 2023

Same as #11952. Fixed in #11953.

@Jarcho Jarcho closed this as completed Dec 15, 2023
@compiler-errors
Copy link
Member

What does this have to do with async gen? The ICE has to do with normal futures.

@Jarcho
Copy link
Contributor

Jarcho commented Dec 29, 2023

That PR changed either how async fn was lowered or how await was lowered which. The new lowering ended up trigger a bug in clippy.

@compiler-errors
Copy link
Member

compiler-errors commented Dec 29, 2023

@Jarcho: That PR should not have affected how async fn or await is lowered, especially not affecting the way that we do trait selection or normalization for those types.

@P1n3appl3: Are you certain that this is failing after rust-lang/rust@f967532, and not some other merge commit on that same day? If you are certain, could you please instruct me how to reproduce the ICE? I have no idea how to build fuchsia.

@Jarcho
Copy link
Contributor

Jarcho commented Dec 29, 2023

Some PR around that time made a change, but I never verified which commit did. #11952 has a repro using async fn.


The clippy bug takes quite a bit to trigger and small changes can avoid it. Minimal repro without async would be this:

fn f<'a, T: AsRef<[u8]>>(x: T, y: &'a ()) -> impl 'a + FnOnce() {
    move || {
        let _y = y;
    }
}

fn g(_: impl FnOnce()) {}

fn main() {
    g(f([].to_vec(), &()));
}

Cause was clippy taking the return type of f (without the signature's binder) and checking if it meets the predicates required by g. Also note that f must be used immediately by g, otherwise it's never checked. e.g. the following didn't trigger the ICE:

let x = f([].to_vec(), &());
g(x);

@compiler-errors
Copy link
Member

compiler-errors commented Dec 29, 2023

This is the change from rust-lang/rust#118420 that causes clippy to begin ICEing:

https://github.com/rust-lang/rust/pull/118420/files#r1419874371

That line fixes a bug where we were not recording the node_args properly during writeback in HIR typeck, and that bug was silently causing some code to not be executed in clippy due to a defensively placed if-condition:

// https://github.com/rust-lang/rust-clippy/issues/9504 and https://github.com/rust-lang/rust-clippy/issues/10021
&& (param_index as usize) < call_generic_args.len()

But now that the args were recorded correctly, that if-condition no longer evaluated to false, which means we actually attempt to normalize the types here.

I want to make it very clear that that change I made to HIR typeck is not wrong, and that it only causes clippy to start exercising code that it was previously silently skipping.

@Jarcho
Copy link
Contributor

Jarcho commented Dec 29, 2023

I had assumed it was lowering changes that caused it since Clippy can be pretty sensitive to the exact HIR generated (I only took a quick look at that PR since I had already found the bug by that point). Either way it definitely exposed a Clippy bug in more code than it originally showed up in.

@compiler-errors
Copy link
Member

compiler-errors commented Dec 29, 2023

I'm mostly just confused why even though the root cause for #9504 was correctly identified in #9505 ("Compiler generated call into_future nodes return empty substs"), it wasn't fixed in rust-lang/rust and it was instead just silently mitigated by an if statement (and later in #10027).

Had it been fixed correctly (i.e. by adding this write_args call), then the bug that #11953 fixes (incorrect handling of a binder's lifetimes) would have been surfaced much sooner.

Anyways, I don't think anything here needs to be done -- everything seems to be resolved. Thanks @Jarcho for fixing the binder ICE, and I'm glad to see that rust-lang/rust#118420 didn't introduce a real bug.

bors added a commit that referenced this issue Dec 29, 2023
Remove mitigations for incorrect node args

This change https://github.com/rust-lang/rust/pull/118420/files#r1419874371 adds a missing `write_args` to properly record node args for lang-item calls.

Thus, in the `unnecessary_to_owned` lint, this ensures that the `call_generic_args` extracted by `get_callee_generic_args_and_args` are always correct, and we can remove the mitigation for #9504 and #10021 since the root cause has been fixed.

I'm not sure if there is other now-unnecessary code that can be removed, but this is the one I found when investigating #11965 (comment).

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants