dalek-cryptography / bulletproofs

A pure-Rust implementation of Bulletproofs using Ristretto.
MIT License
1.02k stars 216 forks source link

Error: external_doc feature removed and unknown feature #363

Open ercembu opened 1 year ago

ercembu commented 1 year ago

When I add the crate as such in Cargo.toml:

[package]
name = "my_pack"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bulletproofs = {version = "2.0.0" }

I get the following errors which seem to be due to some removed feature from rust?

$ cargo check
    Checking bulletproofs v2.0.0
error[E0557]: feature has been removed
 --> /home/bulut/.cargo/registry/src/github.com-1ecc6299db9ec823/bulletproofs-2.0.0/src/lib.rs:3:12
  |
3 | #![feature(external_doc)]
  |            ^^^^^^^^^^^^ feature has been removed
  |
  = note: use #[doc = include_str!("filename")] instead, which handles macro invocations

error[E0635]: unknown feature `try_trait`
 --> /home/bulut/.cargo/registry/src/github.com-1ecc6299db9ec823/bulletproofs-2.0.0/src/lib.rs:4:12
  |
4 | #![feature(try_trait)]
  |            ^^^^^^^^^

Some errors have detailed explanations: E0557, E0635.
For more information about an error, try `rustc --explain E0557`.
error: could not compile `bulletproofs` due to 2 previous errors

The rust is in nightly by default but i don't know if I've missed anything else.

rubdos commented 1 year ago

Nightly Rust is usually pinned to a version. rust-toolchain currently lists nightly-2019-07-31 for this crate.

ercembu commented 1 year ago

After moving to the pinned version, now i'm getting errors about the dependencies.

$ cargo check
    Updating crates.io index
    Checking subtle v2.4.1
   Compiling proc-macro2 v1.0.49
    Checking packed_simd_2 v0.3.8
    Checking clear_on_drop v0.2.5
    Checking sha3 v0.8.2
    Checking rand v0.7.3
error[E0658]: use of unstable library feature 'asm': inline assembly is not stable enough for use and is subject to change
  --> /home/bulut/.cargo/registry/src/github.com-1ecc6299db9ec823/clear_on_drop-0.2.5/src/hide.rs:41:17
   |
41 |                 asm!("/* {0} */", in(reg) (ptr as *mut u8), options(nostack));
   |                 ^^^
   |
   = note: for more information, see https://github.com/rust-lang/rust/issues/29722
   = help: add `#![feature(asm)]` to the crate attributes to enable

error[E0660]: malformed inline assembly
  --> /home/bulut/.cargo/registry/src/github.com-1ecc6299db9ec823/clear_on_drop-0.2.5/src/hide.rs:41:17
   |
41 |                 asm!("/* {0} */", in(reg) (ptr as *mut u8), options(nostack));
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'asm': inline assembly is not stable enough for use and is subject to change
  --> /home/bulut/.cargo/registry/src/github.com-1ecc6299db9ec823/clear_on_drop-0.2.5/src/hide.rs:51:17
   |
51 |                 asm!("/* {0} */", in(reg) ptr, options(nostack));
   |                 ^^^
   |
   = note: for more information, see https://github.com/rust-lang/rust/issues/29722
   = help: add `#![feature(asm)]` to the crate attributes to enable

error[E0660]: malformed inline assembly
  --> /home/bulut/.cargo/registry/src/github.com-1ecc6299db9ec823/clear_on_drop-0.2.5/src/hide.rs:51:17
   |
51 |                 asm!("/* {0} */", in(reg) ptr, options(nostack));
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `core::arch::asm`
  --> /home/bulut/.cargo/registry/src/github.com-1ecc6299db9ec823/clear_on_drop-0.2.5/src/hide.rs:30:9
   |
30 |     use core::arch::asm;
   |         ^^^^^^^^^^^^^^^ no `asm` in `arch`

error[E0658]: specialization is unstable
  --> /home/bulut/.cargo/registry/src/github.com-1ecc6299db9ec823/clear_on_drop-0.2.5/src/hide.rs:38:9
   |
38 | /         default fn hide_mem_impl(ptr: *mut Self) {
39 | |             unsafe {
40 | |                 //llvm_asm!("" : : "r" (ptr as *mut u8) : "memory");
41 | |                 asm!("/* {0} */", in(reg) (ptr as *mut u8), options(nostack));
42 | |             }
43 | |         }
   | |_________^
   |
   = note: for more information, see https://github.com/rust-lang/rust/issues/31844
   = help: add `#![feature(specialization)]` to the crate attributes to enable

error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> /home/bulut/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:575:1
    |
575 | impl<T> From<CtOption<T>> for Option<T> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter

error: aborting due to previous error

For more information about this error, try `rustc --explain E0210`.
error: Could not compile `subtle`.
warning: build failed, waiting for other jobs to finish...
error[E0119]: conflicting implementations of trait `hide::impls::HideMemImpl`:
  --> /home/bulut/.cargo/registry/src/github.com-1ecc6299db9ec823/clear_on_drop-0.2.5/src/hide.rs:46:5
   |
36 |     impl<T: ?Sized> HideMemImpl for T {
   |     --------------------------------- first implementation here
...
46 |     impl<T: Sized> HideMemImpl for T {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation

error: aborting due to 7 previous errors

Some errors have detailed explanations: E0119, E0432, E0658.
For more information about an error, try `rustc --explain E0119`.
error: Could not compile `clear_on_drop`.
warning: build failed, waiting for other jobs to finish...
error[E0635]: unknown feature `proc_macro_span_shrink`
  --> /home/bulut/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.49/src/lib.rs:92:30
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |                              ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0635`.
error: Could not compile `proc-macro2`.
warning: build failed, waiting for other jobs to finish...
error: type parameters must be declared prior to const parameters
  --> /home/bulut/.cargo/registry/src/github.com-1ecc6299db9ec823/packed_simd_2-0.3.8/src/codegen/llvm.rs:20:54
   |
20 | pub unsafe fn __shuffle_vector2<const IDX: [u32; 2], T, U>(x: T, y: T) -> U
   |                                ----------------------^--^- help: reorder the parameters: lifetimes, then types: `<T, U, const IDX: [u32; 2]>`

error: aborting due to previous error

error: Could not compile `packed_simd_2`.
warning: build failed, waiting for other jobs to finish...
error: build failed

Since there is no other dependency added to cargo but bulletproof, im guessing it's still a crate issue

rubdos commented 1 year ago

You'll have to find out what version of packed_simd_2 you need, which was compatible with that Rust nightly version. A good first guess is by looking at crates.io at the release time of the nightly version, and try some around that time. cargo update -p [lib name] --precise [version number] is your friend from there.

ercembu commented 1 year ago

It doesn't seem to be only for packed_simd_2, Isn't this a bug then? A crate published publicly shouldn't be this much of a hassle to actually get up and running. It actually means in every new environment for an experiment that uses this library is going to need special package updates. Why not actually put them in a script yourselves?

ercembu commented 1 year ago

And downgrading to old packages from the time of nightly just produces more dependency issues, and in the end returns to proc-macro2 not being compiled. Maybe a lock system?

ercembu commented 1 year ago

rustup default nightly-2022-07-24 && rustup target add wasm32-unknown-unknown actually fixes everything