Commit Graph

261347 Commits

Author SHA1 Message Date
Yuri Astrakhan
aef0e346de Avoid ref when using format! in compiler
Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing).  Inlining format args prevents accidental `&` misuse.
2024-07-19 14:52:07 -04:00
Guillaume Gomez
063ed0f958 Improve display of trait bounds when there are more than two 2024-07-19 20:41:40 +02:00
bors
ff4b39867e Auto merge of #127982 - matthiaskrgr:rollup-nzyvphj, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #127295 (CFI: Support provided methods on traits)
 - #127814 (`C-cmse-nonsecure-call`: improved error messages)
 - #127949 (fix: explain E0120 better cover cases when its raised)
 - #127966 (Use structured suggestions for unconstrained generic parameters on impl blocks)
 - #127976 (Lazy type aliases: Diagostics: Detect bivariant ty params that are only used recursively)
 - #127978 (Avoid ref when using format! for perf)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-19 18:40:33 +00:00
Oneirical
27334943ed rewrite c-unwind-abi-catch-panic to rmake 2024-07-19 14:39:42 -04:00
Oneirical
7b19389d58 rewrite test-benches to rmake 2024-07-19 14:05:09 -04:00
Matthias Krüger
e28be0d168
Rollup merge of #127978 - nyurik:lib-refs, r=workingjubilee
Avoid ref when using format! for perf

Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing).  Inlining format args prevents accidental `&` misuse.
2024-07-19 20:03:58 +02:00
Matthias Krüger
115b086850
Rollup merge of #127976 - fmease:lta-cyclic-bivariant-param-better-err, r=compiler-errors
Lazy type aliases: Diagostics: Detect bivariant ty params that are only used recursively

Follow-up to errs's #127871. Extends the logic to cover LTAs, too, not just ADTs.
This change only takes effect with the next-gen solver enabled as cycle errors like
the one we have here are fatal in the old solver. That's my explanation anyways.

r? compiler-errors
2024-07-19 20:03:58 +02:00
Matthias Krüger
a2c99cf87c
Rollup merge of #127966 - oli-obk:structured_diag, r=compiler-errors
Use structured suggestions for unconstrained generic parameters on impl blocks

I did not deduplicate with `UnusedGenericParameter`, because in contrast to type declarations, just using a generic parameter in an impl isn't enough, it must be used with the right variance and not just as part of a projection.
2024-07-19 20:03:57 +02:00
Matthias Krüger
41d3cb6dbe
Rollup merge of #127949 - princess-entrapta:master, r=tgross35
fix: explain E0120 better cover cases when its raised

Fixes https://github.com/rust-lang/rust/issues/98996

Wording change on the explain of E0120 as requested
2024-07-19 20:03:56 +02:00
Matthias Krüger
3b20150b48
Rollup merge of #127814 - folkertdev:c-cmse-nonsecure-call-error-messages, r=oli-obk
`C-cmse-nonsecure-call`: improved error messages

tracking issue: #81391
issue for the error messages (partially implemented by this PR): #81347
related, in that it also deals with CMSE: https://github.com/rust-lang/rust/pull/127766

When using the `C-cmse-nonsecure-call` ABI, both the arguments and return value must be passed via registers. Previously, when violating this constraint, an ugly LLVM error would be shown. Now, the rust compiler itself will print a pretty message and link to more information.
2024-07-19 20:03:56 +02:00
Matthias Krüger
6ae6f8bb27
Rollup merge of #127295 - maurer:default-impl-cfi, r=estebank
CFI: Support provided methods on traits

Provided methods currently don't get type erasure performed on them because they are not in an `impl` block. If we are instantiating a method that is an associated item, but *not* in an impl block, treat it as a provided method instead.
2024-07-19 20:03:55 +02:00
Alex Crichton
006c884480 Fix two new failing tests
The updated wasi-sdk has debuginfo by default so be sure to strip the
debuginfo by default when testing the size of new executables.
2024-07-19 10:27:14 -07:00
Alex Crichton
5b0b4ff03c Update wasi-sdk in CI to latest release
This commit updates the `wasi-sdk` download used by the `wasm32-wasi*`
targets. The motivation for this commit is generally just "keep things
up to date" and is not intended to cause any issues or differences from
before, just a routine update.
2024-07-19 10:06:30 -07:00
León Orell Valerian Liehr
756459ed85
LTA: Diag: Detect bivariant ty params that are only used recursively 2024-07-19 18:53:40 +02:00
Oneirical
fdc8d62c96 rewrite pass-non-c-like-enum-to-c to rmake 2024-07-19 12:27:47 -04:00
Oneirical
1f976b43da rewrite linkage-attr-on-static to rmake 2024-07-19 12:27:47 -04:00
Oneirical
db8398db6f rewrite lto-no-link-whole-rlib to rmake 2024-07-19 12:27:47 -04:00
Oneirical
01c7118fa9 rewrite extern-fn-with-union to rmake 2024-07-19 12:27:47 -04:00
Oneirical
8a09f2231d rewrite extern-fn-generic to rmake 2024-07-19 12:27:47 -04:00
Oneirical
1a4fba5eb0 rewrite c-static-rlib to rmake 2024-07-19 12:27:47 -04:00
Oneirical
1ae1ab8215 rewrite c-static-dylib to rmake 2024-07-19 12:27:47 -04:00
Oneirical
5e55f07cc0 rewrite and rename issue-28595 to rmake 2024-07-19 12:27:46 -04:00
Oneirical
5b1860a24e rewrite return-non-c-like-enum-from-c to rmake 2024-07-19 12:27:26 -04:00
Yuri Astrakhan
91275b2c2b Avoid ref when using format! for perf
Clean up a few minor refs in `format!` macro, as it has a tiny perf
cost. A few more minor related cleanups.
2024-07-19 12:23:49 -04:00
bors
0cd01aac6a Auto merge of #127969 - matthiaskrgr:rollup-nhxmwhn, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #112328 (Feat. adding ext that returns change_time)
 - #126199 (Add `isqrt` to `NonZero<uN>`)
 - #127856 (interpret: add sanity check in dyn upcast to double-check what codegen does)
 - #127934 (Improve error when a compiler/library build fails in `checktools.sh`)
 - #127960 (Cleanup dll/exe filename calculations in `run_make_support`)
 - #127963 (Fix display of logo "border")
 - #127967 (Disable run-make/split-debuginfo test for RISC-V 64)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-19 16:13:37 +00:00
Matthias Krüger
73db4e32f3
Rollup merge of #127967 - joshua-zivkovic:joshua-zivkovic/disable-split-debuginfo, r=jieyouxu
Disable run-make/split-debuginfo test for RISC-V 64

Together with `@Hoverbear,` we've been improving the state of the riscv64gc-unknown-linux-gnu target.

This is in relation to https://github.com/rust-lang/rust/pull/125220 where `tests/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs` was disabled for RISC-V 64 in that another test, `tests/run-make/split-debuginfo` also needs to be disabled due to https://github.com/llvm/llvm-project/issues/56642 and the changes made in https://github.com/rust-lang/rust/pull/120518.

This test appears to be a host test, not a target test, so it isn't seen failing in https://github.com/rust-lang/rust/pull/126641, however, we are in the process of testing host tools for riscv64-gc-unknown-linux-gnu so this test has now been noticed to be a problem.
2024-07-19 17:06:52 +02:00
Matthias Krüger
1318ec0fed
Rollup merge of #127963 - GuillaumeGomez:fix-logo-display, r=notriddle
Fix display of logo "border"

Before:

