Matthias Krüger [Wed, 19 Oct 2022 05:15:31 +0000 (07:15 +0200)]
Rollup merge of #103178 - ferrocene:pa-coverage-reports-tests, r=Mark-Simulacrum
Partially fix `src/test/run-make/coverage-reports` when cross-compiling
The test does not work on cross-compiled targets because the --target flag was not passed to rustc inside the test. This commit fixes that by adding the flag to the invocations.
Note that the test still fails on cross-compiled targets using remote-test, as remote-test is not capable (yet) of sending back to the host system the `*.profraw` file generated by the instrumentation.
Because of that, this is only a partial fix, and the test has been ignored on cross-compilation.
Matthias Krüger [Wed, 19 Oct 2022 05:15:30 +0000 (07:15 +0200)]
Rollup merge of #103166 - the8472:copied-next-chunk, r=m-ou-se
Optimize `slice_iter.copied().next_chunk()`
```
OLD:
test iter::bench_copied_array_chunks ... bench: 371 ns/iter (+/- 7)
NEW:
test iter::bench_copied_array_chunks ... bench: 31 ns/iter (+/- 0)
```
The default `next_chunk` implementation suffers from having to assemble the array byte by byte via `next()`, checking the `Option<&T>` and then dereferencing `&T`. The specialization copies the chunk directly from the slice.
bors [Wed, 19 Oct 2022 02:53:24 +0000 (02:53 +0000)]
Auto merge of #103213 - matthiaskrgr:rollup-diloxg3, r=matthiaskrgr
Rollup of 6 pull requests
Successful merges:
- #101889 (doc: rewrite doc for uint::{carrying_add,borrowing_sub})
- #102507 (More slice::partition_point examples)
- #103164 (rustdoc: remove CSS ``@media` (min-width: 701px)`)
- #103189 (Clean up code-color and headers-color rustdoc GUI tests)
- #103203 (Retrieve LLVM version from llvm-filecheck binary if it is not set yet)
- #103204 (Add some more autolabels)
bors [Wed, 19 Oct 2022 00:02:40 +0000 (00:02 +0000)]
Auto merge of #102769 - nnethercote:rustdoc-startup, r=jyn514
Clean up rustdoc startup
Startup is pretty hairy, in both rustdoc and rustc. The first commit here improves the rustdoc situation quite a bit. The remaining commits are smaller but also help.
Use `interface::run_compiler` for `markdown::render`.
It turns out `markdown::render` is more complex than it first appears,
because it can invoke `doctest::make_test`, which requires session
globals and a thread pool.
So this commit changes it to use `interface::run_compiler`. Three of the
four paths in `main_args` now use `interface::run_compiler`.
rustc's startup has several layers, including:
- `interface::run_compiler` passes a closure, `f`, to
`run_in_thread_pool_with_globals`, which creates a thread pool, sets
up session globals, and passes `f` to `create_compiler_and_run`.
- `create_compiler_and_run` creates a `Session`, a `Compiler`, sets the
source map, and calls `f`.
rustdoc is a bit different.
- `main_args` calls `main_options` via
`run_in_thread_pool_with_globals`, which (again) creates a thread pool
(hardcoded to a single thread!) and sets up session globals.
- `main_options` has four different paths.
- The second one calls `interface::run_compiler`, which redoes the
`run_in_thread_pool_with_globals`! This is bad.
- The fourth one calls `interface::create_compiler_and_run`, which is
reasonable.
- The first and third ones don't do anything of note involving the
above functions, except for some symbol interning which requires
session globals.
In other words, rustdoc calls into `rustc_interface` at three different
levels. It's a bit confused, and feels like code where functionality has
been added by different people at different times without fully
understanding how the globally accessible stuff is set up.
This commit tidies things up. It removes the
`run_in_thread_pool_with_globals` call in `main_args`, and adjust the
four paths in `main_options` as follows.
- `markdown::test` calls `test::test_main`, which provides its own
parallelism and so doesn't need a thread pool. It had one small use of
symbol interning, which required session globals, but the commit
removes this.
- `doctest::run` already calls `interface::run_compiler`, so it doesn't
need further adjustment.
- `markdown::render` is simple but needs session globals for interning
(which can't easily be removed), so it's now wrapped in
`create_session_globals_then`.
- The fourth path now uses `interface::run_compiler`, which is
equivalent to the old `run_in_thread_pool_with_globals` +
`create_compiler_and_run` pairing.
Matthias Krüger [Tue, 18 Oct 2022 19:18:48 +0000 (21:18 +0200)]
Rollup merge of #103203 - GuillaumeGomez:fix-llvm-runtools-condition, r=Amanieu
Retrieve LLVM version from llvm-filecheck binary if it is not set yet
In `rustc_codegen_gcc`, we run the `ASM` test suite. The problem is that, if a too recent version of the `llvm-filecheck` binary is provided, an extra argument needs to be passed and the to detect this version, it currently only expects a `--llvm-version` argument. With this, the version can be determined directly from the `llvm-filecheck` binary.
Matthias Krüger [Tue, 18 Oct 2022 19:18:46 +0000 (21:18 +0200)]
Rollup merge of #101889 - tspiteri:redoc-uint-adc-sbb, r=m-ou-se
doc: rewrite doc for uint::{carrying_add,borrowing_sub}
Reword the documentation for bigint helper methods `uint::{carrying_add,borrowing_sub}` (#85532).
The examples were also rewritten to demonstrate how the methods can be used in bignum arithmetic. No loops are used in the examples, but the variable names were chosen to include indices so that it is clear how this can be used in a loop if required.
Also, previously `carrying_add` had an example to say that if the input carry is false, the method is equivalent to `overflowing_add`. While the note was kept, the example was removed and an extra note was added to make sure this equivalence is not assumed for signed integers as well.
bors [Tue, 18 Oct 2022 16:32:41 +0000 (16:32 +0000)]
Auto merge of #102418 - citrus-it:illumos-strip-debug, r=nagisa
The illumos linker does not support --strip-debug
When building and testing rust 1.64.0 on illumos, we saw a large number of failing tests associated with:
```
= note: ld: fatal: unrecognized option '--strip-debug'
ld: fatal: use the -z help option for usage information
collect2: error: ld returned 1 exit status
```
The illumos linker does not support the `--strip-debug` option (although it does support `--strip-all`).
bors [Tue, 18 Oct 2022 13:35:43 +0000 (13:35 +0000)]
Auto merge of #103188 - JohnTitor:rollup-pwilam1, r=JohnTitor
Rollup of 6 pull requests
Successful merges:
- #103023 (Adding `fuchsia-ignore` and `needs-unwind` to compiler test cases)
- #103142 (Make diagnostic for unsatisfied `Termination` bounds more precise)
- #103154 (Fix typo in `ReverseSearcher` docs)
- #103159 (Remove the redundant `Some(try_opt!(..))` in `checked_pow`)
- #103163 (Remove all uses of array_assume_init)
- #103168 (Stabilize asm_sym)
Yuki Okushi [Tue, 18 Oct 2022 12:21:31 +0000 (21:21 +0900)]
Rollup merge of #103159 - cuviper:check_pow-final-try_opt, r=Mark-Simulacrum
Remove the redundant `Some(try_opt!(..))` in `checked_pow`
The final return value doesn't need to be tried at all -- we can just
return the checked option directly. The optimizer can probably figure
this out anyway, but there's no need to make it work here.
Yuki Okushi [Tue, 18 Oct 2022 12:21:30 +0000 (21:21 +0900)]
Rollup merge of #103142 - fmease:fix-103052, r=oli-obk
Make diagnostic for unsatisfied `Termination` bounds more precise
Don't blindly emit a diagnostic claiming that “*`main` has an invalid return type*” if we encounter a type that should but doesn't implement `std::process::Termination` and isn't actually the return type of the program entry `main`.
bors [Tue, 18 Oct 2022 10:54:53 +0000 (10:54 +0000)]
Auto merge of #103075 - SUPERCILEX:miri-metadata, r=thomcc
Support DirEntry metadata calls in miri
This should work as it uses lstat64 which is supported here: ~https://github.com/rust-lang/miri/blob/d9ad25ee4bbd9364c498959cdc82b5fa6c41e63c/src/shims/unix/macos/foreign_items.rs#L42~ just noticed that's macos, linux would be using statx: https://github.com/rust-lang/miri/blob/86f0e63b21721fe2c14608644f467b9cb21945eb/src/shims/unix/linux/foreign_items.rs#L112
The failing syscall is `dirfd`, so maybe that should actually be added to the shims?
Pietro Albini [Tue, 27 Sep 2022 08:11:43 +0000 (10:11 +0200)]
partially fix src/test/run-make/coverage-reports when cross-compiling
The test does not work on cross-compiled targets because the --target
flag was not passed to rustc inside the test. This commit fixes that by
adding the flag to the invocations.
Note that the test still fails on cross-compiled targets using
remote-test, as remote-test is not capable (yet) of sending back to the
host system the *.profraw file generated by the instrumentation.
Because of that, this is only a partial fix, and the test has been
ignored on cross-compilation.
PR #98758 introduced code to avoid redundant assertions in derived code
like this:
```
let _: ::core::clone::AssertParamIsClone<u32>;
let _: ::core::clone::AssertParamIsClone<u32>;
```
But the predicate `is_simple_path` introduced as part of this failed to
account for generic arguments. Therefore the deriving code erroneously
considers types like `Option<bool>` and `Option<f32>` to be the same.
bors [Mon, 17 Oct 2022 23:16:57 +0000 (23:16 +0000)]
Auto merge of #103165 - matthiaskrgr:rollup-guw8oh6, r=matthiaskrgr
Rollup of 4 pull requests
Successful merges:
- #103152 (Use named arguments to make GUI test more clear)
- #103160 (rustdoc: factor JS mobile scroll lock into its own function)
- #103161 (rustdoc: remove redundant CSS on `#copy-path`)
- #103162 (rustdoc: remove redundant CSS `#crate-search { border-radius }`)
bors [Mon, 17 Oct 2022 19:46:04 +0000 (19:46 +0000)]
Auto merge of #101837 - scottmcm:box-array-from-vec, r=m-ou-se
Add `Box<[T; N]>: TryFrom<Vec<T>>`
We have `[T; N]: TryFrom<Vec<T>>` (#76310) and `Box<[T; N]>: TryFrom<Box<[T]>>`, but not this combination.
`vec.into_boxed_slice().try_into()` isn't quite a replacement for this, as that'll reallocate unnecessarily in the error case.
**Insta-stable, so needs an FCP**
(I tried to make this work with `, A`, but that's disallowed because of `#[fundamental]` https://github.com/rust-lang/rust/issues/29635#issuecomment-1247598385)
Josh Stone [Mon, 17 Oct 2022 18:21:50 +0000 (11:21 -0700)]
Remove the redundant `Some(try_opt!(..))` in `checked_pow`
The final return value doesn't need to be tried at all -- we can just
return the checked option directly. The optimizer can probably figure
this out anyway, but there's no need to make it work here.
bors [Mon, 17 Oct 2022 17:05:17 +0000 (17:05 +0000)]
Auto merge of #103151 - matthiaskrgr:rollup-t3mmnsg, r=matthiaskrgr
Rollup of 4 pull requests
Successful merges:
- #102454 (Suggest parentheses for possible range method calling)
- #102466 (only allow `ConstEquate` with `feature(gce)`)
- #102945 (Do not register placeholder `RegionOutlives` obligations when `considering_regions` is false)
- #103091 (rustdoc: remove unused HTML class `sidebar-title`)
Matthias Krüger [Mon, 17 Oct 2022 15:15:50 +0000 (17:15 +0200)]
Rollup merge of #102945 - compiler-errors:placeholder-region-outlives, r=lcnr
Do not register placeholder `RegionOutlives` obligations when `considering_regions` is false
**NOTE:** I'm kinda just putting this up for discussion. I'm not certain this is correct...?
This was introduced in [`608625d`](https://github.com/rust-lang/rust/commit/608625dae95cde00e4570eb6c2d63b2244bbf34c#diff-6e54b18681342ec725d75591dbf384ad08cd73df29db00485fe51b4e90f76ff7R361).
Interestingly, we only check `data.has_placeholders()` for `RegionOutlives`, and not for `TypeOutlives`... why? For the record, that different treatment between `RegionOutlives` and `TypeOutlives` is why the fix "The compiling succeeds when all `'a : 'b` are replaced with `&'a () : 'b`" in #100689 _"works"_, but it seems like an implementation detail considering this.
Also, why do we care about placeholder regions being registered if `considering_regions` is false? It doesn't seem to affect any UI tests, for example.
bors [Mon, 17 Oct 2022 11:33:40 +0000 (11:33 +0000)]
Auto merge of #103145 - matthiaskrgr:rollup-mxwsysv, r=matthiaskrgr
Rollup of 4 pull requests
Successful merges:
- #102962 (remote-test-server: Show command line arguments)
- #103129 (rustdoc: remove unused `.sub-logo-container` DOM on non-source pages)
- #103136 (Fix types in documentation for `Alignment::as_usize` and `Alignmnet::as_nonzero`)
- #103139 (Duplicate comment in mod.rs)
bors [Mon, 17 Oct 2022 02:06:25 +0000 (02:06 +0000)]
Auto merge of #103096 - petrochenkov:indresdoc, r=cjgillot
resolve: Shadow erroneous glob imports with erroneous single imports
If such shadowing doesn't happen we end up in a weird state that may cause ICEs.
(In non-erroneous cases single imports always shadow glob imports too.)
bors [Sun, 16 Oct 2022 23:15:20 +0000 (23:15 +0000)]
Auto merge of #103125 - matthiaskrgr:rollup-82xttcl, r=matthiaskrgr
Rollup of 5 pull requests
Successful merges:
- #103087 (Documentation BTreeMap::append's behavior for already existing keys)
- #103089 (Mark derived StructuralEq as automatically derived.)
- #103102 (Clarify the possible return values of `len_utf16`)
- #103109 (PhantomData: inline a macro that is used only once)
- #103120 (rustdoc: Do not expect `doc(primitive)` modules to always exist)
bors [Sun, 16 Oct 2022 17:54:02 +0000 (17:54 +0000)]
Auto merge of #103119 - matthiaskrgr:rollup-2vb8hif, r=matthiaskrgr
Rollup of 4 pull requests
Successful merges:
- #102857 (Add a regression test for #39137)
- #102953 (Improve docs for `struct_lint_level` function.)
- #103060 (rustdoc: make the help button a link to a page)
- #103115 (Clean up anchors.goml rustdoc GUI test)