rust-playground icon indicating copy to clipboard operation
rust-playground copied to clipboard

Feature request: `cargo check`

Open carols10cents opened this issue 8 years ago • 7 comments

Now that cargo check is stable, i think it'd be useful to offer!

carols10cents avatar Apr 03 '17 15:04 carols10cents

If a program involves loop{}s, sometimes just check is needed, not waiting for running timeout.

vi avatar Aug 09 '18 23:08 vi

How would cargo check be better than cargo build? For example, I recently learned:

note that cargo check won't invoke LLVM so e.g. cargo check won't catch errors like this:

#![feature(asm)]
#![crate_type = "lib"]
pub unsafe fn foo() {
    asm!("asdadasdasdas");
}

shepmaster avatar Aug 10 '18 01:08 shepmaster

"Build" is actually "Run":

fn main() {
    loop{}
}

"..." -> "Build. No bells and whistles, regular build coming right up :D"

   Compiling playground v0.0.1 (file:///playground)
    Finished dev [unoptimized + debuginfo] target(s) in 1.18s
     Running `target/debug/playground`
/root/entrypoint.sh: line 8:     7 Killed                  timeout --signal=KILL ${timeout} "$@"

vi avatar Aug 10 '18 06:08 vi

Yes, the build menu option is misnamed, as you've already reported #333, but that's not what I'm asking. I'm asking why cargo check would be better than cargo build for your purposes.

shepmaster avatar Aug 10 '18 14:08 shepmaster

cargo check is usually faster, i think that's why I suggested it originally, i don't really remember though honestly!

carols10cents avatar Aug 10 '18 20:08 carols10cents

I think this is mostly a non-starter until https://github.com/rust-lang/cargo/issues/3501 is resolved; otherwise we have to build the code twice, doubling the storage requirements.

shepmaster avatar Aug 05 '19 15:08 shepmaster

How would cargo check be better than cargo build? For example, I recently learned:

cargo check is extremely useful when adding a test to the rustc test suite and deciding between check-pass and build-pass. This requires knowing if the issue reproduces with check-pass, which can be quite hard to figure out (and I just almost got it wrong). Being able to try this on the playground would be very helpful.

RalfJung avatar Aug 11 '20 11:08 RalfJung