This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +23
-20
lines changed Expand file tree Collapse file tree 3 files changed +23
-20
lines changed Original file line number Diff line number Diff line change @@ -685,24 +685,18 @@ impl FromWithTcx<clean::Variant> for Variant {
685685impl FromWithTcx < clean:: Import > for Import {
686686 fn from_tcx ( import : clean:: Import , tcx : TyCtxt < ' _ > ) -> Self {
687687 use clean:: ImportKind :: * ;
688- match import. kind {
689- Simple ( s) => Import {
690- source : import. source . path . whole_name ( ) ,
691- name : s. to_string ( ) ,
692- id : import. source . did . map ( ItemId :: from) . map ( |i| from_item_id ( i, tcx) ) ,
693- glob : false ,
694- } ,
695- Glob => Import {
696- source : import. source . path . whole_name ( ) ,
697- name : import
698- . source
699- . path
700- . last_opt ( )
701- . unwrap_or_else ( || Symbol :: intern ( "*" ) )
702- . to_string ( ) ,
703- id : import. source . did . map ( ItemId :: from) . map ( |i| from_item_id ( i, tcx) ) ,
704- glob : true ,
705- } ,
688+ let ( name, glob) = match import. kind {
689+ Simple ( s) => ( s. to_string ( ) , false ) ,
690+ Glob => (
691+ import. source . path . last_opt ( ) . unwrap_or_else ( || Symbol :: intern ( "*" ) ) . to_string ( ) ,
692+ true ,
693+ ) ,
694+ } ;
695+ Import {
696+ source : import. source . path . whole_name ( ) ,
697+ name,
698+ id : import. source . did . map ( ItemId :: from) . map ( |i| from_item_id ( i, tcx) ) ,
699+ glob,
706700 }
707701 }
708702}
Original file line number Diff line number Diff line change @@ -591,8 +591,11 @@ pub struct Import {
591591 /// May be different from the last segment of `source` when renaming imports:
592592 /// `use source as name;`
593593 pub name : String ,
594- /// The ID of the item being imported.
595- pub id : Option < Id > , // FIXME is this actually ever None?
594+ /// The ID of the item being imported. Will be `None` in case of re-exports of primitives:
595+ /// ```rust
596+ /// pub use i32 as my_i32;
597+ /// ```
598+ pub id : Option < Id > ,
596599 /// Whether this import uses a glob: `use source::*;`
597600 pub glob : bool ,
598601}
Original file line number Diff line number Diff line change @@ -12,3 +12,9 @@ mod usize {}
1212// @has - "$.index[*][?(@.name=='checked_add')]"
1313// @!is - "$.index[*][?(@.name=='checked_add')]" $local_crate_id
1414// @!has - "$.index[*][?(@.name=='is_ascii_uppercase')]"
15+
16+ // @is - "$.index[*][?(@.kind=='import' && @.inner.name=='my_i32')].inner.id" null
17+ pub use i32 as my_i32;
18+
19+ // @is - "$.index[*][?(@.kind=='import' && @.inner.name=='u32')].inner.id" null
20+ pub use u32;
You can’t perform that action at this time.
0 commit comments