Skip to content

compilation fix for no-std#69

Merged
stevenroose merged 1 commit intorust-bitcoin:masterfrom
michalkucharczyk:mku-compilation-fix-no-std
Jun 12, 2025
Merged

compilation fix for no-std#69
stevenroose merged 1 commit intorust-bitcoin:masterfrom
michalkucharczyk:mku-compilation-fix-no-std

Conversation

@michalkucharczyk
Copy link
Contributor

This PR fixes following compilation problem for no-std environments:

error[E0412]: cannot find type `Vec` in this scope
   --> /home/miszka/parity/10-genesis-config/rust-bip39-release/src/lib.rs:110:26
    |
110 |     pub fn to_vec(&self) -> Vec<Language> {
    |                             ^^^ not found in this scope

error[E0599]: no method named `to_string` found for struct `Decompositions` in the current scope
    --> /home/miszka/parity/10-genesis-config/rust-bip39-release/src/lib.rs:201:42
     |
201  |             *cow = Cow::Owned(cow.as_ref().nfkd().to_string());
     |                                                   ^^^^^^^^^ method not found in `Decompositions<Chars<'_>>`

The problem can be reproduced with the following steps:

cargo new rust-bip39-dep-problem2
pushd rust-bip39-dep-problem2
cargo add bip39 --git "https://github.com/rust-bitcoin/rust-bip39"  --rev b100bf3 --no-default-features --features alloc
cargo build

@michalkucharczyk michalkucharczyk mentioned this pull request Apr 5, 2024
@michalkucharczyk
Copy link
Contributor Author

cc: @tcharding

Would be nice to add this check to CI somehow. Do you have any idea how to do it?
Maybe we could create a cargo new somewhere in tmp directory?

Co-authored-by: Tobin C. Harding <[email protected]>
@michalkucharczyk michalkucharczyk force-pushed the mku-compilation-fix-no-std branch from 9c3cee9 to 8653fb2 Compare April 8, 2024 06:40
Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 8653fb2

@zhang-wenchao
Copy link

Can you merge this?

@tcharding
Copy link
Member

Would be nice to add this check to CI somehow. Do you have any idea how to do it?

Saw this comment because PR turned up in my notifications. Dunno if this is just as stale comment but there is a check for this in CI ATM on master.

@tcharding
Copy link
Member

Can you merge this?

cc @stevenroose

@jasl
Copy link

jasl commented Mar 30, 2025

@tcharding This PR is still valid

  error[E0412]: cannot find type `Vec` in this scope
     --> /Users/jasl/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bip39-2.1.0/src/lib.rs:107:26
      |
  107 |     pub fn to_vec(&self) -> Vec<Language> {
      |                             ^^^ not found in this scope
      |
  help: consider importing this struct
      |
  47  + use alloc::vec::Vec;
      |

  error[E0412]: cannot find type `Vec` in this scope
     --> /Users/jasl/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bip39-2.1.0/src/lib.rs:608:30
      |
  608 |     pub fn to_entropy(&self) -> Vec<u8> {
      |                                 ^^^ not found in this scope
      |
  help: consider importing this struct
      |
  47  + use alloc::vec::Vec;

Could you merge this and make a new release?

@tcharding
Copy link
Member

I am not a maintainer on this repo.

@stevenroose
Copy link
Collaborator

Seems to not break anything for me and msrv, but I can't really test no_std locally.

@stevenroose stevenroose merged commit bc5a233 into rust-bitcoin:master Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants