title: Workspace optional dependencies (std & no_std)
body: <p>I am developing a code for my school's rocketry team and I have two programs, one meant to flash the on-board computer and another to run some data analysis on the flight data. The chip code uses <code>no_std</code> while the data analysis program uses <code>std</code>. The <code>data-analysis</code> code will run on my PC, and the <code>chip</code> code will run on the chip.
  Here is my workspace root <code>Cargo.toml</code> and my project graph:</p>
  <pre><code>[workspace]
  
  members = [
      &quot;chip&quot;,
      &quot;data-analysis&quot;,
  ]
  </code></pre>
  <pre><code>.
  ├── Cargo.lock
  ├── Cargo.toml
  ├── chip
  │   ├── Cargo.toml
  │   ├── memory.x
  │   ├── openocd.cfg
  │   ├── openocd.gdb
  │   └── src
  │       └── main.rs
  ├── data-analysis
  │   ├── Cargo.toml
  │   └── src
  │       └── main.rs
  ├── README.md
  └── resources
      ├── 3m.mkd
      ├── data-stm32f103c8t6.pdf
      ├── links.txt
      ├── reference-stm32f103xx.pdf
      ├── schematic-stm32f103c8t6.png
      └── todo.txt
  </code></pre>
  <p>I have decided to use a workspace to organize my code. When I attempt to build the workspace, I get the error:</p>
  <pre><code>error[E0463]: can't find crate for `std`
    |
    = note: the `thumbv7m-none-eabi` target may not support the standard library
    = note: `std` is required by `data_analysis` because it does not declare `#![no_std]`
    = help: consider building the standard library from source with `cargo build -Zbuild-std`
  </code></pre>
  <p>When I compile with <code>cargo build -Zbuild-std</code> I get the error:</p>
  <pre><code>error[E0463]: can't find crate for `panic_abort`
  
  error[E0658]: use of unstable library feature 'restricted_std'
    |
    = help: add `#![feature(restricted_std)]` to the crate attributes to enable
  </code></pre>
  <p>However I need <code>no_std</code> and not <code>restricted_std</code>.</p>
  <p>I understand that dependencies for all files are stored in <code>Cargo.lock</code> and presumably that's why it is producing this error. My question is, how do I express to the compiler that I need <code>std</code> for <code>data_analysis</code> but not for <code>chip</code> code? Should I even be using workspaces over just using one package with multiple binaries and using <code>[features]</code> in the <code>Cargo.toml</code>?</p>