Skip to content

Commit

Permalink
Auto merge of #18331 - Veykril:veykril/push-tsolukqqyllz, r=Veykril
Browse files Browse the repository at this point in the history
internal: Add more trivially `Sized` types to `is_sized` check
  • Loading branch information
bors committed Oct 18, 2024
2 parents 6703d7a + c11b45a commit a40c399
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crates/hir-ty/src/infer/unify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,19 @@ impl<'a> InferenceTable<'a> {
/// Check if given type is `Sized` or not
pub(crate) fn is_sized(&mut self, ty: &Ty) -> bool {
// Early return for some obvious types
if matches!(ty.kind(Interner), TyKind::Scalar(..) | TyKind::Ref(..) | TyKind::Raw(..)) {
if matches!(
ty.kind(Interner),
TyKind::Scalar(..)
| TyKind::Ref(..)
| TyKind::Raw(..)
| TyKind::Never
| TyKind::FnDef(..)
| TyKind::Array(..)
| TyKind::Function(_)
) {
return true;
}

if let Some((AdtId::StructId(id), subst)) = ty.as_adt() {
let struct_data = self.db.struct_data(id);
if let Some((last_field, _)) = struct_data.variant_data.fields().iter().last() {
Expand Down

0 comments on commit a40c399

Please sign in to comment.