I tried this code:
struct Check;
impl Check {
const CHECK: () = assert!(1 == 2);
}
fn main() {
let _ = Check::CHECK;
}
(playground)
Above code does not build if you use the playground "run" button.
But the "build" button, which seems to be the equivalent to cargo-check on above code, does "build" (typecheck and everything).
This is reproducible with:
cargo-build/cargo-run does fail the build, as expected
cargo-check does not fail the build, unexpectedly
Meta
rustc --version --verbose:
rustc 1.69.0 (84c898d65 2023-04-16)
binary: rustc
commit-hash: 84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc
commit-date: 2023-04-16
host: x86_64-unknown-linux-gnu
release: 1.69.0
LLVM version: 15.0.7
On the playground:
- stable as described above
- beta as described above
- nightly as expected: the "build" button (cargo-check as I assume), fails as expected
Found with @TheNeikos, also thanks to them for helping me reducing the code example.
I tried this code:
(playground)
Above code does not build if you use the playground "run" button.
But the "build" button, which seems to be the equivalent to
cargo-checkon above code, does "build" (typecheck and everything).This is reproducible with:
cargo-build/cargo-rundoes fail the build, as expectedcargo-checkdoes not fail the build, unexpectedlyMeta
rustc --version --verbose:On the playground:
Found with @TheNeikos, also thanks to them for helping me reducing the code example.