Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.
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

Description

@kazcw

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions