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

#[project] on non-statement expression does not work without unstable features #189

Closed
taiki-e opened this issue Apr 14, 2020 · 0 comments · Fixed by #197
Closed

#[project] on non-statement expression does not work without unstable features #189

taiki-e opened this issue Apr 14, 2020 · 0 comments · Fixed by #197
Assignees
Labels
A-project-attribute Area: #[project], #[project_ref], and #[project_replace] (note: this was removed in v1.0) C-bug Category: related to a bug.

Comments

@taiki-e
Copy link
Owner

taiki-e commented Apr 14, 2020

playground

Code:

#[project]
fn foo() {
    #[pin_project]
    enum Enum<A> {
        Variant(#[pin] A),
    }

    let mut x = Enum::Variant(1);
    let mut x = Pin::new(&mut x).project();

    Some(
        #[project]
        match x {
            Enum::Variant(x) => {}
        },
    );
}

Error:

error[E0658]: attributes on expressions are experimental
   --> tests/project.rs:230:9
    |
230 |         #[project]
    |         ^^^^^^^^^^
    |
    = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
    = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable

error[E0658]: custom attributes cannot be applied to expressions
   --> tests/project.rs:230:9
    |
230 |         #[project]
    |         ^^^^^^^^^^
    |
    = note: see issue #54727 <https://github.com/rust-lang/rust/issues/54727> for more information
    = help: add `#![feature(proc_macro_hygiene)]` to the crate attributes to enable

Same as taiki-e/auto_enums#90

@taiki-e taiki-e self-assigned this Apr 14, 2020
@taiki-e taiki-e added C-bug Category: related to a bug. A-project-attribute Area: #[project], #[project_ref], and #[project_replace] (note: this was removed in v1.0) labels Apr 14, 2020
@bors bors bot closed this as completed in 7012dae May 4, 2020
@bors bors bot closed this as completed in #197 May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-project-attribute Area: #[project], #[project_ref], and #[project_replace] (note: this was removed in v1.0) C-bug Category: related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant