From 909a33d3b4035c29ceb9cd79da4191b32a5a4391 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 22 Apr 2021 21:57:14 -0400 Subject: [PATCH] rustdoc: Implement `is_primitive` in terms of `primitive_type()` Previously, they disagreed about what types were primitives. This also fixes a bug where rustdoc would mark any type with a reference as a primitive. --- src/librustdoc/clean/types.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 675de640c7010..30dc2d1e4a264 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1413,7 +1413,6 @@ impl Type { } } RawPointer(..) => Some(PrimitiveType::RawPointer), - BorrowedRef { type_: box Generic(..), .. } => Some(PrimitiveType::Reference), BareFunction(..) => Some(PrimitiveType::Fn), Never => Some(PrimitiveType::Never), _ => None, @@ -1472,13 +1471,7 @@ impl Type { } crate fn is_primitive(&self) -> bool { - match self { - Self::Primitive(_) => true, - Self::BorrowedRef { ref type_, .. } | Self::RawPointer(_, ref type_) => { - type_.is_primitive() - } - _ => false, - } + self.primitive_type().is_some() } crate fn projection(&self) -> Option<(&Type, DefId, Symbol)> {