Skip to content

Commit 1cb1f00

Browse files
committed
rustdoc: Removed Foreign{Function,Static} item types.
They are just (unsafe) functions and static items to most users and even compilers! The metadata doesn't distinguish them, so Rustdoc ended up producing broken links (generated `ffi.*.html`, links to `fn.*.html`). It would be best to avoid this pitfall at all.
1 parent a3bb858 commit 1cb1f00

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

src/librustdoc/html/item_type.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ pub enum ItemType {
3434
Method = 10,
3535
StructField = 11,
3636
Variant = 12,
37-
ForeignFunction = 13,
38-
ForeignStatic = 14,
37+
// we used to have ForeignFunction and ForeignStatic. they are retired now.
3938
Macro = 15,
4039
Primitive = 16,
4140
AssociatedType = 17,
@@ -59,8 +58,8 @@ impl ItemType {
5958
clean::MethodItem(..) => ItemType::Method,
6059
clean::StructFieldItem(..) => ItemType::StructField,
6160
clean::VariantItem(..) => ItemType::Variant,
62-
clean::ForeignFunctionItem(..) => ItemType::ForeignFunction,
63-
clean::ForeignStaticItem(..) => ItemType::ForeignStatic,
61+
clean::ForeignFunctionItem(..) => ItemType::Function, // no ForeignFunction
62+
clean::ForeignStaticItem(..) => ItemType::Static, // no ForeignStatic
6463
clean::MacroItem(..) => ItemType::Macro,
6564
clean::PrimitiveItem(..) => ItemType::Primitive,
6665
clean::AssociatedTypeItem(..) => ItemType::AssociatedType,
@@ -95,8 +94,6 @@ impl ItemType {
9594
ItemType::Method => "method",
9695
ItemType::StructField => "structfield",
9796
ItemType::Variant => "variant",
98-
ItemType::ForeignFunction => "ffi",
99-
ItemType::ForeignStatic => "ffs",
10097
ItemType::Macro => "macro",
10198
ItemType::Primitive => "primitive",
10299
ItemType::AssociatedType => "associatedtype",

src/librustdoc/html/render.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -1495,12 +1495,10 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
14951495
ItemType::Enum => 5,
14961496
ItemType::Constant => 6,
14971497
ItemType::Static => 7,
1498-
ItemType::ForeignFunction => 8,
1499-
ItemType::ForeignStatic => 9,
1500-
ItemType::Trait => 10,
1501-
ItemType::Function => 11,
1502-
ItemType::Typedef => 12,
1503-
_ => 13 + ty as u8,
1498+
ItemType::Trait => 8,
1499+
ItemType::Function => 9,
1500+
ItemType::Typedef => 10,
1501+
_ => 11 + ty as u8,
15041502
}
15051503
}
15061504

@@ -1559,8 +1557,6 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
15591557
ItemType::Method => ("methods", "Methods"),
15601558
ItemType::StructField => ("fields", "Struct Fields"),
15611559
ItemType::Variant => ("variants", "Variants"),
1562-
ItemType::ForeignFunction => ("ffi-fns", "Foreign Functions"),
1563-
ItemType::ForeignStatic => ("ffi-statics", "Foreign Statics"),
15641560
ItemType::Macro => ("macros", "Macros"),
15651561
ItemType::Primitive => ("primitives", "Primitive Types"),
15661562
ItemType::AssociatedType => ("associated-types", "Associated Types"),

src/librustdoc/html/static/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,8 @@
566566
"method",
567567
"structfield",
568568
"variant",
569-
"ffi",
570-
"ffs",
569+
"ffi", // retained for backward compatibility
570+
"ffs", // retained for backward compatibility
571571
"macro",
572572
"primitive",
573573
"associatedtype",

0 commit comments

Comments
 (0)