Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

#[fail(..)] doesn't import correctly in new epoch #221

Closed
kazcw opened this issue Jun 23, 2018 · 2 comments
Closed

#[fail(..)] doesn't import correctly in new epoch #221

kazcw opened this issue Jun 23, 2018 · 2 comments

Comments

@kazcw
Copy link

kazcw commented Jun 23, 2018

Testing the preview of edition="2018", the fail attribute macro only seems to be recognized when it's inside the lexical block of a #[derive(Fail)] object.

So this works:

use failure::Fail;
#[derive(Fail)]
enum Foo {
    #[fail(display = "foo error: {}", _0)]
    Bad(String),
}

But this doesn't:

use failure::Fail;
#[derive(Fail)]
#[fail(display = "foo error: {}", _0)]
struct Bad(String);
// ^ causes "cannot find attribute macro `fail` in this scope"

I'm not sure what serde would be doing differently but the #[serde(...)] attribute macro still works at either scope.

@kazcw
Copy link
Author

kazcw commented Jun 23, 2018

Actually, I'm not seeing the error in a test case like the snippet above. I need to pare down my crate to find a minimal case that reproduces the error.

@kazcw kazcw closed this as completed Jun 23, 2018
@kazcw
Copy link
Author

kazcw commented Jun 23, 2018

This turns out to be rust-lang/rust#44925

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant