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 in redundant_locals check #11619

Closed
cmyr opened this issue Oct 6, 2023 · 1 comment · Fixed by #11623
Closed

ICE in redundant_locals check #11619

cmyr opened this issue Oct 6, 2023 · 1 comment · Fixed by #11623
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@cmyr
Copy link

cmyr commented Oct 6, 2023

Summary

I don't have a minimal repro, but you can encounter this by running clippy 0.1.73 (cc66ad4 2023-10-03) on the skrifa crate available at googlefonts/fontations@a69db62.

edit: oddly this crash seems to occur as a result of a commit that is fixing some of the new clippy lints, but in a crate that was untouched.

Version

rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: aarch64-apple-darwin (also x86_64-unknown-linux-gnu)
release: 1.73.0
LLVM version: 17.0.2

Error output

Backtrace

thread 'rustc' panicked at src/tools/clippy/clippy_lints/src/redundant_locals.rs:67:49:
called `Option::unwrap()` on a `None` value
stack backtrace:
 0:        0x101942f10 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6d4268b2ed62fb94
 1:        0x101996d2c - core::fmt::write::h5d55d44549819258
 2:        0x101938940 - std::io::Write::write_fmt::hc515897f91abd6cf
 3:        0x101942d50 - std::sys_common::backtrace::print::h2c300c1ebedfc73c
 4:        0x1019459a8 - std::panicking::default_hook::{{closure}}::h0aa9be5c44269370
 5:        0x1019456d4 - std::panicking::default_hook::h2c0ef097934ee9e6
 6:        0x109d7cf80 - <alloc[9d652ec8c31aafa6]::boxed::Box<rustc_driver_impl[9bfd475b98cd59fb]::install_ice_hook::{closure#0}> as core[739ca7dd8b5352f0]::ops::function::Fn<(&dyn for<'a, 'b> core[739ca7dd8b5352f0]::ops::function::Fn<(&'a core[739ca7dd8b5352f0]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[739ca7dd8b5352f0]::marker::Sync + core[739ca7dd8b5352f0]::marker::Send, &core[739ca7dd8b5352f0]::panic::panic_info::PanicInfo)>>::call
 7:        0x101946140 - std::panicking::rust_panic_with_hook::h84c8637cb6e56008
 8:        0x101945ed8 - std::panicking::begin_panic_handler::{{closure}}::h25482adda06c7b7f
 9:        0x10194339c - std::sys_common::backtrace::__rust_end_short_backtrace::h0c6f3beb22324a29
10:        0x101945c78 - _rust_begin_unwind
11:        0x1019c2228 - core::panicking::panic_fmt::h9072a0246ecafd14
12:        0x1019c2298 - core::panicking::panic::hcabaf8436b9c6302
13:        0x100243848 - <clippy_lints[dc5d5ab5e05f480]::redundant_locals::RedundantLocals as rustc_lint[d90e15d5130bc07e]::passes::LateLintPass>::check_local
14:        0x10d8b64e4 - <rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass> as rustc_hir[38b3d6821764c924]::intravisit::Visitor>::visit_local
15:        0x10d87913c - rustc_hir[38b3d6821764c924]::intravisit::walk_block::<rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass>>
16:        0x10d886044 - rustc_hir[38b3d6821764c924]::intravisit::walk_expr::<rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass>>
17:        0x10d8b5a04 - <rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass> as rustc_hir[38b3d6821764c924]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
18:        0x10d8859dc - rustc_hir[38b3d6821764c924]::intravisit::walk_body::<rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass>>
19:        0x10d8b5b44 - <rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass> as rustc_hir[38b3d6821764c924]::intravisit::Visitor>::visit_nested_body
20:        0x10d87b698 - rustc_hir[38b3d6821764c924]::intravisit::walk_impl_item::<rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass>>
21:        0x10d8b3b84 - <rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass> as rustc_hir[38b3d6821764c924]::intravisit::Visitor>::visit_nested_impl_item
22:        0x10d8884e4 - rustc_hir[38b3d6821764c924]::intravisit::walk_item::<rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass>>
23:        0x10d8b3680 - <rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass> as rustc_hir[38b3d6821764c924]::intravisit::Visitor>::visit_nested_item
24:        0x10d887f90 - rustc_hir[38b3d6821764c924]::intravisit::walk_item::<rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass>>
25:        0x10d8b3680 - <rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass> as rustc_hir[38b3d6821764c924]::intravisit::Visitor>::visit_nested_item
26:        0x10d887f90 - rustc_hir[38b3d6821764c924]::intravisit::walk_item::<rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass>>
27:        0x10d8b3680 - <rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass> as rustc_hir[38b3d6821764c924]::intravisit::Visitor>::visit_nested_item
28:        0x10d887f90 - rustc_hir[38b3d6821764c924]::intravisit::walk_item::<rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass>>
29:        0x10d8b3680 - <rustc_lint[d90e15d5130bc07e]::late::LateContextAndPass<rustc_lint[d90e15d5130bc07e]::late::RuntimeCombinedLateLintPass> as rustc_hir[38b3d6821764c924]::intravisit::Visitor>::visit_nested_item
30:        0x10d8b7bb0 - rustc_lint[d90e15d5130bc07e]::late::late_lint_crate
31:        0x10d862b0c - <rustc_session[515fcee844a24980]::session::Session>::time::<(), rustc_lint[d90e15d5130bc07e]::late::check_crate::{closure#0}::{closure#0}>
32:        0x10d8b7da8 - rustc_lint[d90e15d5130bc07e]::late::check_crate
33:        0x109eed600 - <core[739ca7dd8b5352f0]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[e2b6ecfa58a6ef2f]::passes::analysis::{closure#5}::{closure#1}::{closure#2}> as core[739ca7dd8b5352f0]::ops::function::FnOnce<()>>::call_once
34:        0x109eee23c - <core[739ca7dd8b5352f0]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[e2b6ecfa58a6ef2f]::passes::analysis::{closure#5}::{closure#1}> as core[739ca7dd8b5352f0]::ops::function::FnOnce<()>>::call_once
35:        0x109ee7680 - <rustc_session[515fcee844a24980]::session::Session>::time::<(), rustc_interface[e2b6ecfa58a6ef2f]::passes::analysis::{closure#5}>
36:        0x109ee4200 - rustc_interface[e2b6ecfa58a6ef2f]::passes::analysis
37:        0x10d04f2d8 - rustc_query_impl[e4ca9ce52dccb640]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e4ca9ce52dccb640]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[664eaf2b3b9e7bc8]::query::erase::Erased<[u8; 1usize]>>
38:        0x10d0fb780 - <rustc_query_impl[e4ca9ce52dccb640]::query_impl::analysis::dynamic_query::{closure#2} as core[739ca7dd8b5352f0]::ops::function::FnOnce<(rustc_middle[664eaf2b3b9e7bc8]::ty::context::TyCtxt, ())>>::call_once
39:        0x10cfc1ddc - rustc_query_system[37552b805d274941]::query::plumbing::try_execute_query::<rustc_query_impl[e4ca9ce52dccb640]::DynamicConfig<rustc_query_system[37552b805d274941]::query::caches::SingleCache<rustc_middle[664eaf2b3b9e7bc8]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e4ca9ce52dccb640]::plumbing::QueryCtxt, true>
40:        0x10d08bdc0 - rustc_query_impl[e4ca9ce52dccb640]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
41:        0x109d6fca0 - <rustc_middle[664eaf2b3b9e7bc8]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[9bfd475b98cd59fb]::run_compiler::{closure#1}::{closure#2}::{closure#6}, core[739ca7dd8b5352f0]::result::Result<(), rustc_span[3bf7c2dc9f4148d7]::ErrorGuaranteed>>
42:        0x109d90b30 - <rustc_interface[e2b6ecfa58a6ef2f]::interface::Compiler>::enter::<rustc_driver_impl[9bfd475b98cd59fb]::run_compiler::{closure#1}::{closure#2}, core[739ca7dd8b5352f0]::result::Result<core[739ca7dd8b5352f0]::option::Option<rustc_interface[e2b6ecfa58a6ef2f]::queries::Linker>, rustc_span[3bf7c2dc9f4148d7]::ErrorGuaranteed>>
43:        0x109d7989c - std[b8ab0b963f2233c0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e2b6ecfa58a6ef2f]::util::run_in_thread_pool_with_globals<rustc_interface[e2b6ecfa58a6ef2f]::interface::run_compiler<core[739ca7dd8b5352f0]::result::Result<(), rustc_span[3bf7c2dc9f4148d7]::ErrorGuaranteed>, rustc_driver_impl[9bfd475b98cd59fb]::run_compiler::{closure#1}>::{closure#0}, core[739ca7dd8b5352f0]::result::Result<(), rustc_span[3bf7c2dc9f4148d7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[739ca7dd8b5352f0]::result::Result<(), rustc_span[3bf7c2dc9f4148d7]::ErrorGuaranteed>>
44:        0x109d7b140 - <<std[b8ab0b963f2233c0]::thread::Builder>::spawn_unchecked_<rustc_interface[e2b6ecfa58a6ef2f]::util::run_in_thread_pool_with_globals<rustc_interface[e2b6ecfa58a6ef2f]::interface::run_compiler<core[739ca7dd8b5352f0]::result::Result<(), rustc_span[3bf7c2dc9f4148d7]::ErrorGuaranteed>, rustc_driver_impl[9bfd475b98cd59fb]::run_compiler::{closure#1}>::{closure#0}, core[739ca7dd8b5352f0]::result::Result<(), rustc_span[3bf7c2dc9f4148d7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[739ca7dd8b5352f0]::result::Result<(), rustc_span[3bf7c2dc9f4148d7]::ErrorGuaranteed>>::{closure#1} as core[739ca7dd8b5352f0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
45:        0x10194eda4 - std::sys::unix::thread::Thread::new::thread_start::h6244aa8f646b01ac
46:        0x19ca6026c - __pthread_deallocate

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 aarch64-apple-darwin

note: compiler flags: --crate-type lib -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)

@cmyr cmyr added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Oct 6, 2023
@koka831
Copy link
Contributor

koka831 commented Oct 6, 2023

minimal code: (ref: https://github.com/googlefonts/fontations/blob/55b496dffddf9f4d3e3ffd241fe2529e0577e438/skrifa/src/scale/glyf/deltas.rs#L241-L246)

fn reassign_in_macro() {
  let x = 10;
  macro_rules! mac {
    ($i:ident) => {
      let mut x = x;
    }
  }
  mac!(y);
}

@rustbot claim

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

Successfully merging a pull request may close this issue.

2 participants