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
) -> Result<(Symbol, StrStyle, Span), Option<(DiagnosticBuilder<'a, ErrorGuaranteed>, bool)>>
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(None)
indicates that an ast error was encountered.