LLVM 16: Switch to using MemoryEffects
This adapts the compiler to the changes required by 304f1d59ca.
AFAICT, `WriteOnly` isn't used by the compiler, all `ReadNone` uses were migrated and the remaining use of `ReadOnly` is only for function parameters.
To simplify the FFI, this PR uses an enum to represent `MemoryEffects` across the FFI boundary, which then gets mapped to the matching static factory method when constructing the attribute.
Fixes#103961.
`@rustbot` label +llvm-main
r? `@nikic`
Make mir opt unused file check blessable
Makes it slightly nicer to work with.
Can't write automated test but tested locally via
```
$ touch src/test/mir-opt/random
$ x test tidy // shows failure
$ x test tidy --bless // file gone
```
r? `@jyn514`
Fix artifact version/channel detection for stable
On stable, our artifacts are uploaded with the raw version number (e.g., 1.65.0), not the channel. This adjusts our detection logic to use the version number from src/version when we detect the stable channel.
This is really only important for stable channel re-builds, I think, but those do happen from time to time. I'm backporting a similar commit in https://github.com/rust-lang/rust/pull/103859 to make that PR pass CI.
This commit should result in no appearance changes.
To make the logo container exactly the desired height, you want to get rid
of the part of the box used for typographic descenders (you know, the part
of g, y, and j that descends below the baseline). After all, it contains no
text, but the space is still left open in the layout by default, because
`<img>` is `display:inline`. The CSS used to employ three different tricks
to accomplish this:
* By making `.sidebar .logo-container` a flex container, the image becomes
a flex item and is [blockified], without synthesizing any inline boxes.
No inline boxes means no descenders.
* By giving `.mobile-topbar .logo-container` a max-height exactly the same
as the height of the image plus the padding, the descender area gets
cut off.
* By setting `.sub-logo-container { line-height: 0 }`, we ensure that the
only box that contributes to the height of the line box is the image
itself, and not any zero-content text boxes that neighbor it. See the
[logical height algorithm].
This commit gets rid of the first two hacks, leaving only the third,
since it requires only one line of code to accomplish and doesn't require
setting the value based on math.
[blockified]: https://drafts.csswg.org/css-flexbox-1/#flex-items
[logical height algorithm]: https://www.w3.org/TR/css-inline-3/#inline-height
Ensure that compile-flags arguments are the last in UI tests
Before this PR, compiletest would add `-L path/to/aux` at the end of the rustc flags, even after the custom ones set with the compile-flags header comment. This made it impossible to check how rustc would behave when a flag requiring an argument was passed without the argument, because the argument would become `-L`.
This PR fixes that by adding the `-L path/to/aux` before the arguments defined in compile-flags, at least for UI tests. Other test suites might either be fixed as well by this change, or still present the old behavior (`-L` is now always passed before, but other tests suites might add additional flags after the custom ones).
Rollup of 8 pull requests
Successful merges:
- #103367 (Remove std's transitive dependency on cfg-if 0.1)
- #103397 (Port `dead_code` lints to be translatable.)
- #103681 (libtest: run all tests in their own thread, if supported by the host)
- #103792 (Migrate `codegen_ssa` to diagnostics structs - [Part 2])
- #103897 (asm: Work around LLVM bug on AArch64)
- #103937 (minor changes to make method lookup diagnostic code easier to read)
- #103958 (Test tidy should not count untracked paths towards entries limit)
- #103964 (Give a specific lint for unsafety not being inherited)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Give a specific lint for unsafety not being inherited
In cases like
```rs
static mut FOO: u64 = 0;
fn main() {
unsafe {static BAR: u64 = FOO;}
}
```
and
```rs
fn foo() {
unsafe {
fn bar() {
unsafe_call();
}
}
}
```
Specifically inform the user that the unsafety is not inherited for the seperate enclosing items
Fixes#94077
r? compiler-errors
`@rustbot` label +A-diagnostics
minor changes to make method lookup diagnostic code easier to read
The end result of around 4 days of trying to understand this 1000+ line long function- a bunch of tiny nitpicks
r? `@compiler-errors`
asm: Work around LLVM bug on AArch64
Upstream issue: https://github.com/llvm/llvm-project/issues/58384
LLVM gets confused if we assign a 32-bit value to a 64-bit register, so pass the 32-bit register name to LLVM in that case.
libtest: run all tests in their own thread, if supported by the host
This reverts the threading changes of https://github.com/rust-lang/rust/pull/56243, which made it so that with `-j1`, the test harness does not spawn any threads. Those changes were done to enable Miri to run the test harness, but Miri supports threads nowadays, so this is no longer needed. Using a thread for each test is useful because the thread's name can be set to the test's name which makes panic messages consistent between `-j1` and `-j2` runs and also a bit more readable.
I did not revert the HashMap changes of https://github.com/rust-lang/rust/pull/56243; using a deterministic map seems fine for the test harness and the more deterministic testing is the better.
Fixes https://github.com/rust-lang/rust/issues/59122
Fixes https://github.com/rust-lang/rust/issues/70492
Port `dead_code` lints to be translatable.
This adds an additional comma to lists with three or more items, to be consistent with list formatters like `icu4x`.
r? `@davidtwco`
Add QEMU test for x86_64-unknown-uefi
The UEFI targets don't have std support yet, so the normal tests don't work. However, we can compile a simple no-std program and run it under QEMU to at least check that the target compiles, links, and runs.
Tested locally with: `src/ci/docker/run.sh x86_64-uefi`
Fix ICE when negative impl is collected during eager mono
```rust
trait Foo {
fn foo() {}
}
impl !Foo for () {}
```
This code will currently cause an ICE when mono collection mode is "eager" (with `-C link-dead-code=y` or `-Z print-mono-items=eager`.
Remove rustdoc clean::Visibility type
Fixes#90852.
Follow-up of https://github.com/rust-lang/rust/pull/103690.
This PR completely removes the rustdoc `clean::Visibility` type to use the `rustc_middle` one instead. I don't think there will be any impact on perf.
r? `@notriddle`
Fix late-bound lifetime closure ICEs in HIR typeck and MIR borrowck
During HIR typeck, we need to teach astconv to treat late-bound regions within a closure body as free, fixing escaping bound vars ICEs in both of the issues below.
However, this then gets us to MIR borrowck, which itself needs to be taught how to instantiate free region vids for late-bound regions that come from items that _aren't_ the typeck root (for now, just closures).
Fixes#103771Fixes#103736
asm: Match clang behavior for inlateout fixed register operands
We have 2 options for representing LLVM constraints for `inlateout` operands on a fixed register (e.g. `r0`): `={r0},0` or `={r0},{r0}`.
This PR changes the behavior to the latter, which matches the behavior of Clang since https://reviews.llvm.org/D87279.
Add howto for adding new targets
When new targets are added, often a reviewer finds out that e.g. the target-3-tier-policy is not filled out (missing), there is no description etc.
This change adds a description of what I've learned while working on #102701. It should make reviews easier in the future with less rework.
r? compiler-team
Add visit_fn_ret_ty to hir intravisit
I'm working on some RPITIT changes and I need to specialize `visit_fn_ret_ty` in my visitor impl. So I guess it's better to land it separately.
r? `@compiler-errors`