Skip to content

Commit

Permalink
rustdoc-json: Rename Import.span to Import.source
Browse files Browse the repository at this point in the history
* It is called `source` in rustc and the rest of rustdoc
* It is not a span, rather it is the source of the import
  • Loading branch information
camelid committed Mar 22, 2021
1 parent e190983 commit b0659f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/json/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,13 +503,13 @@ impl From<clean::Import> for Import {
use clean::ImportKind::*;
match import.kind {
Simple(s) => Import {
span: import.source.path.whole_name(),
source: import.source.path.whole_name(),
name: s.to_string(),
id: import.source.did.map(from_def_id),
glob: false,
},
Glob => Import {
span: import.source.path.whole_name(),
source: import.source.path.whole_name(),
name: import.source.path.last_name().to_string(),
id: import.source.did.map(from_def_id),
glob: true,
Expand Down
2 changes: 1 addition & 1 deletion src/rustdoc-json-types/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ pub struct Impl {
#[serde(rename_all = "snake_case")]
pub struct Import {
/// The full path being imported.
pub span: String,
pub source: String,
/// May be different from the last segment of `source` when renaming imports:
/// `use source as name;`
pub name: String,
Expand Down
4 changes: 2 additions & 2 deletions src/test/rustdoc-json/nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub mod l1 {
// @has - "$.index[*][?(@.name=='l3')].inner.items[*]" $l4_id
pub struct L4;
}
// @is nested.json "$.index[*][?(@.inner.span=='l3::L4')].kind" \"import\"
// @is - "$.index[*][?(@.inner.span=='l3::L4')].inner.glob" false
// @is nested.json "$.index[*][?(@.inner.source=='l3::L4')].kind" \"import\"
// @is - "$.index[*][?(@.inner.source=='l3::L4')].inner.glob" false
pub use l3::L4;
}

0 comments on commit b0659f9

Please sign in to comment.