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 ParamKindOrd

§

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

§

impl IntoDiagArg for TokenKind

§

impl IntoDiagArg for ExprPrecedence

§

impl IntoDiagArg for Edition

§

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

§

impl IntoDiagArg for bool

§

impl IntoDiagArg for char

§

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

§

impl IntoDiagArg for String

§

impl IntoDiagArg for Vec<char>

§

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 Expr

§

impl IntoDiagArg for Path

§

impl IntoDiagArg for Visibility

§

impl IntoDiagArg for Token

§

impl IntoDiagArg for SmallCStr

§

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 Symbol

§

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

§

impl IntoDiagArg for Backtrace

§

impl IntoDiagArg for Error

§

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

§

impl IntoDiagArg for PathBuf

§

impl IntoDiagArg for ExitStatus

§

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

§

impl IntoDiagArg for ExternAbi

§

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

§

impl IntoDiagArg for FloatTy

§

impl IntoDiagArg for Level

§

impl<'a> IntoDiagArg for &'a str

§

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

§

impl<'a> IntoDiagArg for &'a Path

§

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

§

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

§

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

Implementors§