Commit Graph

265467 Commits

Author SHA1 Message Date
Zalathar acccb39bff Print a helpful message if any tests were skipped for being up-to-date 2024-09-09 16:00:14 +10:00
Nicholas Nethercote 5445953659 Improve consistency in `LowerIntrinsics`.
In some cases `target` and `arg` are obtained fallibly, and in some
cases they are obtained infallibly. This commit changes them all to
infallible.
2024-09-09 15:15:44 +10:00
Nicholas Nethercote 751c8b481b Use `LocalDecls` in a couple of places.
It's nicer than the `IndexVec` type.
2024-09-09 15:15:44 +10:00
Nicholas Nethercote 7adde3f074 Make `CallSite` non-`Copy`.
It doesn't need to be, and it's 72 bytes on 64-bit platforms, which is
fairly large.
2024-09-09 15:15:43 +10:00
Nicholas Nethercote 9cf90b9fc9 Remove some unnecessary dereferences. 2024-09-09 15:15:43 +10:00
Nicholas Nethercote 4f2588f23a Remove an unnecessary `continue`.
Nothing comes after it within the loop.
2024-09-09 15:15:43 +10:00
Nicholas Nethercote 181fbd5ce8 Use `let`/`else` to de-indent `ElaborateBoxDerefs::run_pass`. 2024-09-09 15:15:43 +10:00
Nicholas Nethercote cc09ab3c75 Simplify `verify_candidate_branch`.
Let chains are perfect for this kind of function.
2024-09-09 15:15:43 +10:00
Nicholas Nethercote ec6fe4e198 Streamline `AbortUnwindingCalls`.
Currently it constructs two vectors `calls_to_terminated` and
`cleanups_to_remove` in the main loop, and then processes them after the
main loop. But the processing can be done in the main loop, avoiding the
need for the vectors.
2024-09-09 15:15:42 +10:00
Zalathar a6735e44ca Add an explicit ignore message for "up-to-date" tests
When running tests without the `--force-rerun` flag, compiletest will
automatically skip any tests that (in its judgement) don't need to be run again
since the last time they were run.

This patch adds an explicit reason to those skipped tests, which is visible
when running with `rust.verbose-tests = true` in `config.toml`.
2024-09-09 14:11:43 +10:00
bors 085744b7ad Auto merge of #130036 - weiznich:diagnostic_unstable_tracking, r=compiler-errors
Correctly handle stability of `#[diagnostic]` attributes

This commit changes the way we treat the stability of attributes in the
`#[diagnostic]` namespace. Instead of relaying on ad-hoc checks to
ensure at call side that a certain attribute is really usable at that
location it centralises the logic to one place. For diagnostic
attributes comming from other crates it just skips serializing
attributes that are not stable and that do not have the corresponding
feature enabled. For attributes from the current crate we can just use
the feature information provided by `TyCtx`.

