Michael Howell [Tue, 28 Jun 2022 21:56:24 +0000 (14:56 -0700)]
rustdoc: fix keyboard shortcuts bug in settings menu
This commit fixes the keyboard shorts code to call localStorage every time a
key is pressed. This matters because you're supposed to be able to change a
setting and have it immediately take effect.
bors [Tue, 28 Jun 2022 16:10:30 +0000 (16:10 +0000)]
Auto merge of #98188 - mystor:fast_group_punct, r=eddyb
proc_macro/bridge: stop using a remote object handle for proc_macro Punct and Group
This is the third part of https://github.com/rust-lang/rust/pull/86822, split off as requested in https://github.com/rust-lang/rust/pull/86822#pullrequestreview-1008655452. This patch transforms the `Punct` and `Group` types into structs serialized over IPC rather than handles, making them more efficient to create and manipulate from within proc-macros.
The initialization function of hermit's `Condvar` is not called since https://github.com/rust-lang/rust/pull/97647 and was erroneously removed in https://github.com/rust-lang/rust/pull/97879.
Dylan DPC [Tue, 28 Jun 2022 10:00:05 +0000 (15:30 +0530)]
Rollup merge of #98430 - camsteffen:flatten-refactor, r=joshtriplett
Refactor iter adapters with less macros
Just some code cleanup. Introduced a util `and_then_or_clear` for each of chain, flatten and fuse iter adapter impls. This reduces code nicely for flatten, but admittedly the other modules are more of a lateral move replacing macros with a function. But I think consistency across the modules and avoiding macros when possible is good.
Dylan DPC [Tue, 28 Jun 2022 10:00:04 +0000 (15:30 +0530)]
Rollup merge of #98420 - davidtwco:translation-lint-fixes-and-more-migration, r=compiler-errors
translation: lint fix + more migration
- Unfortunately, the diagnostic lints are very broken and trigger much more often than they should. This PR corrects the conditional which checks if the function call being made is to a diagnostic function so that it returns in every intended case.
- The `rustc_lint_diagnostics` attribute is used by the diagnostic translation/struct migration lints to identify calls where non-translatable diagnostics or diagnostics outwith impls are being created. Any function used in creating a diagnostic should be annotated with this attribute so this PR adds the attribute to many more functions.
- Port the diagnostics from the `rustc_privacy` crate and enable the lints for that crate.
Dylan DPC [Tue, 28 Jun 2022 10:00:03 +0000 (15:30 +0530)]
Rollup merge of #98384 - rdzhaafar:fix-macos-rss-reporting, r=davidtwco,michaelwoerister
Fix RSS reporting on macOS
> NOTE: This is a duplicate of #98164, which I closed because I borked my rustc fork
Currently, `rustc_data_structures::profiling::get_resident_set_size()` always returns `None` on macOS. This is because
macOS does not implement procfs used in the unix version of the function:
```rust
...
else if #[cfg(unix)] {
pub fn get_resident_set_size() -> Option<usize> {
let field = 1;
let contents = fs::read("/proc/self/statm").ok()?;
let contents = String::from_utf8(contents).ok()?;
let s = contents.split_whitespace().nth(field)?;
let npages = s.parse::<usize>().ok()?;
Some(npages * 4096)
}
...
```
The proposed solution uses libproc, and more specifically `proc_pidinfo`, which has been available on macOS since 10.5 if the function signature inside libproc.h is to be believed:
```c
int proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
```
Dylan DPC [Tue, 28 Jun 2022 10:00:01 +0000 (15:30 +0530)]
Rollup merge of #98261 - WaffleLapkin:attempt_to_remove_max_suggestion_highlight_lines, r=flip1995
Remove `MAX_SUGGESTION_HIGHLIGHT_LINES`
After #97798 the `MAX_SUGGESTION_HIGHLIGHT_LINES` constant doesn't really make sense since we always show full suggestions. This PR removes last usages of the constant and the constant itself.
r? ``@flip1995`` (this mostly does changes in clippy)
Dylan DPC [Tue, 28 Jun 2022 10:00:00 +0000 (15:30 +0530)]
Rollup merge of #97346 - JohnTitor:remove-back-compat-hacks, r=oli-obk
Remove a back-compat hack on lazy TAIT
This PR's motivation is here: https://github.com/rust-lang/rust/issues/72614#issuecomment-1134595446
~~But removing a hack doesn't seem to reject the code on the issue, there're some more hacks?~~
r? ``@oli-obk``
Matthias Krüger [Mon, 27 Jun 2022 20:35:14 +0000 (22:35 +0200)]
Rollup merge of #98587 - RalfJung:core-tests, r=thomcc
libcore tests: avoid int2ptr casts
We don't need any of these pointers to actually be dereferenceable so using `ptr::invalid` should be fine. And then we can run Miri with strict provenance enforcement on the tests.
Matthias Krüger [Mon, 27 Jun 2022 20:35:13 +0000 (22:35 +0200)]
Rollup merge of #98579 - RalfJung:alloc-tests, r=thomcc
liballoc tests: avoid int2ptr cast
I think we don't need `ptr::from_exposed_addr` here; `ptr::invalid` should be enough for this test. (And this makes Miri less unhappy when running these tests.)
Matthias Krüger [Mon, 27 Jun 2022 20:35:08 +0000 (22:35 +0200)]
Rollup merge of #98563 - RalfJung:interpret-alloc-check, r=oli-obk
interpret: refactor allocation info query
We now have an infallible function that also tells us which kind of allocation we are talking about.
Also we do longer have to distinguish between data and function allocations for liveness.
This will help us to avoid "catching" `InterpError`s in Miri.
r? `@oli-obk`
bors [Mon, 27 Jun 2022 19:42:09 +0000 (19:42 +0000)]
Auto merge of #97307 - SparrowLii:parallel, r=cjgillot
catch unwind in parallel mode during wfcheck
Update #75760
When performing wfcheck, from the test results, the parallel mode will stop all checks when an `item`'s check failed, (e.g. the first ui test failure raised from [here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs#L249))while the serial mode will output each `item`'s check result via `catch_unwind`. This leads to inconsistencies in the final output of the two mode.
In my local environment, this modification prevents the following ui tests from failing when set `parallel-compiler = true` in `config.toml`:
bors [Mon, 27 Jun 2022 16:28:58 +0000 (16:28 +0000)]
Auto merge of #98566 - matthiaskrgr:rollup-43etyls, r=matthiaskrgr
Rollup of 5 pull requests
Successful merges:
- #97389 (Improve memory ordering diagnostics)
- #97780 (Check ADT field is well-formed before checking it is sized)
- #98530 (compiletest: add issue number param to `known-bug`)
- #98556 (Fix builds on Windows (closes #98546))
- #98561 (Fix spelling in SAFETY comment)
David Wood [Wed, 22 Jun 2022 12:24:35 +0000 (13:24 +0100)]
various: add `rustc_lint_diagnostics` to diag fns
The `rustc_lint_diagnostics` attribute is used by the diagnostic
translation/struct migration lints to identify calls where
non-translatable diagnostics or diagnostics outwith impls are being
created. Any function used in creating a diagnostic should be annotated
with this attribute so this commit adds the attribute to many more
functions.
David Wood [Wed, 22 Jun 2022 10:25:10 +0000 (11:25 +0100)]
lint: fix condition in diagnostic lints
Unfortunately, the diagnostic lints are very broken and trigger much
more often than they should. Correct the conditional which checks if the
function call being made is to a diagnostic function so that it returns
in every intended case.
Matthias Krüger [Mon, 27 Jun 2022 06:06:46 +0000 (08:06 +0200)]
Rollup merge of #97780 - compiler-errors:field-wfcheck-before-sized, r=jackh726
Check ADT field is well-formed before checking it is sized
Fixes #96810.
There is one diagnostics regression, in [`src/test/ui/generic-associated-types/bugs/issue-80626.stderr`](https://github.com/rust-lang/rust/pull/97780/files#diff-53795946378e78a0af23a10277c628ff79091c18090fdc385801ee70c1ba6963). I am not super concerned about it, since it's GAT related.
We _could_ fix it, possibly by using the `FieldSized` obligation cause code instead of `BuiltinDerivedObligation`. But that would require changing `Sized` trait confirmation and the `adt_sized_constraint` query.
Before this change, the compiler suggests the failure ordering is too strong and suggests choosing a weaker ordering. After this change, it instead suggests the success ordering is not strong enough, and suggests chosing a stronger one. This is more likely to be correct.
Also, before this change, the compiler suggested downgrading an invalid AcqRel failure ordering to Relaxed, without mentioning Acquire as an option.
bors [Mon, 27 Jun 2022 05:36:50 +0000 (05:36 +0000)]
Auto merge of #98285 - nikic:update-llvm-5, r=cuviper
Rebase LLVM submodule
This is a rebase of our LLVM fork onto LLVM 14.0.5, which is intended to be the last release of the 14.x series. Additionally:
* I've dropped three patches that were needed to build on FreeBSD 11, which is no longer necessary after #97944.
* I've dropped some cherry-picks that were later reverted.
* I've cherry-picked https://github.com/llvm/llvm-project/commit/caa2a829cdf905a5e8664d96a464d414b2adb42e for https://github.com/rust-lang/rust/issues/96797 (fyi `@Amanieu)`
Ralf Jung [Mon, 27 Jun 2022 02:49:38 +0000 (22:49 -0400)]
interpret: refactor allocation info query
We now have an infallible function that also tells us which kind of allocation we are talking about.
Also we do longer have to distinguish between data and function allocations for liveness.
proc_macro: stop using a remote object handle for Group
This greatly reduces round-trips to fetch relevant extra information about the
token in proc macro code, and avoids RPC messages to create Group tokens.
Nika Layzell [Tue, 29 Jun 2021 02:30:55 +0000 (22:30 -0400)]
proc_macro: stop using a remote object handle for Punct
This greatly reduces round-trips to fetch relevant extra information about the
token in proc macro code, and avoids RPC messages to create Punct tokens.
bors [Sun, 26 Jun 2022 21:28:24 +0000 (21:28 +0000)]
Auto merge of #98187 - mystor:fast_span_call_site, r=eddyb
proc_macro/bridge: cache static spans in proc_macro's client thread-local state
This is the second part of https://github.com/rust-lang/rust/pull/86822, split off as requested in https://github.com/rust-lang/rust/pull/86822#pullrequestreview-1008655452. This patch removes the RPC calls required for the very common operations of `Span::call_site()`, `Span::def_site()` and `Span::mixed_site()`.
Some notes:
This part is one of the ones I don't love as a final solution from a design standpoint, because I don't like how the spans are serialized immediately at macro invocation. I think a more elegant solution might've been to reserve special IDs for `call_site`, `def_site`, and `mixed_site` at compile time (either starting at 1 or from `u32::MAX`) and making reading a Span handle automatically map these IDs to the relevant values, rather than doing extra serialization.
This would also have an advantage for potential future work to allow `proc_macro` to operate more independently from the compiler (e.g. to reduce the necessity of `proc-macro2`), as methods like `Span::call_site()` could be made to function without access to the compiler backend.
That was unfortunately tricky to do at the time, as this was the first part I wrote of the patches. After the later part (#98188, #98189), the other uses of `InternedStore` are removed meaning that a custom serialization strategy for `Span` is easier to implement.
If we want to go that path, we'll still need the majority of the work to split the bridge object and introduce the `Context` trait for free methods, and it will be easier to do after `Span` is the only user of `InternedStore` (after #98189).
bors [Sun, 26 Jun 2022 19:02:00 +0000 (19:02 +0000)]
Auto merge of #98545 - matthiaskrgr:rollup-njely29, r=matthiaskrgr
Rollup of 11 pull requests
Successful merges:
- #97140 (std: use an event-flag-based thread parker on SOLID)
- #97295 ([rustc_parse] Forbid `let`s in certain places)
- #97743 (make const_err show up in future breakage reports)
- #97908 (Stabilize NonZero* checked operations constness.)
- #98297 (Transform help popup into a pocket menu)
- #98428 (macros: use typed identifiers in diag and subdiag derive)
- #98528 (Respect --color when building rustbuild itself)
- #98535 (Add regression test for generic const in rustdoc)
- #98538 (Add a ui test for issue #91883)
- #98540 (Add regression test for #87558)
- #98541 (Update `std::alloc::System` doc example code style)
Matthias Krüger [Sun, 26 Jun 2022 17:47:04 +0000 (19:47 +0200)]
Rollup merge of #98428 - davidtwco:translation-derive-typed-identifiers, r=oli-obk
macros: use typed identifiers in diag and subdiag derive
Using typed identifiers instead of strings with the Fluent identifiers in the diagnostic and subdiagnostic derives - this enables the diagnostic derive to benefit from the compile-time validation that comes with typed identifiers, namely that use of a non-existent Fluent identifier will not compile.
Matthias Krüger [Sun, 26 Jun 2022 17:47:01 +0000 (19:47 +0200)]
Rollup merge of #97743 - RalfJung:const-err-future-breakage, r=estebank
make const_err show up in future breakage reports
As tracked in https://github.com/rust-lang/rust/issues/71800, const_err should become a hard error Any Day Now (TM). I'd love to move forward with that sooner rather than later; it has been deny-by-default for many years and a future incompat lint since https://github.com/rust-lang/rust/pull/80394 (landed more than a year ago). Some CTFE errors are already hard errors since https://github.com/rust-lang/rust/pull/86194. But before we truly make it a hard error in all cases, we now have one more intermediate step we can take -- to make it show up in future breakage reports.
Matthias Krüger [Sun, 26 Jun 2022 17:47:00 +0000 (19:47 +0200)]
Rollup merge of #97295 - c410-f3r:yet-another-let-chain, r=compiler-errors
[rustc_parse] Forbid `let`s in certain places
Currently only forbids in locals to resolve https://github.com/rust-lang/rust/pull/94927#issuecomment-1099605024 but feel free to point any other places.
Matthias Krüger [Sun, 26 Jun 2022 17:46:59 +0000 (19:46 +0200)]
Rollup merge of #97140 - joboet:solid_parker, r=m-ou-se
std: use an event-flag-based thread parker on SOLID
`Mutex` and `Condvar` are being replaced by more efficient implementations, which need thread parking themselves (see #93740). Therefore, the generic `Parker` needs to be replaced on all platforms where the new lock implementation will be used, which, after #96393, are SOLID, SGX and Hermit (more PRs coming soon).
SOLID, conforming to the [μITRON specification](http://www.ertl.jp/ITRON/SPEC/FILE/mitron-400e.pdf), has event flags, which are a thread parking primitive very similar to `Parker`. However, they do not make any atomic ordering guarantees (even though those can probably be assumed) and necessitate a system call even when the thread token is already available. Hence, this `Parker`, like the Windows parker, uses an extra atomic state variable.
I future-proofed the code by wrapping the event flag in a `WaitFlag` structure, as both SGX and Hermit can share the Parker implementation, they just have slightly different primitives (SGX uses signals and Hermit has a thread blocking API).
`````@kawadakk````` I assume you are the target maintainer? Could you test this for me?
bors [Sun, 26 Jun 2022 12:16:10 +0000 (12:16 +0000)]
Auto merge of #98518 - RalfJung:miri, r=RalfJung
update Miri
Fixes https://github.com/rust-lang/rust/issues/98493 (this is a flaky test, that's why the toolstate already says Miri is fixed)
r? `@ghost` Cc `@rust-lang/miri`
bors [Sun, 26 Jun 2022 07:12:16 +0000 (07:12 +0000)]
Auto merge of #98521 - JohnTitor:rollup-tl9sblx, r=JohnTitor
Rollup of 8 pull requests
Successful merges:
- #98371 (Fix printing `impl trait` under binders)
- #98385 (Work around llvm 12's memory ordering restrictions.)
- #98474 (x.py: Support systems with only `python3` not `python`)
- #98488 (Bump RLS to latest master on rust-lang/rls)
- #98491 (Fix backtrace UI test when panic=abort is used)
- #98502 (Fix source sidebar hover in ayu theme)
- #98509 (diagnostics: consider parameter count when suggesting smart pointers)
- #98513 (Fix LLVM rebuild with download-ci-llvm.)
Yuki Okushi [Sun, 26 Jun 2022 04:15:03 +0000 (13:15 +0900)]
Rollup merge of #98513 - ehuss:rebuild-llvm-download, r=Mark-Simulacrum
Fix LLVM rebuild with download-ci-llvm.
This fixes an issue where updating a local checkout that includes a change in `src/version` causes a linking failure.
The cause is that the `rustc_llvm` build script uses `rerun-if-changed` of `llvm-config` to know if it needs to rerun. Cargo only compares the timestamp of the last time the build script to the file. However, extracting the tar files retains the timestamps in the tarball which may be some time in the past. Since `src/version` is included in the LLVM `.so` filename, `rustc` attempts to load the wrong shared library since the `rustc_llvm` build script doesn't rerun.
https://github.com/rust-lang/cargo/issues/10791 contains a more detailed explanation.
The solution here is a hack which updates the timestamp of `llvm-config` to the current time when it is extracted.
This is a bit of a hack, but seems to be the best solution I can think of until https://github.com/rust-lang/cargo/issues/10791 is fixed. There are likely several other situations where this is a problem (such as using system LLVM), and this isn't really a complete fix.
Note that apple platforms are not directly affected by this problem because they don't have a version in the dylib filename.
It's because the CSS selector was not precise enough and was "overloaded" with another one. This PR fixes it and adds a test for the colors in the source sidebar.
Yuki Okushi [Sun, 26 Jun 2022 04:15:00 +0000 (13:15 +0900)]
Rollup merge of #98491 - antoyo:fix/ui-test-backtrace-panic-abort, r=Dylan-DPC
Fix backtrace UI test when panic=abort is used
The function `contains_verbose_expected` is only used when the panic strategy is not abort, so it caused a warning when it was abort, which made the UI test failed on stderr comparison.
Yuki Okushi [Sun, 26 Jun 2022 04:14:59 +0000 (13:14 +0900)]
Rollup merge of #98488 - Mark-Simulacrum:bump-rls, r=pietroalbini
Bump RLS to latest master on rust-lang/rls
Of primary interest, this merges
rust-lang/rls@ece09b88c0365947af79c0ffdeea02bc6c1eec25 into rust-lang/rust,
which brings in the changes that fix RLS tests broken by #97853. #97853 already
introduced that commit's changes (under
rust-lang/rls@27f4044df03d15c7c38a483c3e4635cf4f51807d) but without putting those changes on
rust-lang/rls as a branch, so we ended up with an orphan commit that caused
trouble when updating submodules in rust-lang/rust.
This commit, once merged into rust-lang/rust, should continue to let RLS tests
to pass on rust-lang/rust's side and move us back into a healthy state where tip
of the submodule points to a valid master commit in the rust-lang/rls
repository.
cc https://github.com/rust-lang/rust/issues/98451, but not marking as fixed as I believe we need to add verification to prevent future oversights.