libsecp256k1: no-std support broken in 0.5.0

This issue has the same title as https://github.com/paritytech/libsecp256k1/issues/68, but the problem isn’t the same.

As of version 0.5.0/core-0.2.0, recently published on crates.io, compiling with default-feature = false leads to compilation errors in the core:

error[E0412]: cannot find type `Vec` in this scope
  --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:19:19
   |
19 |     let mut prej: Vec<Jacobian> = Vec::with_capacity(pre.len());
   |                   ^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use alloc::vec::Vec;
   |
1  | use crate::ecmult::vec::Vec;
   |

error[E0433]: failed to resolve: use of undeclared type `Vec`
  --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:19:35
   |
19 |     let mut prej: Vec<Jacobian> = Vec::with_capacity(pre.len());
   |                                   ^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use alloc::vec::Vec;
   |
1  | use crate::ecmult::vec::Vec;
   |

error[E0412]: cannot find type `Vec` in this scope
  --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:23:19
   |
23 |     let mut prea: Vec<Affine> = Vec::with_capacity(pre.len());
   |                   ^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use alloc::vec::Vec;
   |
1  | use crate::ecmult::vec::Vec;
   |

error[E0433]: failed to resolve: use of undeclared type `Vec`
  --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:23:33
   |
23 |     let mut prea: Vec<Affine> = Vec::with_capacity(pre.len());
   |                                 ^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use alloc::vec::Vec;
   |
1  | use crate::ecmult::vec::Vec;
   |

error[E0412]: cannot find type `Vec` in this scope
  --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:27:17
   |
27 |     let mut zr: Vec<Field> = Vec::with_capacity(pre.len());
   |                 ^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use alloc::vec::Vec;
   |
1  | use crate::ecmult::vec::Vec;
   |

error[E0433]: failed to resolve: use of undeclared type `Vec`
  --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:27:30
   |
27 |     let mut zr: Vec<Field> = Vec::with_capacity(pre.len());
   |                              ^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use alloc::vec::Vec;
   |
1  | use crate::ecmult::vec::Vec;
   |

error[E0412]: cannot find type `Box` in this scope
  --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:62:27
   |
62 |     pub fn new_boxed() -> Box<Self> {
   |                           ^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use alloc::prelude::v1::Box;
   |
1  | use crate::ecmult::vec::Box;
   |

error[E0433]: failed to resolve: use of undeclared type `Box`
  --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:69:28
   |
69 |             let mut this = Box::from_raw(ptr);
   |                            ^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use alloc::prelude::v1::Box;
   |
1  | use crate::ecmult::vec::Box;
   |

error[E0412]: cannot find type `Vec` in this scope
  --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:88:43
   |
88 | pub fn set_all_gej_var(a: &[Jacobian]) -> Vec<Affine> {
   |                                           ^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use alloc::vec::Vec;
   |
1  | use crate::ecmult::vec::Vec;
   |

error[E0412]: cannot find type `Vec` in this scope
  --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:89:17
   |
89 |     let mut az: Vec<Field> = Vec::with_capacity(a.len());
   |                 ^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use alloc::vec::Vec;
   |
1  | use crate::ecmult::vec::Vec;
   |

error[E0433]: failed to resolve: use of undeclared type `Vec`
  --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:89:30
   |
89 |     let mut az: Vec<Field> = Vec::with_capacity(a.len());
   |                              ^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use alloc::vec::Vec;
   |
1  | use crate::ecmult::vec::Vec;
   |

error[E0412]: cannot find type `Vec` in this scope
  --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:95:14
   |
95 |     let azi: Vec<Field> = inv_all_var(&az);
   |              ^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use alloc::vec::Vec;
   |
1  | use crate::ecmult::vec::Vec;
   |

error[E0412]: cannot find type `Vec` in this scope
   --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:114:41
    |
114 | pub fn inv_all_var(fields: &[Field]) -> Vec<Field> {
    |                                         ^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   | use alloc::vec::Vec;
    |
1   | use crate::ecmult::vec::Vec;
    |

error[E0433]: failed to resolve: use of undeclared type `Vec`
   --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:116:16
    |
116 |         return Vec::new();
    |                ^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   | use alloc::vec::Vec;
    |
1   | use crate::ecmult::vec::Vec;
    |

error[E0433]: failed to resolve: use of undeclared type `Vec`
   --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:119:19
    |
119 |     let mut ret = Vec::with_capacity(fields.len());
    |                   ^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   | use alloc::vec::Vec;
    |
1   | use crate::ecmult::vec::Vec;
    |

error[E0412]: cannot find type `Box` in this scope
   --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:187:27
    |
187 |     pub fn new_boxed() -> Box<Self> {
    |                           ^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   | use alloc::prelude::v1::Box;
    |
1   | use crate::ecmult::vec::Box;
    |

error[E0433]: failed to resolve: use of undeclared type `Box`
   --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:194:28
    |
194 |             let mut this = Box::from_raw(ptr);
    |                            ^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   | use alloc::prelude::v1::Box;
    |
1   | use crate::ecmult::vec::Box;
    |

error[E0412]: cannot find type `Vec` in this scope
   --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:226:24
    |
226 |         let mut precj: Vec<Jacobian> = Vec::with_capacity(1024);
    |                        ^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   | use alloc::vec::Vec;
    |
1   | use crate::ecmult::vec::Vec;
    |

error[E0433]: failed to resolve: use of undeclared type `Vec`
   --> /home/pierre/.cargo/registry/src/github.com-1ecc6299db9ec823/libsecp256k1-core-0.2.0/src/ecmult.rs:226:40
    |
226 |         let mut precj: Vec<Jacobian> = Vec::with_capacity(1024);
    |                                        ^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   | use alloc::vec::Vec;
    |
1   | use crate::ecmult::vec::Vec;
    |

error: aborting due to 19 previous errors

Some errors have detailed explanations: E0412, E0433.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `libsecp256k1-core`

To reproduce, just add libsecp256k1 = { version = "0.5.0", default-features = false } as a dependency to a project.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

You did it @trevor-crypto . Your branch referenced above is now working for me when compiling to my no_std target.

@fredfortier I submitted a PR. If you’d like you can test it out on my branch or wait for it to come into develop