about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-03-09metadata: Ignore sysroot when doing the manual native lib search in rustcVadim Petrochenkov-47/+46
2025-03-09Auto merge of #137541 - onur-ozkan:fix-cargo-clippy-bin, r=jieyouxubors-4/+15
add `tool::CargoClippy` and `tool::Cargofmt` binary to target sysroot When running `x build clippy`, we expect `stage1-tool-bin/cargo-clippy` and `stage2/bin/cargo-clippy` to be the same, but they aren't. This happens because `tool::CargoClippy` doesn't place its binary in the `stage2` directory. As a result, `stage1-tool-bin/cargo-clippy` comes from `tool::CargoClippy`, while `stage2/bin/cargo-clippy` comes from `tool::Cargo`. Same applies for `tool::Cargofmt`. This PR fixes the issue by adding `tool::CargoClippy` and ``tool::Cargofmt`` binaries to the expected sysroot and makes sure both directories share the same binary. To test this, run `x build --stage 2 compiler clippy rustfmt`, link the stage2 sysroot with rustup, and then call `cargo +stage2 fmt` and `cargo +stage2 clippy` on any rust project (it wouldn't work without this PR).
2025-03-09Auto merge of #137513 - scottmcm:identity-transmute, r=saethlinbors-0/+32
Don't re-`assume` in `transmute`s that don't change niches I noticed in nightly 2025-02-21 that `transmute` is emitting way more `assume`s than necessary for newtypes. For example, the three transmutes in <https://rust.godbolt.org/z/fW1KaTc4o> emits ```rust define noundef range(i32 1, 0) i32 `@repeatedly_transparent_transmute(i32` noundef range(i32 1, 0) %_1) unnamed_addr { start: %0 = sub i32 %_1, 1 %1 = icmp ule i32 %0, -2 call void `@llvm.assume(i1` %1) %2 = sub i32 %_1, 1 %3 = icmp ule i32 %2, -2 call void `@llvm.assume(i1` %3) %4 = sub i32 %_1, 1 %5 = icmp ule i32 %4, -2 call void `@llvm.assume(i1` %5) %6 = sub i32 %_1, 1 %7 = icmp ule i32 %6, -2 call void `@llvm.assume(i1` %7) %8 = sub i32 %_1, 1 %9 = icmp ule i32 %8, -2 call void `@llvm.assume(i1` %9) %10 = sub i32 %_1, 1 %11 = icmp ule i32 %10, -2 call void `@llvm.assume(i1` %11) ret i32 %_1 } ``` But those are all just newtypes that don't change size or niches, so none of it's needed. After this PR it's down to just ```rust define noundef range(i32 1, 0) i32 `@repeatedly_transparent_transmute(i32` noundef range(i32 1, 0) %_1) unnamed_addr { start: ret i32 %_1 } ``` because none of those `assume`s in the original actually did anything. (Transmuting to something with a difference niche, though, still has the assumes -- the other tests continue to pass checking that.)
2025-03-08Auto merge of #137502 - compiler-errors:global-asm-aint-mir-body, r=oli-obkbors-7/+54
Don't include global asm in `mir_keys`, fix error body synthesis r? oli-obk Fixes #137470 Fixes #137471 Fixes #137472 Fixes #137473 try-job: test-various try-job: x86_64-apple-2
2025-03-08Auto merge of #137500 - scottmcm:trunc-br, r=saethlinbors-8/+118
Use `trunc nuw`+`br` for 0/1 branches even in optimized builds Rather than needing to use `switch` for them to include the `unreachable` arm.
2025-03-08Auto merge of #138224 - onur-ozkan:fix-multiple-candidates, r=jieyouxubors-3/+11
skip `compile::Std` and `compile::Rustc` on `forced_compiler` Fixes https://github.com/rust-lang/rust/issues/138220 Set `download-rustc = true/false` and run `x test tests/ui/meta/no_std-extern-libc.rs --force-rerun` to debug it.
2025-03-08skip `compile::Std` and `compile::Rustc` on `forced_compiler`onur-ozkan-3/+11
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-08Auto merge of #138208 - jhpratt:rollup-hlqyu51, r=jhprattbors-866/+1047
Rollup of 5 pull requests Successful merges: - #136642 (Put the alloc unit tests in a separate alloctests package) - #137528 (Windows: Fix error in `fs::rename` on Windows 1607) - #137685 (self-contained linker: conservatively default to `-znostart-stop-gc` on x64 linux) - #137757 (On long spans, trim the middle of them to make them fit in the terminal width) - #138189 (Mention `env` and `option_env` macros in `std::env::var` docs) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-08Rollup merge of #138189 - GuillaumeGomez:env-var, r=joshtriplettJacob Pratt-0/+3
Mention `env` and `option_env` macros in `std::env::var` docs Fixes https://github.com/rust-lang/rust/issues/138159. Just like there are mentions in `env!` and `option_env!` docs to `std::env::var`, it'd be nice to have a "mention back" as well.
2025-03-08Rollup merge of #137757 - estebank:trim-spans, r=davidtwcoJacob Pratt-139/+379
On long spans, trim the middle of them to make them fit in the terminal width When encountering a single line span that is wider than the terminal, we keep context at the start and end of the span but otherwise remove the code from the middle. This is somewhat independent from whether the left and right margins of the output have been trimmed as well. ``` error[E0308]: mismatched types --> $DIR/long-span.rs:6:15 | LL | ... = [0, 0, 0, 0, ..., 0, 0]; | ^^^^^^^^^^^^^...^^^^^^^ expected `u8`, found `[{integer}; 1681]` ``` Address part of https://github.com/rust-lang/rust/issues/137680 (missing handling of the long suggestion). Fix https://github.com/rust-lang/rust/issues/125581. --- Change the way that underline positions are calculated by delaying using the "visual" column position until the last possible moment, instead using the "file"/byte position in the file, and then calculating visual positioning as late as possible. This should make the underlines more resilient to non-1-width unicode chars. Unfortunately, as part of this change (which fixes some visual bugs) comes with the loss of some eager tab codepoint handling, but the output remains legible despite some minor regression on the "margin trimming" logic. --- `-Zteach` is perma-unstable, barely used, the highlighting logic buggy and the flag being passed around is tech-debt. We should likely remove `-Zteach` in its entirely.
2025-03-08Rollup merge of #137685 - lqd:nostart-stop-gc, r=petrochenkovJacob Pratt-0/+29
self-contained linker: conservatively default to `-znostart-stop-gc` on x64 linux To help stabilization, this PR disables an LLD optimization on x64 linux with respect to `--gc-sections` and encapsulation symbols: it will reduce the number of crates needing to opt-out of lld due to this bfd / lld difference. For example, all the people using [linkme](https://github.com/dtolnay/linkme), which [doesn't work with lld](https://github.com/dtolnay/linkme/issues/63) or on nightly, need to disable lld. More information about all this, and the historical differences, can be found in: - https://maskray.me/blog/2021-01-31-metadata-sections-comdat-and-shf-link-order - https://lld.llvm.org/ELF/start-stop-gc This optimization has [no visible impact](https://github.com/rust-lang/rust/pull/137685#issuecomment-2686116312) on our benchmarks, so we can use it by default and have a safer/more conservative starting point to remove friction during migration. We can them emit an FCW for the cases where lld detects reliance on encapsulation symbols without `-znostart-stop-gc`, and then revert back to lld's default after a while. No one compiling on nightly relies on this difference, obviously, so doing an FCW is not necessary until after lld is used on stable. I've tested that this correctly links on `linkme` examples. I've also quickly tried to crate an rmake test but the setup with encapsulation symbols is annoying to reproduce: a few link section/name attributes is not enough, we also need to collect symbols between the encapsulation symbols, without referencing them in code, for `-znostart-stop-gc` to only impact this... It should of course be doable though, maybe ````@Kobzol```` will look into it if they have time. r? ````@petrochenkov````
2025-03-08Rollup merge of #137528 - ChrisDenton:rename-win, r=joboetJacob Pratt-124/+57
Windows: Fix error in `fs::rename` on Windows 1607 Fixes #137499 There's a bug in our Windows implementation of `fs::rename` that only manifests on a specific version of Windows. Both newer and older versions of Windows work. I took the safest route to fixing this by using the old `MoveFileExW` function to implement this and only falling back to the new behaviour if that fails. This is similar to what is done in `unlink` (just above this function). try-job: dist-x86_64-mingw try-job: dist-x86_64-msvc
2025-03-08Rollup merge of #136642 - bjorn3:separate_alloctest_crate, r=cuviperJacob Pratt-603/+579
Put the alloc unit tests in a separate alloctests package Same rationale as https://github.com/rust-lang/rust/pull/135937. This PR has some extra complexity though as a decent amount of tests are testing internal implementation details rather than the public api. As such I opted to include the modules containing the types under test using `#[path]` into the alloctests package. This means that those modules still need `#[cfg(test)]`, but the rest of liballoc no longer need it.
2025-03-08Auto merge of #138205 - onur-ozkan:fix-build-cycle, r=jieyouxubors-17/+21
handle precompiled compiler more properly Fixes the build cycle problem reported on [#t-infra/bootstrap > Cycle on &#96;aarch64-apple&#96;](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Cycle.20on.20.60aarch64-apple.60/with/504231609).
2025-03-08update doc-comment for `forced_compiler`onur-ozkan-2/+2
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-08handle precompiled compiler more properlyonur-ozkan-15/+19
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-03-08Auto merge of #138202 - jhpratt:rollup-kqrl5xn, r=jhprattbors-99/+644
Rollup of 12 pull requests Successful merges: - #137337 (Add verbatim linker to AIXLinker) - #137363 (compiler: factor Windows x86-32 ABI impl into its own file) - #137537 (Prevent `rmake.rs` from using unstable features, and fix 3 run-make tests that currently do) - #137606 (add a "future" edition) - #137957 (Remove i586-pc-windows-msvc) - #138000 (atomic: clarify that failing conditional RMW operations are not 'writes') - #138013 (Add post-merge analysis CI workflow) - #138033 (rustdoc: Add attribute-related tests for rustdoc JSON.) - #138137 (setTargetTriple now accepts Triple rather than string) - #138173 (Delay bug for negative auto trait rather than ICEing) - #138184 (Allow anyone to relabel `CI-spurious-*`) - #138187 (remove clones) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-07Rollup merge of #138187 - matthiaskrgr:rmclone, r=cjgillotJacob Pratt-19/+10
remove clones
2025-03-07Rollup merge of #138184 - thaliaarchi:unauthenticated-ci-spurious, ↵Jacob Pratt-0/+1
r=compiler-errors Allow anyone to relabel `CI-spurious-*` As suggested by `@Noratrieb` in reference to me attempting to set this label in https://github.com/rust-lang/rust/pull/136780#issuecomment-2707364425, allow unauthenticated users to relabel `CI-spurious-*`.
2025-03-07Rollup merge of #138173 - compiler-errors:incoherent-negative-impl, r=oli-obkJacob Pratt-1/+34
Delay bug for negative auto trait rather than ICEing Fixes #138149 r? oli-obk
2025-03-07Rollup merge of #138137 - ZequanWu:fix-triple, r=cuviperJacob Pratt-2/+6
setTargetTriple now accepts Triple rather than string https://github.com/llvm/llvm-project/pull/129868 updated `setTargetTriple`
2025-03-07Rollup merge of #138033 - obi1kenobi:pg/json-attrs-tests, r=aDotInTheVoidJacob Pratt-0/+58
rustdoc: Add attribute-related tests for rustdoc JSON. Add rustdoc JSON tests covering the use of the following attributes: - `#[non_exhaustive]` applied to enums, variants, and structs - `#[must_use]`, both with and without a message - `#[no_mangle]`, in both edition 2021 and 2024 (`#[unsafe(no_mangle)]`) flavors - `#[export_name]`, also in both edition 2021 and 2024 flavors Related to #137645; this is a subset of the attributes that `cargo-semver-checks` relies on and tests in its own test suite or in the test suites of its components such as `trustfall-rustdoc-adapter`. Helps with #81359 r? `@aDotInTheVoid`
2025-03-07Rollup merge of #138013 - Kobzol:ci-post-merge-analysis, r=marcoieniJacob Pratt-10/+319
Add post-merge analysis CI workflow This PR adds a post-merge analysis workflow, which was discussed [here](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Reporting.20test.20suite.20statistics.20after.20merge). The workflow currently analyzes test suite results from bootstrap metrics. It downloads metrics for all known jobs in the parent and current (HEAD) commit, compares them and prints a truncated diff. It then posts this diff to the merged PR as a comment. Later I also want to add other statistics to the analysis, e.g. changes in CI/bootstrap step durations. It can be tested locally e.g. using this: ``` cargo run --release --manifest-path src/ci/citool/Cargo.toml post-merge-report 3cb02729ab3c6583a3b1d1845c5e22b674f04b8d fd17deacce374a4185c882795be162e17b557050 ``` This uses a slightly older commit as a parent, to have more results in the diff (normally the diff won't be so large). CC `@jieyouxu` r? `@marcoieni`
2025-03-07Rollup merge of #138000 - RalfJung:atomic-rmw, r=AmanieuJacob Pratt-2/+3
atomic: clarify that failing conditional RMW operations are not 'writes' Fixes https://github.com/rust-lang/rust/issues/136669 r? ``@Amanieu`` Cc ``@rust-lang/opsem`` ``@chorman0773`` ``@gnzlbg`` ``@briansmith``
2025-03-07Rollup merge of #137957 - Noratrieb:no, r=wesleywiserJacob Pratt-22/+11
Remove i586-pc-windows-msvc See [MCP 840](https://github.com/rust-lang/compiler-team/issues/840). I left a specialized error message that should help users that hit this in the wild (for example, because they use it in their CI). ``` error: Error loading target specification: the `i586-pc-windows-msvc` target has been removed. Use the `i686-pc-windows-msvc` target instead. Windows 10 (the minimum required OS version) requires a CPU baseline of at least i686 so you can safely switch. Run `rustc --print target-list` for a list of built-in targets ``` ``@workingjubilee`` ``@calebzulawski`` fyi portable-simd uses this target in CI, if you wanna remove it already before this happens
2025-03-07Rollup merge of #137606 - davidtwco:next-edition, r=traviscross,ehussJacob Pratt-2/+67
add a "future" edition This idea has been discussed previously [on Zulip](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Continuous.20edition-like.20changes.3F/near/432559262) (though what I've implemented isn't exactly the "next"/"future" editions proposed in that message, just the "future" edition). I've found myself prototyping changes that involve edition migrations and wanting to target an upcoming edition for those migrations, but none exists. This should be permanently unstable and not removed.
2025-03-07Rollup merge of #137537 - jieyouxu:daily-rmake, r=KobzolJacob Pratt-15/+43
Prevent `rmake.rs` from using unstable features, and fix 3 run-make tests that currently do Addresses (mostly) #137532. Follow-up to #137373. ### Summary - Fix 3 run-make tests that currently use unstable features: 1. `tests/run-make/issue-107495-archive-permissions/rmake.rs` uses `#![feature(rustc_private)]` for `libc` on `unix`, but `run_make_support` already exports `libc`, so just use that. 2. `tests/run-make/cross-lang-lto/rmake.rs` uses `#![feature(path_file_prefix)]` for convenience, replaced with similar filename prefix logic. 3. `tests/run-make/broken-pipe-no-ice/rmake.rs` uses `#![feature(anonymous_pipe)]` for anonymous pipes. This is more complicated[^race-condition], and I decided to temporarily introduce a dependency on [`os_pipe`] before std's `anonymous_pipe` library feature is stabilized[^pipe-stab]. I left a FIXME tracked by #137532 to make the switch once `anonymous_pipe` stabilizes and reaches beta. - Use `RUSTC_BOOTSTRAP=-1` when building `rmake.rs` to have the stage 0 rustc reject any unstable features used in `rmake.rs`. - The requirement that `rmake.rs` may not use any unstable features is now documented in rustc-dev-guide. - This PR does not impose `RUSTC_BOOTSTRAP=-1` when building `run-make-support`, but I suppose we could. r? `@Kobzol` try-job: x86_64-msvc-1 try-job: x86_64-mingw-1 [`os_pipe`]: https://github.com/oconnor663/os_pipe.rs [^race-condition]: We can't just try to spawn `rustc` and immediate close the stderr handle because of race condition, as there's no guarantee `rustc` will not try to print to stderr before the handle gets closed. [^pipe-stab]: In-progress stabilization PR over at https://github.com/rust-lang/rust/pull/135822.
2025-03-07Rollup merge of #137363 - workingjubilee:untangle-x86-abi-impl, r=jieyouxuJacob Pratt-23/+89
compiler: factor Windows x86-32 ABI impl into its own file While it shares more than zero code with the SysV x86-32 ABI impl, there is no particular reason to organize wildly different ABIs using if-else in the same function.
2025-03-07Rollup merge of #137337 - dalvescb:master, r=petrochenkovJacob Pratt-3/+3
Add verbatim linker to AIXLinker This adds support for the "verbatim" native link modifier on AIX, will successfully pass the `native-link-modifier-verbatim-linker test case`
2025-03-07Mention `env` and `option_env` macros in `std::env::var` docsGuillaume Gomez-0/+3
2025-03-07remove clonesMatthias Krüger-19/+10
2025-03-07Auto merge of #138177 - matthiaskrgr:rollup-y0ikkzz, r=matthiaskrgrbors-572/+2022
Rollup of 6 pull requests Successful merges: - #134797 (Ergonomic ref counting) - #137549 (Clean up various LLVM FFI things in codegen_llvm) - #137977 (Reduce `kw::Empty` usage, part 1) - #138042 (Suggest struct or union to add generic that impls trait) - #138141 (tests: fix some typos in comment) - #138150 (Streamline HIR intravisit `visit_id` calls for items) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-07Allow anyone to relabel CI-spurious-*Thalia Archibald-0/+1
2025-03-07Add commentsbjorn3-0/+9
2025-03-07Fully test the alloc crate through alloctestsbjorn3-311/+232
For the tests that make use of internal implementation details, we include the module to test using #[path] in alloctests now.
2025-03-07Move last remaining Rc test to alloctestsbjorn3-18/+18
2025-03-07Move most Rc tests to alloctestsbjorn3-650/+648
2025-03-07Move all alloc integration tests to a new alloctests cratebjorn3-25/+73
2025-03-07Rollup merge of #138150 - nnethercote:streamline-intravisit-visit_id, r=oli-obkMatthias Krüger-35/+13
Streamline HIR intravisit `visit_id` calls for items A small clean up.
2025-03-07Rollup merge of #138141 - tcpdumppy:master, r=compiler-errorsMatthias Krüger-6/+6
tests: fix some typos in comment fix some typos in comment
2025-03-07Rollup merge of #138042 - xizheyin:issue-135759, r=nnethercoteMatthias Krüger-2/+142
Suggest struct or union to add generic that impls trait Fixes #135759 cc ```@tdittr```
2025-03-07Rollup merge of #137977 - nnethercote:less-kw-Empty-1, r=spastorinoMatthias Krüger-83/+125
Reduce `kw::Empty` usage, part 1 This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way. r? ```@spastorino```
2025-03-07Rollup merge of #137549 - oli-obk:llvm-ffi, r=davidtwcoMatthias Krüger-367/+335
Clean up various LLVM FFI things in codegen_llvm cc ```@ZuseZ4``` I touched some autodiff parts The major change of this PR is [bfd88ce](https://github.com/rust-lang/rust/pull/137549/commits/bfd88cead0dd79717f123ad7e9a26ecad88653cb) which makes `CodegenCx` generic just like `GenericBuilder` The other commits mostly took advantage of the new feature of making extern functions safe, but also just used some wrappers that were already there and shrunk unsafe blocks. best reviewed commit-by-commit
2025-03-07Rollup merge of #134797 - spastorino:ergonomic-ref-counting-1, r=nikomatsakisMatthias Krüger-79/+1401
Ergonomic ref counting This is an experimental first version of ergonomic ref counting. This first version implements most of the RFC but doesn't implement any of the optimizations. This was left for following iterations. RFC: https://github.com/rust-lang/rfcs/pull/3680 Tracking issue: https://github.com/rust-lang/rust/issues/132290 Project goal: https://github.com/rust-lang/rust-project-goals/issues/107 r? ```@nikomatsakis```
2025-03-07fix rebaseEsteban Küber-4/+4
2025-03-07Make trimming logic work on more than one span at a timeEsteban Küber-29/+80
2025-03-07Fix multiline span start special caseEsteban Küber-227/+211
2025-03-07Fix rustdoc testEsteban Küber-2/+5
2025-03-07Refactor `emitter` to better account for unicode chars when trimmingEsteban Küber-329/+462
Change the way that underline positions are calculated by delaying using the "visual" column position until the last possible moment, instead using the "file"/byte position in the file, and then calculating visual positioning as late as possible. This should make the underlines more resilient to non-1-width unicode chars. Unfortunately, as part of this change (which fixes some visual bugs) comes with the loss of some eager tab codepoint handling, but the output remains legible despite some minor regression on the "margin trimming" logic.
2025-03-07On long spans, trim the middle of them to make them fit in the terminal widthEsteban Küber-4/+86
When encountering a single line span that is wider than the terminal, we keep context at the start and end of the span but otherwise remove the code from the middle. This is somewhat independent from whether the left and right margins of the output have been trimmed as well. ``` error[E0308]: mismatched types --> $DIR/long-span.rs:6:15 | LL | ... = [0, 0, 0, 0, ..., 0, 0]; | ^^^^^^^^^^^^^...^^^^^^^ expected `u8`, found `[{integer}; 1681]` ``` Address part of #137680 (missing handling of the long suggestion). Fix #125581.