about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-11-05 12:36:47 +0000
committerMichael Goulet <michael@errs.io>2023-11-12 12:15:30 -0800
commit1539eb8c03362ec765991b178031e4e97ecd1602 (patch)
tree4051de52c6353d1f466dda9a7db979c0cc60f609
parent661e91be5717e2bfab2469b6e1e3e7d7029a2001 (diff)
downloadrust-1539eb8c03362ec765991b178031e4e97ecd1602.tar.gz
rust-1539eb8c03362ec765991b178031e4e97ecd1602.zip
Don't check for late-bound vars, check for escaping bound vars
-rw-r--r--clippy_utils/src/ty.rs14
-rw-r--r--tests/ui/crashes/ice-11230.stderr104
2 files changed, 12 insertions, 106 deletions
diff --git a/clippy_utils/src/ty.rs b/clippy_utils/src/ty.rs
index 7eff93881b2..842a206f96b 100644
--- a/clippy_utils/src/ty.rs
+++ b/clippy_utils/src/ty.rs
@@ -1160,7 +1160,12 @@ pub fn make_normalized_projection<'tcx>(
 ) -> Option<Ty<'tcx>> {
     fn helper<'tcx>(tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, ty: AliasTy<'tcx>) -> Option<Ty<'tcx>> {
         #[cfg(debug_assertions)]
