Commit graph

249267 commits

Author SHA1 Message Date
Ralf Jung 279465b5e8 const-checking: add some corner case tests, and fix some nits 2024-03-11 14:15:24 +01:00
Kjetil Kjeka 843dd28d21 NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
Kjetil Kjeka 6a50d059a5 Bootstrap: Add argument for building llvm bitcode linker 2024-03-11 13:35:55 +01:00
Kjetil Kjeka 43f2055af5 LLVM Bitcode Linker: Add as a linker known to the compiler 2024-03-11 13:35:35 +01:00
Kjetil Kjeka af42d2a4b2 NVPTX: Enable self-contained for the nvptx target 2024-03-11 13:35:35 +01:00
Kjetil Kjeka 222ce4fdb8 LLVM Bitcode Linker: Added crate 2024-03-11 13:35:35 +01:00
Kjetil Kjeka ed252e931e LLVM_TOOLS: Include llvm-link as a llvm tool 2024-03-11 13:35:35 +01:00
bors d255c6a57c Auto merge of #122305 - Nilstrieb:target-tiers, r=davidtwco
Add metadata to targets

follow up to #121905 and #122157

This adds four pieces of metadata to every target:
- description
- tier
- host tools
- std

This information is currently scattered across target docs and both
- not machine readable, making validation harder
- sometimes subtly encoding by the table it's in, causing mistakes and making it harder to review changes to the properties

By putting it in the compiler, we improve this. Later, we will use this canonical information to generate target documentation from it.

I used find-replace for all the `description: None`.

One thing I'm not sure about is the behavior for the JSON. It doesn't really make sense that custom targets supply this information, especially the tier. But for the roundtrip tests, we do need to print and parse it. Maybe emit a warning when a custom target provides the metadata key? Either way, I don't think that's important right now, this PR should get merged ASAP or it will conflict all over the place.

r? davidtwco
2024-03-11 12:27:15 +00:00
bors e919669d42 Auto merge of #122331 - jhpratt:rollup-cbl8xsy, r=jhpratt
Rollup of 9 pull requests

Successful merges:

 - #121148 (Add slice::try_range)
 - #121633 (Win10: Use `GetSystemTimePreciseAsFileTime` directly)
 - #121840 (Expose the Freeze trait again (unstably) and forbid implementing it manually)
 - #121907 (skip sanity check for non-host targets in `check` builds)
 - #122002 (std::threads: revisit stack address calculation on netbsd.)
 - #122108 (Add `target.*.runner` configuration for targets)
 - #122298 (RawVec::into_box: avoid unnecessary intermediate reference)
 - #122315 (Allow multiple `impl Into<{D,Subd}iagMessage>` parameters in a function.)
 - #122326 (Optimize `process_heap_alloc`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-11 10:22:10 +00:00
Oli Scherer 55ea94402b Run a single huge par_body_owners instead of many small ones after each other.
This improves parallel rustc parallelism by avoiding the bottleneck after each individual `par_body_owners` (because it needs to wait for queries to finish, so if there is one long running one, a lot of cores will be idle while waiting for the single query).
2024-03-11 08:48:03 +00:00
Oli Scherer e2e751e76d Merge various rustc_attr based tests 2024-03-11 08:48:03 +00:00
Oli Scherer cfbc1b96d5 Enable creating backtraces via -Ztreat-err-as-bug when stashing errors 2024-03-11 08:46:58 +00:00
Oli Scherer 4279da583c Never bail out early while running all the type check queries 2024-03-11 08:43:50 +00:00
Jacob Pratt 5a3d6c91b1
Rollup merge of #122326 - Zoxc:win-alloc-tweak, r=ChrisDenton
Optimize `process_heap_alloc`

This optimizes `process_heap_alloc` introduced in https://github.com/rust-lang/rust/pull/120205.