![Screenshot from 2024-07-19 13-32-17](https://github.com/user-attachments/assets/381bb9c8-0ae0-408b-8476-9785ef1b5fd4)

After:

![Screenshot from 2024-07-19 13-37-46](https://github.com/user-attachments/assets/19cdb71f-3912-4fcd-95de-99b9f86a8293)

r? `@notriddle`
2024-07-19 17:06:52 +02:00
Matthias Krüger
e3f18bb056
Rollup merge of #127960 - jieyouxu:minor-rmake-cleanup, r=fmease
Cleanup dll/exe filename calculations in `run_make_support`

Use `std::env::consts` constants since now we have access to them (unlike in Makefiles!) ^^

cc `@bzEq` (this is one of the places in our test suites that tries to compute e.g. dylib extension; using `std::env::consts::DLL_EXTENSION` should correctly return `a` for AIX)

r? `@fmease` (thank you for the suggestion in https://github.com/rust-lang/rust/pull/127760#discussion_r1678079698, this also improves correctness for the support library!)

try-job: aarch64-apple
try-job: armhf-gnu
try-job: test-various
try-job: x86_64-msvc
try-job: x86_64-gnu-llvm-18
2024-07-19 17:06:51 +02:00
Matthias Krüger
32b9725b7d
Rollup merge of #127934 - Kobzol:checktools-better-error, r=onur-ozkan
Improve error when a compiler/library build fails in `checktools.sh`

Suggested by ``@RalfJung`` [here](https://github.com/rust-lang/rust/issues/127869#issuecomment-2235829643).

`x86_64-gnu-tools` should take ~45 minutes, let's see if this doesn't regress it.

r? ``@onur-ozkan``
2024-07-19 17:06:51 +02:00
Matthias Krüger
9f8c618a90
Rollup merge of #127856 - RalfJung:interpret-cast-sanity, r=oli-obk
interpret: add sanity check in dyn upcast to double-check what codegen does

For dyn receiver calls, we already have two codepaths: look up the function to call by indexing into the vtable, or alternatively resolve the DefId given the dynamic type of the receiver. With debug assertions enabled, the interpreter does both and compares the results. (Without debug assertions we always use the vtable as it is simpler.)

This PR does the same for dyn trait upcasts. However, for casts *not* using the vtable is the easier thing to do, so now the vtable path is the debug-assertion-only path. In particular, there are cases where the vtable does not contain a pointer for upcasts but instead reuses the old pointer: when the supertrait vtable is a prefix of the larger vtable. We don't want to expose this optimization and detect UB if people do a transmute assuming this optimization, so we cannot in general use the vtable indexing path.

r? ``@oli-obk``
2024-07-19 17:06:50 +02:00
Matthias Krüger
355cdd3bc1
Rollup merge of #126199 - ivan-shrimp:nonzero_isqrt, r=tgross35
Add `isqrt` to `NonZero<uN>`

Implements [#70887 (comment)](https://github.com/rust-lang/rust/issues/116226#issuecomment-2144225174), with the following signature:

```rust
impl NonZero<uN> {
    const fn isqrt(self) -> Self;
}
```

Unintended benefits include one fewer panicking branch in `ilog2` for LLVM to optimize away, and one fewer `assume_unchecked` as `NonZero` already does that.

The fast path for `self == 1` is dropped, but the current implementation is very slow anyways compared to hardware. Performance improvements can always come later.

(I didn't add the function to `NonZero<iN>`, since _every_ existing `NonZero` method is non-panicking, and it might be nice to leave it that way.)
2024-07-19 17:06:49 +02:00
Matthias Krüger
45e4e96385
Rollup merge of #112328 - juliusl:pr/windows-add-change-time, r=ChrisDenton
Feat. adding ext that returns change_time

Addresses #112327
2024-07-19 17:06:49 +02:00
León Orell Valerian Liehr
633f41de09
Update all rustdoc-json/ tests to use the new style 2024-07-19 16:54:42 +02:00
León Orell Valerian Liehr
25be41cfb8
Update jsondocck directives to follow ui_test-style 2024-07-19 16:54:16 +02:00
Alex Crichton
f0a2b5b0d9 Add a change tracker entry 2024-07-19 07:51:37 -07:00
Alex Crichton
ae82726a44 Conditionally build wasm-component-ld
This commit updates the support for the `wasm-component-ld` tool
from #126967 to conditionally build it rather than unconditionally
building it when LLD is enabled. This support is disabled by default and
can be enabled by one of two means:

* the `extended` field in `config.toml` which dist builders use to build
  a complete set of tools for each host platform.
* a `"wasm-component-ld"` entry in the `tools` section of `config.toml`.

Neither of these are enabled by default meaning that most local builds
will likely not have this new tool built. Dist builders should still,
however, build the tool.
2024-07-19 07:51:17 -07:00
Oli Scherer
a0db06bdeb Use structured suggestions for unconstrained generic parameters on impl blocks 2024-07-19 14:21:56 +00:00
许杰友 Jieyou Xu (Joe)
993d83af71 compiletest/rmake: cleanup stage_std_path and recipe_dylib_search_paths handling 2024-07-19 14:04:58 +00:00
许杰友 Jieyou Xu (Joe)
aa22102f2f compiletest/rmake: better explain why stage0 sysroot is needed if forced stage0 2024-07-19 14:04:58 +00:00
许杰友 Jieyou Xu (Joe)
2383e9dd4f compiletest/rmake: prune useless env vars and explain passed rustc options and env vars 2024-07-19 14:04:58 +00:00
许杰友 Jieyou Xu (Joe)
f5488f0c4b compiletest/rmake: rename cmd to rustc 2024-07-19 14:04:58 +00:00
许杰友 Jieyou Xu (Joe)
cf5edfe3f9 compiletest/rmake: cleanup rmake exe extension calculation 2024-07-19 14:04:58 +00:00
许杰友 Jieyou Xu (Joe)
9f2a660f86 compiletest/rmake: cleanup library search paths 2024-07-19 14:04:58 +00:00
许杰友 Jieyou Xu (Joe)
49ca9ff0ac compiletest/rmake: cleanup dylib search paths related calculations 2024-07-19 14:04:58 +00:00
许杰友 Jieyou Xu (Joe)
01ed951f8b compiletest/rmake: improve clarity of support_lib_{path,deps,deps_deps} calculations 2024-07-19 14:04:58 +00:00
许杰友 Jieyou Xu (Joe)
2eb8810d32 compiletest/rmake: move stage_std_path and recipe_bin closer to use site 2024-07-19 14:04:58 +00:00
许杰友 Jieyou Xu (Joe)
6ca31099e3 compiletest/rmake: improve stage explanation 2024-07-19 14:04:58 +00:00
许杰友 Jieyou Xu (Joe)
23f32f44dd compiletest/rmake: make {source,build}_root path calculation more robust for rmake.rs setup 2024-07-19 14:04:58 +00:00
许杰友 Jieyou Xu (Joe)
1b4972bc28 compiletest/rmake: adjust docs for rmake.rs setup and add FIXMEs 2024-07-19 13:53:56 +00:00
许杰友 Jieyou Xu (Joe)
36ebf7a321 run_make_support: skip rustfmt for lib.rs to preserve use ordering 2024-07-19 13:42:36 +00:00