## is_fn_or_trait_safe_to_expose_on_stable

# Function is_fn_or_trait_safe_to_expose_on_stable

Source

    pub fn is_fn_or_trait_safe_to_expose_on_stable(
        tcx: TyCtxt<'_>,
        def_id: DefId,
    ) -> bool

Expand description

Returns `true` if the given `def_id` (trait or function) is “safe to expose on stable”.

This is relevant within a `staged_api` crate. Unlike with normal features, the use of unstable const features recursively taints the functions that use them. This is to avoid accidentally exposing e.g. the implementation of an unstable const intrinsic on stable. So we partition the world into two functions: those that are safe to expose on stable (and hence may not use unstable features, not even recursively), and those that are not.