|
1 |
| -use std::collections::hash_map::Entry; |
| 1 | +ƒ√use std::collections::hash_map::Entry; |
2 | 2 | use std::collections::{BTreeMap, VecDeque};
|
3 | 3 |
|
4 | 4 | use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
|
@@ -133,10 +133,12 @@ pub(crate) fn build_index<'tcx>(
|
133 | 133 | let exact_fqp = exact_paths
|
134 | 134 | .get(&defid)
|
135 | 135 | .or_else(|| external_paths.get(&defid).map(|&(ref fqp, _)| fqp))
|
136 |
| - // re-exports only count if the name is exactly the same |
137 |
| - // this is a size optimization, as well as a DWIM attempt |
138 |
| - // since if the names are not the same, the intent probably |
139 |
| - // isn't, either |
| 136 | + // Re-exports only count if the name is exactly the same. |
| 137 | + // This is a size optimization, since it means we only need |
| 138 | + // to store the name once (and the path is re-used for everything |
| 139 | + // exported from this same module). It's also likely to Do |
| 140 | + // What I Mean, since if a re-export changes the name, it might |
| 141 | + // also be a change in semantic meaning. |
140 | 142 | .filter(|fqp| fqp.last() == fqp.last());
|
141 | 143 | Some(insert_into_map(
|
142 | 144 | itemid_to_pathid,
|
@@ -319,10 +321,12 @@ pub(crate) fn build_index<'tcx>(
|
319 | 321 | .get(&defid)
|
320 | 322 | .or_else(|| external_paths.get(&defid).map(|&(ref fqp, _)| fqp));
|
321 | 323 | item.exact_path = exact_fqp.and_then(|fqp| {
|
322 |
| - // re-exports only count if the name is exactly the same |
323 |
| - // this is a size optimization, as well as a DWIM attempt |
324 |
| - // since if the names are not the same, the intent probably |
325 |
| - // isn't, either |
| 324 | + // Re-exports only count if the name is exactly the same. |
| 325 | + // This is a size optimization, since it means we only need |
| 326 | + // to store the name once (and the path is re-used for everything |
| 327 | + // exported from this same module). It's also likely to Do |
| 328 | + // What I Mean, since if a re-export changes the name, it might |
| 329 | + // also be a change in semantic meaning. |
326 | 330 | if fqp.last() != Some(&item.name) {
|
327 | 331 | return None;
|
328 | 332 | }
|
|
0 commit comments