Why does the nighly feature "expand_expr" giving me an ExpandError?

/// # Examples
/// ```
/// let x = rimpiazza::replace_expand!(include_str!("../testfile"), "hate" => "love");
/// assert_eq!("I love pizza", x);
/// ```
#[proc_macro]
#[cfg(feature = "nightly")]
pub fn replace_expand(input: TokenStream) -> TokenStream {
    let input = input.expand_expr().expect("Couldn't expand macros");
    replace(input)
}

The test above fails, why can't it expand the include_str!() macro?

It's explicitly documented.

Parses this TokenStream as an expression and attempts to expand any macros within it. Returns the expanded TokenStream.

Currently only expressions expanding to literals will succeed, although this may be relaxed in the future.

Your input is not even an expression in the first place.

Thank you again!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.