LLVM can make use of the `noalias` parameter attribute on the parameter to
`drop_in_place` in areas like argument promotion. Because the Rust compiler
fully controls the code for `drop_in_place`, it can soundly deduce parameter
attributes on it. In the case of a value that has a programmer-defined Drop
implementation, we know that the first thing `drop_in_place` will do is pass a
pointer to the object to `Drop::drop`. `Drop::drop` takes `&mut`, so it must be
guaranteed that there are no pointers to the object upon entering that
function. Therefore, it should be safe to mark `noalias` there.
With this patch, we mark `noalias` only when the type is a value with a
programmer-defined Drop implementation. This is possibly overly conservative,
but I thought that proceeding cautiously was best in this instance.
Use code with reliable branchless code-gen for slice::sort merge
The recent LLVM 16 update changes code-gen to be not branchless anymore, in the slice::sort implementation merge function. This improves performance by 30% for random patterns, restoring the performance to the state with LLVM 15.
Fixes#111559
Rollup of 5 pull requests
Successful merges:
- #111450 (Use `OpaqueTypeKey` in query response)
- #111726 (Migrate GUI colors test to original CSS color format)
- #111746 (Merge some query impl modules into one)
- #111765 (Migrate GUI colors test to original CSS color format)
- #111771 (add `--remote-time` flag to curl for bootstrap)
r? `@ghost`
`@rustbot` modify labels: rollup
add `--remote-time` flag to curl for bootstrap
This pull request sets the timestamp of the downloaded stage0 binary according to the server-reported timestamp (if possible).
This allows make_orig-dl_tarball.sh to be more reproducible on the filesystem.
Merge some query impl modules into one
This merges some modules in `rustc_query_impl` into one per query, analogous to https://github.com/rust-lang/rust/pull/111703.
r? `@cjgillot`
Update URLs in Type Checking chapter
Updated links to `Adt`, `pat_ty` and `Tykind` in the "Type Checking" chapter of the book.
### Notes:
- For discussion about the whole project, please use the tracking issue for the project #10597 (It also contains a timeline, discussions, and more information).
changelog: Fix broken links in "Type Checking" chapter of the book
Rollup of 10 pull requests
Successful merges:
- #111491 (Dont check `must_use` on nested `impl Future` from fn)
- #111606 (very minor cleanups)
- #111619 (Add timings for MIR passes to profiling report)
- #111652 (Better diagnostic for `use Self::..`)
- #111665 (Add more tests for the offset_of macro)
- #111708 (Give a more useful location for where a span_bug was delayed)
- #111715 (Fix doc comment for `ConstParamTy` derive)
- #111723 (style: do not overwrite obligations)
- #111743 (Improve cgu merging debug output)
- #111762 (fix: emit error when fragment is `MethodReceiverExpr` and items is empty)
r? `@ghost`
`@rustbot` modify labels: rollup
Process current bucket instead of parent's bucket when starting loop for dominators.
The linked paper by Georgiadis suggests in §2.2.3 to process `bucket[w]` when beginning the loop, instead of `bucket[parent[w]]` when finishing it.
In the test case, we correctly computed `idom[2] = 0` and `sdom[3] = 1`, but the algorithm returned `idom[3] = 1`, instead of the correct value 0, because of the path 0-7-2-3.
This provoked LLVM ICE in https://github.com/rust-lang/rust/pull/111061#issuecomment-1546912112. LLVM checks that SSA assignments dominate uses using its own implementation of Lengauer-Tarjan, and saw case where rustc was breaking the dominance property.
r? `@Mark-Simulacrum`
Give a more useful location for where a span_bug was delayed
Before:
```
= note: delayed at 0: <rustc_errors::HandlerInner>::emit_diagnostic
at ./compiler/rustc_errors/src/lib.rs:1335:29
1: <rustc_errors::Handler>::emit_diagnostic
at ./compiler/rustc_errors/src/lib.rs:1124:9
...
```
After:
```
= note: delayed at compiler/rustc_parse/src/parser/diagnostics.rs:2158:28
0: <rustc_errors::HandlerInner>::emit_diagnostic
at ./compiler/rustc_errors/src/lib.rs:1335:29
1: <rustc_errors::Handler>::emit_diagnostic
at ./compiler/rustc_errors/src/lib.rs:1124:9
...
```
This both makes the relevant frame easier to find without having to dig through diagnostic internals, and avoids the weird-looking formatting for the first frame.
Found while working on https://github.com/rust-lang/rust/issues/111529.
Add more tests for the offset_of macro
Implements what I [suggested in the tracking issue](https://github.com/rust-lang/rust/issues/106655#issuecomment-1535007205), plus some further improvements:
* ensuring that offset_of!(Self, ...) works iff inside an impl block
* ensuring that the output type is usize and doesn't coerce. this can be changed in the future, but if it is done, it should be a conscious decision
* improving the privacy checking test
* ensuring that generics don't let you escape the unsized check
r? `````@WaffleLapkin`````
very minor cleanups
- add `must_use` to `early_error_no_abort`
this was already being used at its only callsite, but this ensures that new code remembers to use it if it's called in the future. found this while investigating https://github.com/rust-lang/rust/issues/110090.
- remove outdated and incorrect comment in `builder.rs`. `doc_rust_lang_org_channel` doesn't exist in rustdoc, it gets it from an env var instead: b275d2c30b/src/librustdoc/clean/utils.rs (L569-L573)
Dont check `must_use` on nested `impl Future` from fn
Fixes (but does not close, per beta policy) #111484
Also fixes a `FIXME` left in the code about (presumably) false-positives on non-async `#[must_use] fn() -> impl Future` cases, though if that's not desirable to include in the beta backport then I can certainly revert it.
Beta nominating as it fixes a beta ICE.
`ascii::Char`-ify the escaping code in `core`
This means that `EscapeIterInner::as_str` no longer needs unsafe code, because the type system ensures the internal buffer is only ASCII, and thus valid UTF-8.
Come to think of it, this also gives it a (non-guaranteed) niche.
cc `@BurntSushi` as potentially interested
`ascii::Char` tracking issue: #110998
Add `MINIMAL_CFG_CONDITION` lint
I encountered a few cases where some code had:
```rust
#[cfg(any(unix))]
```
In this case, the `any` is useless. This lint checks this and also for the `all` condition.
```
changelog: [`unique_cfg_condition`]: Add new `UNIQUE_CFG_CONDITION` lint
```
... using server-reported timestamp.
This allows us to track changes to the downloaded artifact more easily
and in a more reproducible manner.
Co-authored-by: Zixing Liu <zixing.liu@canonical.com>
Add creation time support to `FileTimes` on apple and windows
Adds support for setting file creation times on platforms which support changing it directly (currently only Apple and Windows). Based on top of #110093 (which was split from this PR).
ACP: rust-lang/libs-team#199 (currently still in progress)
Tracking issue: #98245
`@rustbot` label +T-libs-api -T-libs