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

Some modules support no_std #680

Merged
merged 14 commits into from
Feb 4, 2020
Merged

Some modules support no_std #680

merged 14 commits into from
Feb 4, 2020

Conversation

k-nasa
Copy link
Member

@k-nasa k-nasa commented Jan 16, 2020

The following three modules have been changed to work with no_std.

  • task
  • future
  • stream

Copy link
Contributor

@yoshuawuyts yoshuawuyts left a comment

Choose a reason for hiding this comment

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

This is incredibly cool! @k-nasa what's left for this PR before we can merge?

@k-nasa k-nasa marked this pull request as ready for review January 28, 2020 00:49
@k-nasa
Copy link
Member Author

k-nasa commented Jan 28, 2020

@yoshuawuyts
I think it's nothing. I think it is enough now.

However, I think it is necessary to add no_std examples and documentation in the future.

Or should it be done now?

Cargo.toml Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
src/utils.rs Outdated Show resolved Hide resolved
src/utils.rs Outdated Show resolved Hide resolved
@taiki-e taiki-e self-assigned this Jan 29, 2020
@k-nasa
Copy link
Member Author

k-nasa commented Feb 1, 2020

I couldn't build with target thumbv7m-none-eabi.
Looking at build details using cargo -v, it appears to be linked std.

Running `rustc --edition=2018 --crate-name futures_core /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata -C debuginfo=2 --cfg 'feature="alloc"' --cfg 'feature="std"' -C metadata=612df2be1fa85baa -C extra-filename=-612df2be1fa85baa --out-dir /home/runner/work/async-std/async-std/target/thumbv7m-none-eabi/debug/deps --target thumbv7m-none-eabi -L dependency=/home/runner/work/async-std/async-std/target/thumbv7m-none-eabi/debug/deps -L dependency=/home/runner/work/async-std/async-std/target/debug/deps --cap-lints allow -Dwarnings`

I ran command cargo check --no-default-features --features alloc --target thumbv7m-none-eabi -v.

output is

cargo build --no-default-features --target thumbv7m-none-eabi --features alloc -v
   Compiling futures-core v0.3.1
       Fresh pin-project-lite v0.1.4
     Running `rustc --crate-name futures_core --edition=2018 /Users/nasa/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 --cfg 'feature="alloc"' --cfg 'feature="std"' -C metadata=bf22d8a7eee34ada -C extra-filename=-bf22d8a7eee34ada --out-dir /Users/nasa/lab/oss/k-nasa/async-std/target/thumbv7m-none-eabi/debug/deps --target thumbv7m-none-eabi -L dependency=/Users/nasa/lab/oss/k-nasa/async-std/target/thumbv7m-none-eabi/debug/deps -L dependency=/Users/nasa/lab/oss/k-nasa/async-std/target/debug/deps --cap-lints allow`
error[E0463]: can't find crate for `std`
  |
  = note: the `thumbv7m-none-eabi` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `futures-core`.

Caused by:
  process didn't exit successfully: `rustc --crate-name futures_core --edition=2018 /Users/nasa/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 --cfg 'feature="alloc"' --cfg 'feature="std"' -C metadata=bf22d8a7eee34ada -C extra-filename=-bf22d8a7eee34ada --out-dir /Users/nasa/lab/oss/k-nasa/async-std/target/thumbv7m-none-eabi/debug/deps --target thumbv7m-none-eabi -L dependency=/Users/nasa/lab/oss/k-nasa/async-std/target/thumbv7m-none-eabi/debug/deps -L dependency=/Users/nasa/lab/oss/k-nasa/async-std/target/debug/deps --cap-lints allow` (exit code: 1)

@taiki-e Do you know any solution?

@taiki-e
Copy link
Contributor

taiki-e commented Feb 1, 2020

Looks like due to rust-lang/cargo#4866 (cargo leaking *-dependencies into normal build)

Could you add -Z avoid-dev-deps flag for cargo command?

(if we need to run on stable, use cargo-hack's --no-dev-deps flag instead.)

@k-nasa
Copy link
Member Author

k-nasa commented Feb 1, 2020

@taiki-e Thanks!!
I could build no-std.

@k-nasa k-nasa requested a review from taiki-e February 1, 2020 08:08
cfg_std! {
pub use pending::pending;
pub use poll_fn::poll_fn;
pub use ready::ready;
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: to enable these utilities on no-std, use manually implemented futures instead of async functions.

@taiki-e taiki-e removed their assignment Feb 1, 2020
@k-nasa
Copy link
Member Author

k-nasa commented Feb 4, 2020

Is it a problem to merge this?

@yoshuawuyts yoshuawuyts merged commit 125fa5b into async-rs:master Feb 4, 2020
@k-nasa k-nasa deleted the no_std branch February 4, 2020 10:03
@yoshuawuyts
Copy link
Contributor

yoshuawuyts commented Feb 4, 2020

@k-nasa fantastic work; this is great!

yoshuawuyts added a commit that referenced this pull request Feb 4, 2020
@tirr-c
Copy link
Contributor

tirr-c commented Feb 4, 2020

@yoshuawuyts it seems like an autocompletion failure? ;)

@yoshuawuyts
Copy link
Contributor

@tirr-c ahaha, oops context switch failure. Was also reviewing Tide patches 😂 sorry sorry!

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.

4 participants