Function rustc_expand::base::expr_to_spanned_string
source · pub fn expr_to_spanned_string<'a>(
cx: &'a mut ExtCtxt<'_>,
expr: P<Expr>,
err_msg: &'static str
) -> ExpandResult<Result<(Symbol, StrStyle, Span), Result<(Diag<'a>, bool), ErrorGuaranteed>>, ()>
Expand description
Extracts a string literal from the macro expanded version of expr
,
returning a diagnostic error of err_msg
if expr
is not a string literal.
The returned bool indicates whether an applicable suggestion has already been
added to the diagnostic to avoid emitting multiple suggestions. Err(Err(ErrorGuaranteed))
indicates that an ast error was encountered.