Skip to content

Commit 5b85f1c

Browse files
committed
Auto merge of rust-lang#18331 - Veykril:veykril/push-tsolukqqyllz, r=Veykril
internal: Add more trivially `Sized` types to `is_sized` check
2 parents 6b919c4 + c9f2a0e commit 5b85f1c

File tree

1 file changed

+11
-1
lines changed
  • src/tools/rust-analyzer/crates/hir-ty/src/infer

1 file changed

+11
-1
lines changed

src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,9 +917,19 @@ impl<'a> InferenceTable<'a> {
917917
/// Check if given type is `Sized` or not
918918
pub(crate) fn is_sized(&mut self, ty: &Ty) -> bool {
919919
// Early return for some obvious types
920-
if matches!(ty.kind(Interner), TyKind::Scalar(..) | TyKind::Ref(..) | TyKind::Raw(..)) {
920+
if matches!(
921+
ty.kind(Interner),
922+
TyKind::Scalar(..)
923+
| TyKind::Ref(..)
924+
| TyKind::Raw(..)
925+
| TyKind::Never
926+
| TyKind::FnDef(..)
927+
| TyKind::Array(..)
928+
| TyKind::Function(_)
929+
) {
921930
return true;
922931
}
932+
923933
if let Some((AdtId::StructId(id), subst)) = ty.as_adt() {
924934
let struct_data = self.db.struct_data(id);
925935
if let Some((last_field, _)) = struct_data.variant_data.fields().iter().last() {

0 commit comments

Comments
 (0)