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 @@ -681,24 +681,18 @@ impl FromWithTcx<clean::Variant> for Variant {
681
681
impl FromWithTcx < clean:: Import > for Import {
682
682
fn from_tcx ( import : clean:: Import , tcx : TyCtxt < ' _ > ) -> Self {
683
683
use clean:: ImportKind :: * ;
684
- match import. kind {
685
- Simple ( s) => Import {
686
- source : import. source . path . whole_name ( ) ,
687
- name : s. to_string ( ) ,
688
- id : import. source . did . map ( ItemId :: from) . map ( |i| from_item_id ( i, tcx) ) ,
689
- glob : false ,
690
- } ,
691
- Glob => Import {
692
- source : import. source . path . whole_name ( ) ,
693
- name : import
694
- . source
695
- . path
696
- . last_opt ( )
697
- . unwrap_or_else ( || Symbol :: intern ( "*" ) )
698
- . to_string ( ) ,
699
- id : import. source . did . map ( ItemId :: from) . map ( |i| from_item_id ( i, tcx) ) ,
700
- glob : true ,
701
- } ,
684
+ let ( name, glob) = match import. kind {
685
+ Simple ( s) => ( s. to_string ( ) , false ) ,
686
+ Glob => (
687
+ import. source . path . last_opt ( ) . unwrap_or_else ( || Symbol :: intern ( "*" ) ) . to_string ( ) ,
688
+ true ,
689
+ ) ,
690
+ } ;
691
+ Import {
692
+ source : import. source . path . whole_name ( ) ,
693
+ name,
694
+ id : import. source . did . map ( ItemId :: from) . map ( |i| from_item_id ( i, tcx) ) ,
695
+ glob,
702
696
}
703
697
}
704
698
}
Original file line number Diff line number Diff line change @@ -561,8 +561,11 @@ pub struct Import {
561
561
/// May be different from the last segment of `source` when renaming imports:
562
562
/// `use source as name;`
563
563
pub name : String ,
564
- /// The ID of the item being imported.
565
- pub id : Option < Id > , // FIXME is this actually ever None?
564
+ /// The ID of the item being imported. Will be `None` in case of re-exports of primitives:
565
+ /// ```rust
566
+ /// pub use i32 as my_i32;
567
+ /// ```
568
+ pub id : Option < Id > ,
566
569
/// Whether this import uses a glob: `use source::*;`
567
570
pub glob : bool ,
568
571
}
Original file line number Diff line number Diff line change @@ -12,3 +12,9 @@ mod usize {}
12
12
// @has - "$.index[*][?(@.name=='checked_add')]"
13
13
// @!is - "$.index[*][?(@.name=='checked_add')]" $local_crate_id
14
14
// @!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