rustdoc: rename /implementors to /impl.trait

This is shorter, avoids potential conflicts with a crate
named `implementors`[^1], and will be less confusing when JS
include files are added for type aliases.

[^1]: AFAIK, this couldn't actually cause any problems right now,
but it's simpler just to make it impossible than relying on never
having a file named `trait.Foo.js` in the crate data area.
This commit is contained in:
Michael Howell 2023-10-05 18:44:40 -07:00
parent 54b0434cea
commit ade7ecf909
12 changed files with 19 additions and 19 deletions

View file

@ -1101,7 +1101,7 @@ fn trait_item(w: &mut Buffer, cx: &mut Context<'_>, m: &clean::Item, t: &clean::
// ```
//
// Basically, we want `C::Baz` and `A::Foo` to show the same set of
// impls, which is easier if they both treat `/implementors/A/trait.Foo.js`
// impls, which is easier if they both treat `/trait.impl/A/trait.Foo.js`
// as the Single Source of Truth.
//
// We also want the `impl Baz for Quux` to be written to
@ -1110,7 +1110,7 @@ fn trait_item(w: &mut Buffer, cx: &mut Context<'_>, m: &clean::Item, t: &clean::
// because that'll load faster, and it's better for SEO. And we don't want
// the same impl to show up twice on the same page.
//
// To make this work, the implementors JS file has a structure kinda
// To make this work, the trait.impl/A/trait.Foo.js JS file has a structure kinda
// like this:
//
// ```js
@ -1127,7 +1127,7 @@ fn trait_item(w: &mut Buffer, cx: &mut Context<'_>, m: &clean::Item, t: &clean::
// So C's HTML will have something like this:
//
// ```html
// <script src="/implementors/A/trait.Foo.js"
// <script src="/trait.impl/A/trait.Foo.js"
// data-ignore-extern-crates="A,B" async></script>
// ```
//
@ -1137,7 +1137,7 @@ fn trait_item(w: &mut Buffer, cx: &mut Context<'_>, m: &clean::Item, t: &clean::
// [JSONP]: https://en.wikipedia.org/wiki/JSONP
let mut js_src_path: UrlPartsBuilder = std::iter::repeat("..")
.take(cx.current.len())
.chain(std::iter::once("implementors"))
.chain(std::iter::once("trait.impl"))
.collect();
if let Some(did) = it.item_id.as_def_id() &&
let get_extern = { || cache.external_paths.get(&did).map(|s| &s.0) } &&

View file

@ -362,7 +362,7 @@ fn add_path(self: &Rc<Self>, path: &Path) {
}
// Update the list of all implementors for traits
let dst = cx.dst.join("implementors");
let dst = cx.dst.join("trait.impl");
let cache = cx.cache();
for (&did, imps) in &cache.implementors {
// Private modules can leak through to this phase of rustdoc, which

View file

@ -1,6 +1,6 @@
// This test ensures that items and documentation code blocks are wrapped in <pre><code>
// We need to disable this check because `implementors/test_docs/trait.AnotherOne.js`
// We need to disable this check because `trait.impl/test_docs/trait.AnotherOne.js`
// doesn't exist.
fail-on-request-error: false
go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"

View file

@ -1,6 +1,6 @@
// This test ensures that the color of the items in the type decl are working as expected.
// We need to disable this check because `implementors/test_docs/trait.TraitWithoutGenerics.js`
// We need to disable this check because `trait.impl/test_docs/trait.TraitWithoutGenerics.js`
// doesn't exist.
fail-on-request-error: false

View file

@ -1,6 +1,6 @@
// This test checks that there are margins applied to methods with no docblocks.
// We need to disable this check because `implementors/test_docs/trait.TraitWithNoDocblock.js`
// We need to disable this check because `trait.impl/test_docs/trait.TraitWithNoDocblock.js`
// doesn't exist.
fail-on-request-error: false

View file

@ -1,7 +1,7 @@
// This test ensures that the "Auto-hide item contents for large items" setting is working as
// expected.
// We need to disable this check because `implementors/test_docs/trait.Iterator.js` doesn't exist.
// We need to disable this check because `trait.impl/test_docs/trait.Iterator.js` doesn't exist.
fail-on-request-error: false
define-function: (

View file

@ -1,6 +1,6 @@
// Checks that the elements in the sidebar are alphabetically sorted.
// We need to disable this check because `implementors/test_docs/trait.AnotherOne.js`
// We need to disable this check because `trait.impl/test_docs/trait.AnotherOne.js`
// doesn't exist.
fail-on-request-error: false

View file

@ -2,7 +2,7 @@
// This test ensures that the items declaration content overflow is handled inside the <pre> directly.
// We need to disable this check because
// `implementors/test_docs/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.js`
// `trait.impl/test_docs/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.js`
// doesn't exist.
fail-on-request-error: false

View file

@ -12,6 +12,6 @@ pub mod __hidden {
// @has foo/trait.Clone.html
// @!hasraw - 'Foo'
// @has implementors/core/clone/trait.Clone.js
// @has trait.impl/core/clone/trait.Clone.js
// @!hasraw - 'Foo'
pub use std::clone::Clone;

View file

@ -12,7 +12,7 @@ pub struct Bar<T> { t: T }
// full impl string. Instead, just make sure something from each part
// is mentioned.
// @hasraw implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar
// @hasraw trait.impl/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar
// @hasraw - Send
// @hasraw - !AnAutoTrait
// @hasraw - Copy

View file

@ -4,13 +4,13 @@
extern crate implementors_inline;
// @!has implementors/implementors_js/trait.MyTrait.js
// @has implementors/implementors_inline/my_trait/trait.MyTrait.js
// @!has implementors/implementors_inline/prelude/trait.MyTrait.js
// @!has trait.impl/implementors_js/trait.MyTrait.js
// @has trait.impl/implementors_inline/my_trait/trait.MyTrait.js
// @!has trait.impl/implementors_inline/prelude/trait.MyTrait.js
// @has implementors_inline/my_trait/trait.MyTrait.html
// @has - '//script/@src' '../../implementors/implementors_inline/my_trait/trait.MyTrait.js'
// @has - '//script/@src' '../../trait.impl/implementors_inline/my_trait/trait.MyTrait.js'
// @has implementors_js/trait.MyTrait.html
// @has - '//script/@src' '../implementors/implementors_inline/my_trait/trait.MyTrait.js'
// @has - '//script/@src' '../trait.impl/implementors_inline/my_trait/trait.MyTrait.js'
/// When re-exporting this trait, the HTML will be inlined,
/// but, vitally, the JavaScript will be located only at the
/// one canonical path.

View file

@ -2,4 +2,4 @@
pub use std::vec::Vec;
// @!has implementors/core/clone/trait.Clone.js
// @!has trait.impl/core/clone/trait.Clone.js