Commit graph

251869 commits

Author SHA1 Message Date
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 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
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
Trevor Gross ebc86e6f58 Add f16 and f128 to rustdoc's PrimitiveType
Fix a few places where these primitives were missing from librustdoc.
2024-04-06 23:47:40 -04:00
bors 087ae978a1 Auto merge of #123058 - lukas-code:clauses, r=lcnr
[perf] cache type info for ParamEnv

This is an attempt to mitigate some of the perf regressions in https://github.com/rust-lang/rust/pull/122553#issuecomment-2007563027, but seems worth to test and land separately, since it is mostly unrelated to that PR.
2024-04-07 02:07:20 +00:00
bors 6f837503aa Auto merge of #123576 - matthiaskrgr:rollup-9wiqkfa, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #119224 (Drop panic hook after running tests)
 - #123411 (Put checks that detect UB under their own flag below debug_assertions)
 - #123516 (Do not ICE on field access check on expr with `ty::Error`)
 - #123522 (Stabilize const Atomic*::into_inner)
 - #123559 (Add a debug asserts call to match_projection_projections to ensure invariant)
 - #123563 (Rewrite `version` test run-make as an UI test)

Failed merges:

 - #123569 (Move some tests)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-07 00:04:20 +00:00
Matthias Krüger 88aa71f108 add test for assertion failed: !value.has_infer() #115806
Fixes https://github.com/rust-lang/rust/issues/115806
2024-04-07 01:45:31 +02:00
Matthias Krüger b976142439 add test for ice: unknown alias DefKind: AnonConst #116710
Fixes https://github.com/rust-lang/rust/issues/116710
2024-04-07 01:20:56 +02:00
Matthias Krüger 96dbde796c
Rollup merge of #123563 - Oneirical:version, r=jieyouxu
Rewrite `version` test run-make as an UI test

Claiming the simple `version` test from #121876.

Reasoning: As discussed in #123297, 10 years ago, some changes to CLI flags warranted the creation of the `version` test. Since it's not actually executing the compiled binary, it has no purpose being a `run-make` test and should instead be an UI test.

This is the exact same change as it was shown on my closed PR #123297. Changes were ready, but I did a major Git mishap while trying to fix a tidy error and messed up my branch. The details of this error are explained [here](https://github.com/rust-lang/rust/pull/123297#issuecomment-2041152379).
2024-04-07 00:51:27 +02:00
Matthias Krüger 7524f5e1b9
Rollup merge of #123559 - spastorino:match_projection_projections_invariant, r=compiler-errors
Add a debug asserts call to match_projection_projections to ensure invariant

Small nit as follow up of #123471.

r? `@compiler-errors`

`@bors` rollup=always
2024-04-07 00:51:27 +02:00
Matthias Krüger 0b5a8ac116
Rollup merge of #123522 - dtolnay:constatomicintoinner, r=Nilstrieb
Stabilize const Atomic*::into_inner

Partial stabilization for https://github.com/rust-lang/rust/issues/78729, for which the FCP has already completed.

The other `into_inner` functions in that tracking issue (`UnsafeCell`, `Cell`, `RefCell`) are blocked on https://github.com/rust-lang/rust/issues/73255 for now.

```console
error[E0493]: destructor of `UnsafeCell<T>` cannot be evaluated at compile-time
    --> library/core/src/cell.rs:2076:29
     |
2076 |     pub const fn into_inner(self) -> T {
     |                             ^^^^ the destructor for this type cannot be evaluated in constant functions
2077 |         self.value
2078 |     }
     |     - value is dropped here
```
2024-04-07 00:51:26 +02:00
Matthias Krüger f51ce75af4
Rollup merge of #123516 - estebank:issue-123428, r=compiler-errors
Do not ICE on field access check on expr with `ty::Error`

Fix #123428
2024-04-07 00:51:26 +02:00
Matthias Krüger 84dca1503e
Rollup merge of #123411 - saethlin:ub-checks, r=Urgau,RalfJung
Put checks that detect UB under their own flag below debug_assertions

Implementation of https://github.com/rust-lang/compiler-team/issues/725
2024-04-07 00:51:25 +02:00
Matthias Krüger 0ea427025b
Rollup merge of #119224 - Duckilicious:test_main_memory_leak, r=cuviper
Drop panic hook after running tests

Issue: https://github.com/rust-lang/rust/issues/119223
Previously we left the panic hook we allocated
on main termination. Doing so makes Valgrind
report it as a reachable unfreed block.
In order to fix that use `panic::take_hook()` before examining test results.

Example backtrace:
```
==146594== 16 bytes in 1 blocks are still reachable in loss record 1 of 1
==146594==    at 0x4A390C5: malloc (vg_replace_malloc.c:442)
==146594==    by 0x151336: alloc (alloc.rs:98)
==146594==    by 0x151336: alloc_impl (alloc.rs:181)
==146594==    by 0x151336: allocate (alloc.rs:241)
==146594==    by 0x151336: exchange_malloc (alloc.rs:330)
==146594==    by 0x151336: new<test::test_main::{closure_env#0}> (boxed.rs:217)
==146594==    by 0x151336: test::test_main (lib.rs:124)
==146594==    by 0x1522F9: test::test_main_static (lib.rs:160)
==146594==    by 0x11E102: reachable_block_with_cargo_test::main (lib.rs:1)
==146594==    by 0x11EABA: core::ops::function::FnOnce::call_once (function.rs:250)
==146594==    by 0x11E76D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:154)
==146594==    by 0x11DFC0: std::rt::lang_start::{{closure}} (rt.rs:166)
==146594==    by 0x177D3A: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:284)
==146594==    by 0x177D3A: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:504)
==146594==    by 0x177D3A: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:468)
==146594==    by 0x177D3A: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:142)
==146594==    by 0x177D3A: {closure#2} (rt.rs:148)
==146594==    by 0x177D3A: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:504)
==146594==    by 0x177D3A: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:468)
==146594==    by 0x177D3A: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:142)
==146594==    by 0x177D3A: std::rt::lang_start_internal (rt.rs:148)
==146594==    by 0x11DF99: std::rt::lang_start (rt.rs:165)
```
2024-04-07 00:51:25 +02:00
Matthias Krüger 7c43bc0378 add test for ICE: failed to resolve instance for <fn() -> impl ...> #123145
Fixes https://github.com/rust-lang/rust/issues/123145
2024-04-07 00:48:47 +02:00
Matthias Krüger 7836909402 add test for ice called Option::unwrap() on a None value in collector.rs:934:13 #105488
Fixes https://github.com/rust-lang/rust/issues/105488
2024-04-07 00:25:56 +02:00
Matthias Krüger 7d9e1067fd add test for ICE: Unexpected unsized type tail: &ReStatic [u8] #122488
Fixes https://github.com/rust-lang/rust/issues/122488
2024-04-06 23:34:46 +02:00
Matthias Krüger 5dc7fe473b add test for ICE: !base.layout().is_sized() #123078
Fixes https://github.com/rust-lang/rust/issues/123078
2024-04-06 23:30:51 +02:00
Oneirical a9c0ffa35b Rewrite version test as UI test
fix: re-add stout ignore

restore does-nothing

fix: universal check-pass
2024-04-06 15:14:16 -04:00
Santiago Pastorino 60be29bec8
Add a debug asserts call to match_projection_projections to ensure invariant 2024-04-06 14:45:48 -03:00
bors aa1c45908d Auto merge of #123557 - GuillaumeGomez:rollup-3af7urf, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #123541 (remove miri-test-libstd hacks that are no longer needed)
 - #123552 (Add missing -Zquery-dep-graph to the spike-neg incr comp tests)
 - #123553 (Miri subtree update)
 - #123554 (Simplify/cleanup `search-result-color.goml`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-06 17:12:12 +00:00
Esteban Küber 97ea48ce32 Do not ICE on field access check on expr with ty::Error
Fix #123428
2024-04-06 16:34:57 +00:00
Tal Gelbard 92ebf60b3b Drop panic hook after running tests
Previously we left the panic hook we allocated
on main termination. Doing so makes Valgrind
report it as a reachable unfreed block.
In order to fix that use `panic::take_hook()` before
examining test results.

Example backtrace:
```
==146594== 16 bytes in 1 blocks are still reachable in loss record 1 of 1
==146594==    at 0x4A390C5: malloc (vg_replace_malloc.c:442)
==146594==    by 0x151336: alloc (alloc.rs:98)
==146594==    by 0x151336: alloc_impl (alloc.rs:181)
==146594==    by 0x151336: allocate (alloc.rs:241)
==146594==    by 0x151336: exchange_malloc (alloc.rs:330)
==146594==    by 0x151336: new<test::test_main::{closure_env#0}> (boxed.rs:217)
==146594==    by 0x151336: test::test_main (lib.rs:124)
==146594==    by 0x1522F9: test::test_main_static (lib.rs:160)
==146594==    by 0x11E102: reachable_block_with_cargo_test::main (lib.rs:1)
==146594==    by 0x11EABA: core::ops::function::FnOnce::call_once (function.rs:250)
==146594==    by 0x11E76D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:154)
==146594==    by 0x11DFC0: std::rt::lang_start::{{closure}} (rt.rs:166)
==146594==    by 0x177D3A: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:284)
==146594==    by 0x177D3A: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:504)
==146594==    by 0x177D3A: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:468)
==146594==    by 0x177D3A: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:142)
==146594==    by 0x177D3A: {closure#2} (rt.rs:148)
==146594==    by 0x177D3A: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:504)
==146594==    by 0x177D3A: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:468)
==146594==    by 0x177D3A: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:142)
==146594==    by 0x177D3A: std::rt::lang_start_internal (rt.rs:148)
==146594==    by 0x11DF99: std::rt::lang_start (rt.rs:165)
```

