about summary refs log tree commit diff
diff options
context:
space:
mode:
authorflip1995 <hello@philkrones.com>2020-10-09 22:22:21 +0200
committerflip1995 <hello@philkrones.com>2020-10-09 22:22:21 +0200
commita98f9d21fcdad85ae95d00d3931cf438f9d5a9de (patch)
tree32b6e22056403f1f621abfa2b19227cf3e7f95ae
parent6d88803a1c5516fda1d1030e5676d6b15be130fc (diff)
downloadrust-a98f9d21fcdad85ae95d00d3931cf438f9d5a9de.tar.gz
rust-a98f9d21fcdad85ae95d00d3931cf438f9d5a9de.zip
(Hacky) Fix for ICE #6139
-rw-r--r--clippy_lints/src/types.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs
index 5e83b6c81ec..a982b92bb2b 100644
--- a/clippy_lints/src/types.rs
+++ b/clippy_lints/src/types.rs
@@ -541,6 +541,11 @@ impl Types {
                                 _ => None,
                             });
                             let ty_ty = hir_ty_to_ty(cx.tcx, boxed_ty);
+                            // HACK(flip1995): This is a fix for an ICE occuring when `ty_ty` is a
+                            // trait object with a lifetime, e.g. `dyn T<'_>`. Since trait objects
+                            // don't have a known size, this shouldn't introduce FNs. But there
+                            // should be a better solution.
+                            if !matches!(ty_ty.kind(), ty::Dynamic(..));
                             if ty_ty.is_sized(cx.tcx.at(ty.span), cx.param_env);
                             if let Ok(ty_ty_size) = cx.layout_of(ty_ty).map(|l| l.size.bytes());
                             if ty_ty_size <= self.vec_box_size_threshold;