1
Fork 0
Commit graph

286843 commits

Author SHA1 Message Date
reddevilmidzy
11256a0fb0 Add regression test for #127424 2025-04-12 22:16:08 +09:00
Thalia Archibald
bea202253e Unify owned Args types between platforms 2025-04-12 05:11:27 -07:00
Yotam Ofek
c36e8fcc3c In rustc_mir_tranform, iterate over index newtypes instead of ints 2025-04-12 11:53:07 +00:00
Thalia Archibald
e014fd6b87 Use unsupported args for espidf and vita 2025-04-12 04:38:20 -07:00
Alice Ryhl
6c6a39e6bf cfg(kcfi) 2025-04-12 11:18:19 +00:00
Thalia Archibald
6ffebb65d6 Move args into std::sys 2025-04-12 03:10:21 -07:00
Tshepang Mbambo
32dd3831f5
bootstrap: fix typo in doc string 2025-04-12 11:38:55 +02:00
Samuel Tardieu
83dd8a2c2a Fix name of field in doc comment 2025-04-12 11:34:04 +02:00
Jakub Beránek
ddf8237bcb
Fix comment in bootstrap 2025-04-12 10:05:50 +02:00
Maksim Bondarenkov
86e2a07a13 opt-dist: use executable-extension for host llvm-profdata
so the merging step doesn't fail for `opt-dist local` on Windows
2025-04-12 10:52:46 +03:00
Jieyou Xu
db6e3aa913
tests: ensure disabled tests have a reason 2025-04-12 15:24:25 +08:00
Jieyou Xu
762ecf8e00
tests/ui: remove outdated README
We should consolidate our test suite docs in rustc-dev-guide, and this
README is very outdated.
2025-04-12 15:18:01 +08:00
Jieyou Xu
4362789eb0
tests: produce target artifacts and/or require crate type / ignore cross-compile
Some tests fail on cross-compiled targets due to various linker problems
on cross-compiled target, and having test coverage for these against
cross-compiled targets is nice but not necessary.
2025-04-12 15:09:06 +08:00
Jieyou Xu
41931320f8
run-make-support: fix artifact name calculations for target
This was implemented incorrectly during the porting process, where we
relied on std consts. However, `run-make-support` is a host-only
library, which meant that these artifact names were for the *host* and
not the *target*.
2025-04-12 14:48:01 +08:00
Ricardo Fernández Serrata
072678ec86
docs: clarify uint exponent for is_power_of_two 2025-04-12 02:18:40 -04:00
Oli Scherer
1f8cb690fc
Merge pull request #4270 from rust-lang/rustup-2025-04-12
Automatic Rustup
2025-04-12 06:14:31 +00:00
The Miri Cronjob Bot
59a3730169 fmt 2025-04-12 05:08:28 +00:00
The Miri Cronjob Bot
352545f16f Merge from rustc 2025-04-12 05:07:15 +00:00
The Miri Cronjob Bot
c4620021dc Preparing for merge from rustc 2025-04-12 05:00:08 +00:00
Weihang Lo
52b7571707
Update cargo 2025-04-11 23:00:05 -04:00
bors
1bc56185ee Auto merge of #139430 - scottmcm:polymorphic-array-into-iter, r=cuviper
Some checks failed
Post merge analysis / analysis (push) Has been cancelled
Polymorphize `array::IntoIter`'s iterator impl

Today we emit all the iterator methods for every different array width.  That's wasteful since the actual array length never even comes into it -- the indices used are from the separate `alive: IndexRange` field, not even the `N` const param.

This PR switches things so that an `array::IntoIter<T, N>` stores a `PolymorphicIter<[MaybeUninit<T>; N]>`, which we *unsize* to `PolymorphicIter<[MaybeUninit<T>]>` and call methods on that non-`Sized` type for all the iterator methods.

That also necessarily makes the layout consistent between the different lengths of arrays, because of the unsizing.  Compare that to today <https://rust.godbolt.org/z/Prb4xMPrb>, where different widths can't even be deduped because the offset to the indices is different for different array widths.
2025-04-11 23:21:31 +00:00
bors
d2b3dd7c17 Auto merge of #139689 - jhpratt:rollup-wlkdyjg, r=jhpratt
Rollup of 7 pull requests

Successful merges:

 - #137835 (Use `BinOp::Cmp` for `iNN::signum`)
 - #139584 (Avoid a reverse map that is only used in diagnostics paths)
 - #139638 (Cleanup the `InstSimplify` MIR transformation)
 - #139653 (Handle a negated literal in `eat_token_lit`.)
 - #139662 (Tweak `DefPathData`)
 - #139664 (Reuse address-space computation from global alloc)
 - #139687 (Add spastorino to users_on_vacation)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-11 20:06:06 +00:00
Jakub Beránek
394610b6d6 Document that opt-dist requires metrics to be enabled 2025-04-11 21:30:10 +02:00
Jacob Pratt
c8992c90e0
Rollup merge of #139687 - spastorino:add-spastorino-to-vacation, r=Urgau
Add spastorino to users_on_vacation
2025-04-11 21:21:02 +02:00
Jacob Pratt
eea366c191
Rollup merge of #139664 - oli-obk:push-tkmurytmnsyw, r=RalfJung
Reuse address-space computation from global alloc

r? `@RalfJung`

just avoiding some minor duplication
2025-04-11 21:21:02 +02:00
Jacob Pratt
2b54f9bfb1
Rollup merge of #139662 - nnethercote:tweak-DefPathData, r=compiler-errors
Tweak `DefPathData`

Some improvements in and around `DefPathData`, following on from #137977.

r? `@spastorino`
2025-04-11 21:21:01 +02:00
Jacob Pratt
2f873f96e2
Rollup merge of #139653 - nnethercote:fix-139495, r=petrochenkov
Handle a negated literal in `eat_token_lit`.

Fixes #139495.

r? `@petrochenkov`
2025-04-11 21:21:01 +02:00
Jacob Pratt
00b9060c3b
Rollup merge of #139638 - yotamofek:pr/mir_transform/instsimplify/cleanup, r=oli-obk
Cleanup the `InstSimplify` MIR transformation

Some minor cleanups and rightward-drift-protection found while working on #139411 and a future follow-up
2025-04-11 21:21:00 +02:00
Jacob Pratt
bc05aaeeaa
Rollup merge of #139584 - oli-obk:horrible-experiment-1, r=petrochenkov
Avoid a reverse map that is only used in diagnostics paths

r? `@petrochenkov`

iterating a map until a value matches and returning the key is bad obviously, but it happens very rarely and only on diagnostics paths. It would also be a lot cheaper with https://github.com/rust-lang/rust/pull/138995. Which is actually why I'm trying this out, that PR adds a new entry in `create_def`, which makes `create_def` show up in cachegrind. So I'm trying out if removing adding an entry in `create_def` is a perf improvement
2025-04-11 21:20:59 +02:00
Jacob Pratt
a6608294a9
Rollup merge of #137835 - scottmcm:signum, r=compiler-errors
Use `BinOp::Cmp` for `iNN::signum`

This way it can use the nice new LLVM intrinsic in LLVM20.
2025-04-11 21:20:59 +02:00
Michael Howell
e013cf8afc rustdoc-search: add unbox flag to Result aliases
Fixes #139665
2025-04-11 11:36:40 -07:00
Santiago Pastorino
452c280f64
Add spastorino to users_on_vacation 2025-04-11 15:27:11 -03:00
Chris Denton
b613e9781a
Use with_native_path for Windows
Also add a WCStr type
2025-04-11 18:02:03 +00:00
bors
ed3a4aac81 Auto merge of #139588 - Kobzol:rust-analyzer-opt, r=jieyouxu
Use LTO to optimize Rust tools (cargo, miri, rustfmt, clippy, Rust Analyzer)

Trying if LTO/PGO can help RA's performance, and by how much. As `@Noratrieb` suggested, we could actually LTO optimize all the important tools.

CC `@Veykril` I realized that we don't even do LTO for Rust Analyzer, that could be a very low hanging fruit to improve its performance 😅

