## IntoDiagArg

# Trait IntoDiagArg

    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§

#### 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§

§

### impl IntoDiagArg for Level

§

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

§

### impl IntoDiagArg for bool

§

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

§

### impl IntoDiagArg for char

§

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

§

### impl IntoDiagArg for i8

§

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

§

### impl IntoDiagArg for i16

§

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

§

### impl IntoDiagArg for i32

§

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

§

### impl IntoDiagArg for i64

§

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

§

### impl IntoDiagArg for i128

§

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

§

### impl IntoDiagArg for isize

§

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

§

### impl IntoDiagArg for u8

§

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

§

### impl IntoDiagArg for u16

§

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

§

### impl IntoDiagArg for u32

§

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

§

### impl IntoDiagArg for u64

§

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

§

### impl IntoDiagArg for u128

§

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

§

### impl IntoDiagArg for usize

§

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

§

### impl IntoDiagArg for Box<dyn Error>

§

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

§

### impl IntoDiagArg for CString

§

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

§

### impl IntoDiagArg for String

§

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

§

### impl IntoDiagArg for Vec<char>

§

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

§

### impl IntoDiagArg for ParseIntError

§

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

§

### impl IntoDiagArg for NonZero<u32>

§

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

§

### impl IntoDiagArg for Backtrace

§

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

§

### impl IntoDiagArg for Error

§

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

§

### impl IntoDiagArg for PathBuf

§

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

§

### impl IntoDiagArg for ExitStatus

§

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

§

### impl IntoDiagArg for Edition

§

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

§

### impl IntoDiagArg for Expr

§

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

§

### impl IntoDiagArg for ExprPrecedence

§

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

§

### impl IntoDiagArg for ExternAbi

§

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

§

### impl IntoDiagArg for FloatTy

§

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

§

### impl IntoDiagArg for Ident

§

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

§

### impl IntoDiagArg for MacroRulesNormalizedIdent

§

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

§

### impl IntoDiagArg for ParamKindOrd

§

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

§

### impl IntoDiagArg for Path

§

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

§

### impl IntoDiagArg for SmallCStr

§

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

§

### impl IntoDiagArg for Symbol

§

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

§

### impl IntoDiagArg for Token

§

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

§

### impl IntoDiagArg for TokenKind

§

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

§

### impl IntoDiagArg for Visibility

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

## Implementors§

§

### impl IntoDiagArg for DiagArgValue

Source§

### impl IntoDiagArg for rustc_errors::Level

Source§

### impl IntoDiagArg for ErrCode

Source§

### impl IntoDiagArg for DiagLocation

§

### impl IntoDiagArg for DiagArgFromDisplay<'_>

Source§

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