Signed-off-by: Tal Gelbard <talgelbard1@gmail.com>
2024-04-06 18:56:22 +03:00
Guillaume Gomez 3a203b0ada
Rollup merge of #123554 - GuillaumeGomez:cleanup-search-result-color, r=notriddle
Simplify/cleanup `search-result-color.goml`

Greatly shorten code of `search-result-color.goml` GUI test.

I split the changes into smaller commits to allow to more easily see what changed.

r? `@notriddle`
2024-04-06 17:37:41 +02:00
Guillaume Gomez 74c3b7badc
Rollup merge of #123553 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2024-04-06 17:37:40 +02:00
Guillaume Gomez 79a97b3999
Rollup merge of #123552 - bjorn3:fix-spike-neg, r=Mark-Simulacrum
Add missing -Zquery-dep-graph to the spike-neg incr comp tests

This ensures that the tests actually test what they are meant to test rather than exitting immediately with an error that -Zquery-dep-graph has to be passed.
2024-04-06 17:37:40 +02:00
Guillaume Gomez b4a761db78
Rollup merge of #123541 - RalfJung:remove-old-hacks, r=Mark-Simulacrum
remove miri-test-libstd hacks that are no longer needed

In https://github.com/rust-lang/rust/pull/123317 we developed a different approach to testing the standard library in Miri, and with https://github.com/rust-lang/miri-test-libstd/pull/56 the out-of-tree miri-test-libstd has been switched to that approach. That makes these hacks here no longer necessary.
2024-04-06 17:37:39 +02:00
Lukas Markeffsky 94d61d899f add RawList 2024-04-06 17:28:47 +02:00
Ben Kimock a7912cb421 Put checks that detect UB under their own flag below debug_assertions 2024-04-06 11:21:47 -04:00
bors 773fb88e13 Auto merge of #123339 - onur-ozkan:optimize-tidy-check, r=Mark-Simulacrum
optimize tidy check on `src/tools/tidy/src/issues.txt`

This change applies to the following:

- Handles `is_sorted` in the first iteration without needing a second.
- Fixes line sorting on `--bless`.
- Reads `issues.txt` as str rather than making it part of the source code.

Fixes #123002
2024-04-06 15:10:23 +00:00
Michael Baikov 691e953da6 Save/restore more items in cache with incremental compilation 2024-04-06 10:59:24 -04:00
Mark Rousskov 668b3188ab 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-06 10:49:31 -04:00
Michael Baikov 914e43a664 extend run-make test runner with some helper functions 2024-04-06 10:16:50 -04:00
Guillaume Gomez 53c5a69dfd Move check-container-color's code into check-search-color function 2024-04-06 15:52:00 +02:00
Guillaume Gomez 2b1c799636 Move duplicated code into check-search-color function 2024-04-06 15:47:12 +02:00
bjorn3 809e0c7453 Add missing -Zquery-dep-graph to the spike-neg incr comp tests
This ensures that the tests actually test what they are meant to test
rather than exitting immediately with an error that -Zquery-dep-graph
has to be passed.
2024-04-06 13:36:16 +00:00
Guillaume Gomez f14e4db1f9 Move more common code into a function in tests/rustdoc-gui/search-result-color.goml 2024-04-06 15:24:09 +02:00
DianQK 87519b258c
Update to LLVM 18.1.3 2024-04-06 21:07:35 +08:00
bors 83d0a940c6 Auto merge of #123545 - matthiaskrgr:rollup-vyx8cfv, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #114788 (impl get_mut_or_init and get_mut_or_try_init for OnceCell and OnceLock)
 - #122291 (Stabilize `const_caller_location` and `const_location_fields`)
 - #123357 (CI: Redirect stderr to stdout to order GHA logs)
 - #123504 (bootstrap: split cargo-miri test into separate Step)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-06 12:58:38 +00:00
Guillaume Gomez 4967895e55 Move search-result-color.goml common parts into a function 2024-04-06 14:53:30 +02:00