pin-project 0.4.11 breaks hyper
wg opened this issue · comments
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
Thanks for the reporting! I yanked 0.4.11. I'll look into this.
provisional measures soultion:
...
[dependencies]
pin-project = "=0.4.10"
...
I released 0.4.12 based on 0.4.10. (It should be fixed by updating Cargo.lock: cargo update
)
Ok, this is due to #197's visiter skips visiting initializer expression on local (will be fixed in #207).
EDIT: see #206 (comment)
Oops, it actually seems to skip all expressions visits nested by expressions, not just local.
Either way, #207 should fix it.
Thank you for the quick fix!