holochain / holochain-rust

DEPRECATED. The Holochain framework implemented in rust with a redux style internal state-model.
GNU General Public License v3.0
1.12k stars 267 forks source link

futures-core errors: "use of unstable library feature 'pin'" & "arbitrary `self` types are unstable" #871

Closed marcusnewton closed 5 years ago

marcusnewton commented 5 years ago

I'm getting 94 errors when running hc package, producing either of the following errors

$ hc package
> cargo build --release --target=wasm32-unknown-unknown --target-dir=target
   Compiling futures-core-preview v0.3.0-alpha.11 (https://github.com/holochain/futures-rs?branch=pinned-to-alpha-11#dd9acd0b)
   Compiling rand_core v0.2.2
   Compiling serde v1.0.84
error[E0658]: use of unstable library feature 'pin' (see issue #49150)
 --> C:\Users\marcu\.cargo\git\checkouts\futures-rs-d2a1cd193ada173b\dd9acd0\futures-core\src\future\mod.rs:4:5
  |
4 | use core::pin::Pin;
  |     ^^^^^^^^^^^^^^
  |
  = help: add #![feature(pin)] to the crate attributes to enable
error[E0658]: arbitrary `self` types are unstable (see issue #44874)
   --> C:\Users\marcu\.cargo\git\checkouts\futures-rs-d2a1cd193ada173b\dd9acd0\futures-core\src\stream\mod.rs:141:28
    |
141 |     fn try_poll_next(self: Pin<&mut Self>, lw: &LocalWaker)
    |                            ^^^^^^^^^^^^^^
    |
    = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable
    = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`
marcusnewton commented 5 years ago

Resolved by updating rust (silly me)

jdeepee commented 5 years ago

@marcusnewton1 Which version of rust did you use to fix this? I am on 1.32.0-nightly and receive this error

marcusnewton commented 5 years ago

@jdeepee Are you getting the 94 errors?

1.33-nightly. Update with rustup update and see if it fixes for you, or at least dramatically reduces the number of errors.

jdeepee commented 5 years ago

Yes I was getting 94 errors on 1.32. Just updated to 1.33 and am receiving 9 errors related to mismatched type. Do you have the dependencies compiling correctly?

marcusnewton commented 5 years ago

@jdeepee I've submitted a pull request (https://github.com/holochain/futures-rs/pull/1) that fixes this for the futures-util-preview alpha-11 version, but waiting for merge.

Until then, you can fix this manually by opening both

.cargo\git\checkouts\holochain-rust-c3b6365fc5bfa642\dc2b8b2\core\Cargo.toml

and

.cargo\git\checkouts\holochain-rust-c3b6365fc5bfa642\dc2b8b2\core_types\Cargo.toml

Change the line

futures-preview = { git = "https://github.com/holochain/futures-rs" branch="pinned-to-alpha-11" }

to

futures-preview = { git = "https://github.com/marcusnewton1/futures-rs", branch = "alpha-11-mut-fix" }

in both of those files.

cargo clean in all your zomes under code/src and then hc package in the root of the project directory again

jdeepee commented 5 years ago

@marcusnewton1 Awesome thanks for the hotfix, this should be useful if people want to move onto the latest nightly version.

I just tried changing my rust version to: nightly-2018-12-26 using the command: rustup override set nightly-2018-12-26 as per the comment on: holochain/futures-rs#1. That seemed to fix all of the errors.

Perhaps the holochain team should specify the exact nightly version/commit to be used when trying to compile holochain applications because currently running curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly as per the getting started guide will always install an incompatible version for HC release 0.0.3.

jdeepee commented 5 years ago

Okay not to worry looks like #904 will solve the dependency issues going forward

maackle commented 5 years ago

Thanks for bringing this up, you two. It looks like this is a bug in our documentation more than anything. There is a version mismatch in the Rust toolchain, where some devs are on an older nightly version before the breaking change to Pin. Our docs should mention this.

If we merged in @marcusnewton1's hotfix PR, it would solve the problem for people on newer Rust nightlies but break it again for people on older Rust (like anyone using the holochain-rust Makefile). I hadn't considered that the problem was a Rust version mismatch when we were talking about that, which led to a bit of a wild goose chase, sorry about that.

Looks like the best solution is:

  1. We need to keep our docs updated to always reflect the nightly version the code is built against
  2. We should upgrade the Makefile to a newer nightly ASAP so we can all get past this breaking change. That work is started in #904.