rustc_builtin_macros::util

Function expr_to_string

source
pub(crate) fn expr_to_string(
    cx: &mut ExtCtxt<'_>,
    expr: P<Expr>,
    err_msg: &'static str,
) -> ExpandResult<Result<(Symbol, StrStyle), ErrorGuaranteed>, ()>
Expand description

Extracts a string literal from the macro expanded version of expr, emitting err_msg if expr is not a string literal. This does not stop compilation on error, merely emits a non-fatal error and returns Err.