Commit Graph

252029 Commits

Author SHA1 Message Date
DianQK
e752af765e
Transforms a match containing negative numbers into an assignment statement as well 2024-04-08 19:00:57 +08:00
DianQK
1f061f47e2
Transforms match into an assignment statement 2024-04-08 19:00:53 +08:00
DianQK
7af7458453
Refactor MatchBranchSimplification 2024-04-08 18:54:42 +08:00
DianQK
badb73b921
Update matches_reduce_branches.rs 2024-04-08 18:54:33 +08:00
Guillaume Gomez
66bc97cc88 Make theme switching closer to reality 2024-04-08 12:14:41 +02:00
Guillaume Gomez
cf65764920 Update browser-ui-test version to 0.17.2 2024-04-08 12:14:26 +02:00
Philippe-Cholet
7a2678de7d Add invariant to VecDeque::pop_* that len < cap if pop successful
Similar to #114370 for VecDeque instead of Vec. It now uses `core::hint::assert_unchecked`.
2024-04-08 12:12:13 +02:00
bors
0e5f520788 Auto merge of #123577 - Urgau:prep-work-for-compiletest-check-cfg, r=oli-obk
Do some preparation work for compiletest check-cfg

This PR does several preparation work for having always-on check-cfg in compiletest.

In particular, this PR does two main things:
 - It unifies all the *always-false* cfgs under the `FALSE` cfg (as it seems to be the convention under `tests/ui`)
 - It also removes some useless conditions

This is done ahead of the introduction of the always-on check-cfg in compiletest to reduce the amount of changes in that follow-up work. I also think that this is useful even without that follow-up work.
2024-04-08 09:34:44 +00:00
bors
7a495cc13d Auto merge of #123616 - bzEq:fix-be-test, r=jhpratt
[Test] issue-122805.rs should limit to little endian target

In issue-122805.rs, codegen on big endian target is different from little endian target.
```llvm
%0 = load <8 x i16>, ptr %value, align 2
store <8 x i16> %0, ptr %_0, align 1
ret void
```
This is expected since the conversion is unnecessary on BE target for this case.
2024-04-08 04:16:16 +00:00
Kai Luo
d8d1e6ce21 Limited to little endian target 2024-04-08 11:11:11 +08:00
Nikita Popov
1b7342b411 force_array -> is_consecutive
The actual ABI implication here is that in some cases the values
are required to be "consecutive", i.e. must either all be passed
in registers or all on stack (without padding).

Adjust the code to either use Uniform::new() or Uniform::consecutive()
depending on which behavior is needed.

Then, when lowering this in LLVM, skip the [1 x i128] to i128
simplification if is_consecutive is set. i128 is the only case
I'm aware of where this is problematic right now. If we find
other cases, we can extend this (either based on target information
or possibly just by not simplifying for is_consecutive entirely).
2024-04-08 11:31:43 +09:00
Nikita Popov
009280c5e3 Fix argument ABI for overaligned structs on ppc64le
When passing a 16 (or higher) aligned struct by value on ppc64le,
it needs to be passed as an array of `i128` rather than an array
of `i64`. This will force the use of an even starting register.

For the case of a 16 byte struct with alignment 16 it is important
that `[1 x i128]` is used instead of `i128` -- apparently, the
latter will get treated similarly to `[2 x i64]`, not exhibiting
the correct ABI. Add a `force_array` flag to `Uniform` to support
this.

The relevant clang code can be found here:
fe2119a7b0/clang/lib/CodeGen/Targets/PPC.cpp (L878-L884)
fe2119a7b0/clang/lib/CodeGen/Targets/PPC.cpp (L780-L784)

I think the corresponding psABI wording is this:

> Fixed size aggregates and unions passed by value are mapped to as
> many doublewords of the parameter save area as the value uses in
> memory. Aggregrates and unions are aligned according to their
> alignment requirements. This may result in doublewords being
> skipped for alignment.

In particular the last sentence.

Fixes https://github.com/rust-lang/rust/issues/122767.
2024-04-08 11:15:36 +09:00
bors
f2c8013393 Auto merge of #123569 - c410-f3r:testsssssss, r=jieyouxu
Move some tests

r? `@petrochenkov`
2024-04-08 02:13:05 +00:00
bors
a2c72ce594 Auto merge of #123506 - RalfJung:miri-test-libstd, r=Mark-Simulacrum
check-aux: test core, alloc, std in Miri

Let's see if this works, and how long it takes.
2024-04-08 00:08:44 +00:00
Mark Rousskov
f946bf4f2e Remove debuginfo from rustc-demangle too
This is done for the same reason as the other dependencies in this list.
2024-04-07 19:19:11 -04:00
bors
f65f84feb0 Auto merge of #123597 - Gbd199:patch-1, r=jhpratt
Fix typo in library/core/src/iter/traits/iterator.rs
2024-04-07 22:04:40 +00:00
Ben Kimock
b5b49289e1 Only traverse mono-reachable blocks in cg_clif 2024-04-07 16:46:21 -04:00
Caio
ab8994d93e Move tests 2024-04-07 17:38:07 -03:00
Ben Kimock
339f4be046 Only collect mono items from reachable blocks 2024-04-07 14:36:42 -04:00
bors
9d5cdf75aa Auto merge of #123601 - jieyouxu:compiletest-run-rustfix-revisions, r=WaffleLapkin
compiletest: properly handle revisioned run-rustfix tests

Before this PR, if you have a revisioned `//@ run-rustfix` test like `//`@[foo]` run-rustfix`, you would run into an error saying crate name cannot contain `.` characters because the fixed test file trying to be compiled is named `<test-name>.<revision>.fixed`, from which `rustc` infers the crate name to be `<test-name>.<revision>` which is not a valid crate name.

This PR fixes the problem by constructing a synthetic crate name from `<test-name>.<revision>`, by

1. replacing all `-` with `_`, and
2. replacing all `.` with `__`

and pass that constructed crate name with `--crate-name` to rustc to compile the fixed file.

Fixes https://github.com/rust-lang/rust/issues/123596.
2024-04-07 18:22:55 +00:00
许杰友 Jieyou Xu (Joe)
de3857e553 tests/ui: remove workaround for broken revisioned run-rustfix test 2024-04-07 17:06:15 +00:00
许杰友 Jieyou Xu (Joe)
5dc276c0da compiletest: properly handle revisioned run-rustfix tests 2024-04-07 17:06:15 +00:00
Gabriel Dolberg
a1d4066e53
Fix typo in library/core/src/iter/traits/iterator.rs 2024-04-07 18:55:28 +03:00
BALAGANESH
8f6ebf608d Made changes in documentation 2024-04-07 15:07:25 +00:00
bors
e78913baef Auto merge of #123592 - matthiaskrgr:rollup-3k1pq8s, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - #123584 (Emit an error when `rustc_doc_primitive` has an unknown value)
 - #123589 (sys_common::thread_local_key: make a note that this is not used on Windows)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-07 14:51:54 +00:00
DianQK
a334848ba3
Re-enable the early otherwise branch optimization 2024-04-07 21:14:29 +08:00
DianQK
f5c256fa0f
Add FileCheck for early_otherwise_branch*.rs 2024-04-07 21:14:29 +08:00
DianQK
31e74771f0
Resolve unsound hoisting of discriminant in EarlyOtherwiseBranch 2024-04-07 21:14:26 +08:00
Matthias Krüger
e5bdd7ebc1
Rollup merge of #123589 - RalfJung:nowin, r=ChrisDenton
sys_common::thread_local_key: make a note that this is not used on Windows

This just confused me for a while. I don't have the time to clean it up but I can at least leave a note for the next wary traveler.
2024-04-07 14:50:00 +02:00
Matthias Krüger
f64e97100c
Rollup merge of #123584 - tgross35:rustc_doc_primitive-usage-error, r=fmease
Emit an error when `rustc_doc_primitive` has an unknown value

Currently rustdoc silently does nothing. Change this to raise an error instead.
2024-04-07 14:49:59 +02:00
bors
4e431fad67 Auto merge of #123561 - saethlin:str-unchecked-sub-index, r=scottmcm
Use unchecked_sub in str indexing

https://github.com/rust-lang/rust/pull/108763 applied this logic to indexing for slices, but of course `str` has its own separate impl.

Found this by skimming over the codegen for https://github.com/oxidecomputer/hubris/; their dist builds enable overflow checks so the lack of `unchecked_sub` was producing an impossible-to-hit overflow check and also inhibiting some inlining.

r? scottmcm
2024-04-07 12:49:15 +00:00
Zalathar
e38dfc4961 Remove unnecessary cast from LLVMRustGetInstrProfIncrementIntrinsic
This particular cast appears to have been copied over from clang, but there are
plenty of other call sites in clang that don't bother with a cast here, and it
works fine without one.

For context, `llvm::Intrinsic::ID` is a typedef for `unsigned`, and
`llvm::Intrinsic::instrprof_increment` is a member of
`enum IndependentIntrinsics : unsigned`.
2024-04-07 21:27:53 +10:00
bors
fc1a4c5cc9 Auto merge of #123221 - pacak:cache_emit, r=fmease,jieyouxu
Save/restore more items in cache with incremental compilation

Right now they don't play very well together, consider a simple example:

```
$ export RUSTFLAGS="--emit asm"
$ cargo new --lib foo
     Created library `foo` package
$ cargo build -q
$ touch src/lib.rs
$ cargo build
error: could not copy
  "/path/to/foo/target/debug/deps/foo-e307cc7fa7b6d64f.4qbzn9k8mosu50a5.rcgu.s"
  to "/path/to/foo/target/debug/deps/foo-e307cc7fa7b6d64f.s":
  No such file or directory (os error 2)
```

Touch triggers the rebuild, incremental compilation detects no changes (yay) and everything explodes while trying to copy files were they should go.

This pull request fixes it by copying and restoring more files in the incremental compilation cache

Fixes https://github.com/rust-lang/rust/issues/89149
Fixes https://github.com/rust-lang/rust/issues/88829

Related: https://internals.rust-lang.org/t/interaction-between-incremental-compilation-and-emit/20551
2024-04-07 10:46:50 +00:00
Ralf Jung
b1d1ad9f8c sys_common::thread_local_key: make a note that this is not used on Windows 2024-04-07 12:23:47 +02:00
bors
8f2c255ae0 Auto merge of #123585 - matthiaskrgr:rollup-dexaj7a, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #123410 (Relax framework linking test)
 - #123446 (Fix incorrect 'llvm_target' value used on watchOS target)
 - #123579 (add some more tests)
 - #123581 (Add `f16` and `f128` to rustdoc's `PrimitiveType`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-07 08:44:19 +00:00
Ralf Jung
596908bb9a also test core+alloc on a 32bit big-endian target 2024-04-07 10:06:06 +02:00
Ralf Jung
d0346c50bc disable debug assertions to speed up the check-aux job 2024-04-07 10:06:06 +02:00
Ralf Jung
24089812db run some std tests on more targets 2024-04-07 10:06:06 +02:00
Ralf Jung
a986c0a100 make a doctest less slow in Miri 2024-04-07 10:06:06 +02:00
Ralf Jung
1242093da2 also test parts of std
requires disabling some tests that do not work
2024-04-07 10:05:57 +02:00
Ralf Jung
c0b564b767 disable benches in Miri 2024-04-07 09:58:10 +02:00
Ralf Jung
7b89445cc3 check-aux: test core and alloc in Miri 2024-04-07 09:58:10 +02:00
Trevor Gross
695514e8d8 rustdoc: error when rustc_doc_primitive has an unknown type
Currently rustdoc silently does nothing if it isn't aware of the
specified primitive type. Change this to raise an error instead.
2024-04-07 03:21:22 -04:00
Matthias Krüger
549d85d13f
Rollup merge of #123581 - tgross35:f16-f128-rustdoc-updates, r=fmease
Add `f16` and `f128` to rustdoc's `PrimitiveType`

Fix a few places where these primitives were missing from librustdoc. This should fix the CI failures from doc links in https://github.com/rust-lang/rust/pull/122470.
2024-04-07 09:17:16 +02:00
Matthias Krüger
bbc7807b42
Rollup merge of #123579 - matthiaskrgr:I_Love_Tests, r=jieyouxu
add some more tests

Fixes https://github.com/rust-lang/rust/issues/115806
Fixes https://github.com/rust-lang/rust/issues/116710
Fixes https://github.com/rust-lang/rust/issues/123145
Fixes https://github.com/rust-lang/rust/issues/105488
Fixes https://github.com/rust-lang/rust/issues/122488
Fixes https://github.com/rust-lang/rust/issues/123078
2024-04-07 09:17:15 +02:00
Matthias Krüger
dc387cf295
Rollup merge of #123446 - crazytonyli:fix-watchos-llvm-target, r=estebank
Fix incorrect 'llvm_target' value used on watchOS target

## Issue

`xcodebuild -create-xcframework` command doesn't recognize static libraries that are built on "arm64_32-apple-watchos" target.

Here are steps to reproduce the issue on a Mac:
1. Install nightly toolchain `nightly-2024-03-27`. Needs this specific version, because newer nightly versions are broken on watchos target.
1. Create an empty library: `mkdir watchos-lib && cd watchos-lib && cargo init --lib`.
1. Add configuration `lib.crate-type=["staticlib"]` to Cargo.toml.
1. Build the library: `cargo +nightly-2024-03-27 build --release -Zbuild-std --target arm64_32-apple-watchos`
1. Run `xcodebuild -create-xcframework` to put the static library into a xcframework, which results in an error:

```
$ xcodebuild -create-xcframework -library target/arm64_32-apple-watchos/release/libwatchos_lib.a -output test.xcframework
error: unable to determine the platform for the given binary '.../watchos-lib/target/arm64_32-apple-watchos/release/libwatchos_lib.a'; check your deployment version settings
```

## Fix

The root cause of this error is `xcodebuild` couldn't read `LC_BUILD_VERSION` from the static library to determine the library's target platform. And the reason it's missing is that an incorrect `llvm_target` value is used in `arm64_32-apple-watchos` target. The expected value is `<arch>-apple-watchos<major>.<minor>.0`, i.e. "arm64_32-apple-watchos8.0.0".

The [.../apple/mod.rs](43f4f2a3b1/compiler/rustc_target/src/spec/base/apple/mod.rs (L321)) file contains functions that construct such string. There is an existing function `watchos_sim_llvm_target` which returns llvm target value for watchOS simulator. But there is none for watchOS device. This PR adds that missing function to align watchOS with other Apple platform targets.

To verify the fix, you can simply build a toolchain on this PR branch and repeat the steps above using the built local toolchain to verify the `xcodebuild -create-xcframework` command can create a xcframework successfully.

Furthermore, you can verify `LC_BUILD_VERSION` contains correct info by using the simple shell script below to print `LC_BUILD_VERSION` of the static library that's built on watchos target:

```shell
bin=target/arm64_32-apple-watchos/release/libwatchos_lib.a
file=$(ar -t "$bin" | grep -E '\.o$' | head -n 1)
ar -x "$bin" "$file"
vtool -show-build-version "$file"
```

Here is an example output from my machine:

```
watchos_rust-495d6aaf3bccc08d.watchos_rust.35ba42bf9255ca9d-cgu.0.rcgu.o:
Load command 1
      cmd LC_BUILD_VERSION
  cmdsize 24
 platform WATCHOS
    minos 8.0
      sdk n/a
   ntools 0
```
2024-04-07 09:17:15 +02:00
Matthias Krüger
4eef6e313e
Rollup merge of #123410 - madsmtm:relax-framework-linking-test, r=fmease
Relax framework linking test

This test was introduced by myself in https://github.com/rust-lang/rust/pull/118644, but was over-specified in that it assumed the path of the linker was always `cc`, which [causes a test failure for Chromium](https://issues.chromium.org/issues/332562251).
2024-04-07 09:17:14 +02:00
bors
0e3235f85b Auto merge of #123555 - DianQK:update-llvm-18, r=cuviper
Update to LLVM 18.1.3

Fixes #122805.

This should work on all targets: https://rust.godbolt.org/z/svW8ha31z.

r? `@cuviper`
2024-04-07 06:33:58 +00:00
DianQK
5acfe772fa
Add the test case for #122805 2024-04-07 13:01:54 +08:00
bors
af2525317b Auto merge of #123556 - Mark-Simulacrum:drop-unused-sharding, r=Nadrieril
Remove sharding for VecCache

This sharding is never used (per the comment in code). If we re-add sharding at some point in the future this is cheap to restore, but for now no need for the extra complexity.
2024-04-07 04:28:46 +00:00