From 661e91be5717e2bfab2469b6e1e3e7d7029a2001 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 5 Nov 2023 12:47:00 +0000 Subject: [PATCH] Add test --- tests/ui/crashes/ice-11230.rs | 6 ++ tests/ui/crashes/ice-11230.stderr | 104 ++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 tests/ui/crashes/ice-11230.rs create mode 100644 tests/ui/crashes/ice-11230.stderr diff --git a/tests/ui/crashes/ice-11230.rs b/tests/ui/crashes/ice-11230.rs new file mode 100644 index 00000000000..5761882273e --- /dev/null +++ b/tests/ui/crashes/ice-11230.rs @@ -0,0 +1,6 @@ +/// Test for https://github.com/rust-lang/rust-clippy/issues/11230 + +fn main() { + const A: &[for<'a> fn(&'a ())] = &[]; + for v in A.iter() {} +} diff --git a/tests/ui/crashes/ice-11230.stderr b/tests/ui/crashes/ice-11230.stderr new file mode 100644 index 00000000000..8340baa84e9 --- /dev/null +++ b/tests/ui/crashes/ice-11230.stderr @@ -0,0 +1,104 @@ +thread 'rustc' panicked at clippy_utils/src/ty.rs:1163:13: +args contain late-bound region at index `0` which can't be normalized. +use `TyCtxt::erase_late_bound_regions` +note: arg is `&ReErased [Binder(fn(&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:5 ~ ice_11230[5616]::main::A::'a), 'a) }) ()), [Region(BrNamed(DefId(0:5 ~ ice_11230[5616]::main::A::'a), 'a))])]` +stack backtrace: + 0: 0xffff8960a170 - std::backtrace_rs::backtrace::libunwind::trace::h320ab2a22a25f139 + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5 + 1: 0xffff8960a170 - std::backtrace_rs::backtrace::trace_unsynchronized::h16d1a04a96890f2a + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 + 2: 0xffff8960a170 - std::sys_common::backtrace::_print_fmt::h7e1b326c76e12a8c + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/sys_common/backtrace.rs:67:5 + 3: 0xffff8960a170 - ::fmt::h2186811d6fb1749f + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/sys_common/backtrace.rs:44:22 + 4: 0xffff896628c0 - core::fmt::rt::Argument::fmt::hada011e99b0247aa + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/core/src/fmt/rt.rs:142:9 + 5: 0xffff896628c0 - core::fmt::write::h98b9cd590cb49ea6 + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/core/src/fmt/mod.rs:1117:17 + 6: 0xffff895ffefc - std::io::Write::write_fmt::hc1b33644358379a1 + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/io/mod.rs:1763:15 + 7: 0xffff89609fa0 - std::sys_common::backtrace::_print::haadb90ba41221bdf + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/sys_common/backtrace.rs:47:5 + 8: 0xffff89609fa0 - std::sys_common::backtrace::print::h687b224e21f53221 + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/sys_common/backtrace.rs:34:9 + 9: 0xffff8960c9dc - std::panicking::default_hook::{{closure}}::h20eb868a9804d388 + 10: 0xffff8960c708 - std::panicking::default_hook::he2e7647da3859155 + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/panicking.rs:292:9 + 11: 0xffff8a1bd724 - as core[372137152654ca71]::ops::function::Fn<(&dyn for<'a, 'b> core[372137152654ca71]::ops::function::Fn<(&'a core[372137152654ca71]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[372137152654ca71]::marker::Sync + core[372137152654ca71]::marker::Send, &core[372137152654ca71]::panic::panic_info::PanicInfo)>>::call + 12: 0xffff8960d0ec - as core::ops::function::Fn>::call::h3efbbd6870939e83 + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/alloc/src/boxed.rs:2021:9 + 13: 0xffff8960d0ec - std::panicking::rust_panic_with_hook::h6c4e0a2f6faf0a2b + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/panicking.rs:783:13 + 14: 0xffff8960ce64 - std::panicking::begin_panic_handler::{{closure}}::h15776c8fd16b21b0 + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/panicking.rs:657:13 + 15: 0xffff8960a618 - std::sys_common::backtrace::__rust_end_short_backtrace::hb62f3de86e07aa16 + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/sys_common/backtrace.rs:170:18 + 16: 0xffff8960cbf0 - rust_begin_unwind + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/panicking.rs:645:5 + 17: 0xffff895d7e18 - core::panicking::panic_fmt::hbb713efb709e5bdd + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/core/src/panicking.rs:72:14 + 18: 0xaaaac4057f34 - clippy_utils::ty::make_normalized_projection::helper::hf37c74780a760ba8 + at /home/gh-compiler-errors/rust-clippy/clippy_utils/src/ty.rs:1163:13 + 19: 0xaaaac36904f8 - clippy_utils::ty::make_normalized_projection::ha2a48c15f42154c3 + at /home/gh-compiler-errors/rust-clippy/clippy_utils/src/ty.rs:1179:5 + 20: 0xaaaac3acffdc - clippy_lints::loops::explicit_iter_loop::is_ref_iterable::h3cb7d7d17ef4f7ce + at /home/gh-compiler-errors/rust-clippy/clippy_lints/src/loops/explicit_iter_loop.rs:150:25 + 21: 0xaaaac3acf1b0 - clippy_lints::loops::explicit_iter_loop::check::heb346c925cdbe922 + at /home/gh-compiler-errors/rust-clippy/clippy_lints/src/loops/explicit_iter_loop.rs:23:30 + 22: 0xaaaac39cd91c - clippy_lints::loops::Loops::check_for_loop_arg::h2e9b032dc1512aff + at /home/gh-compiler-errors/rust-clippy/clippy_lints/src/loops/mod.rs:757:21 + 23: 0xaaaac39cd780 - clippy_lints::loops::Loops::check_for_loop::hc5996965e5e3a33d + at /home/gh-compiler-errors/rust-clippy/clippy_lints/src/loops/mod.rs:743:9 + 24: 0xaaaac39cd50c - ::check_expr::h6662c9277d8d0296 + at /home/gh-compiler-errors/rust-clippy/clippy_lints/src/loops/mod.rs:691:13 + 25: 0xffff8e853654 - >::with_lint_attrs::< as rustc_hir[db60bed8d006eb91]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}> + 26: 0xffff8e8b69c4 - rustc_hir[db60bed8d006eb91]::intravisit::walk_block::> + 27: 0xffff8e8c5edc - rustc_hir[db60bed8d006eb91]::intravisit::walk_expr::> + 28: 0xffff8e853670 - >::with_lint_attrs::< as rustc_hir[db60bed8d006eb91]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}> + 29: 0xffff8e8c57f4 - rustc_hir[db60bed8d006eb91]::intravisit::walk_body::> + 30: 0xffff8e853818 - as rustc_hir[db60bed8d006eb91]::intravisit::Visitor>::visit_nested_body + 31: 0xffff8e8c7d30 - rustc_hir[db60bed8d006eb91]::intravisit::walk_item::> + 32: 0xffff8e84f8d4 - as rustc_hir[db60bed8d006eb91]::intravisit::Visitor>::visit_nested_item + 33: 0xffff8e856410 - rustc_lint[1beac62862d2c77b]::late::late_lint_crate + 34: 0xffff8e8a78a8 - std[a964fe975f360ef7]::panicking::try::<(), core[372137152654ca71]::panic::unwind_safe::AssertUnwindSafe> + 35: 0xffff8e829f18 - ::run::<(), rustc_lint[1beac62862d2c77b]::late::check_crate::{closure#0}> + 36: 0xffff8e8b2c40 - rustc_data_structures[be7b9a727c51c438]::sync::parallel::disabled::join:: + 37: 0xffff8e85657c - rustc_lint[1beac62862d2c77b]::late::check_crate + 38: 0xffff8a2eb478 - ::time::<(), rustc_interface[8e7397053680d7df]::passes::analysis::{closure#6}::{closure#1}::{closure#0}::{closure#0}::{closure#2}::{closure#0}> + 39: 0xffff8a30ac48 - ::run::<(), rustc_interface[8e7397053680d7df]::passes::analysis::{closure#6}::{closure#1}::{closure#0}> + 40: 0xffff8a2ecbc4 - ::time::<(), rustc_interface[8e7397053680d7df]::passes::analysis::{closure#6}> + 41: 0xffff8a2b72b0 - rustc_interface[8e7397053680d7df]::passes::analysis + 42: 0xffff8dee1e0c - rustc_query_impl[f8a196ef7ba77aa8]::plumbing::__rust_begin_short_backtrace::> + 43: 0xffff8df68414 - >::call_once + 44: 0xffff8e09b108 - rustc_query_system[9650e766b9dacf57]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[f8a196ef7ba77aa8]::plumbing::QueryCtxt, false> + 45: 0xffff8dfc8328 - rustc_query_impl[f8a196ef7ba77aa8]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace + 46: 0xffff8a185134 - ::enter::> + 47: 0xffff8a19e0f4 - rustc_span[b38dd79340837c7e]::set_source_map::, rustc_interface[8e7397053680d7df]::interface::run_compiler, rustc_driver_impl[4936b348bb3e13e6]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> + 48: 0xffff8a1b5e04 - >::set::, rustc_driver_impl[4936b348bb3e13e6]::run_compiler::{closure#1}>::{closure#0}, core[372137152654ca71]::result::Result<(), rustc_span[b38dd79340837c7e]::ErrorGuaranteed>> + 49: 0xffff8a1b27c4 - std[a964fe975f360ef7]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[4936b348bb3e13e6]::run_compiler::{closure#1}>::{closure#0}, core[372137152654ca71]::result::Result<(), rustc_span[b38dd79340837c7e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[372137152654ca71]::result::Result<(), rustc_span[b38dd79340837c7e]::ErrorGuaranteed>> + 50: 0xffff8a1bc628 - <::spawn_unchecked_, rustc_driver_impl[4936b348bb3e13e6]::run_compiler::{closure#1}>::{closure#0}, core[372137152654ca71]::result::Result<(), rustc_span[b38dd79340837c7e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[372137152654ca71]::result::Result<(), rustc_span[b38dd79340837c7e]::ErrorGuaranteed>>::{closure#1} as core[372137152654ca71]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 51: 0xffff896170e8 - as core::ops::function::FnOnce>::call_once::h79516df3f2a39016 + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/alloc/src/boxed.rs:2007:9 + 52: 0xffff896170e8 - as core::ops::function::FnOnce>::call_once::h034e5730ad6da724 + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/alloc/src/boxed.rs:2007:9 + 53: 0xffff896170e8 - std::sys::unix::thread::Thread::new::thread_start::hf1f483f7384dd89e + at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/std/src/sys/unix/thread.rs:108:17 + 54: 0xffff8937d5c8 - start_thread + at ./nptl/pthread_create.c:442:8 + 55: 0xffff893e5d9c - thread_start + at ./misc/../sysdeps/unix/sysv/linux/aarch64/clone.S:79 + 56: 0x0 - + +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.75.0-nightly (75b064d26 2023-11-01) running on aarch64-unknown-linux-gnu + +note: compiler flags: -Z ui-testing + +query stack during panic: +#0 [analysis] running analysis passes on this crate +end of query stack +note: Clippy version: clippy 0.1.75 (789bc73d8 2023-11-03) +