## IntoDiagArg

# Trait IntoDiagArg

Source

    pub trait IntoDiagArg {
        // Required method
        fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue;
    }

Expand description

Converts a value of a type into a `DiagArg` (typically a field of an `Diag` struct). Implemented as a custom trait rather than `From` so that it is implemented on the type being converted rather than on `DiagArgValue`, which enables types from other `rustc_*` crates to implement this.

## Required Methods§

Source

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Convert `Self` into a `DiagArgValue` suitable for rendering in a diagnostic.

It takes a `path` where “long values” could be written to, if the `DiagArgValue` is too big for displaying on the terminal. This path comes from the `Diag` itself. When rendering values that come from `TyCtxt`, like `Ty<'_>`, they can use `TyCtxt::short_string`. If a value has no shortening logic that could be used, the argument can be safely ignored.

## Implementations on Foreign Types§

Source§

### impl IntoDiagArg for ExternAbi

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for bool

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for char

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for i8

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for i16

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for i32

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for i64

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for i128

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for isize

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for u8

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for u16

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for u32

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for u64

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for u128

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for usize

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for Box<dyn Error>

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for CString

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for String

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for Vec<char>

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for ParseIntError

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for NonZero<u32>

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for Backtrace

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for Error

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for PathBuf

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for ExitStatus

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for Edition

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for Expr

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for ExprPrecedence

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for FloatTy

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for Ident

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

§

### impl IntoDiagArg for Level

§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for MacroRulesNormalizedIdent

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for ParamKindOrd

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for Path

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for SmallCStr

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for Symbol

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for Token

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for TokenKind

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl IntoDiagArg for Visibility

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl<'a> IntoDiagArg for &'a str

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl<'a> IntoDiagArg for &'a Path

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl<'a> IntoDiagArg for Cow<'a, str>

Source§

#### fn into_diag_arg(self, _: &mut Option<PathBuf>) -> DiagArgValue

Source§

### impl<'a, T> IntoDiagArg for &'a T
where T: Clone + IntoDiagArg,

Source§

#### fn into_diag_arg(self, path: &mut Option<PathBuf>) -> DiagArgValue

## Implementors§

Source§

### impl IntoDiagArg for DiagArgValue

Source§

### impl IntoDiagArg for rustc_errors::Level

Source§

### impl IntoDiagArg for ErrCode

Source§

### impl IntoDiagArg for DiagLocation

Source§

### impl IntoDiagArg for DiagArgFromDisplay<'_>

Source§

### impl<S: Display> IntoDiagArg for DiagSymbolList<S>