IsSuggestable in rustc_middle::ty - Rust
Description: API documentation for the Rust `IsSuggestable` trait in crate `rustc_middle`.

Skip to main content

## IsSuggestable

# Trait IsSuggestable

Source

    pub trait IsSuggestable<'tcx>: Sized {
        // Required methods
        fn is_suggestable(self, tcx: TyCtxt<'tcx>, infer_suggestable: bool) -> bool;
        fn make_suggestable(
            self,
            tcx: TyCtxt<'tcx>,
            infer_suggestable: bool,
            placeholder: Option<Ty<'tcx>>,
        ) -> Option<Self>;
    }

## Required Methods§

Source

#### fn is_suggestable(self, tcx: TyCtxt<'tcx>, infer_suggestable: bool) -> bool

Whether this makes sense to suggest in a diagnostic.

We filter out certain types and constants since they don’t provide meaningful rendered suggestions when pretty-printed. We leave some nonsense, such as region vars, since those render as `'_` and are usually okay to reinterpret as elided lifetimes.

Only if `infer_suggestable` is true, we consider type and const inference variables to be suggestable.

Source

#### fn make_suggestable( self, tcx: TyCtxt<'tcx>, infer_suggestable: bool, placeholder: Option<Ty<'tcx>>, ) -> Option<Self>

## Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

## Implementors§

Source§

### impl<'tcx, T> IsSuggestable<'tcx> for T
where T: TypeVisitable<TyCtxt<'tcx>> + TypeFoldable<TyCtxt<'tcx>>,