r​? `@compiler-errors`
2024-09-08 23:39:00 +00:00
Nicholas Nethercote bbe28cf1d9 Remove `serialized_bitcode` from `LtoModuleCodegen`.
It's unused.
2024-09-09 09:00:50 +10:00
Nicholas Nethercote cd9fd274d1 Factor out some more repetitive code. 2024-09-09 08:48:09 +10:00
Nicholas Nethercote 6af470e360 Reduce visibilities, and add `warn(unreachable_pub)`.
Lots of unnecessary `pub`s in this crate. Most are downgraded to
`pub(super)`, though some don't need any visibility.
2024-09-09 08:48:09 +10:00
Samuel Thibault 7626015848 added support for GNU/Hurd on x86_64 2024-09-08 23:37:07 +02:00
Eduardo Sánchez Muñoz 5f3fdd14df Remove needless returns detected by clippy in libraries 2024-09-08 21:51:00 +02:00
Ralf Jung 11d51aae86 const: make ptr.is_null() stop execution on ambiguity 2024-09-08 19:07:46 +02:00
Ralf Jung 11bd99de8c IntervalSet: add comment about representation 2024-09-08 16:54:28 +02:00
Ralf Jung a2410425b3 clarify comments and names in check_validity_requirement 2024-09-08 16:53:23 +02:00
Ralf Jung 8cd982caa1 interpret: reset padding during validation 2024-09-08 16:53:23 +02:00
Ralf Jung cbdcbf0d6a interpret: reset provenance on typed copies 2024-09-08 16:53:23 +02:00
Ralf Jung 85dc22f2cf interpret: factor out common code for place mutation 2024-09-08 16:53:23 +02:00
Ralf Jung 8ad808db7e interpret: make Writeable trait about a to_place operation 2024-09-08 16:53:23 +02:00
Ralf Jung fa60ea7d38 interpret: remove Readable trait, we can use Projectable instead 2024-09-08 16:53:22 +02:00
Ralf Jung f7b4f4a73b Option, Result: put the &mut variants of 'copied' under the same feature as the '&' variants 2024-09-08 16:52:40 +02:00
onur-ozkan 7b8cbe4f1c handle dry-run mode in `Config::get_builder_toml`
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-08 17:52:21 +03:00
onur-ozkan 13e16a9101 use `Config::get_builder_toml` for ci-rustc config parsing
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-08 17:52:18 +03:00
onur-ozkan 018ed9abb9 fix llvm ThinLTO behaviour
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-08 17:52:14 +03:00
onur-ozkan ea34bb0452 print incompatible options even if we don't download
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-08 17:52:09 +03:00
onur-ozkan 23df3a9eeb remove `check_ci_llvm` usage
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-08 17:52:06 +03:00
onur-ozkan 9df7680ecf detect incompatible CI LLVM options more precisely
Previously, the logic here was simply checking whether the option was set in `config.toml`.
This approach was not manageable in our CI runners as we set so many options in config.toml.
In reality, those values are not incompatible since they are usually the same value used to generate
the CI llvm. Now, the new logic compares the configuration values with the values used to generate
the CI llvm, so we get more precise results and make the process more manageable.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-08 17:51:54 +03:00
bors adf8d168af Auto merge of #130002 - orlp:better-div-floor-ceil, r=thomcc
better implementation of signed div_floor/ceil

Tracking issue for signed `div_floor`/`div_ceil`: https://github.com/rust-lang/rust/issues/88581.

This PR improves the implementation of those two functions by adding a better branchless algorithm. Side-by-side comparison of `i32::div_floor` on x86-64:

```asm
div_floor_new:                               div_floor_old:
        push    rax                                  push    rax
        test    esi, esi                             test    esi, esi
        je      .LBB0_3                              je      .LBB1_6
        mov     eax, esi                             mov     eax, esi
        not     eax                                  not     eax
        lea     ecx, [rdi - 2147483648]              lea     ecx, [rdi - 2147483648]
        or      ecx, eax                             or      ecx, eax
        je      .LBB0_2                              je      .LBB1_7
        mov     eax, edi                             mov     eax, edi
        cdq                                          cdq
        idiv    esi                                  idiv    esi
        xor     esi, edi                             test    edx, edx
        sar     esi, 31                              setg    cl
        test    edx, edx                             test    esi, esi
        cmove   esi, edx                             sets    dil
        add     eax, esi                             test    dil, cl
        pop     rcx                                  jne     .LBB1_4
        ret                                          test    edx, edx
.LBB0_3:                                             setns   cl
        lea     rdi, [rip + .L__unnamed_1]           test    esi, esi
        call    qword ptr [rip + panic...]          setle   dl
.LBB0_2:                                             or      dl, cl
        lea     rdi, [rip + .L__unnamed_1]           jne     .LBB1_5
        call    qword ptr [rip + panic...]   .LBB1_4:
                                                     dec     eax
                                             .LBB1_5:
                                                     pop     rcx
                                                     ret
                                             .LBB1_6:
                                                     lea     rdi, [rip + .L__unnamed_2]
                                                     call    qword ptr [rip + panic...]
                                             .LBB1_7:
                                                     lea     rdi, [rip + .L__unnamed_2]
                                                     call    qword ptr [rip + panic...]
```

And on Aarch64:

