mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 11:12:43 +00:00
Auto merge of #6152 - flip1995:ice_6139, r=ebroto
Fixes ICE 6139 Fixes #6139 Kind of hacky, but this should be fine. changelog: none
This commit is contained in:
commit
08bd3f0b0d
@ -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;
|
||||
|
7
tests/ui/crashes/ice-6139.rs
Normal file
7
tests/ui/crashes/ice-6139.rs
Normal file
@ -0,0 +1,7 @@
|
||||
trait T<'a> {}
|
||||
|
||||
fn foo(_: Vec<Box<dyn T<'_>>>) {}
|
||||
|
||||
fn main() {
|
||||
foo(vec![]);
|
||||
}
|
Loading…
Reference in New Issue
Block a user