diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2024-10-18 12:41:14 +0200 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2024-10-18 12:41:14 +0200 |
| commit | c9f2a0e94bb2bdd5b4dadb6d8de842bd8309670d (patch) | |
| tree | 92967cc79b3045b43d60b007495cecfb6112ffe3 | |
| parent | e09bf4c07af8a424f9022bfe8d42ec714a51f0be (diff) | |
| download | rust-c9f2a0e94bb2bdd5b4dadb6d8de842bd8309670d.tar.gz rust-c9f2a0e94bb2bdd5b4dadb6d8de842bd8309670d.zip | |
internal: Add more trivially `Sized` types to `is_sized` check
| -rw-r--r-- | src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs index 7300453ff00..e4881d75201 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs @@ -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() { |
