rsolomo / cargo-check Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
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.
Hi, in rust-lang/cargo#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.
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
.
Available in Rust 1.12
% 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.
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
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.
Use case
cargo check && cargo doc && cargo test
I.e. once project gets successfully compiled, I might want to run tests again, but due to cargo check
recompiling project both cargo doc
and cargo test
compile stuff again when there's no need, which takes time.
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.
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.
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!
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.
It would be nice if I could use cargo install cargo-check
.
I've been getting this warning on every invocation of cargo check
on stable rust (1.10):
$ cargo check
Compiling ...redacted...
warning: the option `Z` is unstable and should only be used on the nightly compiler, but it is currently accepted for backwards compatibility; this will soon change, see issue #31847 for more details
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'.`
I would like to see an option, such as --recur-local
, that checks the dependency list for the current crate and recurs, building a list of dependencies that are path-local, for example:
[dependencies]
subcrate = { path = "subcrate" }
subcrate2 = { path = "subcrate2" }
where each subcrate may have further local dependencies.
After building this list, the command would invoke cargo check -p <dep>
on each one and append all the warning output until it reached the top crate.
The use case is in large projects that split their code into trees of crates to reduce iteration time or better organize independent parts. Currently, if you invoke cargo check
, the dependencies will only be linted when they need to be recompiled. This hinders the output that parsers like Syntastic or atom-linter have to work with.
Problems with this would be when there's an error in a leaf crate. Because rustc
needs rlib
s to reference symbols from, if a lower level crate fails to compile, the upper ones can't even be checked with -Zno-trans
. Another issue is that invoking cargo rustc
or cargo build
at all, even with -Zno-trans
, causes cargo to delete the existing artifacts for the crate, so lower level crates would have to be recompiled anyway for the full lint.
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.
See rust-lang/rust#33602 for this new feature.
Basically, it supports compiling dependencies using no-trans as well
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.