Remove CACHE_KEY global
We realized in https://github.com/rust-lang/rust/pull/80914 that the cache handling (through a global) needed to be updated to make it much easier to handle.
r? `@jyn514`
Make weak item traversal deterministic
Fix#81296.
(No test added. The relevant test *is* ui/panic-handler/weak-lang-item.rs, and this change should make it less flaky.)
Refine "remove semicolon" suggestion in trait selection
Don't suggest it if the last statement doesn't have a semicolon
Fixes#81098
See also #54771 for why this suggestion was added
tidy: Some code cleanup.
This is just some cleanup that shouldn't have any change in behavior. (See commit messages for more details.)
* Remove cargo check. This test wasn't working, and is no longer valid.
* Remove edition filter exceptions. They are no longer necessary.
* Remove unnecessary trailing semicolon. Otherwise the warning will prevent tidy from building after the beta branch.
Update books
## nomicon
7 commits in a8584998eacdea7106a1dfafcbf6c1c06fcdf925..bbf06ad39d1f45654047e9596b750cc6e6d1b693
2021-01-06 12:49:49 -0500 to 2021-01-22 07:07:31 -0800
- Fix alloc link in exotic-sizes for local docs (rust-lang-nursery/nomicon#255)
- Remove TODO
- Fix small punctuation error
- Arc revisions (Clone atomic explanation) (pt2/3(+?))
- Fix Arc Clone
- Arc revisions (pt1/2(+?))
- Simple Arc implementation (without Weak refs)
## reference
5 commits in 50af691f838937c300b47812d0507c6d88c14f97..f02b09eb6e8af340ad1256a54adb7aae2ff3163e
2021-01-12 21:19:20 -0800 to 2021-01-22 01:53:02 -0800
- Fix missing space (rust-lang-nursery/reference#941)
- Start documenting name resolution. (rust-lang-nursery/reference#937)
- Fix plural and delete spurious words in comparison ops (rust-lang-nursery/reference#932)
- Document execution order (rust-lang-nursery/reference#888)
- Compound operator expressions (rust-lang-nursery/reference#915)
## book
3 commits in ac57a0ddd23d173b26731ccf939f3ba729753275..e724bd826580ff95df48a8533af7dec1080693d4
2021-01-09 14:18:45 -0500 to 2021-01-20 08:19:49 -0600
- Fixesrust-lang/book#2417. Get the index from user input instead of a const. (rust-lang/book#2566)
- Turn off the playground in a bunch more lib.rs inclusions (rust-lang/book#2569)
- Merge pull request rust-lang/book#2567 from rust-lang/rust-1.49
## rust-by-example
1 commits in 03e23af01f0b4f83a3a513da280e1ca92587f2ec..f633769acef68574427a6fae6c06f13bc2199573
2021-01-09 10:20:28 -0300 to 2021-01-13 20:58:25 -0300
- Fixed styling on closure example (rust-lang/rust-by-example#1405)
rustdoc: Document CommonMark extensions.
This updates the rustdoc book to include some documentation on the CommonMark extensions that rustdoc supports.
rustc_codegen_ssa: use wall time for codegen_to_LLVM_IR time-passes entry
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).
Fix some bugs reported by eslint
Simply went into `src/librustdoc/html/static/` and ran `eslint *.js` in case you want to reproduce. :)
r? ``````@Nemo157``````
BTreeMap: test all borrowing interfaces and test more chaotic order behavior
Inspired by #81169, test what happens if you mess up order of the type with which you search (as opposed to the key type).
r? `@Mark-Simulacrum`
Add `unwrap_unchecked()` methods for `Option` and `Result`
In particular:
- `unwrap_unchecked()` for `Option`.
- `unwrap_unchecked()` and `unwrap_err_unchecked()` for `Result`.
These complement other `*_unchecked()` methods in `core` etc.
Currently there are a couple of places it may be used inside rustc (`LinkedList`, `BTree`). It is also easy to find other repositories with similar functionality.
Fixes#48278.
BTreeMap: bring back the key slice for immutable lookup
Pave the way for binary search, by reverting a bit of #73971, which banned `keys` for misbehaving while it was defined for every `BorrowType`. Adding some `debug_assert`s along the way.
r? `@Mark-Simulacrum`
libtest: Wait for test threads to exit after they report completion
Otherwise we can miss bugs where a test reports that it succeeded but then panics within a TLS destructor.
Example:
```rust
use std:🧵:sleep;
use std::time::Duration;
struct Foo;
impl Drop for Foo {
fn drop(&mut self) {
sleep(Duration::from_secs(1));
panic!()
}
}
thread_local!(static FOO: Foo = Foo);
#[test]
pub fn test() {
FOO.with(|_| {});
}
```
Before this fix, `cargo test` incorrectly reports success.
```console
$ cargo test
Finished test [unoptimized + debuginfo] target(s) in 0.01s
Running target/debug/deps/panicking_test-85130fa46b54f758
running 1 test
test test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
$ echo $?
0
```
After this fix, the failure is visible. (The entire process is aborted due to #24479.)
```console
$ cargo test
Finished test [unoptimized + debuginfo] target(s) in 0.01s
Running target/debug/deps/panicking_test-76180625bc2ee3c9
running 1 test
thread 'test' panicked at 'explicit panic', src/main.rs:9:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
error: test failed, to rerun pass '--bin panicking-test'
Caused by:
process didn't exit successfully: `/tmp/panicking-test/target/debug/deps/panicking_test-76180625bc2ee3c9 --nocapture` (signal: 6, SIGABRT: process abort signal)
$ echo $?
101
```
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`