try-job: dist-x86_64-linux
2025-04-11 17:00:31 +00:00
Matthew Jasper
ac45a67297 Use delayed bug for normalization errors in drop elaboration
Normalization can fail from errors from other items so use a delayed
bug instead of checking the body.
2025-04-11 16:31:28 +00:00
Alice Ryhl
17d412439a
Update library/core/src/fmt/rt.rs 2025-04-11 17:55:25 +02:00
Jesus Checa Hidalgo
dc0fbcab7e Fix profiler_builtins build script to handle full path to profiler lib
LLVM_PROFILER_RT_LIB may be set to an absolute path (e.g., in Fedora builds),
but `-l` expects a library name, not a path. After #138273, this caused builds
to fail with a "could not find native static library" error.

This patch updates the build script to split the path into directory and
filename, using `cargo::rustc-link-search` for the directory and
`cargo::rustc-link-lib=+verbatim` for the file. This allows profiler_builtins to
correctly link the static library even when an absolute path is provided.
2025-04-11 16:57:38 +02:00
bors
e1b06f7730 Auto merge of #139453 - compiler-errors:incr, r=jieyouxu
Prepend temp files with per-invocation random string to avoid temp filename conflicts

https://github.com/rust-lang/rust/issues/139407 uncovered a very subtle unsoundness with incremental codegen, failing compilation sessions (due to assembler errors), and the "prefer hard linking over copying files" strategy we use in the compiler for file management.

Specifically, imagine we're building a single file 3 times, all with `-Csave-temps -Cincremental=...`. Let's call the object file we're building for the codegen unit for `main` "`XXX.o`" just for clarity since it's probably some gigantic hash name:

```
#[inline(never)]
#[cfg(any(rpass1, rpass3))]
fn a() -> i32 {
    0
}

#[cfg(any(cfail2))]
fn a() -> i32 {
    1
}

fn main() {
    evil::evil();
    assert_eq!(a(), 0);
}

mod evil {
    #[cfg(any(rpass1, rpass3))]
    pub fn evil() {
        unsafe {
            std::arch::asm!("/*  */");
        }
    }

    #[cfg(any(cfail2))]
    pub fn evil() {
        unsafe {
            std::arch::asm!("missing");
        }
    }
}
```

Session 1 (`rpass1`):
* Type-check, borrow-check, etc.
* Serialize the dep graph to the incremental working directory `.../s-...-working/`.
* Codegen object file to a temp file `XXX.rcgu.o` which is spit out in the cwd.
* Hard-link[^1] `XXX.rcgu.o` to the incremental working directory `.../s-...-working/XXX.o`.
* Save-temps option means we don't delete `XXX.rgcu.o`.
* Link the binary and stuff.
* Finalize[^2] the working incremental session by renaming `.../s-...-working` to ` s-...-asjkdhsjakd` (some other finalized incr comp session dir name).

Session 2 (`cfail2`):
* Load artifacts from the previous *finalized* incremental session, namely the dep graph.
* Type-check, borrow-check, etc. since the file has changed, so most dep graph nodes are red.
* Serialize the dep graph to the incremental working directory `.../s-...-working/`.
* Codegen object file to a temp file `XXX.rcgu.o`. **HERE IS THE PROBLEM**: The hard-link is still set up to point to the inode from `XXX.o` from the first session, so this also modifies the `XXX.o` in the previous finalized session directory.
* Codegen emits an error b/c `missing` is not an instruction, so we abort before finalizing the incremental session. Specifically, this means that the *previous* session is the last finalized session.

Session 3 (`rpass3`):
* Load artifacts from the previous *finalized* incremental session, namely the dep graph. NOTE that this is from session 1.
* All the dep graph nodes are green since we are basically replaying session 1.
* codegen object file `XXX.o`, which is detected as *reused* from session 1 since dep nodes were green. That means we **reuse** `XXX.o` which had been dirtied from session 2.
* Link the binary and stuff.

This results in a binary which reuses some of the build artifacts from session 2, but thinks it's from session 1.

At this point, I hope it's clear to see that the incremental results from session 1 were dirtied from session 2, but we reuse them as if session 1 was the previous (finalized) incremental session we ran. This is at best really buggy, and at worst **unsound**.

This isn't limited to `-C save-temps`, since there are other combinations of flags that may keep around temporary files (hard linked) in the working directory (like `-C debuginfo=1 -C split-debuginfo=unpacked` on darwin, for example).