From:
```
.text:0000000180027ED0 ; std::sys::pal::windows::alloc::process_heap_alloc::h703a613b3e25ff93
.text:0000000180027ED0                 public _ZN3std3sys3pal7windows5alloc18process_heap_alloc17h703a613b3e25ff93E
.text:0000000180027ED0 _ZN3std3sys3pal7windows5alloc18process_heap_alloc17h703a613b3e25ff93E proc near
.text:0000000180027ED0                                         ; CODE XREF: std::sys::pal::common::alloc::realloc_fallback::hc4c96b4c24d03e77+23↑p
.text:0000000180027ED0                                         ; std::sys::pal::common::alloc::realloc_fallback::hc4c96b4c24d03e77+55↑p ...
.text:0000000180027ED0                 push    rsi
.text:0000000180027ED1                 push    rdi
.text:0000000180027ED2                 sub     rsp, 28h
.text:0000000180027ED6                 mov     rsi, rdx
.text:0000000180027ED9                 mov     edi, ecx
.text:0000000180027EDB                 mov     rcx, cs:_ZN3std3sys3pal7windows5alloc4HEAP17hb53ca4010cc29b62E ; std::sys::pal::windows::alloc::HEAP::hb53ca4010cc29b62
.text:0000000180027EE2                 test    rcx, rcx
.text:0000000180027EE5                 jnz     short loc_180027EFC
.text:0000000180027EE7                 call    cs:__imp_GetProcessHeap
.text:0000000180027EED                 test    rax, rax
.text:0000000180027EF0                 jz      short loc_180027F0E
.text:0000000180027EF2                 mov     rcx, rax
.text:0000000180027EF5                 mov     cs:_ZN3std3sys3pal7windows5alloc4HEAP17hb53ca4010cc29b62E, rax ; std::sys::pal::windows::alloc::HEAP::hb53ca4010cc29b62
.text:0000000180027EFC
.text:0000000180027EFC loc_180027EFC:                          ; CODE XREF: std::sys::pal::windows::alloc::process_heap_alloc::h703a613b3e25ff93+15↑j
.text:0000000180027EFC                 mov     edx, edi
.text:0000000180027EFE                 mov     r8, rsi
.text:0000000180027F01                 add     rsp, 28h
.text:0000000180027F05                 pop     rdi
.text:0000000180027F06                 pop     rsi
.text:0000000180027F07                 jmp     cs:__imp_HeapAlloc
.text:0000000180027F0E ; ---------------------------------------------------------------------------
.text:0000000180027F0E
.text:0000000180027F0E loc_180027F0E:                          ; CODE XREF: std::sys::pal::windows::alloc::process_heap_alloc::h703a613b3e25ff93+20↑j
.text:0000000180027F0E                 xor     eax, eax
.text:0000000180027F10                 add     rsp, 28h
.text:0000000180027F14                 pop     rdi
.text:0000000180027F15                 pop     rsi
.text:0000000180027F16                 retn
.text:0000000180027F16 _ZN3std3sys3pal7windows5alloc18process_heap_alloc17h703a613b3e25ff93E endp
```
to
```
.text:0000000180027EE0 ; std::sys::pal::windows::alloc::process_heap_alloc::h70f9d61a631e5c16
.text:0000000180027EE0                 public _ZN3std3sys3pal7windows5alloc18process_heap_alloc17h70f9d61a631e5c16E
.text:0000000180027EE0 _ZN3std3sys3pal7windows5alloc18process_heap_alloc17h70f9d61a631e5c16E proc near
.text:0000000180027EE0                                         ; CODE XREF: std::sys::pal::common::alloc::realloc_fallback::hc4c96b4c24d03e77+23↑p
.text:0000000180027EE0                                         ; std::sys::pal::common::alloc::realloc_fallback::hc4c96b4c24d03e77+54↑p ...
.text:0000000180027EE0                 mov     rcx, cs:_ZN3std3sys3pal7windows5alloc4HEAP17hb53ca4010cc29b62E ; std::sys::pal::windows::alloc::HEAP::hb53ca4010cc29b62
.text:0000000180027EE7                 test    rcx, rcx
.text:0000000180027EEA                 jz      short loc_180027EF3
.text:0000000180027EEC                 jmp     cs:__imp_HeapAlloc
.text:0000000180027EF3 ; ---------------------------------------------------------------------------
.text:0000000180027EF3
.text:0000000180027EF3 loc_180027EF3:                          ; CODE XREF: std::sys::pal::windows::alloc::process_heap_alloc::h70f9d61a631e5c16+A↑j
.text:0000000180027EF3                 mov     ecx, edx
.text:0000000180027EF5                 mov     rdx, r8
.text:0000000180027EF8                 jmp     std__sys__pal__windows__alloc__process_heap_init_and_alloc
.text:0000000180027EF8 _ZN3std3sys3pal7windows5alloc18process_heap_alloc17h70f9d61a631e5c16E endp
```

