mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 17:53:56 +00:00
Auto merge of #18331 - Veykril:veykril/push-tsolukqqyllz, r=Veykril
internal: Add more trivially `Sized` types to `is_sized` check
This commit is contained in:
commit
5b85f1c2d9
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user