File tree Expand file tree Collapse file tree 2 files changed +46
-2
lines changed
crates/hir-def/src/nameres Expand file tree Collapse file tree 2 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -910,8 +910,13 @@ impl DefCollector<'_> {
910
910
self . update ( module_id, & items, vis, Some ( ImportType :: Glob ( id) ) ) ;
911
911
// record the glob import in case we add further items
912
912
let glob = self . glob_imports . entry ( m. local_id ) . or_default ( ) ;
913
- if !glob. iter ( ) . any ( |( mid, _, _) | * mid == module_id) {
914
- glob. push ( ( module_id, vis, id) ) ;
913
+ match glob. iter_mut ( ) . find ( |( mid, _, _) | * mid == module_id) {
914
+ None => glob. push ( ( module_id, vis, id) ) ,
915
+ Some ( ( _, old_vis, _) ) => {
916
+ if let Some ( new_vis) = old_vis. max ( vis, & self . def_map ) {
917
+ * old_vis = new_vis;
918
+ }
919
+ }
915
920
}
916
921
}
917
922
}
Original file line number Diff line number Diff line change @@ -451,3 +451,42 @@ mod glob_target {
451
451
"# ] ] ,
452
452
) ;
453
453
}
454
+
455
+ #[ test]
456
+ fn regression_18580 ( ) {
457
+ check (
458
+ r#"
459
+ pub mod libs {
460
+ pub struct Placeholder;
461
+ }
462
+
463
+ pub mod reexport_2 {
464
+ use reexport_1::*;
465
+ pub use reexport_1::*;
466
+
467
+ pub mod reexport_1 {
468
+ pub use crate::libs::*;
469
+ }
470
+ }
471
+
472
+ use reexport_2::*;
473
+ "# ,
474
+ expect ! [ [ r#"
475
+ crate
476
+ Placeholder: t v
477
+ libs: t
478
+ reexport_1: t
479
+ reexport_2: t
480
+
481
+ crate::libs
482
+ Placeholder: t v
483
+
484
+ crate::reexport_2
485
+ Placeholder: t v
486
+ reexport_1: t
487
+
488
+ crate::reexport_2::reexport_1
489
+ Placeholder: t v
490
+ "# ] ] ,
491
+ ) ;
492
+ }
You can’t perform that action at this time.
0 commit comments