File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,12 @@ use rustc_span::source_map;
2424use rustc_span:: symbol:: sym;
2525use rustc_span:: DUMMY_SP ;
2626
27- use std:: cell:: { Cell , RefCell } ;
2827use std:: mem;
2928use std:: rc:: Rc ;
29+ use std:: {
30+ cell:: { Cell , RefCell } ,
31+ collections:: hash_map:: Entry ,
32+ } ;
3033
3134use crate :: clean;
3235use crate :: clean:: { AttributesExt , MAX_DEF_ID } ;
@@ -150,14 +153,18 @@ impl<'tcx> DocContext<'tcx> {
150153
151154 let mut fake_ids = self . fake_def_ids . borrow_mut ( ) ;
152155
153- let def_id = fake_ids. entry ( crate_num) . or_insert ( start_def_id) ;
156+ let def_id = match fake_ids. entry ( crate_num) {
157+ Entry :: Vacant ( e) => {
158+ MAX_DEF_ID . with ( |m| {
159+ m. borrow_mut ( ) . insert ( crate_num, start_def_id) ;
160+ } ) ;
161+ e. insert ( start_def_id)
162+ }
163+ Entry :: Occupied ( e) => e. into_mut ( ) ,
164+ } ;
154165 * def_id = DefId { krate : crate_num, index : DefIndex :: from ( def_id. index . index ( ) + 1 ) } ;
155166 let def_id = * def_id;
156167
157- MAX_DEF_ID . with ( |m| {
158- m. borrow_mut ( ) . entry ( def_id. krate ) . or_insert ( start_def_id) ;
159- } ) ;
160-
161168 self . all_fake_def_ids . borrow_mut ( ) . insert ( def_id) ;
162169
163170 def_id
You can’t perform that action at this time.
0 commit comments