Skip to content

sorted: update 02-not-enum.stderr #35

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

Merged
merged 1 commit into from
Aug 15, 2020
Merged

Conversation

suyash
Copy link
Contributor

@suyash suyash commented Aug 15, 2020

On my machine I am seeing an additional message on trying to implement the second test for sorted.

My implementation

#[proc_macro_attribute]
pub fn sorted(args: TokenStream, input: TokenStream) -> TokenStream {
    let item = parse_macro_input!(input as Item);

    match item {
        Item::Enum(item) => {
            let stream = quote! { #item };
            stream.into()
        }
        _ => Error::new_spanned(
            TokenStream2::from(args),
            "expected enum or match expression",
        )
        .to_compile_error()
        .into(),
    }
}

I have tried other things also, still getting the additional line in the error for attribute macro.

rustc --version output:

rustc 1.45.2 (d3fb005a3 2020-07-31)

Not sure if I am doing something wrong. Also the additional line specifically mentions attribute macro, and so far I have only implemented the derive and functional macro exercises from before

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks like this got introduced by rustc 1.43.0.

@dtolnay dtolnay merged commit fc9704e into dtolnay:master Aug 15, 2020
goodpeanuts pushed a commit to goodpeanuts/proc-macro-workshop that referenced this pull request Jul 11, 2025
sorted: update 02-not-enum.stderr
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

Successfully merging this pull request may close these issues.

2 participants