about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2021-04-22 21:57:14 -0400
committerJoshua Nelson <jyn514@gmail.com>2021-04-23 09:57:06 -0400
commit909a33d3b4035c29ceb9cd79da4191b32a5a4391 (patch)
treee7da0fe5e3312fc6600b1233bf5a880a2bb6ff55
parent7f4afdf0255600306bf67432da722c7b5d2cbf82 (diff)
downloadrust-909a33d3b4035c29ceb9cd79da4191b32a5a4391.tar.gz
rust-909a33d3b4035c29ceb9cd79da4191b32a5a4391.zip
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.
-rw-r--r--src/librustdoc/clean/types.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs
index 675de640c70..30dc2d1e4a2 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)> {