add "cargo dev crater" to run clippy on a fixed set of crates and diff the lint warnings
`cargo dev crater` now does the following:
build clippy in debug mode
for a fixed set of crates:
download and extract the crate
run compiled clippy on the crate
dump the warnings into a file that is inside the repo
We can then do a "git diff" and see what effects our clippy changes had on a tiny fraction of the rust ecosystem and can see when an change unexpectedly added or silenced a lot of warnings.
Checking all the crates took less than 5 minutes on my system.
Should help with https://github.com/rust-lang/rust-clippy/issues/6429
---
*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: extend cargo dev to run clippy against a fixed set of crates and compare warnings
Enforce that query results implement Debug
Currently, we require that query keys implement `Debug`, but we do not do the same for query values. This can make incremental compilation bugs difficult to debug - there isn't a good place to print out the result loaded from disk.
This PR adds `Debug` bounds to several query-related functions, allowing us to debug-print the query value when an 'unstable fingerprint' error occurs. This required adding `#[derive(Debug)]` to a fairly large number of types - hopefully, this doesn't have much of an impact on compiler bootstrapping times.
mark raw_vec::ptr with inline
when a lot of vectors is used in a enum as in the example in #66617 if this function is not inlined and multiple cgus is used this results in huge compile times. with this fix the compile time is 6s from minutes for the example in #66617. I did not have the patience to wait for it to compile for more then 3 min.
The cargo check was checking that every dependency had an `extern crate`.
The compiler has not used `extern crate` in a long time (edition 2018).
The test was broken (the call to `!super::filter_dirs(path)` was backwards).
This just removes it since it is no longer valid.
This reduces the total complexity of checking timeouts from quadratic
to linear, and should also fix an unwrap of None on completion of an
already timed-out test.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Prevent query cycles in the MIR inliner
r? `@eddyb` `@wesleywiser`
cc `@rust-lang/wg-mir-opt`
The general design is that we have a new query that is run on the `validated_mir` instead of on the `optimized_mir`. That query is forced before going into the optimization pipeline, so as to not try to read from a stolen MIR.
The query should not be cached cross crate, as you should never call it for items from other crates. By its very design calls into other crates can never cause query cycles.
This is a pessimistic approach to inlining, since we strictly have more calls in the `validated_mir` than we have in `optimized_mir`, but that's not a problem imo.
Use the monorepo's lockfile when building cargo for PGO profiling
Fixes https://github.com/rust-lang/rust/issues/81378. The description of the problem and the reasoning for the fix is in the source code comments.
r? `@Mark-Simulacrum`
Add expected error
Add comment
Tweak comment wording
Fix after rebase to updated master
Fix after rebase to updated master
Distinguish mutation in normal and move closures
Tweak error message
Fix error message for nested closures
Refactor code showing mutated upvar in closure
Remove debug assert
B
Use elapsed wall time spent on codegen_to_LLVM_IR for all CGUs as a
whole, rather than the sum for each CGU (the distinction matters for
parallel builds, where some CGUs are processed in parallel).
Otherwise we can miss bugs where a test reports that it succeeded but
then panics within a TLS destructor.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Rollup of 14 pull requests
Successful merges:
- #75180 (Implement Error for &(impl Error))
- #78578 (Permit mutable references in all const contexts)
- #79174 (Make std::future a re-export of core::future)
- #79884 (Replace magic numbers with existing constants)
- #80855 (Expand assert!(expr, args..) to include $crate for hygiene on 2021.)
- #80933 (Fix sysroot option not being honored across rustc)
- #81259 (Replace version_check dependency with own version parsing code)
- #81264 (Add unstable option to control doctest run directory)
- #81279 (Small refactor in typeck)
- #81297 (Don't provide backend_optimization_level query for extern crates)
- #81302 (Fix rendering of stabilization version for trait implementors)
- #81310 (Do not mark unit variants as used when in path pattern)
- #81320 (Make bad shlex parsing a pretty error)
- #81338 (Clean up `dominators_given_rpo`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Do not mark unit variants as used when in path pattern
Record that we are processing a pattern so that code responsible for
handling path resolution can correctly decide whether to mark it as
used or not.
Closes#76788.
Fix rendering of stabilization version for trait implementors
Rustdoc compares an item's stabilization version with its parent's to not render it if they are the same. Here, the implementor was compared with itself, resulting in the stabilization version never getting shown.
This probably needs a test.
Fixes#80777.
r? `@jyn514`
Small refactor in typeck
- `check_impl_items_against_trait` only queries and walks through associated items once
- extracted function that reports errors
- don't check specialization validity when trait item does not match
- small additional cleanups
Replace version_check dependency with own version parsing code
This gives compiler maintainers a better degree of control
over how the version gets parsed and is a good way to ensure
that there are no changes of behaviour in the future.
Also, issue a warning if the version is invalid instead of erroring
so that we stay forwards compatible with possible future changes
of the versioning scheme.
Last, this improves the present test a little.
Fixes#79436
r? `@petrochenkov`
Fix sysroot option not being honored across rustc
Change link_sanitizer_runtime() to check if the sanitizer library exists in the specified/session sysroot, and if it doesn't exist, use the default sysroot. (See #79253.)
Expand assert!(expr, args..) to include $crate for hygiene on 2021.
This makes `assert!(expr, args..)` properly hygienic in Rust 2021.
This is part of rust-lang/rfcs#3007, see #80162.
Before edition 2021, this was a breaking change, as `std::panic` and `core::panic` are different. In edition 2021 they will be identical, making it possible to apply proper hygiene here.