Skip to content

Commit ebc86e6

Browse files
committed
Add f16 and f128 to rustdoc's PrimitiveType
Fix a few places where these primitives were missing from librustdoc.
1 parent aa1c459 commit ebc86e6

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/librustdoc/clean/types.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1797,8 +1797,10 @@ impl PrimitiveType {
17971797
sym::bool => Some(PrimitiveType::Bool),
17981798
sym::char => Some(PrimitiveType::Char),
17991799
sym::str => Some(PrimitiveType::Str),
1800+
sym::f16 => Some(PrimitiveType::F16),
18001801
sym::f32 => Some(PrimitiveType::F32),
18011802
sym::f64 => Some(PrimitiveType::F64),
1803+
sym::f128 => Some(PrimitiveType::F128),
18021804
sym::array => Some(PrimitiveType::Array),
18031805
sym::slice => Some(PrimitiveType::Slice),
18041806
sym::tuple => Some(PrimitiveType::Tuple),
@@ -1831,8 +1833,10 @@ impl PrimitiveType {
18311833
U32 => single(SimplifiedType::Uint(UintTy::U32)),
18321834
U64 => single(SimplifiedType::Uint(UintTy::U64)),
18331835
U128 => single(SimplifiedType::Uint(UintTy::U128)),
1836+
F16 => single(SimplifiedType::Float(FloatTy::F16)),
18341837
F32 => single(SimplifiedType::Float(FloatTy::F32)),
18351838
F64 => single(SimplifiedType::Float(FloatTy::F64)),
1839+
F128 => single(SimplifiedType::Float(FloatTy::F128)),
18361840
Str => single(SimplifiedType::Str),
18371841
Bool => single(SimplifiedType::Bool),
18381842
Char => single(SimplifiedType::Char),

src/librustdoc/passes/collect_intra_doc_links.rs

+4
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,10 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
536536
I64 => tcx.types.i64,
537537
I128 => tcx.types.i128,
538538
Isize => tcx.types.isize,
539+
F16 => tcx.types.f16,
539540
F32 => tcx.types.f32,
540541
F64 => tcx.types.f64,
542+
F128 => tcx.types.f128,
541543
U8 => tcx.types.u8,
542544
U16 => tcx.types.u16,
543545
U32 => tcx.types.u32,
@@ -2196,8 +2198,10 @@ fn resolve_primitive(path_str: &str, ns: Namespace) -> Option<Res> {
21962198
"u32" => U32,
21972199
"u64" => U64,
21982200
"u128" => U128,
2201+
"f16" => F16,
21992202
"f32" => F32,
22002203
"f64" => F64,
2204+
"f128" => F128,
22012205
"char" => Char,
22022206
"bool" | "true" | "false" => Bool,
22032207
"str" | "&str" => Str,

tests/rustdoc/primitive/primitive.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#![crate_name = "foo"]
22

33
#![feature(rustc_attrs)]
4+
#![feature(f16)]
5+
#![feature(f128)]
46

57
// @has foo/index.html '//h2[@id="primitives"]' 'Primitive Types'
68
// @has foo/index.html '//a[@href="primitive.i32.html"]' 'i32'
@@ -13,9 +15,19 @@
1315
// @!has foo/index.html '//span' '🔒'
1416
#[rustc_doc_primitive = "i32"]
1517
/// this is a test!
16-
mod i32{}
18+
mod i32 {}
1719

1820
// @has foo/primitive.bool.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello'
1921
#[rustc_doc_primitive = "bool"]
2022
/// hello
2123
mod bool {}
24+
25+
// @has foo/primitive.f16.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello'
26+
#[rustc_doc_primitive = "f16"]
27+
/// hello
28+
mod f16 {}
29+
30+
// @has foo/primitive.f128.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello'
31+
#[rustc_doc_primitive = "f128"]
32+
/// hello
33+
mod f128 {}

0 commit comments

Comments
 (0)