```asm
_div_floor_new:                                   _div_floor_old:
        stp     x29, x30, [sp, #-16]!                     stp     x29, x30, [sp, #-16]!
        mov     x29, sp                                   mov     x29, sp
        cbz     w1, LBB0_4                                cbz     w1, LBB1_9
        mov     w8, #-2147483648                          mov     x8, x0
        cmp     w0, w8                                    mov     w9, #-2147483648
        b.ne    LBB0_3                                    cmp     w0, w9
        cmn     w1, #1                                    b.ne    LBB1_3
        b.eq    LBB0_5                                    cmn     w1, #1
LBB0_3:                                                   b.eq    LBB1_10
        sdiv    w8, w0, w1                        LBB1_3:
        msub    w9, w8, w1, w0                            sdiv    w0, w8, w1
        eor     w10, w1, w0                               msub    w8, w0, w1, w8
        asr     w10, w10, #31                             tbz     w1, #31, LBB1_5
        cmp     w9, #0                                    cmp     w8, #0
        csel    w9, wzr, w10, eq                          b.gt    LBB1_7
        add     w0, w9, w8                        LBB1_5:
        ldp     x29, x30, [sp], #16                       cmp     w1, #1
        ret                                               b.lt    LBB1_8
LBB0_4:                                                   tbz     w8, #31, LBB1_8
        adrp    x0, l___unnamed_1@PAGE            LBB1_7:
        add     x0, x0, l___unnamed_1@PAGEOFF             sub     w0, w0, #1
        bl      panic...                          LBB1_8:
LBB0_5:                                                   ldp     x29, x30, [sp], #16
        adrp    x0, l___unnamed_1@PAGE                    ret
        add     x0, x0, l___unnamed_1@PAGEOFF     LBB1_9:
        bl      panic...                                  adrp    x0, l___unnamed_2@PAGE
                                                          add     x0, x0, l___unnamed_2@PAGEOFF
                                                          bl      panic...
                                                  LBB1_10:
                                                          adrp    x0, l___unnamed_2@PAGE
                                                          add     x0, x0, l___unnamed_2@PAGEOFF
                                                          bl      panic...
```
2024-09-08 13:54:02 +00:00
Florian Schmiderer ec11001f2b run-make-support: Add llvm-pdbutil 2024-09-08 14:12:57 +02:00
bors 7b18b3eb6d Auto merge of #129019 - kromych:master, r=workingjubilee
Break into the debugger (if attached) on panics (Windows, Linux, macOS, FreeBSD)

The developer experience for panics is to provide the backtrace and
exit the program. When running under debugger, that might be improved
by breaking into the debugger once the code panics thus enabling
the developer to examine the program state at the exact time when
the code panicked.

Let the developer catch the panic in the debugger if it is attached.
If the debugger is not attached, nothing changes. Providing this feature
inside the standard library facilitates better debugging experience.

Validated under Windows, Linux, macOS 14.6, and FreeBSD 13.3..14.1.
2024-09-08 10:28:26 +00:00
bors 8f93a10801 Auto merge of #130072 - ChrisDenton:split-ci, r=Kobzol
Split x86_64-msvc-ext into two jobs

This is an attempt to mitigate (but not resolve) the high failure rate of the x86_64-msvc-ext builder. The theory being that doing less makes it less likely to fail. But this may not work as having an extra job that may fail might be worse.

try-job: x86_64-msvc-ext
try-job: x86_64-msvc-ext2
2024-09-08 08:04:56 +00:00
Ralf Jung 3de6838238 add some FIXME(const-hack) 2024-09-08 08:30:28 +02:00
bors 6d05f12170 Auto merge of #129346 - nnethercote:fix-double-handling-in-collect_tokens, r=petrochenkov
Fix double handling in `collect_tokens`

Double handling of AST nodes can occur in `collect_tokens`. This is when an inner call to `collect_tokens` produces an AST node, and then an outer call to `collect_tokens` produces the same AST node. This can happen in a few places, e.g. expression statements where the statement delegates `HasTokens` and `HasAttrs` to the expression. It will also happen more after #124141.

This PR fixes some double handling cases that cause problems, including #129166.

r? `@petrochenkov`
2024-09-08 05:35:23 +00:00
Michael Howell 65903362ad rustdoc: use a single box to store Attributes and ItemKind 2024-09-07 21:06:50 -07:00
Michael Howell e80c9ac3e2 rustdoc: use `LocalDefId` for inline stmt
It's never a cross-crate DefId, so save space by not storing it.
2024-09-07 20:56:39 -07:00
bors 7f4b270aa4 Auto merge of #129313 - RalfJung:coroutine-niches, r=compiler-errors
Supress niches in coroutines to avoid aliasing violations

