Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE when passing format!() to doc_comment!() #66854

Closed
DoubleHyphen opened this issue Nov 28, 2019 · 1 comment
Closed

ICE when passing format!() to doc_comment!() #66854

DoubleHyphen opened this issue Nov 28, 2019 · 1 comment

Comments

@DoubleHyphen
Copy link

Example code:

macro_rules! doc_comment {
    ($x:expr) => {
        #[doc = $x]
        extern {
}};}

macro_rules! some_macro {
    ($t1: ty) => {
        doc_comment!{format!("{coor}", coor = stringify!($t1)).as_str()
}}}

fn main() {
    some_macro!(u8);
}

Expected result: The compiler does not crash.
Actual result: The compiler crashes, and asks for the crash to be reported as a bug.
Workaround: Using concat!() instead of format!()
Likely cause: concat!() returns a &str, whereas format!() returns a String.

@jonas-schievink
Copy link
Contributor

Duplicate of #66804

@jonas-schievink jonas-schievink marked this as a duplicate of #66804 Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants