cargo-check This is a wrapper around cargo rustc

Overview

cargo-check

Build Status

This is a wrapper around cargo rustc -- -Zno-trans. It can be helpful for running a faster compile if you only need correctness checks.

Installation

Install with cargo install cargo-check

Note that additonal cargo rustc options can still be passed through.

In other words, this:

cargo check -v -- -Zprint-link-args

Should do the same thing as this:

cargo rustc -v -- -Zprint-link-args -Zno-trans

If lib or bin targets are present they will be added to cargo rustc automatically.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Comments
  • Support both [[bin]] and [lib] together?

    Support both [[bin]] and [lib] together?

    % cargo check
    extra arguments to `rustc` can only be passed to one target, consider filtering
    the package by passing e.g. `--lib` or `--bin NAME` to specify a single target
    

    Isn't there any way to support both [[bin]] and [lib] in one go? cargo build just works, so I'd expect cargo check to be drop-in replacement.

    opened by dpc 5
  • Doesn't work with crates providing more than one result

    Doesn't work with crates providing more than one result

    A few of my packages provide more than output, i.e., a library and potentially multiple binaries. However in that case, cargo rustc requires that you specify which result it should build using either --lib or --bin NAME.

    opened by aomader 4
  • Archlinux package

    Archlinux package

    https://aur4.archlinux.org/packages/cargo-check-git/

    You should disable the compilation of main during the tests using #[cfg(not(test))] to remove the warning. And you should put the tests in a module, see http://doc.rust-lang.org/book/testing.html.

    opened by Yamakaky 3
  • Cargo errors out on

    Cargo errors out on "cargo check"

    After installing cargo-check, when I try to use it, I get the following error:

    $ PATH=$HOME/r/.cargo/bin:$PATH cargo check
    error: extra arguments to `rustc` can only be passed to one target, consider filtering
    the package by passing e.g. `--lib` or `--bin NAME` to specify a single target
    error: third party subcommand `cargo-check` exited unsuccessfully
    
    To learn more, run the command again with --verbose.
    

    This is with

    $ rustc --version
    rustc 1.9.0-beta.1 (37a2869af 2016-04-12)
    

    but I already saw this with the 1.8 betas.

    opened by RalfJung 2
  • Minor Improvements

    Minor Improvements

    After having had a short look at cargo-check, I immediately found it incredibly useful. While staring at the code, I made some improvements that might be more idiomatic Rust. It's quite amazing how much simpler the tests have become now.

    As I am still a beginner, please be sure to review the code thoroughly. At least it works both when testing automatically and manually.

    Cheers

    opened by Byron 2
  • Relicense under dual MIT/Apache-2.0

    Relicense under dual MIT/Apache-2.0

    This issue was automatically generated. Feel free to close without ceremony if you do not agree with re-licensing or if it is not possible for other reasons. Respond to @cmr with any questions or concerns, or pop over to #rust-offtopic on IRC to discuss.

    You're receiving this because someone (perhaps the project maintainer) published a crates.io package with the license as "MIT" xor "Apache-2.0" and the repository field pointing here.

    TL;DR the Rust ecosystem is largely Apache-2.0. Being available under that license is good for interoperation. The MIT license as an add-on can be nice for GPLv2 projects to use your code.

    Why?

    The MIT license requires reproducing countless copies of the same copyright header with different names in the copyright field, for every MIT library in use. The Apache license does not have this drawback. However, this is not the primary motivation for me creating these issues. The Apache license also has protections from patent trolls and an explicit contribution licensing clause. However, the Apache license is incompatible with GPLv2. This is why Rust is dual-licensed as MIT/Apache (the "primary" license being Apache, MIT only for GPLv2 compat), and doing so would be wise for this project. This also makes this crate suitable for inclusion and unrestricted sharing in the Rust standard distribution and other projects using dual MIT/Apache, such as my personal ulterior motive, the Robigalia project.

    Some ask, "Does this really apply to binary redistributions? Does MIT really require reproducing the whole thing?" I'm not a lawyer, and I can't give legal advice, but some Google Android apps include open source attributions using this interpretation. Others also agree with it. But, again, the copyright notice redistribution is not the primary motivation for the dual-licensing. It's stronger protections to licensees and better interoperation with the wider Rust ecosystem.

    How?

    To do this, get explicit approval from each contributor of copyrightable work (as not all contributions qualify for copyright, due to not being a "creative work", e.g. a typo fix) and then add the following to your README:

    ## License
    
    Licensed under either of
    
     * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
     * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
    
    at your option.
    
    ### Contribution
    
    Unless you explicitly state otherwise, any contribution intentionally submitted
    for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
    additional terms or conditions.
    

    and in your license headers, if you have them, use the following boilerplate (based on that used in Rust):

    // Copyright 2016 cargo-check Developers
    //
    // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
    // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
    // http://opensource.org/licenses/MIT>, at your option. This file may not be
    // copied, modified, or distributed except according to those terms.
    

    It's commonly asked whether license headers are required. I'm not comfortable making an official recommendation either way, but the Apache license recommends it in their appendix on how to use the license.

    Be sure to add the relevant LICENSE-{MIT,APACHE} files. You can copy these from the Rust repo for a plain-text version.

    And don't forget to update the license metadata in your Cargo.toml to:

    license = "MIT OR Apache-2.0"
    

    I'll be going through projects which agree to be relicensed and have approval by the necessary contributors and doing this changes, so feel free to leave the heavy lifting to me!

    Contributor checkoff

    To agree to relicensing, comment with :

    I license past and future contributions under the dual MIT/Apache-2.0 license, allowing licensees to chose either at their option.
    

    Or, if you're a contributor, you can check the box in this repo next to your name. My scripts will pick this exact phrase up and check your checkbox, but I'll come through and manually review this issue later as well.

    • [x] @Byron
    • [x] @rsolomo
    opened by emberian 1
  • added: desktop notifications (on linux)

    added: desktop notifications (on linux)

    Hi there, I'm using cargo check in combination with cargo watch. In this combination, wouldn't it be cool if the watcher in the background would notify you if your crate no longer would compile? At least I liked that idea :smile: So I added a feature which enables desktop notifications (only on linux so far).

    What do you think?

    opened by hoodie 1
  • Add '--version' flag and exit cleanly on 'cargo metadata' errors

    Add '--version' flag and exit cleanly on 'cargo metadata' errors

    The version flag makes it possible to distinguish capabilities when using the tool from other places. The fix for cargo metadata is to avoid getting a nasty stack trace when invoking the tool from a folder that isn't a cargo project.

    opened by Machtan 0
  • Fix multiple target checking introduced in #13.

    Fix multiple target checking introduced in #13.

    See discussion in #13 for details.

    I also cleaned up some code, removed some tests in favor of actually testing compilation of broken crates. Diff of src/main.rs is +18 -59, major additions are the new tests. Please test this out manually once before merging!

    (I will be submitting another PR to enable checking of benches and tests that are in their own files instead of being in the lib or bin. I didn't want to add too many things to one PR.)

    cc @euclio

    opened by utkarshkukreti 0
  • Relicense to dual MIT/Apache-2.0

    Relicense to dual MIT/Apache-2.0

    This pull request was automatically generated because my scripts detected that everyone in the relicensing issue agreed to relicensing.

    License headers in files were not updated, if they exist. I've reproduced an example license header below if you want to copy-paste it in. If you don't have license headers, don't feel compelled to add them.

    // Copyright 2016 cargo-check Developers
    //
    // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
    // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
    // http://opensource.org/licenses/MIT>, at your option. This file may not be
    // copied, modified, or distributed except according to those terms.
    

    I recommend publishing a new patch version (the z in x.y.z) so that the metadata propagates to crates.io.

    Please be sure to check the README.md for style. I've try to review these PRs as they go out, but I might miss something.

    Thanks for relicensing!

    (For my bookkeeping: this is repository id cargo-check-8bf7908f-512e-440b-b772-fc185bc1ec58)

    opened by emberian 0
  • error: the option `Z` is only accepted on the nightly compiler

    error: the option `Z` is only accepted on the nightly compiler

    Just installed Rust, Cargo, etc. the other day, and getting this error when running cargo-check

    `error: the option 'Z' is only accepted on the nightly compiler

    error: Could not compile 'helloworld'.`

    opened by MFernstrom 0
  • An unkown error occured: dep-info not in an understood format

    An unkown error occured: dep-info not in an understood format

    I was write some code and iteratively running cargo check when my computer crashed. Upon restarting, running cargo check gave:

    error: An unknown error occurred
    
    To learn more, run the command again with --verbose.
    

    cargo check --verbose gave:

    error: dep-info not in an understood format: /home/isaac/prog/rust/text/target/debug/.fingerprint/text-9ae3aaa45655e90e/dep-bin-text-9ae3aaa45655e90e
    

    The contents of the aforementioned file are:

    /home/isaac/prog/rust/text/target/debug/deps/text-9ae3aaa45655e90e.rmeta: src/main.rs
    
    /home/isaac/prog/rust/text/target/debug/deps/text-9ae3aaa45655e90e.d: src/main.rs
    
    src/main.rs:
    

    Notably, running cargo rustc -- -Zno-trans works without error as expected.

    opened by isaacg1 0
  • doesn't work with workspace

    doesn't work with workspace

    I have a binary crate with a workspace section with one member pointing to a library crate like here

    cargo rustc -- -Zno-trans works fine cargo check prints error: no library targets found

    opened by thiolliere 0
  • warning: function is never used: main

    warning: function is never used: main

    I get the following:

    warning: function is never used: `main`, #[warn(dead_code)] on by default
      --> src/bin/alt.rs:17:1
       |
    17 | fn main() {
       | ^
    

    This is wrong, correct?

    opened by remexre 1
  • co-exist with new `cargo check` sub-command

    co-exist with new `cargo check` sub-command

    Hi, in https://github.com/rust-lang/cargo/pull/3296 we've implemented a cargo check sub-command as part of Cargo. The advantage that has over this plugin is that it uses the stable rustc feature --crate-type metadata rather than -Zno-trans, it does no code gen wherever possible for dependent crates as well as the primary crate, and it can handle plugins and build scripts (and their dependencies) by generating code for these crates only.

    If you have any feedback on that PR it would be appreciated!

    Unfortunately, this plugin won't be able to use the check name because Cargo sub-commands get prioritised. I'd be interested to hear if there are niches where the plugin is still useful, and if we can do anything to help you there, please let us know.

    opened by nrc 0
Owner
Ray Solomon
Ray Solomon
FFI wrapper around cfitsio in Rust

rust-fitsio FFI wrapper around cfitsio in Rust Installation fitsio supports versions of cfitsio >= 3.08. cfitsio must be compiled with reentrant suppo

Simon Walker 22 Dec 24, 2022
A simple, yet feature-filled wrapper around the coqui-stt C API

A simple, yet feature-filled wrapper around the coqui-stt C API

0/0 56 Jan 3, 2023
A safe wrapper around Gamercade's raw Api.

gamercade-rs A safe wrapper around Gamercade's Raw Api. As the Raw Api requires using a lot of unsafe and hiding of values through different types (fo

null 1 Aug 23, 2022
🌋 A very lightweight wrapper around the Vulkan Memory Allocator 🦀

?? vk-mem-alloc-rs A very lightweight wrapper around the Vulkan Memory Allocator ?? [dependencies] vk-mem-alloc = "0.1.1" Simple Vulkan Memory Allocat

Project KML 13 Nov 8, 2022
Shows only the first page of rustc output

cargo-first-page Shows only the first page of rustc output. Installation cargo install cargo-firstpage Usage Prefix the cargo command by firstpage: T

Cecile Tonglet 11 Dec 19, 2021
Provide expansion of proc-macros, in a way that rustc directs you directly to the issues at hand

expander Expands a proc-macro into a file, and uses a include! directive in place. Advantages Only expands a particular proc-macro, not all of them. I

Bernhard Schuster 16 Oct 5, 2022
The working code for my Safe Pay app - check out my tutorial!

Safe Pay Tutorial This repository contains the source code for my blog post Using PDAs and SPL Token in Anchor. The code contains the following: Solan

Daniel Pyrathon 39 Aug 28, 2022
A Garry's Mod module that lets you check which fonts are available on the system

gm_fontsx Since apparently we're never getting a proper way to check for installed fonts on Garry's Mod, this has to exist ?? Usage require("fontsx")

Earu 4 Mar 14, 2022
CFD is a tool that allows you to check one or more domains to see if they are protected by CloudFlare or not.

CFD is a tool that allows you to check one or more domains to see if they are protected by CloudFlare or not. The check is carried out based on five criteria: 3 headers in the HTTP response, IP, and SSL certificate issuer. The check result can be displayed on the screen or saved to a file.

Airat Galiullin 13 Apr 7, 2023
cargo extension for flashing embedded rust programs via dfu based on jacobrosenthals cargo-hf2

cargo-dfu This crate provides a cargo subcommand to flash ELF binaries via dfu Most STM chips will probably work with this, although you might need to

Roman Kretschmer 0 Feb 6, 2022
A collection of compilers based around compiling a high level language to a Brainfuck dialect.

tf A collection of compilers based around compiling a high level language to a Brainfuck dialect. Built at, and for, the VolHacks V hackathon during O

adam mcdaniel 6 Nov 25, 2021
A high-level Rust crate around the Discord API, aimed to be easy and straight-forward to use.

rs-cord A high-level Rust crate around the Discord API, aimed to be easy and straight-forward to use. Documentation • Crates.io • Discord Navigation M

Jay3332 4 Sep 24, 2022
A simple library with just one struct which is used to wrap around pointers

A simple library with just one struct which is used to wrap around pointers. This can be used to create pointers and share them across threads without the hassle of synchronization if you really do not care about that.

null 1 Apr 11, 2022
Just a personal Rust Playground to play around and understand the language.

Rust Proactive Introduction The code is a bit messy but it serves just as a personal Rust Playground to play around and understand the language. You c

Fernando Cejas 3 Dec 21, 2022
dm-jitaux is a Rust-based JIT compiler using modified auxtools, dmasm and Inkwell LLVM wrapper for boosting Byond DM performance without any hassle!

dm-jitaux is a Rust-based JIT compiler using modified auxtools, dmasm and Inkwell LLVM wrapper for boosting Byond DM performance without any hassle (such as rewriting/refactroing your DM code).

SS220 20 Dec 13, 2022
A lightweight Discord wrapper made in Tauri

Discord-Tauri is a work in progress lightweight wrapper for Discord.

null 104 Dec 20, 2022
A rust wrapper for the spam protection API

SpamProtection-rs Table of contents About Supported Rust version Features How to use Credits License About This repo has been shifted to the official

cyberknight777 28 Aug 5, 2022
A Rust wrapper for the SponsorBlock API.

sponsor-block A Rust wrapper for the SponsorBlock API, which you can find complete documentation for here. Uses SponsorBlock data licensed under CC BY

Zacchary Dempsey-Plante 8 Nov 19, 2022
API wrapper for the tankerkönig api

tankerkoenig-rs API wrapper for the tankerkoenig-api written in rust. Gives you ready deserialized structs and a easy to use and strictly typed api. I

Jonathan 2 Feb 27, 2022