File tree 2 files changed +20
-2
lines changed
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -1038,8 +1038,17 @@ pub enum Type {
1038
1038
pub struct Path {
1039
1039
/// The path of the type.
1040
1040
///
1041
- /// This will be the path where the type is *used*, so it may be a
1042
- /// re-export.
1041
+ /// This will be the path that is *used* (not where it is defined), so
1042
+ /// multiple `Path`s may have different values for this field even if
1043
+ /// they all refer to the same item. e.g.
1044
+ ///
1045
+ /// ```rust
1046
+ /// pub type Vec1 = std::vec::Vec<i32>; // path: "std::vec::Vec"
1047
+ /// pub type Vec2 = Vec<i32>; // path: "Vec"
1048
+ /// pub type Vec3 = std::prelude::v1::Vec<i32>; // path: "std::prelude::v1::Vec"
1049
+ /// ```
1050
+ //
1051
+ // Example tested in ./tests/rustdoc-json/path_name.rs
1043
1052
pub path : String ,
1044
1053
/// The ID of the type.
1045
1054
pub id : Id ,
Original file line number Diff line number Diff line change @@ -72,3 +72,12 @@ pub type Y4 = XPrivMod2;
72
72
//@ has "$.paths[*].path" '["defines_and_reexports", "m2", "InPrivMod"]'
73
73
//@ !has "$.paths[*].path" '["defines_and_reexports", "InPubMod"]'
74
74
//@ !has "$.paths[*].path" '["defines_and_reexports", "InPrivMod"]'
75
+
76
+ // Tests for the example in the docs of Path::name.
77
+ // If these change, chage the docs.
78
+ //@ is "$.index[*][?(@.name=='Vec1')].inner.type_alias.type.resolved_path.path" '"std::vec::Vec"'
79
+ pub type Vec1 = std:: vec:: Vec < i32 > ;
80
+ //@ is "$.index[*][?(@.name=='Vec2')].inner.type_alias.type.resolved_path.path" '"Vec"'
81
+ pub type Vec2 = Vec < i32 > ;
82
+ //@ is "$.index[*][?(@.name=='Vec3')].inner.type_alias.type.resolved_path.path" '"std::prelude::v1::Vec"'
83
+ pub type Vec3 = std:: prelude:: v1:: Vec < i32 > ;
You can’t perform that action at this time.
0 commit comments