As mentioned [here](https://github.com/rust-lang/rust/issues/63818#issuecomment-2264915918), using niches in fields of coroutines that are referenced by other fields is unsound: the discriminant accesses violate the aliasing requirements of the reference pointing to the relevant field. This issue causes [Miri errors in practice](https://github.com/rust-lang/miri/issues/3780).

The "obvious" fix for this is to suppress niches in coroutines. That's what this PR does. However, we have several tests explicitly ensuring that we *do* use niches in coroutines. So I see two options:
- We guard this behavior behind a `-Z` flag (that Miri will set by default). There is no known case of these aliasing violations causing miscompilations. But absence of evidence is not evidence of absence...
- (What this PR does right now.) We temporarily adjust the coroutine layout logic and the associated tests until the proper fix lands. The "proper fix" here is to wrap fields that other fields can point to in [`UnsafePinned`](https://github.com/rust-lang/rust/issues/125735) and make `UnsafePinned` suppress niches; that would then still permit using niches of *other* fields (those that never get borrowed). However, I know that coroutine sizes are already a problem, so I am not sure if this temporary size regression is acceptable.

`@compiler-errors` any opinion? Also who else should be Cc'd here?
2024-09-08 03:11:12 +00:00
EtomicBomb 548b6e197d add tests for behavior in rfc#3662
* Adds tests for the behavior from rfc#3662 in `tests/rustdoc/`
2024-09-07 19:02:22 -04:00
bors 878f49f5ff Auto merge of #130091 - matthiaskrgr:rollup-kalu1cs, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #126452 (Implement raw lifetimes and labels (`'r#ident`))
 - #129555 (stabilize const_float_bits_conv)
 - #129594 (explain the options bootstrap passes to curl)
 - #129677 (Don't build by-move body when async closure is tainted)
 - #129847 (Do not call query to compute coroutine layout for synthetic body of async closure)
 - #129869 (add a few more crashtests)
 - #130009 (rustdoc-search: allow trailing `Foo ->` arg search)
 - #130046 (str: make as_mut_ptr and as_bytes_mut unstably const)
 - #130047 (Win: Add dbghelp to the list of import libraries)
 - #130059 (Remove the unused  `llvm-skip-rebuild` option from x.py)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-07 23:02:03 +00:00
EtomicBomb 2e1cba6415 rfc#3662 changes under unstable flags
* All new functionality is under unstable options
* Adds `--merge=shared|none|finalize` flags
* Adds `--parts-out-dir=<crate specific directory>` for `--merge=none`
to write cross-crate info file for a single crate
* Adds `--include-parts-dir=<previously specified directory>` for
`--merge=finalize` to write cross-crate info files
* update tests/run-make/rustdoc-default-output/rmake.rs golden
2024-09-07 18:59:01 -04:00
EtomicBomb 3782251c2c librustdoc::config: removed Input from Options
The `librustdoc::config::Options` struct no longer includes
`rustc_session::config::Input`. This is so that Input can be optional.
In rfc#3662, the crate input is not required if `--merge=finalize`.

Replacing Input with Option<Input> was decided against. In most places
that Input is needed, it should be statically known to not be optional
(means fewer unwraps). We just want to have an Input-free Options in
librustdoc::main_args, where we can run the write shared procedure.
2024-09-07 18:57:48 -04:00
Zack Slayton cfe85a3a73 Fixes typo in wasm32-wasip2 doc comment 2024-09-07 17:36:47 -04:00
Matthias Krüger 4ba483d68b
Rollup merge of #130059 - gurry:130039-remove-skip-rebuild, r=Kobzol
Remove the unused  `llvm-skip-rebuild` option from x.py

Fixes #130039
2024-09-07 23:30:16 +02:00
Matthias Krüger 0dc9f1ac90
Rollup merge of #130047 - ChrisDenton:win-dbghelp, r=wesleywiser
Win: Add dbghelp to the list of import libraries

This is used by the backtrace crate. But we use a submodule to include backtrace in std (rather than being a real crate) so we need to add the dependency here.
2024-09-07 23:30:15 +02:00
Matthias Krüger c139dc6281
Rollup merge of #130046 - RalfJung:const_str_as_mut, r=dtolnay
str: make as_mut_ptr and as_bytes_mut unstably const

`@rust-lang/libs-api` the corresponding non-mutable methods are already const fn, so this seems pretty trivial. I hope this is small enough that it does not need an ACP? :)

I would like to get these stabilized ASAP because I want to avoid people doing `s.as_ptr().cast_mut()`, which is UB if they ever write to it, but is already const-stable.

TODO: create a tracking issue.
2024-09-07 23:30:14 +02:00
Matthias Krüger 04b4523efc
Rollup merge of #130009 - notriddle:notriddle/trailing-arrow, r=lolbinarycat,GuillaumeGomez
rustdoc-search: allow trailing `Foo ->` arg search

Fixes #129710
2024-09-07 23:30:14 +02:00
Matthias Krüger a88b1af7c0
Rollup merge of #129869 - cyrgani:master, r=Mark-Simulacrum
add a few more crashtests

Added them for #123629, #127033 and #129372.
2024-09-07 23:30:13 +02:00