-        if let Some((i, arg)) = ty.args.iter().enumerate().find(|(_, arg)| arg.has_late_bound_regions()) {
+        if let Some((i, arg)) = ty
+            .args
+            .iter()
+            .enumerate()
+            .find(|(_, arg)| arg.has_escaping_bound_vars())
+        {
             debug_assert!(
                 false,
                 "args contain late-bound region at index `{i}` which can't be normalized.\n\
@@ -1233,7 +1238,12 @@ pub fn make_normalized_projection_with_regions<'tcx>(
 ) -> Option<Ty<'tcx>> {
     fn helper<'tcx>(tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, ty: AliasTy<'tcx>) -> Option<Ty<'tcx>> {
         #[cfg(debug_assertions)]
-        if let Some((i, arg)) = ty.args.iter().enumerate().find(|(_, arg)| arg.has_late_bound_regions()) {
+        if let Some((i, arg)) = ty
+            .args
+            .iter()
+            .enumerate()
+            .find(|(_, arg)| arg.has_escaping_bound_vars())
+        {
             debug_assert!(
                 false,
                 "args contain late-bound region at index `{i}` which can't be normalized.\n\
diff --git a/tests/ui/crashes/ice-11230.stderr b/tests/ui/crashes/ice-11230.stderr
deleted file mode 100644
index 8340baa84e9..00000000000
--- a/tests/ui/crashes/ice-11230.stderr
+++ /dev/null
@@ -1,104 +0,0 @@
-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 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::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 - <alloc[218617f89300c0f8]::boxed::Box<rustc_driver_impl[4936b348bb3e13e6]::install_ice_hook::{closure#0}> 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 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::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 - <clippy_lints::loops::Loops as rustc_lint::passes::LateLintPass>::check_expr::h6662c9277d8d0296
-                               at /home/gh-compiler-errors/rust-clippy/clippy_lints/src/loops/mod.rs:691:13
-  25:     0xffff8e853654 - <rustc_lint[1beac62862d2c77b]::late::LateContextAndPass<rustc_lint[1beac62862d2c77b]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[1beac62862d2c77b]::late::LateContextAndPass<rustc_lint[1beac62862d2c77b]::late::RuntimeCombinedLateLintPass> as rustc_hir[db60bed8d006eb91]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
-  26:     0xffff8e8b69c4 - rustc_hir[db60bed8d006eb91]::intravisit::walk_block::<rustc_lint[1beac62862d2c77b]::late::LateContextAndPass<rustc_lint[1beac62862d2c77b]::late::RuntimeCombinedLateLintPass>>
-  27:     0xffff8e8c5edc - rustc_hir[db60bed8d006eb91]::intravisit::walk_expr::<rustc_lint[1beac62862d2c77b]::late::LateContextAndPass<rustc_lint[1beac62862d2c77b]::late::RuntimeCombinedLateLintPass>>
-  28:     0xffff8e853670 - <rustc_lint[1beac62862d2c77b]::late::LateContextAndPass<rustc_lint[1beac62862d2c77b]::late::RuntimeCombinedLateLintPass>>::with_lint_attrs::<<rustc_lint[1beac62862d2c77b]::late::LateContextAndPass<rustc_lint[1beac62862d2c77b]::late::RuntimeCombinedLateLintPass> as rustc_hir[db60bed8d006eb91]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}>
-  29:     0xffff8e8c57f4 - rustc_hir[db60bed8d006eb91]::intravisit::walk_body::<rustc_lint[1beac62862d2c77b]::late::LateContextAndPass<rustc_lint[1beac62862d2c77b]::late::RuntimeCombinedLateLintPass>>
-  30:     0xffff8e853818 - <rustc_lint[1beac62862d2c77b]::late::LateContextAndPass<rustc_lint[1beac62862d2c77b]::late::RuntimeCombinedLateLintPass> as rustc_hir[db60bed8d006eb91]::intravisit::Visitor>::visit_nested_body
-  31:     0xffff8e8c7d30 - rustc_hir[db60bed8d006eb91]::intravisit::walk_item::<rustc_lint[1beac62862d2c77b]::late::LateContextAndPass<rustc_lint[1beac62862d2c77b]::late::RuntimeCombinedLateLintPass>>
-  32:     0xffff8e84f8d4 - <rustc_lint[1beac62862d2c77b]::late::LateContextAndPass<rustc_lint[1beac62862d2c77b]::late::RuntimeCombinedLateLintPass> 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<rustc_lint[1beac62862d2c77b]::late::check_crate::{closure#0}>>
-  35:     0xffff8e829f18 - <rustc_data_structures[be7b9a727c51c438]::sync::parallel::ParallelGuard>::run::<(), rustc_lint[1beac62862d2c77b]::late::check_crate::{closure#0}>
-  36:     0xffff8e8b2c40 - rustc_data_structures[be7b9a727c51c438]::sync::parallel::disabled::join::<rustc_lint[1beac62862d2c77b]::late::check_crate::{closure#0}, rustc_lint[1beac62862d2c77b]::late::check_crate::{closure#1}, (), ()>
-  37:     0xffff8e85657c - rustc_lint[1beac62862d2c77b]::late::check_crate
-  38:     0xffff8a2eb478 - <rustc_session[254464c25c15f658]::session::Session>::time::<(), rustc_interface[8e7397053680d7df]::passes::analysis::{closure#6}::{closure#1}::{closure#0}::{closure#0}::{closure#2}::{closure#0}>
-  39:     0xffff8a30ac48 - <rustc_data_structures[be7b9a727c51c438]::sync::parallel::ParallelGuard>::run::<(), rustc_interface[8e7397053680d7df]::passes::analysis::{closure#6}::{closure#1}::{closure#0}>
-  40:     0xffff8a2ecbc4 - <rustc_session[254464c25c15f658]::session::Session>::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::<rustc_query_impl[f8a196ef7ba77aa8]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[51c473aff86ea40d]::query::erase::Erased<[u8; 1usize]>>
-  43:     0xffff8df68414 - <rustc_query_impl[f8a196ef7ba77aa8]::query_impl::analysis::dynamic_query::{closure#2} as core[372137152654ca71]::ops::function::FnOnce<(rustc_middle[51c473aff86ea40d]::ty::context::TyCtxt, ())>>::call_once
-  44:     0xffff8e09b108 - rustc_query_system[9650e766b9dacf57]::query::plumbing::try_execute_query::<rustc_query_impl[f8a196ef7ba77aa8]::DynamicConfig<rustc_query_system[9650e766b9dacf57]::query::caches::SingleCache<rustc_middle[51c473aff86ea40d]::query::erase::Erased<[u8; 1usize]>>, 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 - <rustc_middle[51c473aff86ea40d]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[4936b348bb3e13e6]::run_compiler::{closure#1}::{closure#2}::{closure#6}, core[372137152654ca71]::result::Result<(), rustc_span[b38dd79340837c7e]::ErrorGuaranteed>>
-  47:     0xffff8a19e0f4 - rustc_span[b38dd79340837c7e]::set_source_map::<core[372137152654ca71]::result::Result<(), rustc_span[b38dd79340837c7e]::ErrorGuaranteed>, rustc_interface[8e7397053680d7df]::interface::run_compiler<core[372137152654ca71]::result::Result<(), rustc_span[b38dd79340837c7e]::ErrorGuaranteed>, rustc_driver_impl[4936b348bb3e13e6]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
-  48:     0xffff8a1b5e04 - <scoped_tls[9b592f59d5a77926]::ScopedKey<rustc_span[b38dd79340837c7e]::SessionGlobals>>::set::<rustc_interface[8e7397053680d7df]::interface::run_compiler<core[372137152654ca71]::result::Result<(), rustc_span[b38dd79340837c7e]::ErrorGuaranteed>, 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_interface[8e7397053680d7df]::util::run_in_thread_with_globals<rustc_interface[8e7397053680d7df]::interface::run_compiler<core[372137152654ca71]::result::Result<(), rustc_span[b38dd79340837c7e]::ErrorGuaranteed>, 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 - <<std[a964fe975f360ef7]::thread::Builder>::spawn_unchecked_<rustc_interface[8e7397053680d7df]::util::run_in_thread_with_globals<rustc_interface[8e7397053680d7df]::interface::run_compiler<core[372137152654ca71]::result::Result<(), rustc_span[b38dd79340837c7e]::ErrorGuaranteed>, 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 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h79516df3f2a39016
-                               at /rustc/75b064d26970ca8e7a487072f51835ebb057d575/library/alloc/src/boxed.rs:2007:9
-  52:     0xffff896170e8 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::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 - <unknown>
-
-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)
-