Skip to main content

rustc_passes/
reachable.rs

1//! Finds local items that are "reachable", which means that other crates need access to their
2//! compiled code or their *runtime* MIR. (Compile-time MIR is always encoded anyway, so we don't
3//! worry about that here.)
4//!
5//! An item is "reachable" if codegen that happens in downstream crates can end up referencing this
6//! item. This obviously includes all public items. However, some of these items cannot be codegen'd
7//! (because they are generic), and for some the compiled code is not sufficient (because we want to
8//! cross-crate inline them). These items "need cross-crate MIR". When a reachable function `f`
9//! needs cross-crate MIR, then its MIR may be codegen'd in a downstream crate, and hence items it
10//! mentions need to be considered reachable.
11//!
12//! Furthermore, if a `const`/`const fn` is reachable, then it can return pointers to other items,
13//! making those reachable as well. For instance, consider a `const fn` returning a pointer to an
14//! otherwise entirely private function: if a downstream crate calls that `const fn` to compute the
15//! initial value of a `static`, then it needs to generate a direct reference to this function --
16//! i.e., the function is directly reachable from that downstream crate! Hence we have to recurse
17//! into `const` and `const fn`.
18//!
19//! Conversely, reachability *stops* when it hits a monomorphic non-`const` function that we do not
20//! want to cross-crate inline. That function will just be codegen'd in this crate, which means the
21//! monomorphization collector will consider it a root and then do another graph traversal to
22//! codegen everything called by this function -- but that's a very different graph from what we are
23//! considering here as at that point, everything is monomorphic.
24
25use hir::def_id::LocalDefIdSet;
26use rustc_hir as hir;
27use rustc_hir::Node;
28use rustc_hir::def::{DefKind, Res};
29use rustc_hir::def_id::{DefId, LocalDefId};
30use rustc_hir::intravisit::{self, Visitor};
31use rustc_middle::bug;
32use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
33use rustc_middle::middle::privacy::{self, Level};
34use rustc_middle::mir::interpret::{ConstAllocation, ErrorHandled, GlobalAlloc};
35use rustc_middle::query::Providers;
36use rustc_middle::ty::{self, ExistentialTraitRef, TyCtxt};
37use rustc_privacy::DefIdVisitor;
38use rustc_session::config::CrateType;
39use tracing::debug;
40
41/// Determines whether this item is recursive for reachability. See `is_recursively_reachable_local`
42/// below for details.
43fn recursively_reachable(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
44    tcx.generics_of(def_id).requires_monomorphization(tcx)
45        || tcx.cross_crate_inlinable(def_id)
46        || tcx.is_const_fn(def_id)
47}
48
49// Information needed while computing reachability.
50struct ReachableContext<'tcx> {
51    // The type context.
52    tcx: TyCtxt<'tcx>,
53    maybe_typeck_results: Option<&'tcx ty::TypeckResults<'tcx>>,
54    // The set of items which must be exported in the linkage sense.
55    reachable_symbols: LocalDefIdSet,
56    // A worklist of item IDs. Each item ID in this worklist will be inlined
57    // and will be scanned for further references.
58    // FIXME(eddyb) benchmark if this would be faster as a `VecDeque`.
59    worklist: Vec<LocalDefId>,
60    // Whether any output of this compilation is a library
61    any_library: bool,
62}
63
64impl<'tcx> Visitor<'tcx> for ReachableContext<'tcx> {
65    fn visit_nested_body(&mut self, body: hir::BodyId) {
66        let old_maybe_typeck_results =
67            self.maybe_typeck_results.replace(self.tcx.typeck_body(body));
68        let body = self.tcx.hir_body(body);
69        self.visit_body(body);
70        self.maybe_typeck_results = old_maybe_typeck_results;
71    }
72
73    fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) {
74        let res = match expr.kind {
75            hir::ExprKind::Path(ref qpath) => {
76                // This covers fn ptr casts but also "non-method" calls.
77                Some(self.typeck_results().qpath_res(qpath, expr.hir_id))
78            }
79            hir::ExprKind::MethodCall(..) => {
80                // Method calls don't involve a full "path", so we need to determine the callee
81                // based on the receiver type.
82                // If this is a method call on a generic type, we might not be able to find the
83                // callee. That's why `reachable_set` also adds all potential callees for such
84                // calls, i.e. all trait impl items, to the reachable set. So here we only worry
85                // about the calls we can identify.
86                self.typeck_results()
87                    .type_dependent_def(expr.hir_id)
88                    .map(|(kind, def_id)| Res::Def(kind, def_id))
89            }
90            hir::ExprKind::Closure(&hir::Closure { def_id, .. }) => {
91                self.reachable_symbols.insert(def_id);
92                None
93            }
94            _ => None,
95        };
96
97        if let Some(res) = res {
98            self.propagate_item(res);
99        }
100
101        intravisit::walk_expr(self, expr)
102    }
103
104    fn visit_inline_asm(&mut self, asm: &'tcx hir::InlineAsm<'tcx>, id: hir::HirId) {
105        for (op, _) in asm.operands {
106            if let hir::InlineAsmOperand::SymStatic { def_id, .. } = op
107                && let Some(def_id) = def_id.as_local()
108            {
109                self.reachable_symbols.insert(def_id);
110            }
111        }
112        intravisit::walk_inline_asm(self, asm, id);
113    }
114}
115
116impl<'tcx> ReachableContext<'tcx> {
117    /// Gets the type-checking results for the current body.
118    /// As this will ICE if called outside bodies, only call when working with
119    /// `Expr` or `Pat` nodes (they are guaranteed to be found only in bodies).
120    #[track_caller]
121    fn typeck_results(&self) -> &'tcx ty::TypeckResults<'tcx> {
122        self.maybe_typeck_results
123            .expect("`ReachableContext::typeck_results` called outside of body")
124    }
125
126    /// Returns true if the given def ID represents a local item that is recursive for reachability,
127    /// i.e. whether everything mentioned in here also needs to be considered reachable.
128    ///
129    /// There are two reasons why an item may be recursively reachable:
130    /// - It needs cross-crate MIR (see the module-level doc comment above).
131    /// - It is a `const` or `const fn`. This is *not* because we need the MIR to interpret them
132    ///   (MIR for const-eval and MIR for codegen is separate, and MIR for const-eval is always
133    ///   encoded). Instead, it is because `const fn` can create `fn()` pointers to other items
134    ///   which end up in the evaluated result of the constant and can then be called from other
135    ///   crates. Those items must be considered reachable.
136    fn is_recursively_reachable_local(&self, def_id: DefId) -> bool {
137        let Some(def_id) = def_id.as_local() else {
138            return false;
139        };
140
141        match self.tcx.hir_node_by_def_id(def_id) {
142            Node::Item(item) => match item.kind {
143                hir::ItemKind::Fn { .. } => recursively_reachable(self.tcx, def_id.into()),
144                _ => false,
145            },
146            Node::TraitItem(trait_method) => match trait_method.kind {
147                hir::TraitItemKind::Const(_, ref default) => default.is_some(),
148                hir::TraitItemKind::Fn(_, hir::TraitFn::Provided(_)) => true,
149                hir::TraitItemKind::Fn(_, hir::TraitFn::Required(_))
150                | hir::TraitItemKind::Type(..) => false,
151            },
152            Node::ImplItem(impl_item) => match impl_item.kind {
153                hir::ImplItemKind::Const(..) => true,
154                hir::ImplItemKind::Fn(..) => {
155                    recursively_reachable(self.tcx, impl_item.hir_id().owner.to_def_id())
156                }
157                hir::ImplItemKind::Type(_) => false,
158            },
159            Node::Expr(&hir::Expr { kind: hir::ExprKind::Closure(..), .. }) => true,
160            _ => false,
161        }
162    }
163
164    // Step 2: Mark all symbols that the symbols on the worklist touch.
165    fn propagate(&mut self) {
166        let mut scanned = LocalDefIdSet::default();
167        while let Some(search_item) = self.worklist.pop() {
168            if !scanned.insert(search_item) {
169                continue;
170            }
171
172            self.propagate_node(&self.tcx.hir_node_by_def_id(search_item), search_item);
173        }
174    }
175
176    fn propagate_node(&mut self, node: &Node<'tcx>, search_item: LocalDefId) {
177        if !self.any_library {
178            // If we are building an executable, only explicitly extern
179            // types need to be exported.
180            let codegen_attrs = if self.tcx.def_kind(search_item).has_codegen_attrs() {
181                self.tcx.codegen_fn_attrs(search_item)
182            } else {
183                CodegenFnAttrs::EMPTY
184            };
185            let is_extern = codegen_attrs.contains_extern_indicator();
186            // Right now, the only way to get "foreign item symbol aliases" is by being an EII-implementation.
187            // EII implementations will generate under their own name but also under the name of some foreign item
188            // (hence alias) that may be in another crate. These functions are marked as always-reachable since
189            // it's very hard to track whether the original foreign item was reachable. It may live in another crate
190            // and may be reachable from sibling crates.
191            let has_foreign_aliases_eii = !codegen_attrs.foreign_item_symbol_aliases.is_empty();
192            if is_extern || has_foreign_aliases_eii {
193                self.reachable_symbols.insert(search_item);
194            }
195        } else {
196            // If we are building a library, then reachable symbols will
197            // continue to participate in linkage after this product is
198            // produced. In this case, we traverse the ast node, recursing on
199            // all reachable nodes from this one.
200            self.reachable_symbols.insert(search_item);
201        }
202
203        match *node {
204            Node::Item(item) => {
205                match item.kind {
206                    hir::ItemKind::Fn { body, .. } => {
207                        if recursively_reachable(self.tcx, item.owner_id.into()) {
208                            self.visit_nested_body(body);
209                        }
210                    }
211                    // For `type const` we want to evaluate the RHS.
212                    hir::ItemKind::Const(_, _, _, init @ hir::ConstItemRhs::TypeConst(_)) => {
213                        self.visit_const_item_rhs(init);
214                    }
215                    hir::ItemKind::Const(_, _, _, init) => {
216                        if self.tcx.generics_of(item.owner_id).own_requires_monomorphization() {
217                            // In this case, we don't want to evaluate the const initializer.
218                            // In lieu of that, we have to consider everything mentioned in it
219                            // as reachable, since it *may* end up in the final value.
220                            self.visit_const_item_rhs(init);
221                            return;
222                        }
223
224                        match self.tcx.const_eval_poly_to_alloc(item.owner_id.def_id.into()) {
225                            Ok(alloc) => {
226                                // Only things actually ending up in the final constant value are
227                                // reachable for codegen. Everything else is only needed during
228                                // const-eval, so even if const-eval happens in a downstream crate,
229                                // all they need is `mir_for_ctfe`.
230                                let alloc = self.tcx.global_alloc(alloc.alloc_id).unwrap_memory();
231                                self.propagate_from_alloc(alloc);
232                            }
233                            // Trivially unsatisfiable bounds on the item prevented us from
234                            // normalizing the initializer. Similar to the other case, we have to
235                            // everything mentioned in it as reachable.
236                            Err(ErrorHandled::TooGeneric(_)) => self.visit_const_item_rhs(init),
237                            // If there was an error evaluating the const, nothing can be reachable
238                            // via it, and anyway compilation will fail.
239                            Err(ErrorHandled::Reported(..)) => {}
240                        }
241                    }
242                    hir::ItemKind::Static(..) => {
243                        if let Ok(alloc) = self.tcx.eval_static_initializer(item.owner_id.def_id) {
244                            self.propagate_from_alloc(alloc);
245                        }
246                    }
247
248                    // These are normal, nothing reachable about these
249                    // inherently and their children are already in the
250                    // worklist, as determined by the privacy pass
251                    hir::ItemKind::ExternCrate(..)
252                    | hir::ItemKind::Use(..)
253                    | hir::ItemKind::TyAlias(..)
254                    | hir::ItemKind::Macro(..)
255                    | hir::ItemKind::Mod(..)
256                    | hir::ItemKind::ForeignMod { .. }
257                    | hir::ItemKind::Impl { .. }
258                    | hir::ItemKind::Trait { .. }
259                    | hir::ItemKind::TraitAlias(..)
260                    | hir::ItemKind::Struct(..)
261                    | hir::ItemKind::Enum(..)
262                    | hir::ItemKind::Union(..)
263                    | hir::ItemKind::GlobalAsm { .. } => {}
264                }
265            }
266            Node::TraitItem(trait_method) => {
267                match trait_method.kind {
268                    hir::TraitItemKind::Const(_, None)
269                    | hir::TraitItemKind::Fn(_, hir::TraitFn::Required(_)) => {
270                        // Keep going, nothing to get exported
271                    }
272                    hir::TraitItemKind::Const(_, Some(rhs)) => self.visit_const_item_rhs(rhs),
273                    hir::TraitItemKind::Fn(_, hir::TraitFn::Provided(body_id)) => {
274                        self.visit_nested_body(body_id);
275                    }
276                    hir::TraitItemKind::Type(..) => {}
277                }
278            }
279            Node::ImplItem(impl_item) => match impl_item.kind {
280                hir::ImplItemKind::Const(_, rhs) => {
281                    self.visit_const_item_rhs(rhs);
282                }
283                hir::ImplItemKind::Fn(_, body) => {
284                    if recursively_reachable(self.tcx, impl_item.hir_id().owner.to_def_id()) {
285                        self.visit_nested_body(body)
286                    }
287                }
288                hir::ImplItemKind::Type(_) => {}
289            },
290            Node::Expr(&hir::Expr {
291                kind: hir::ExprKind::Closure(&hir::Closure { body, .. }),
292                ..
293            }) => {
294                self.visit_nested_body(body);
295            }
296            // Nothing to recurse on for these
297            Node::ForeignItem(_)
298            | Node::Variant(_)
299            | Node::Ctor(..)
300            | Node::Field(_)
301            | Node::Ty(_)
302            | Node::Crate(_)
303            | Node::Synthetic
304            | Node::OpaqueTy(..) => {}
305            _ => {
306                ::rustc_middle::util::bug::bug_fmt(format_args!("found unexpected node kind in worklist: {0} ({1:?})",
        self.tcx.hir_id_to_string(self.tcx.local_def_id_to_hir_id(search_item)),
        node));bug!(
307                    "found unexpected node kind in worklist: {} ({:?})",
308                    self.tcx.hir_id_to_string(self.tcx.local_def_id_to_hir_id(search_item)),
309                    node,
310                );
311            }
312        }
313    }
314
315    /// Finds things to add to `reachable_symbols` within allocations.
316    /// In contrast to visit_nested_body this ignores things that were only needed to evaluate
317    /// the allocation.
318    fn propagate_from_alloc(&mut self, alloc: ConstAllocation<'tcx>) {
319        if !self.any_library {
320            return;
321        }
322        for (_, prov) in alloc.0.provenance().ptrs().iter() {
323            match self.tcx.global_alloc(prov.alloc_id()) {
324                GlobalAlloc::Static(def_id) => {
325                    self.propagate_item(Res::Def(self.tcx.def_kind(def_id), def_id))
326                }
327                GlobalAlloc::Function { instance, .. } => {
328                    // Manually visit to actually see the instance's `DefId`. Type visitors won't see it
329                    self.propagate_item(Res::Def(
330                        self.tcx.def_kind(instance.def_id()),
331                        instance.def_id(),
332                    ));
333                    self.visit(instance.args);
334                }
335                GlobalAlloc::VTable(ty, dyn_ty) => {
336                    self.visit(ty);
337                    // Manually visit to actually see the trait's `DefId`. Type visitors won't see it
338                    if let Some(trait_ref) = dyn_ty.principal() {
339                        let ExistentialTraitRef { def_id, args, .. } = trait_ref.skip_binder();
340                        self.visit_def_id(def_id, "", &"");
341                        self.visit(args);
342                    }
343                }
344                GlobalAlloc::TypeId { ty, .. } => self.visit(ty),
345                GlobalAlloc::Memory(alloc) => self.propagate_from_alloc(alloc),
346            }
347        }
348    }
349
350    fn propagate_item(&mut self, res: Res) {
351        let Res::Def(kind, def_id) = res else { return };
352        let Some(def_id) = def_id.as_local() else { return };
353        match kind {
354            DefKind::Static { nested: true, .. } => {
355                // This is the main purpose of this function: add the def_id we find
356                // to `reachable_symbols`.
357                if self.reachable_symbols.insert(def_id) {
358                    if let Ok(alloc) = self.tcx.eval_static_initializer(def_id) {
359                        // This cannot cause infinite recursion, because we abort by inserting into the
360                        // work list once we hit a normal static. Nested statics, even if they somehow
361                        // become recursive, are also not infinitely recursing, because of the
362                        // `reachable_symbols` check above.
363                        // We still need to protect against stack overflow due to deeply nested statics.
364                        self.propagate_from_alloc(alloc);
365                    }
366                }
367            }
368            // Reachable constants and reachable statics can have their contents inlined
369            // into other crates. Mark them as reachable and recurse into their body.
370            DefKind::Const { .. } | DefKind::AssocConst { .. } | DefKind::Static { .. } => {
371                self.worklist.push(def_id);
372            }
373            _ => {
374                if self.is_recursively_reachable_local(def_id.to_def_id()) {
375                    self.worklist.push(def_id);
376                } else {
377                    self.reachable_symbols.insert(def_id);
378                }
379            }
380        }
381    }
382}
383
384impl<'tcx> DefIdVisitor<'tcx> for ReachableContext<'tcx> {
385    type Result = ();
386
387    fn tcx(&self) -> TyCtxt<'tcx> {
388        self.tcx
389    }
390
391    fn visit_def_id(
392        &mut self,
393        def_id: DefId,
394        _kind: &str,
395        _descr: &dyn std::fmt::Display,
396    ) -> Self::Result {
397        self.propagate_item(Res::Def(self.tcx.def_kind(def_id), def_id))
398    }
399}
400
401fn check_item<'tcx>(
402    tcx: TyCtxt<'tcx>,
403    id: hir::ItemId,
404    worklist: &mut Vec<LocalDefId>,
405    effective_visibilities: &privacy::EffectiveVisibilities,
406) {
407    if has_custom_linkage(tcx, id.owner_id.def_id) {
408        worklist.push(id.owner_id.def_id);
409    }
410
411    if !#[allow(non_exhaustive_omitted_patterns)] match tcx.def_kind(id.owner_id) {
    DefKind::Impl { of_trait: true } => true,
    _ => false,
}matches!(tcx.def_kind(id.owner_id), DefKind::Impl { of_trait: true }) {
412        return;
413    }
414
415    // We need only trait impls here, not inherent impls, and only non-exported ones
416    if effective_visibilities.is_reachable(id.owner_id.def_id) {
417        return;
418    }
419
420    let items = tcx.associated_item_def_ids(id.owner_id);
421    worklist.extend(items.iter().map(|ii_ref| ii_ref.expect_local()));
422
423    let trait_def_id = tcx.impl_trait_id(id.owner_id.to_def_id());
424
425    if !trait_def_id.is_local() {
426        return;
427    }
428
429    worklist
430        .extend(tcx.provided_trait_methods(trait_def_id).map(|assoc| assoc.def_id.expect_local()));
431}
432
433fn has_custom_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
434    // Anything which has custom linkage gets thrown on the worklist no
435    // matter where it is in the crate, along with "special std symbols"
436    // which are currently akin to allocator symbols.
437    if !tcx.def_kind(def_id).has_codegen_attrs() {
438        return false;
439    }
440
441    let codegen_attrs = tcx.codegen_fn_attrs(def_id);
442    codegen_attrs.contains_extern_indicator()
443        // FIXME(nbdd0121): `#[used]` are marked as reachable here so it's picked up by
444        // `linked_symbols` in cg_ssa. They won't be exported in binary or cdylib due to their
445        // `SymbolExportLevel::Rust` export level but may end up being exported in dylibs.
446        // Also note that Miri is relying on this to be able to find private `link_section` statics
447        // across all crates.
448        || codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_COMPILER)
449        || codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER)
450        // Right now, the only way to get "foreign item symbol aliases" is by being an EII-implementation.
451        // EII implementations will generate under their own name but also under the name of some foreign item
452        // (hence alias) that may be in another crate. These functions are marked as always-reachable since
453        // it's very hard to track whether the original foreign item was reachable. It may live in another crate
454        // and may be reachable from sibling crates.
455        || !codegen_attrs.foreign_item_symbol_aliases.is_empty()
456}
457
458/// See module-level doc comment above.
459fn reachable_set(tcx: TyCtxt<'_>, (): ()) -> LocalDefIdSet {
460    let effective_visibilities = &tcx.effective_visibilities(());
461
462    let any_library = tcx.crate_types().iter().any(|ty| {
463        *ty == CrateType::Rlib
464            || *ty == CrateType::Dylib
465            || *ty == CrateType::ProcMacro
466            || *ty == CrateType::Sdylib
467    });
468    let mut reachable_context = ReachableContext {
469        tcx,
470        maybe_typeck_results: None,
471        reachable_symbols: Default::default(),
472        worklist: Vec::new(),
473        any_library,
474    };
475
476    // Step 1: Seed the worklist with all nodes which were found to be public as
477    //         a result of the privacy pass along with all local lang items and impl items.
478    //         If other crates link to us, they're going to expect to be able to
479    //         use the lang items, so we need to be sure to mark them as
480    //         exported.
481    reachable_context.worklist = effective_visibilities
482        .iter()
483        .filter_map(|(&id, effective_vis)| {
484            effective_vis.is_public_at_level(Level::ReachableThroughImplTrait).then_some(id)
485        })
486        .collect::<Vec<_>>();
487
488    for (_, def_id) in tcx.lang_items().iter() {
489        if let Some(def_id) = def_id.as_local() {
490            reachable_context.worklist.push(def_id);
491        }
492    }
493    {
494        // As explained above, we have to mark all functions called from reachable
495        // `item_might_be_inlined` items as reachable. The issue is, when those functions are
496        // generic and call a trait method, we have no idea where that call goes! So, we
497        // conservatively mark all trait impl items as reachable.
498        // FIXME: One possible strategy for pruning the reachable set is to avoid marking impl
499        // items of non-exported traits (or maybe all local traits?) unless their respective
500        // trait items are used from inlinable code through method call syntax or UFCS, or their
501        // trait is a lang item.
502        // (But if you implement this, don't forget to take into account that vtables can also
503        // make trait methods reachable!)
504        let crate_items = tcx.hir_crate_items(());
505
506        for id in crate_items.free_items() {
507            check_item(tcx, id, &mut reachable_context.worklist, effective_visibilities);
508        }
509
510        for id in crate_items.impl_items() {
511            if has_custom_linkage(tcx, id.owner_id.def_id) {
512                reachable_context.worklist.push(id.owner_id.def_id);
513            }
514        }
515    }
516
517    // Step 2: Mark all symbols that the symbols on the worklist touch.
518    reachable_context.propagate();
519
520    {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event compiler/rustc_passes/src/reachable.rs:520",
                        "rustc_passes::reachable", ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("compiler/rustc_passes/src/reachable.rs"),
                        ::tracing_core::__macro_support::Option::Some(520u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_passes::reachable"),
                        ::tracing_core::field::FieldSet::new(&["message"],
                            ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("Inline reachability shows: {0:?}",
                                                    reachable_context.reachable_symbols) as
                                            &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("Inline reachability shows: {:?}", reachable_context.reachable_symbols);
521
522    // Return the set of reachable symbols.
523    reachable_context.reachable_symbols
524}
525
526pub(crate) fn provide(providers: &mut Providers) {
527    *providers = Providers { reachable_set, ..*providers };
528}