Skip to content

Commit 909a33d

Browse files
committed
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.
1 parent 7f4afdf commit 909a33d

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/librustdoc/clean/types.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,6 @@ impl Type {
14131413
}
14141414
}
14151415
RawPointer(..) => Some(PrimitiveType::RawPointer),
1416-
BorrowedRef { type_: box Generic(..), .. } => Some(PrimitiveType::Reference),
14171416
BareFunction(..) => Some(PrimitiveType::Fn),
14181417
Never => Some(PrimitiveType::Never),
14191418
_ => None,
@@ -1472,13 +1471,7 @@ impl Type {
14721471
}
14731472

14741473
crate fn is_primitive(&self) -> bool {
1475-
match self {
1476-
Self::Primitive(_) => true,
1477-
Self::BorrowedRef { ref type_, .. } | Self::RawPointer(_, ref type_) => {
1478-
type_.is_primitive()
1479-
}
1480-
_ => false,
1481-
}
1474+
self.primitive_type().is_some()
14821475
}
14831476

14841477
crate fn projection(&self) -> Option<(&Type, DefId, Symbol)> {

0 commit comments

Comments
 (0)