Closed
Description
openedon Oct 9, 2023
Summary
fn main() {
let x = "world";
#[clippy::author]
let print_text = |y| println!("Hello {}!", y);
print_text(x);
}
Version
rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: x86_64-apple-darwin
release: 1.73.0
LLVM version: 17.0.2
Error output
Backtrace
if let StmtKind::Local(local) = stmt.kind
&& let Some(init) = local.init
&& let ExprKind::Closure(CaptureBy::Ref, fn_decl, body_id, _, None) = init.kind
&& let FnRetTy::DefaultReturn(_) = fn_decl.output
&& expr = &cx.tcx.hir().body(body_id).value
&& let ExprKind::Block(block, None) = expr.kind
&& block.stmts.len() == 1
&& let StmtKind::Semi(e) = block.stmts[0].kind
&& let ExprKind::Call(func, args) = e.kind
&& let ExprKind::Path(ref qpath) = func.kind
&& match_qpath(qpath, &["$crate", "io", "_print"])
&& args.len() == 1
&& let ExprKind::Call(func1, args1) = args[0].kind
&& let ExprKind::Path(ref qpath1) = func1.kind
thread 'rustc' panicked at src/tools/clippy/clippy_lints/src/utils/author.rs:760:36:
path_to_string: called for lang item qpath
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: clippy_lints::utils::author::path_to_string::inner
3: clippy_lints::utils::author::path_to_string::inner
4: <clippy_lints::utils::author::PrintVisitor>::qpath
5: <clippy_lints::utils::author::PrintVisitor>::expr
6: <clippy_lints::utils::author::PrintVisitor>::expr
7: <clippy_lints::utils::author::PrintVisitor>::slice::<rustc_hir::hir::Expr, <clippy_lints::utils::author::PrintVisitor>::expr::{closure#2}>
8: <clippy_lints::utils::author::PrintVisitor>::expr
9: <clippy_lints::utils::author::PrintVisitor>::stmt
10: <clippy_lints::utils::author::PrintVisitor>::block
11: <clippy_lints::utils::author::PrintVisitor>::expr
12: <clippy_lints::utils::author::PrintVisitor>::body
13: <clippy_lints::utils::author::PrintVisitor>::expr
14: <clippy_lints::utils::author::PrintVisitor>::stmt
15: <clippy_lints::utils::author::Author as rustc_lint::passes::LateLintPass>::check_stmt
16: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_stmt
17: rustc_hir::intravisit::walk_block::<rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass>>
18: rustc_hir::intravisit::walk_expr::<rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass>>
19: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_expr::{closure#0}
20: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_nested_body
21: rustc_hir::intravisit::walk_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass>>
22: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_nested_item
23: <rustc_session::session::Session>::time::<(), rustc_lint::late::check_crate::{closure#0}::{closure#0}>
24: <core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::analysis::{closure#5}::{closure#1}::{closure#2}> as core::ops::function::FnOnce<()>>::call_once
25: <core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::analysis::{closure#5}::{closure#1}> as core::ops::function::FnOnce<()>>::call_once
26: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#5}>
27: rustc_interface::passes::analysis
[... omitted 2 frames ...]
28: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#6}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
29: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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: rustc 1.73.0 (cc66ad468 2023-10-03) running on x86_64-apple-darwin
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
note: Clippy version: clippy 0.1.73 (cc66ad46 2023-10-03)
error: could not compile `demo_bug` (bin "demo_bug")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment