Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fixed-hash]: fix build with default-features #268

Merged
merged 1 commit into from
Nov 26, 2019

Conversation

niklasad1
Copy link
Member

@niklasad1 niklasad1 commented Nov 20, 2019

alloc is required by the rustc-hex implementation which makes the build with default-features to fail.
This commit re-exports alloc for both std and no-std to fix this problem

alloc is required by the `rustc-hex` implementation which make the `std` build to fail.
This commit re-exports `alloc` for both std and no-std to fix this problem
@@ -10,7 +10,6 @@

// Re-export liballoc using an alias so that the macros can work without
// requiring `extern crate alloc` downstream.
#[cfg(not(feature = "std"))]
Copy link
Member Author

Choose a reason for hiding this comment

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

could also be #[cfg(any(no_std, feature = "rustc-hex"))] but std is using rustc-hex so I re-exported alloc for all instead,

@niklasad1 niklasad1 changed the title [fixed-hash]: re-export alloc_ [fixed-hash]: make std build again Nov 20, 2019
@ordian
Copy link
Member

ordian commented Nov 20, 2019

which make the std build to fail.

which command fails exactly?

@niklasad1
Copy link
Member Author

niklasad1 commented Nov 20, 2019

which command fails exactly?

[dependencies]
fixed-hash = { path = "../parity-common/fixed-hash" }
error[E0433]: failed to resolve: could not find `alloc_` in `$crate`
 --> src/main.rs:3:1
  |
3 | / construct_fixed_hash! {
4 | |     /// My 256 bit hash type.
5 | |     struct H256(32);
6 | | }
  | |_^ could not find `alloc_` in `$crate`

As you can see here, alloc is used when rustc-hex is required which is part of the default features which I meant by std

@niklasad1 niklasad1 changed the title [fixed-hash]: make std build again [fixed-hash]: fix build with default-features Nov 20, 2019
Copy link
Member

@ordian ordian left a comment

Choose a reason for hiding this comment

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

Thanks for the explanation!

@dvdplm dvdplm merged commit 83e79c2 into master Nov 26, 2019
@dvdplm dvdplm deleted the na-fixed-hash-make-std-compile-again branch November 26, 2019 08:12
ordian added a commit that referenced this pull request Nov 27, 2019
* master:
  travis: try to fix wasmpack chrome test on macOS (#263)
  Use 2018 edition for rustfmt (#266)
  [fixed-hash]: re-export `alloc_` (#268)
  kvdb-web: async-awaitify (#259)
dvdplm added a commit that referenced this pull request Nov 28, 2019
…h/parity-common into ao-rocksdb-switch-to-upstream2

* 'ao-rocksdb-switch-to-upstream2' of github.com:paritytech/parity-common:
  kvdb-rocksdb: remove lz4 feature as it has no effect for now
  travis: try to fix wasmpack chrome test on macOS (#263)
  kvdb-rocksdb: please the CI
  kvdb-rocksdb: do not account for default column memory budget
  Use 2018 edition for rustfmt (#266)
  [fixed-hash]: re-export `alloc_` (#268)
  kvdb-web: async-awaitify (#259)
dvdplm added a commit that referenced this pull request Dec 10, 2019
* master:
  Compile triehash for no_std (#280)
  [kvdb-rocksdb] Use "pinned" gets to avoid allocations (#274)
  [kvdb-rocksdb] Release 0.2 (#273)
  [kvdb-rocksdb] switch to upstream (#257)
  travis: try to fix wasmpack chrome test on macOS (#263)
  Use 2018 edition for rustfmt (#266)
  [fixed-hash]: re-export `alloc_` (#268)
  kvdb-web: async-awaitify (#259)
  kvdb-rocksdb: configurable memory budget per column (#256)
  Bump rlp crate version. (#270)
  Introduce Rlp::at_with_offset method. (#269)
  Make fixed-hash test structs public (#267)
  Migrate primitive types to 2018 edition (#262)
  upgrade tiny-keccak to 2.0 (#260)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants