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

pin-project 0.4.11 breaks hyper #206

Closed
wg opened this issue May 7, 2020 · 6 comments · Fixed by #207
Closed

pin-project 0.4.11 breaks hyper #206

wg opened this issue May 7, 2020 · 6 comments · Fixed by #207
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. regression Regression from a previous version

Comments

@wg
Copy link

wg commented May 7, 2020

Hello, hyper uses #[project] on an expression https://github.com/hyperium/hyper/blob/v0.13.5/src/server/conn.rs#L926 and https://github.com/hyperium/hyper/blob/v0.13.5/src/server/shutdown.rs#L65 which now causes a compilation error with pin-project 0.4.11.

Here is one of your test cases adapted to demonstrate the issue, this code works fine with 0.4.10 but not 0.4.11:

#[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();

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

    Some(asdf);
}

Error:

error[E0658]: attributes on expressions are experimental
  --> src/main.rs:16:9
   |
16 |         #[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
@taiki-e
Copy link
Owner

taiki-e commented May 7, 2020

Thanks for the reporting! I yanked 0.4.11. I'll look into this.

@taiki-e taiki-e added A-project-attribute Area: #[project], #[project_ref], and #[project_replace] (note: this was removed in v1.0) C-bug Category: related to a bug. labels May 7, 2020
@taiki-e taiki-e self-assigned this May 7, 2020
@taiki-e taiki-e added the regression Regression from a previous version label May 7, 2020
@baoyachi
Copy link

baoyachi commented May 7, 2020

provisional measures soultion:

...
[dependencies]
pin-project = "=0.4.10"
...

@taiki-e
Copy link
Owner

taiki-e commented May 7, 2020

I released 0.4.12 based on 0.4.10. (It should be fixed by updating Cargo.lock: cargo update)

@taiki-e
Copy link
Owner

taiki-e commented May 7, 2020

Ok, this is due to #197's visiter skips visiting initializer expression on local (will be fixed in #207).

EDIT: see #206 (comment)

@taiki-e
Copy link
Owner

taiki-e commented May 7, 2020

Oops, it actually seems to skip all expressions visits nested by expressions, not just local.
Either way, #207 should fix it.

@bors bors bot closed this as completed in e51a387 May 7, 2020
@bors bors bot closed this as completed in #207 May 7, 2020
@wg
Copy link
Author

wg commented May 7, 2020

Thank you for the quick fix!

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. regression Regression from a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants