rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.34k stars 2.34k forks source link

cargo check - make possible to use "pipes" instead of files #3892

Open Dushistov opened 7 years ago

Dushistov commented 7 years ago

As I understand cargo check works only with files, so work pattern should looks like:

  1. Enter a couple of symbols
  2. Save file to disk
  3. Run cargo check

A lot of saves, bad for SSD.

So it would be good if cargo check provide interface like:

cargo check --temp-file-name src/lib.rs

in such mode cargo read content of modified src/lib.rs from stdin, and do cargo check as src/lib.rs contains data that cargo read from stdin.

This helps for example flycheck-rust: https://github.com/flycheck/flycheck-rust/issues/29

epage commented 9 months ago

For me, the big challenge is that IDEs would likely have multiple files open for edit that need to be checked and stdin wouldn't be sufficient. https://internals.rust-lang.org/t/jar-for-rust-single-file-crate-support-for-rustc/19576 does do some exploring for alternative ways for Cargo to communicate source buffers to rustc.