Skip to content

Commit a2c9fe0

Browse files
committed
rename
1 parent 1eb4553 commit a2c9fe0

File tree

10 files changed

+38
-35
lines changed

10 files changed

+38
-35
lines changed

src/librustdoc/json/conversions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ impl FromClean<clean::Type> for Type {
622622
impl FromClean<clean::Path> for Path {
623623
fn from_clean(path: clean::Path, renderer: &JsonRenderer<'_>) -> Path {
624624
Path {
625-
name: path.whole_name(),
625+
path: path.whole_name(),
626626
id: renderer.id_from_item_default(path.def_id().into()),
627627
args: path.segments.last().map(|args| Box::new(args.clone().args.into_json(renderer))),
628628
}

src/rustdoc-json-types/lib.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1036,8 +1036,11 @@ pub enum Type {
10361036
/// A type that has a simple path to it. This is the kind of type of structs, unions, enums, etc.
10371037
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
10381038
pub struct Path {
1039-
/// The name of the type.
1040-
pub name: String,
1039+
/// The path of the type.
1040+
///
1041+
/// This will be the path where the type is *used*, so it may be a
1042+
/// re-export.
1043+
pub path: String,
10411044
/// The ID of the type.
10421045
pub id: Id,
10431046
/// Generic arguments to the type.

tests/rustdoc-json/blanket_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type"
66
//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type.type.resolved_path"
7-
//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type.type.resolved_path.name" \"Infallible\"
7+
//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type.type.resolved_path.path" \"Infallible\"
88
pub struct ForBlanketTryFromImpl;

tests/rustdoc-json/fns/async_return.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ pub async fn get_int_async() -> i32 {
1717
42
1818
}
1919

20-
//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.name" '"Future"'
20+
//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.path" '"Future"'
2121
//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
2222
//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive" \"i32\"
2323
//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.header.is_async" false
2424
pub fn get_int_future() -> impl Future<Output = i32> {
2525
async { 42 }
2626
}
2727

28-
//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.name" '"Future"'
28+
//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.path" '"Future"'
2929
//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
3030
//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive" \"i32\"
3131
//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.header.is_async" true

tests/rustdoc-json/impl-trait-in-assoc-type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ impl IntoIterator for AlwaysTrue {
1010
type Item = bool;
1111

1212
//@ count '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[*]' 1
13-
//@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.name' '"Iterator"'
13+
//@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.path' '"Iterator"'
1414
//@ count '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[*]' 1
1515
//@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name' '"Item"'
1616
//@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive' '"bool"'

tests/rustdoc-json/path_name.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ pub use priv_mod::{InPrivMod, InPrivMod as InPrivMod2};
2020
use pub_mod::InPubMod as InPubMod3;
2121
pub use pub_mod::{InPubMod, InPubMod as InPubMod2};
2222

23-
//@ is "$.index[*][?(@.name=='T0')].inner.type_alias.type.resolved_path.name" '"priv_mod::InPrivMod"'
23+
//@ is "$.index[*][?(@.name=='T0')].inner.type_alias.type.resolved_path.path" '"priv_mod::InPrivMod"'
2424
pub type T0 = priv_mod::InPrivMod;
25-
//@ is "$.index[*][?(@.name=='T1')].inner.type_alias.type.resolved_path.name" '"InPrivMod"'
25+
//@ is "$.index[*][?(@.name=='T1')].inner.type_alias.type.resolved_path.path" '"InPrivMod"'
2626
pub type T1 = InPrivMod;
27-
//@ is "$.index[*][?(@.name=='T2')].inner.type_alias.type.resolved_path.name" '"InPrivMod2"'
27+
//@ is "$.index[*][?(@.name=='T2')].inner.type_alias.type.resolved_path.path" '"InPrivMod2"'
2828
pub type T2 = InPrivMod2;
29-
//@ is "$.index[*][?(@.name=='T3')].inner.type_alias.type.resolved_path.name" '"priv_mod::InPrivMod"'
29+
//@ is "$.index[*][?(@.name=='T3')].inner.type_alias.type.resolved_path.path" '"priv_mod::InPrivMod"'
3030
pub type T3 = InPrivMod3;
3131

32-
//@ is "$.index[*][?(@.name=='U0')].inner.type_alias.type.resolved_path.name" '"pub_mod::InPubMod"'
32+
//@ is "$.index[*][?(@.name=='U0')].inner.type_alias.type.resolved_path.path" '"pub_mod::InPubMod"'
3333
pub type U0 = pub_mod::InPubMod;
34-
//@ is "$.index[*][?(@.name=='U1')].inner.type_alias.type.resolved_path.name" '"InPubMod"'
34+
//@ is "$.index[*][?(@.name=='U1')].inner.type_alias.type.resolved_path.path" '"InPubMod"'
3535
pub type U1 = InPubMod;
36-
//@ is "$.index[*][?(@.name=='U2')].inner.type_alias.type.resolved_path.name" '"InPubMod2"'
36+
//@ is "$.index[*][?(@.name=='U2')].inner.type_alias.type.resolved_path.path" '"InPubMod2"'
3737
pub type U2 = InPubMod2;
38-
//@ is "$.index[*][?(@.name=='U3')].inner.type_alias.type.resolved_path.name" '"pub_mod::InPubMod"'
38+
//@ is "$.index[*][?(@.name=='U3')].inner.type_alias.type.resolved_path.path" '"pub_mod::InPubMod"'
3939
pub type U3 = InPubMod3;
4040

4141
// Check we only have paths for structs at their original path
@@ -44,25 +44,25 @@ pub type U3 = InPubMod3;
4444
pub use defines_and_reexports::{InPrivMod as XPrivMod, InPubMod as XPubMod};
4545
use defines_and_reexports::{InPrivMod as XPrivMod2, InPubMod as XPubMod2};
4646

47-
//@ is "$.index[*][?(@.name=='X0')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::m1::InPubMod"'
47+
//@ is "$.index[*][?(@.name=='X0')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::m1::InPubMod"'
4848
pub type X0 = defines_and_reexports::m1::InPubMod;
49-
//@ is "$.index[*][?(@.name=='X1')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::InPubMod"'
49+
//@ is "$.index[*][?(@.name=='X1')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod"'
5050
pub type X1 = defines_and_reexports::InPubMod;
51-
//@ is "$.index[*][?(@.name=='X2')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::InPubMod2"'
51+
//@ is "$.index[*][?(@.name=='X2')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod2"'
5252
pub type X2 = defines_and_reexports::InPubMod2;
53-
//@ is "$.index[*][?(@.name=='X3')].inner.type_alias.type.resolved_path.name" '"XPubMod"'
53+
//@ is "$.index[*][?(@.name=='X3')].inner.type_alias.type.resolved_path.path" '"XPubMod"'
5454
pub type X3 = XPubMod;
5555
// N.B. This isn't the path as used *or* the original path!
56-
//@ is "$.index[*][?(@.name=='X4')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::InPubMod"'
56+
//@ is "$.index[*][?(@.name=='X4')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPubMod"'
5757
pub type X4 = XPubMod2;
5858

59-
//@ is "$.index[*][?(@.name=='Y1')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::InPrivMod"'
59+
//@ is "$.index[*][?(@.name=='Y1')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod"'
6060
pub type Y1 = defines_and_reexports::InPrivMod;
61-
//@ is "$.index[*][?(@.name=='Y2')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::InPrivMod2"'
61+
//@ is "$.index[*][?(@.name=='Y2')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod2"'
6262
pub type Y2 = defines_and_reexports::InPrivMod2;
63-
//@ is "$.index[*][?(@.name=='Y3')].inner.type_alias.type.resolved_path.name" '"XPrivMod"'
63+
//@ is "$.index[*][?(@.name=='Y3')].inner.type_alias.type.resolved_path.path" '"XPrivMod"'
6464
pub type Y3 = XPrivMod;
65-
//@ is "$.index[*][?(@.name=='Y4')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::InPrivMod"'
65+
//@ is "$.index[*][?(@.name=='Y4')].inner.type_alias.type.resolved_path.path" '"defines_and_reexports::InPrivMod"'
6666
pub type Y4 = XPrivMod2;
6767

6868
// For foreign items, $.paths contains the *origional* path, even if it's not publicly

tests/rustdoc-json/return_private.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mod secret {
77
}
88

99
//@ has "$.index[*][?(@.name=='get_secret')].inner.function"
10-
//@ is "$.index[*][?(@.name=='get_secret')].inner.function.sig.output.resolved_path.name" '"secret::Secret"'
10+
//@ is "$.index[*][?(@.name=='get_secret')].inner.function.sig.output.resolved_path.path" '"secret::Secret"'
1111
//@ is "$.index[*][?(@.name=='get_secret')].inner.function.sig.output.resolved_path.id" $struct_secret
1212
pub fn get_secret() -> secret::Secret {
1313
secret::Secret

tests/rustdoc-json/type/dyn.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::fmt::Debug;
1010
//@ has "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias"
1111
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.generics" '{"params": [], "where_predicates": []}'
1212
//@ has "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path"
13-
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.name" \"Box\"
13+
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.path" \"Box\"
1414
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.constraints" []
1515
//@ count "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args" 1
1616
//@ has "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait"
@@ -19,9 +19,9 @@ use std::fmt::Debug;
1919
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].generic_params" []
2020
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].generic_params" []
2121
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].generic_params" []
22-
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.name" '"Fn"'
23-
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.name" '"Send"'
24-
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].trait.name" '"Sync"'
22+
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.path" '"Fn"'
23+
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.path" '"Send"'
24+
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[2].trait.path" '"Sync"'
2525
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.args" '{"parenthesized": {"inputs": [],"output": {"primitive": "i32"}}}'
2626
pub type SyncIntGen = Box<dyn Fn() -> i32 + Send + Sync + 'static>;
2727

@@ -34,13 +34,13 @@ pub type SyncIntGen = Box<dyn Fn() -> i32 + Send + Sync + 'static>;
3434
//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.lifetime" null
3535
//@ count "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[*]" 1
3636
//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
37-
//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.name" '"Fn"'
37+
//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.path" '"Fn"'
3838
//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref"
3939
//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.inputs[0].borrowed_ref.lifetime" "\"'b\""
4040
//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref"
4141
//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.traits[0].trait.args.parenthesized.output.borrowed_ref.lifetime" "\"'b\""
4242
pub type RefFn<'a> = &'a dyn for<'b> Fn(&'b i32) -> &'b i32;
4343

44-
//@ is "$.index[*][?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.name" '"Send"'
45-
//@ is "$.index[*][?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.name" '"Debug"'
44+
//@ is "$.index[*][?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[0].trait.path" '"Send"'
45+
//@ is "$.index[*][?(@.name=='WeirdOrder')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.traits[1].trait.path" '"Debug"'
4646
pub type WeirdOrder = Box<dyn Send + Debug>;

tests/rustdoc-json/type/generic_default.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ pub struct MyError {}
2121
//@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[0].kind.type.default" null
2222
//@ has "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path"
2323
//@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.id" $my_error
24-
//@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.name" \"MyError\"
24+
//@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.generics.params[1].kind.type.default.resolved_path.path" \"MyError\"
2525
//@ has "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path"
2626
//@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.id" $result
27-
//@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.name" \"Result\"
27+
//@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.path" \"Result\"
2828
//@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.constraints" []
2929
//@ has "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic"
3030
//@ has "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic"

tests/rustdoc-json/type/hrtb.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ where
1515
//@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.lifetime" null
1616
//@ count "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[*]" 1
1717
//@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"},{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
18-
//@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].trait.name" '"Fn"'
18+
//@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].trait.path" '"Fn"'
1919
pub fn dynfn(f: &dyn for<'a, 'b> Fn(&'a i32, &'b i32)) {
2020
let zero = 0;
2121
f(&zero, &zero);

0 commit comments

Comments
 (0)