Skip to content

Commit a5c0b14

Browse files
committed
rustdoc-json-types: implementors -> implementations
Closes rust-lang#94198
1 parent b526d8f commit a5c0b14

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

Diff for: src/etc/check_missing_items.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def check_type(ty):
171171
for bound in item["inner"]["bounds"]:
172172
check_generic_bound(bound)
173173
work_list |= (
174-
set(item["inner"]["items"]) | set(item["inner"]["implementors"])
174+
set(item["inner"]["items"]) | set(item["inner"]["implementations"])
175175
) - visited
176176
elif item["kind"] == "impl":
177177
check_generics(item["inner"]["generics"])

Diff for: src/librustdoc/json/conversions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ impl FromWithTcx<clean::Trait> for Trait {
517517
items: ids(items),
518518
generics: generics.into_tcx(tcx),
519519
bounds: bounds.into_iter().map(|x| x.into_tcx(tcx)).collect(),
520-
implementors: Vec::new(), // Added in JsonRenderer::item
520+
implementations: Vec::new(), // Added in JsonRenderer::item
521521
}
522522
}
523523
}

Diff for: src/librustdoc/json/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
179179
let id = item.def_id;
180180
if let Some(mut new_item) = self.convert_item(item) {
181181
if let types::ItemEnum::Trait(ref mut t) = new_item.inner {
182-
t.implementors = self.get_trait_implementors(id.expect_def_id())
182+
t.implementations = self.get_trait_implementors(id.expect_def_id())
183183
} else if let types::ItemEnum::Struct(ref mut s) = new_item.inner {
184184
s.impls = self.get_impls(id.expect_def_id())
185185
} else if let types::ItemEnum::Enum(ref mut e) = new_item.inner {

Diff for: src/rustdoc-json-types/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::path::PathBuf;
99
use serde::{Deserialize, Serialize};
1010

1111
/// rustdoc format-version.
12-
pub const FORMAT_VERSION: u32 = 13;
12+
pub const FORMAT_VERSION: u32 = 14;
1313

1414
/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
1515
/// about the language items in the local crate, as well as info about external items to allow
@@ -505,7 +505,7 @@ pub struct Trait {
505505
pub items: Vec<Id>,
506506
pub generics: Generics,
507507
pub bounds: Vec<GenericBound>,
508-
pub implementors: Vec<Id>,
508+
pub implementations: Vec<Id>,
509509
}
510510

511511
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]

Diff for: src/test/rustdoc-json/traits/implementors.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![feature(no_core)]
2+
#![no_core]
3+
4+
// @set wham = implementors.json "$.index[*][?(@.name=='Wham')].id"
5+
// @count - "$.index[*][?(@.name=='Wham')].inner.implementations[*]" 1
6+
// @set gmWham = - "$.index[*][?(@.name=='Wham')].inner.implementations[0]"
7+
pub trait Wham {}
8+
9+
// @count - "$.index[*][?(@.name=='GeorgeMichael')].inner.impls[*]" 1
10+
// @is - "$.index[*][?(@.name=='GeorgeMichael')].inner.impls[0]" $gmWham
11+
// @set gm = - "$.index[*][?(@.name=='Wham')].id"
12+
13+
// jsonpath_lib isnt expressive enough (for now) to get the "impl" item, so we
14+
// just check it isn't pointing to the type, but when you port to jsondocck-ng
15+
// check what the impl item is
16+
// @!is - "$.index[*][?(@.name=='Wham')].inner.implementations[0]" $gm
17+
pub struct GeorgeMichael {}
18+
19+
impl Wham for GeorgeMichael {}

0 commit comments

Comments
 (0)