File tree 3 files changed +23
-20
lines changed
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 {
685
685
impl FromWithTcx < clean:: Import > for Import {
686
686
fn from_tcx ( import : clean:: Import , tcx : TyCtxt < ' _ > ) -> Self {
687
687
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,
706
700
}
707
701
}
708
702
}
Original file line number Diff line number Diff line change @@ -591,8 +591,11 @@ pub struct Import {
591
591
/// May be different from the last segment of `source` when renaming imports:
592
592
/// `use source as name;`
593
593
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 > ,
596
599
/// Whether this import uses a glob: `use source::*;`
597
600
pub glob : bool ,
598
601
}
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