|
1 |
| -// Finds items that are externally reachable, to determine which items |
2 |
| -// need to have their metadata (and possibly their AST) serialized. |
3 |
| -// All items that can be referred to through an exported name are |
4 |
| -// reachable, and when a reachable thing is inline or generic, it |
5 |
| -// makes all other generics or inline functions that it references |
6 |
| -// reachable as well. |
| 1 | +//! Finds local items that are externally reachable, to determine which items |
| 2 | +//! need to have their metadata (and possibly their AST) serialized. |
| 3 | +//! |
| 4 | +//! This set is *not* transitively closed, i.e., in general the set only contains definitions that |
| 5 | +//! can be reached *directly* via an exported name, not private functions that can only be reached |
| 6 | +//! transitively. |
| 7 | +//! |
| 8 | +//! However, there's a catch: if an item is generic or cross-crate inlinable, then it will have its |
| 9 | +//! code generated by some downstream crate. Now if that item calls private monomorphic |
| 10 | +//! non-cross-crate-inlinable items, then those can be reached by the code generated by the |
| 11 | +//! downstream create! Therefore, when a reachable thing is cross-crate inlinable or generic, it |
| 12 | +//! makes all other functions that it references reachable as well. |
7 | 13 |
|
8 | 14 | use hir::def_id::LocalDefIdSet;
|
9 | 15 | use rustc_data_structures::stack::ensure_sufficient_stack;
|
@@ -394,6 +400,7 @@ fn has_custom_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
|
394 | 400 | || codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER)
|
395 | 401 | }
|
396 | 402 |
|
| 403 | +/// See module-level doc comment above. |
397 | 404 | fn reachable_set(tcx: TyCtxt<'_>, (): ()) -> LocalDefIdSet {
|
398 | 405 | let effective_visibilities = &tcx.effective_visibilities(());
|
399 | 406 |
|
|
0 commit comments