r? `@ChrisDenton`
2024-03-11 03:47:22 -04:00
Jacob Pratt 6f158164ba
Rollup merge of #122315 - nnethercote:multiple-into-diag-message, r=Nilstrieb
Allow multiple `impl Into<{D,Subd}iagMessage>` parameters in a function.

The internal diagnostic lint currently only allows one, because that was all that occurred in practice. But rust-lang/rust-clippy/pull/12453 wants to introduce functions with more than one, and this limitation is getting in the way.

r? `@Nilstrieb`
2024-03-11 03:47:22 -04:00
Jacob Pratt eb1ebbfc92
Rollup merge of #122298 - RalfJung:raw-vec-into-box, r=cuviper
RawVec::into_box: avoid unnecessary intermediate reference

Fixes the problem described [here](https://github.com/rust-lang/miri/issues/3341#issuecomment-1987207195).
2024-03-11 03:47:21 -04:00
Jacob Pratt 9b30f01c0c
Rollup merge of #122108 - alexcrichton:target-config-runtool, r=WaffleLapkin
Add `target.*.runner` configuration for targets

This commit adds a `runner` field configuration to `config.toml` for specifying a wrapper executable when executing binaries for a target. This is pulled out of #122036 where a WebAssembly runtime is used, for example, to execute tests for `wasm32-wasip1`.

The name "runner" here is chosen to match Cargo's `CARGO_*_RUNNER` configuration, and to make things a bit more consistent this additionally renames compiletest's `--runtool` argument to `--runner`.
2024-03-11 03:47:21 -04:00
Jacob Pratt b3ac6fab3d
Rollup merge of #122002 - devnexen:thread_stack_netbsd_fix, r=workingjubilee,riastradh
std::threads: revisit stack address calculation on netbsd.

like older linux glibc versions, we need to get the guard size
 and increasing the stack's bottom address accordingly.
2024-03-11 03:47:20 -04:00
Jacob Pratt 1009859899
Rollup merge of #121907 - onur-ozkan:better-target-sanity-check, r=albertlarsan68
skip sanity check for non-host targets in `check` builds

For `check` builds, since we only need to perform a sanity check on the host target, this patch skips target sanity checks on non-host targets.

For more context, see https://github.com/rust-lang/rust/issues/121519#issuecomment-1974836049

cc ``@saethlin``
2024-03-11 03:47:20 -04:00
Jacob Pratt 05f22c3614
Rollup merge of #121840 - oli-obk:freeze, r=dtolnay
Expose the Freeze trait again (unstably) and forbid implementing it manually

non-emoji version of https://github.com/rust-lang/rust/pull/121501

cc #60715

This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: https://github.com/google/zerocopy/issues/941

cc ```@RalfJung```

T-lang signed off on reexposing this unstably: https://github.com/rust-lang/rust/pull/121501#issuecomment-1969827742
2024-03-11 03:47:19 -04:00
Jacob Pratt 1a989e0757
Rollup merge of #121633 - ChrisDenton:precise, r=Nilstrieb
Win10: Use `GetSystemTimePreciseAsFileTime` directly

On Windows 10 we can use `GetSystemTimePreciseAsFileTime` directly instead of lazy loading it (with a fallback).
2024-03-11 03:47:19 -04:00
Jacob Pratt 6c8c272ad4
Rollup merge of #121148 - clarfonthey:try-range, r=dtolnay
Add slice::try_range

This adds a fallible version of the unstable `slice::range` (tracking: #76393) which is highly requested in the tracking issue.

Hoping this can slide by without an ACP (since the feature is already being tracked), but let me know otherwise.
2024-03-11 03:47:18 -04:00
bors 6639672554 Auto merge of #117156 - jmillikin:os-unix-socket-ext, r=Amanieu,dtolnay
Convert `Unix{Datagram,Stream}::{set_}passcred()` to per-OS traits

These methods are the pre-stabilized API for obtaining peer credentials from an `AF_UNIX` socket, part of the `unix_socket_ancillary_data` feature.

Their current behavior is to get/set one of the `SO_PASSCRED` (Linux), `LOCAL_CREDS_PERSISTENT` (FreeBSD), or `LOCAL_CREDS` (NetBSD) socket options. On other targets the `{set_}passcred()` methods do not exist.

There are two problems with this approach:

1. Having public methods only exist for certain targets isn't permitted in a stable `std` API.

2. These options have generally similar purposes, but they are non-POSIX and their details can differ in subtle and surprising ways (such as whether they continue to be set after the next call to `recvmsg()`).

Splitting into OS-specific extension traits is the preferred solution to both problems.
2024-03-11 07:46:01 +00:00
Tshepang Mbambo 816dc96b3d
bootstrap readme: fix, improve, update 2024-03-11 09:27:00 +02:00
Nicholas Nethercote 47b4b8e8c5 Allow multiple impl Into<{D,Subd}iagMessage> parameters in a function.
The internal diagnostic lint currently only allows one, because that was
all that occurred in practice. But rust-lang/rust-clippy/pull/12453
wants to introduce functions with more than one, and this limitation is
getting in the way.
2024-03-11 16:42:10 +11:00
Martin Nordholts aea60b0cc7 unix_sigpipe: Replace inherit with sig_dfl in syntax tests
The `sig_dfl` variant of the attribute is the most likely variant to be
stabilized first, and thus to become the "most allowed" variant of the
attribute. Because of this, it is the most appropriate variant to use in
syntax tests, because even if the most allowed variant is used, the
compiler shall still emit errors if it e.g. is used in the wrong places.
2024-03-11 06:19:30 +01:00
bors a6d93acf5f Auto merge of #122050 - erikdesjardins:sret, r=nikic
Stop using LLVM struct types for byval/sret

For `byval` and `sret`, the type has no semantic meaning, only the size matters\*†. Using `[N x i8]` is a more direct way to specify that we want `N` bytes, and avoids relying on LLVM's struct layout.

\*: The alignment would matter, if we didn't explicitly specify it. From what I can tell, we always specified the alignment for `sret`; for `byval`, we didn't until #112157.

†: For `byval`, the hidden copy may be impacted by padding in the LLVM struct type, i.e. padding bytes may not be copied. (I'm not sure if this is done today, but I think it would be legal.) But we manually pad our LLVM struct types specifically to avoid there ever being LLVM-visible padding, so that shouldn't be an issue.

Split out from #121577.

r? `@nikic`
2024-03-11 04:45:27 +00:00
John Kåre Alsaker 50760aa2b5 Optimize process_heap_alloc 2024-03-11 05:43:12 +01:00
Michael Goulet 01e6b43a07 Mark some next-solver-behavior tests explicitly with revisions 2024-03-10 23:23:46 -04:00
Michael Goulet 73fc170544 Store backtrace for must_produce_diag 2024-03-10 23:22:30 -04:00
Erik Desjardins a7cd803d02 use ptradd for vtable indexing
Like field offsets, these are always constant.
2024-03-10 22:47:30 -04:00
bors c69fda7dc6 Auto merge of #121752 - mu001999:dead_code/improve, r=pnkfelix
Detect unused struct impls pub trait

Fixes #47851
2024-03-11 02:46:47 +00:00
Michael Goulet 383051092f Ignore tests w/ current/next revisions from compare-mode=next-solver 2024-03-10 21:18:41 -04:00
bors cd81f5b27e Auto merge of #122132 - nnethercote:diag-renaming3, r=nnethercote
Diagnostic renaming 3

A sequel to https://github.com/rust-lang/rust/pull/121780.

r? `@davidtwco`
2024-03-11 00:34:44 +00:00
Nicholas Nethercote 43c06335cf Rename diagnostic derive things.
For increased consistency.

- session_diagnostic_derive    -> diagnostic_derive
- session_subdiagnostic_derive -> subdiagnostic_derive
- SubdiagnosticDeriveBuilder   -> SubdiagnosticDerive
2024-03-11 10:06:34 +11:00
Nicholas Nethercote e9f0d9be0e Rename DecorateLint as LintDiagnostic.
To match `derive(LintDiagnostic)`.
2024-03-11 10:04:50 +11:00
Nicholas Nethercote 541d7cc65c Rename AddToDiagnostic as Subdiagnostic.
To match `derive(Subdiagnostic)`.

Also rename `add_to_diagnostic{,_with}` as `add_to_diag{,_with}`.
2024-03-11 10:04:49 +11:00
bors 76ee6fc926 Auto merge of #122312 - matthiaskrgr:rollup-0p8y7gg, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #122275 (disable OOM test in Miri)
 - #122276 (io::Read trait: make it more clear when we are adressing implementations vs callers)
 - #122277 (BorrowedCursor docs clarification)
 - #122286 (use Instance::expect_resolve() instead of unwraping Instance::resolve())
 - #122290 (MIR printing: print the path of uneval'd const)
 - #122293 (diagnostics: Do not suggest using `#[unix_sigpipe]` without a value)
 - #122297 (bootstrap: document what the triples in 'Build' mean)
 - #122302 (docs: Correct ptr/ref verbiage in SliceIndex docs.)
 - #122304 (fix metadata for dyn-star in new solver)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-10 22:16:22 +00:00
Nicholas Nethercote 7a294e998b Rename IntoDiagnostic as Diagnostic.
To match `derive(Diagnostic)`.

Also rename `into_diagnostic` as `into_diag`.
2024-03-11 09:15:09 +11:00
Nicholas Nethercote a09b1d33a7 Rename IntoDiagnosticArg as IntoDiagArg.
Also rename `into_diagnostic_arg` as `into_diag_arg`, and
`NotIntoDiagnosticArg` as `NotInotDiagArg`.
2024-03-11 09:12:19 +11:00
Nicholas Nethercote 256d802233 Remove unused impls from some subdiagnostics. 2024-03-11 09:08:33 +11:00
Nicholas Nethercote 4e38ef9e1a Remove unused impls for some diagnostics. 2024-03-11 09:08:29 +11:00
erer1243 3af28f0b70 Fix 32-bit overflows in LLVM composite constants 2024-03-10 17:54:55 -04:00
Nicholas Nethercote 567744c10e Remove Default derive from MacroExpectedFound.
It's the only diagnostic in the entire project that impls `Default`, and
the code is clearer without it.
2024-03-11 08:52:50 +11:00
Matthias Krüger 16ffeb208d
Rollup merge of #122304 - lukas-code:dyn-star-meta, r=compiler-errors
fix metadata for dyn-star in new solver

The pointee metadata of `dyn* Trait` types is `()` and not a vtable.
2024-03-10 22:16:45 +01:00
Matthias Krüger 97f3b3383a
Rollup merge of #122302 - ratmice:issue122234, r=cuviper
docs: Correct ptr/ref verbiage in SliceIndex docs.

Fixes #122234
2024-03-10 22:16:45 +01:00
Matthias Krüger 2a3a8dbdbf
Rollup merge of #122297 - RalfJung:bootstrap-build, r=onur-ozkan
bootstrap: document what the triples in 'Build' mean

Thanks to ``@onur-ozkan``  for pointing this out to me.
2024-03-10 22:16:44 +01:00
Matthias Krüger c4b159c4a0
Rollup merge of #122293 - Enselic:no-bare-unix_sigpipe, r=fmease
diagnostics: Do not suggest using `#[unix_sigpipe]` without a value

Remove `Word` from the `unix_sigpipe` attribute template so that plain `#[unix_sigpipe]` is not included in suggestions of valid forms of the attribute. Also re-arrange diagnostics code slightly to avoid duplicate diagnostics.

Tracking issue is https://github.com/rust-lang/rust/issues/97889.
2024-03-10 22:16:44 +01:00
Matthias Krüger 9ccbbda6ac
Rollup merge of #122290 - RalfJung:mir-printing, r=compiler-errors
MIR printing: print the path of uneval'd const

Currently it just prints `const _` which makes it impossible to say which constant is being referred to.

Also refer to promoteds in a consistent way; previously MIR printing would do
```
promoted[0] in C1: &Option<Cell<i32>> = {
    // ...
}
```
Now that should be
```
const C1::promoted[0]: &Option<Cell<i32>> = {
    // ...
}
```

We don't seem to have a test for that so I tried it by hand, it seems to work:
```
const main::promoted[12]: &[&str; 3] = {
    let mut _0: &[&str; 3];
    let mut _1: [&str; 3];
    let mut _2: &str;
    let mut _3: &str;
    let mut _4: &str;
    let mut _5: &str;

    bb0: {
        _3 = const "b";
        _2 = &(*_3);
        _5 = const "c";
        _4 = &(*_5);
        _1 = [const "a", move _2, move _4];
        _0 = &_1;
        return;
    }
}
```
2024-03-10 22:16:43 +01:00
Matthias Krüger b02f2a0e76
Rollup merge of #122286 - RalfJung:resolve, r=compiler-errors
use Instance::expect_resolve() instead of unwraping Instance::resolve()
2024-03-10 22:16:43 +01:00