diff options
| author | Noah Lev <camelidcamel@gmail.com> | 2021-10-03 12:40:53 -0700 |
|---|---|---|
| committer | Noah Lev <camelidcamel@gmail.com> | 2021-10-03 12:40:53 -0700 |
| commit | ebbcafbfa3d7dde58a548621a2003d26c1005fd4 (patch) | |
| tree | 313837553e553a71950aba24a6a79f432fcf2909 /src | |
| parent | f359b316df4e42369b91cbd39fec2925fe1a2fd7 (diff) | |
| download | rust-ebbcafbfa3d7dde58a548621a2003d26c1005fd4.tar.gz rust-ebbcafbfa3d7dde58a548621a2003d26c1005fd4.zip | |
Fix implementation of `clean::Path::whole_name()`
I think that before this commit, the path `::std::vec::Vec` would have
rendered as `{{root}}::std::vec::Vec`. Now, it should render correctly
as `::std::vec::Vec`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/types.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index df6e030aeef..2e09768a8ef 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1958,7 +1958,11 @@ impl Path { } crate fn whole_name(&self) -> String { - self.segments.iter().map(|s| s.name.to_string()).intersperse("::".into()).collect() + self.segments + .iter() + .map(|s| if s.name == kw::PathRoot { String::new() } else { s.name.to_string() }) + .intersperse("::".into()) + .collect() } /// Checks if this is a `T::Name` path for an associated type. |
