We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 947516f + a98f9d2 commit 08bd3f0Copy full SHA for 08bd3f0
clippy_lints/src/types.rs
@@ -541,6 +541,11 @@ impl Types {
541
_ => None,
542
});
543
let ty_ty = hir_ty_to_ty(cx.tcx, boxed_ty);
544
+ // HACK(flip1995): This is a fix for an ICE occuring when `ty_ty` is a
545
+ // trait object with a lifetime, e.g. `dyn T<'_>`. Since trait objects
546
+ // don't have a known size, this shouldn't introduce FNs. But there
547
+ // should be a better solution.
548
+ if !matches!(ty_ty.kind(), ty::Dynamic(..));
549
if ty_ty.is_sized(cx.tcx.at(ty.span), cx.param_env);
550
if let Ok(ty_ty_size) = cx.layout_of(ty_ty).map(|l| l.size.bytes());
551
if ty_ty_size <= self.vec_box_size_threshold;
tests/ui/crashes/ice-6139.rs
@@ -0,0 +1,7 @@
1
+trait T<'a> {}
2
+
3
+fn foo(_: Vec<Box<dyn T<'_>>>) {}
4
5
+fn main() {
6
+ foo(vec![]);
7
+}
0 commit comments