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

Warn on unexpected libstd dependence #95

Merged
merged 4 commits into from
Apr 9, 2024
Merged

Warn on unexpected libstd dependence #95

merged 4 commits into from
Apr 9, 2024

Conversation

ggwpez
Copy link
Owner

@ggwpez ggwpez commented Apr 9, 2024

Warn when a crate could unexpectedly pull in libstd.

Example on Polkadot-SDK:
Screenshot 2024-04-09 at 23 19 24

Since these crate do have both:
#![cfg_attr(not(feature = "std"), no_std)] and #![cfg(feature = "runtime-benchmarks")] which conditionally disables the nostd attribute.

Note that this is just a warning for now. Could be made into an additional lint (plus failure condition) in the future.

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez ggwpez enabled auto-merge (squash) April 9, 2024 21:28
@ggwpez ggwpez changed the title Warn on unexpected libstd pull Warn on unexpected libstd dependence Apr 9, 2024
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez ggwpez disabled auto-merge April 9, 2024 22:30
@ggwpez ggwpez merged commit c72cce2 into master Apr 9, 2024
10 of 16 checks passed
@ggwpez ggwpez deleted the dev branch April 9, 2024 22:30
github-merge-queue bot pushed a commit to paritytech/polkadot-sdk that referenced this pull request Apr 17, 2024
Preparation for #3935

Changes:
- Add some `default-features = false` for the case that a crate and that
dependency both support nostd builds.
- Shuffle files around of some benchmarking-only crates. These
conditionally disabled the `cfg_attr` for nostd and pulled in libstd.
Example [here](ggwpez/zepter#95). The actual
logic is moved into a `inner.rs` to preserve nostd capability of the
crate in case the benchmarking feature is disabled.
- Add some `use sp_std::vec` where needed.
- Remove some `optional = true` in cases where it was not optional.
- Removed one superfluous `cfg_attr(not(feature = "std"), no_std..`.

All in all this should be logical no-op.

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
github-merge-queue bot pushed a commit to paritytech/polkadot-sdk that referenced this pull request Apr 17, 2024
Preparation for #3935

Changes:
- Add some `default-features = false` for the case that a crate and that
dependency both support nostd builds.
- Shuffle files around of some benchmarking-only crates. These
conditionally disabled the `cfg_attr` for nostd and pulled in libstd.
Example [here](ggwpez/zepter#95). The actual
logic is moved into a `inner.rs` to preserve nostd capability of the
crate in case the benchmarking feature is disabled.
- Add some `use sp_std::vec` where needed.
- Remove some `optional = true` in cases where it was not optional.
- Removed one superfluous `cfg_attr(not(feature = "std"), no_std..`.

All in all this should be logical no-op.

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
sandreim pushed a commit to paritytech/polkadot-sdk that referenced this pull request Apr 18, 2024
Preparation for #3935

Changes:
- Add some `default-features = false` for the case that a crate and that
dependency both support nostd builds.
- Shuffle files around of some benchmarking-only crates. These
conditionally disabled the `cfg_attr` for nostd and pulled in libstd.
Example [here](ggwpez/zepter#95). The actual
logic is moved into a `inner.rs` to preserve nostd capability of the
crate in case the benchmarking feature is disabled.
- Add some `use sp_std::vec` where needed.
- Remove some `optional = true` in cases where it was not optional.
- Removed one superfluous `cfg_attr(not(feature = "std"), no_std..`.

All in all this should be logical no-op.

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
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.

1 participant