---

This PR implements a fix which is to prepend temp filenames with a random string that is generated per invocation of rustc. This string is not *deterministic*, but temporary files are transient anyways, so I don't believe this is a problem.

That means that temp files are now something like... `{crate-name}.{cgu}.{invocation_temp}.rcgu.o`, where `{invocation_temp}` is the new temporary string we generate per invocation of rustc.

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

[^1]: 175dcc7773/compiler/rustc_fs_util/src/lib.rs (L60)
[^2]: 175dcc7773/compiler/rustc_incremental/src/persist/fs.rs (L1-L40)
2025-04-11 13:59:33 +00:00
Mara Bos
5113f5e602 Update rust-analyzer for new proc_macro span api. 2025-04-11 15:30:03 +02:00
Ben Kimock
52b204ef55
Merge pull request #4268 from LorrensP-2158466/update-libffi
Fix Build Fail on MacOs because of libffi-sys
2025-04-11 13:21:02 +00:00
lcnr
420390c848 eagerly initialize definitions in sub-fn 2025-04-11 15:18:30 +02:00
lcnr
5d0048303c NonGenericOpaqueTypeParam::ty to arg 2025-04-11 15:18:30 +02:00
lcnr
83033838a3 remove redundant fields 2025-04-11 15:18:29 +02:00
Mara Bos
3962069982 Replace proc_macro::SourceFile by Span::{file, local_file}. 2025-04-11 15:07:08 +02:00
Petros Angelatos
b9e2ac5c7b sync::mpsc: prevent double free on Drop
This PR is fixing a regression introduced by #121646 that can lead to a
double free when dropping the channel.

The details of the bug can be found in the corresponding crossbeam PR
https://github.com/crossbeam-rs/crossbeam/pull/1187

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2025-04-11 15:33:09 +03:00
Petros Angelatos
9eb6a5446a sync::mpsc: add miri reproducer of double free
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2025-04-11 15:23:12 +03:00
Mara Bos
6788ce76c9 Remove proc_macro::SourceFile::is_real(). 2025-04-11 14:02:06 +02:00
LorrensP-2158466
49cc860182 fix build fail on macos bacause of libffi-sys 2.3.0; This updates libffi to new major version 2025-04-11 13:56:53 +02:00
bors
71b68da1bd Auto merge of #139578 - ferrocene:pa-compiletest-edition, r=jieyouxu
Fix breakage when running compiletest with `--test-args=--edition=2015`

Compiletest has an `--edition` flag to change the default edition tests are run with. Unfortunately no test suite successfully executes when that flag is passed. If the edition is set to something greater than 2015 the breakage is expected, since the test suite currently supports only edition 2015 (Ferrous Systems will open an MCP about fixing that soonish). Surprisingly, the test suite is also broken if `--edition=2015` is passed to compiletest. This PR focuses on fixing the latter.

This PR fixes the two categories of failures happening when `--edition=2015` is passed:

* Some edition-specific tests set their edition through `//@ compile-flags` instead of `//@ edition`. Compiletest doesn't parse the compile flags, so it would see no `//@ edition` and add another `--edition` flag, leading to a rustc error.
* Compiletest would add the edition after `//@ compile-flags`, while some tests depend on flags passed to `//@ compile-flags` being the last flags in the rustc invocation.

Note that for the first category, I opted to manually go and replace all `//@ compile-flags` setting an edition with an explicit `//@ edition`. We could've changed compiletest to instead check whether an edition was set in `//@ compile-flags`, but I thought it was better to enforce a consistent way to set the edition in tests.

I also added the edition to the stamp, so that changing `--edition` results in tests being re-executed.

r? `@jieyouxu`
2025-04-11 10:53:45 +00:00
Bastian Kersting
068a332459 cfi: Remove #[no_sanitize(cfi)] for extern weak functions
Previously (https://github.com/rust-lang/rust/pull/115200,
https://github.com/rust-lang/rust/pull/138002), we
added `#[no_sanitize(cfi)]` to all code paths that call to a weakly
linked function.

In https://github.com/rust-lang/rust/pull/138349 we fixed the root cause
for this issue, which means we can now remove the corresponding
attributes.
2025-04-11 10:15:55 +00:00