303456 Commits

Author SHA1 Message Date
Jakub Beránek
6893e691ea
Add a post-dist test for compiling a basic program with Cranelift 2025-08-10 20:46:30 +02:00
Jakub Beránek
01652d37ae
Extract Cranelift component 2025-08-10 20:46:04 +02:00
Jakub Beránek
cef5ebc5ff
Ship the correct Cranelift backend in its dist step 2025-08-10 20:46:04 +02:00
bors
29737cb44b Auto merge of #144544 - JonathanBrouwer:illformed-in-deps, r=traviscross
Start reporting future breakage for `ILL_FORMED_ATTRIBUTE_INPUT` in dependencies

This has been a warn lint since early 2019 and a deny-by-default lint since late 2019.
We're currently transitioning some of the cases where this lint is being produced to a hard error (https://github.com/rust-lang/rust/pull/143607 https://github.com/rust-lang/rust/pull/143808 and more)
So let's report this lint in all dependencies for the remaining attributes

r? `@traviscross`
`@rustbot` labels +I-lang-nominated +T-lang -T-compiler
cc `@jdonszelmann`

(Separate question: Why does the "Future incompatibility report" only trigger if `report_in_deps` is true, even if the future incompatibility happens in the same crate, is this correct?)

This also needs a crater run, but I don't have permissions to trigger this
2025-08-10 17:44:40 +00:00
Oneirical
aa543963c6 Rehome tests/ui/issues/ tests [4/?] 2025-08-10 11:54:15 -04:00
Eval EXEC
20a134f5f0 rustdoc: Use discrs Display impl to render the value with the correct signedness 2025-08-10 23:33:23 +08:00
Eval EXEC
de13718c66 test: Add rustdoc test for enum negative overflow 2025-08-10 23:02:53 +08:00
Jakub Beránek
8b4d9411ba
Explicitly pass path to built stdlib JSON docs and use the correct compiler for it 2025-08-10 16:35:56 +02:00
bors
18eeac04fc Auto merge of #145210 - Zalathar:rollup-dm4reb2, r=Zalathar
Rollup of 17 pull requests

Successful merges:

 - rust-lang/rust#141624 (unstable-book: Add stubs for environment variables; document some of the important ones)
 - rust-lang/rust#143093 (Simplify polonius location-sensitive analysis)
 - rust-lang/rust#144402 (Stabilize loongarch32 inline asm)
 - rust-lang/rust#144403 (`tests/ui/issues/`: The Issues Strike Back [4/N])
 - rust-lang/rust#144739 (Use new public libtest `ERROR_EXIT_CODE` constant in rustdoc)
 - rust-lang/rust#145089 (Improve error output when a command fails in bootstrap)
 - rust-lang/rust#145112 ([win][arm64ec] Partial fix for raw-dylib-link-ordinal on Arm64EC)
 - rust-lang/rust#145129 ([win][arm64ec] Add `/machine:arm64ec` when linking LLVM as Arm64EC)
 - rust-lang/rust#145130 (improve "Documentation problem" issue template.)
 - rust-lang/rust#145135 (Stabilize `duration_constructors_lite` feature)
 - rust-lang/rust#145145 (some `derive_more` refactors)
 - rust-lang/rust#145147 (rename `TraitRef::from_method` to `from_assoc`)
 - rust-lang/rust#145156 (Override custom Cargo `build-dir` in bootstrap)
 - rust-lang/rust#145160 (Change days-threshold to 28 in [behind-upstream])
 - rust-lang/rust#145162 (`{BTree,Hash}Map`: add "`Entry` API" section heading)
 - rust-lang/rust#145187 (Fix an unstable feature comment that wasn't a doc comment)
 - rust-lang/rust#145191 (`suggest_borrow_generic_arg`: use the correct generic args)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-10 14:17:41 +00:00
Pierre Tardy
bc14ad38a3 strip prefix of temporary file names when it exceeds filesystem name length limit
When doing lto, rustc generates filenames that are concatenating many information.

In the case of this testcase, it is concatenating crate name and rust file name, plus some hash, and the extension.
In some other cases it will concatenate even more information reducing the maximum effective crate name to about 110 chars on linux filesystems where
filename max length is 255

This commit is ensuring that the temporary file names are limited in size, while still reasonabily ensuring the unicity (with hashing of the stripped part)
2025-08-10 15:50:40 +02:00
Lee ByeongJun
ba350ff911 fix: re-enable self-assignment 2025-08-10 22:50:14 +09:00
Stuart Cook
934cb10f1b
Rollup merge of #145191 - dianne:fix-borrow-suggestion-args, r=compiler-errors
`suggest_borrow_generic_arg`: use the correct generic args

The suggestion now gets calls' generic arguments from the callee's type to handle cases where the callee isn't an identifier expression. Fixes rust-lang/rust#145164.
2025-08-10 19:45:56 +10:00
Stuart Cook
94b344d1af
Rollup merge of #145187 - joshtriplett:fix-unstable-feature-comment, r=lqd
Fix an unstable feature comment that wasn't a doc comment

Every other feature in the list uses a doc comment; fix one that used a regular comment to use a doc comment.
2025-08-10 19:45:55 +10:00
Stuart Cook
461009dc93
Rollup merge of #145162 - ada4a:hash_and_btree_map-add-entry-section, r=joshtriplett
`{BTree,Hash}Map`: add "`Entry` API" section heading

I wanted to link to an introduction of the `Entry` API to the help message of `clippy::map_entry` (see https://github.com/rust-lang/rust-clippy/issues/11598 for motivation), but I found the documentation on the `Entry` enum itself a bit short. On the other hand, `{BTree,Hash}Map` both have sections in their docs introducing the whole API and giving usage examples, and so I would like to link to that instead. For that, I introduce the "`Entry` API" section heading to both of them.

Do let me know whether you think this is the right approach.
2025-08-10 19:45:54 +10:00
Stuart Cook
a4acb8aafa
Rollup merge of #145160 - xizheyin:behind-upstream, r=Urgau
Change days-threshold to 28 in [behind-upstream]

Make the days-threshold to 28 to reduce false positives.

[#triagebot > Outdated commit message](https://rust-lang.zulipchat.com/#narrow/channel/224082-triagebot/topic/Outdated.20commit.20message)

r? ``````@Urgau``````

cc ``````@jieyouxu``````
2025-08-10 19:45:54 +10:00
Stuart Cook
53eab6bc75
Rollup merge of #145156 - Kobzol:cargo-build-dir, r=lqd,jieyouxu
Override custom Cargo `build-dir` in bootstrap

The context for this issue is in https://github.com/rust-lang/rust/issues/145107. The issue is that if people configure `build-dir`, it would break bootstrap. For now, we just hard-code it to our self-contained target directories inside the build directory.

Tested by putting the following:
```toml
[build]
build-dir = "/tmp/foo"

[unstable]
build-dir = true
```

into `<rustc-checkout>/.cargo/config.toml`. `x build` works with this PR, doesn't work without this PR.

Fixes: https://github.com/rust-lang/rust/issues/145107
2025-08-10 19:45:53 +10:00
Stuart Cook
b30fe4bb8b
Rollup merge of #145147 - fee1-dead-contrib:push-mxxpmlpmzmsz, r=compiler-errors
rename `TraitRef::from_method` to `from_assoc`

also add a note to `GenericArgs::truncate_to`
2025-08-10 19:45:53 +10:00
Stuart Cook
b81be36719
Rollup merge of #145145 - fee1-dead-contrib:push-qnmpmtmtpkkr, r=jieyouxu
some `derive_more` refactors

some clauses can be merged together without requiring an attribute for each trait derived.

also manually impl `Eq` because the `derive_where` generated code is too much for my comfort (cc https://github.com/ModProg/derive-where/pull/128)
2025-08-10 19:45:52 +10:00
Stuart Cook
c15c2f0a42
Rollup merge of #145135 - Kivooeo:stabilize-duration_constructors_lite, r=ChrisDenton
Stabilize `duration_constructors_lite` feature

This closes [tracking issue](https://github.com/rust-lang/rust/issues/140881) and stabilises `Duration::from_hours` and `Duration::from_mins` while not touching a `duration_constructors` feature from the related [tracking issue (2)](https://github.com/rust-lang/rust/issues/120301)
2025-08-10 19:45:51 +10:00
Stuart Cook
7b3afa6554
Rollup merge of #145130 - lolbinarycat:issue-template-docs-update, r=Noratrieb
improve "Documentation problem" issue template.

rustdoc has its own issue template now, mention that.

swap the order of the last two sentances so it reads more like a typical if/else chain (base case listed last).
2025-08-10 19:45:51 +10:00
Stuart Cook
2e0829173b
Rollup merge of #145129 - dpaoliello:arm64eclink, r=wesleywiser
[win][arm64ec] Add `/machine:arm64ec` when linking LLVM as Arm64EC

When the MSVC linker sees an Arm64EC object file, it needs to know if it's linking the final executable as Arm64EC or Arm64X.

This change adds the `/machine:arm64ec` flag to the linker when building LLVM as Arm64EC to avoid that ambiguity (and resulting linker error).
2025-08-10 19:45:50 +10:00
Stuart Cook
baa35853a9
Rollup merge of #145112 - dpaoliello:raw-dylib-link-ordinal, r=jieyouxu
[win][arm64ec] Partial fix for raw-dylib-link-ordinal on Arm64EC

These are the test fixes required to get `raw-dylib-link-ordinal` working on Arm64EC.

For the test to completely pass, we also need an updated `ar_archive_writer` with <https://github.com/rust-lang/ar_archive_writer/pull/24> merged in.
2025-08-10 19:45:50 +10:00
Stuart Cook
4e9bf08937
Rollup merge of #145089 - Kobzol:bootstrap-cmd-error, r=jieyouxu
Improve error output when a command fails in bootstrap

I fixed this because it was being an issue for debugging CI failures.

We try to print as much information as possible, just with a slightly less verbose command description in non-verbose mode. The code is now more unified and hopefully simpler to understand.

I also fixed the `format_short_cmd` logic, it was a bit weird after some recent refactors.

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

r? `````````@jieyouxu`````````

CC `````````@Shourya742`````````
2025-08-10 19:45:49 +10:00
Stuart Cook
3d6976cba8
Rollup merge of #144739 - GuillaumeGomez:rustdoc-test-cleanup, r=fmease
Use new public libtest `ERROR_EXIT_CODE` constant in rustdoc

Followup of rust-lang/rust#144297.
2025-08-10 19:45:48 +10:00
Stuart Cook
62b406d4b1
Rollup merge of #144403 - Kivooeo:issue4, r=jieyouxu
`tests/ui/issues/`: The Issues Strike Back [4/N]

Some `tests/ui/issues/` housekeeping, to trim down number of tests directly under `tests/ui/issues/`. Part of https://github.com/rust-lang/rust/issues/133895.

r? ````````@jieyouxu````````
2025-08-10 19:45:48 +10:00
Stuart Cook
5955f005e5
Rollup merge of #144402 - heiher:stabilize-loong32-asm, r=Amanieu
Stabilize loongarch32 inline asm

r? ````````@Amanieu````````
2025-08-10 19:45:47 +10:00
Stuart Cook
e5b98a9c21
Rollup merge of #143093 - lqd:polonius-pre-alpha, r=jackh726
Simplify polonius location-sensitive analysis

This PR reworks the location-sensitive analysis into what we think is a worthwhile subset of the datalog analysis. A sort of polonius alpha analysis that handles NLL problem case 3 and more, but is still using the faster "reachability as an approximation of liveness", as well as the same loans-in-scope computation as NLLs -- and thus doesn't handle full flow-sensitivity like the datalog implementation.

In the last few months, we've identified this subset as being actionable:
- we believe we can make a stabilizable version of this analysis
- it is an improvement over the status quo
- it can also be modeled in a-mir-formality, or some other formalism, for assurances about soundness, and I believe ````````@nikomatsakis```````` is interested in looking into this during H2.
- and we've identified the areas of work we wish to explore later to gradually expand the supported cases: the differences between reachability and liveness, support of kills, and considerations of time-traveling, for example.

The approach in this PR is to try less to have the graph only represent live paths, by checking whether we reach a live region during traversal and recording the loan as live there, instead of equating traversal with liveness like today because it has subtleties with the typeck edges in statements (that could forward loans to the successor point without ensuring their liveness). We can then also simplify these typeck stmt edges. And we also can simplify traversal by removing looking at kills, because that's enough to handle a bunch of NLL problem 3 cases -- and we can gradually support them more and more in traversal in the future, to reduce the approximation of liveness.

There's still some in-progress pieces of work w/r/t opaque types that I'm expecting [lcnr's opaque types rework](https://github.com/rust-lang/rust/pull/139587), and [amanda's SCCs rework](https://github.com/rust-lang/rust/pull/130227) to handle. That didn't seem to show up in tests until I rebased today (and shows lack of test coverage once again) when https://github.com/rust-lang/rust/pull/142255 introduced a couple of test failures with the new captures rules from edition 2024. It's not unexpected since we know more work is needed with member constraints (and we're not even using SCCs in this prototype yet)

I'll look into these anyways, both for future work, and checking how these other 2 PRs would change things.

---

I'm not sure the following means a lot until we have some formalism in-place, but:
- I've changed the polonius compare-mode to use this analysis: the tests pass with it, except 2 cases with minor diagnostics differences, and the 2 edition 2024 opaque types one I mentioned above and need to investigate
- things that are expected to work still do work: it bootstraps, can run our rustc-perf benchmarks (and the results are not even that bad), and a crater run didn't find any regressions (forgetting that crater currently fails to test around a quarter of all crates 👼)
- I've added tests with improvements, like the NLL problem case 3 and others, as well as some that behave the same as NLLs today and are thus worse than the datalog implementation

r? ````````@jackh726````````

(no rush I know you're deep in phd work and "implmentating" the new trait solver for r-a :p <3)

This also fixes rust-lang/rust#135646, a diagnostics ICE from the previous implementation.
2025-08-10 19:45:46 +10:00
Stuart Cook
652429a6c8
Rollup merge of #141624 - jyn514:env-var-stubs, r=BoxyUwU
unstable-book: Add stubs for environment variables; document some of the important ones

This uses a very hacky regex that will probably miss some variables. But having some docs seems better than none at all.

In particular, this documents the following env vars explicitly (cc ````````@madsmtm```````` ````````@flba-eb```````` - do the docs for SDKROOT and QNX_TARGET look right?):

- COLORTERM
- QNX_TARGET
- SDKROOT
- TERM

and generates stubs for the following env vars:

- RUST_BACKTRACE
- RUSTC_BLESS
- RUSTC_BREAK_ON_ICE
- RUSTC_CTFE_BACKTRACE
- RUSTC_FORCE_RUSTC_VERSION
- RUSTC_GRAPHVIZ_FONT
- RUSTC_ICE
- RUSTC_LOG
- RUSTC_RETRY_LINKER_ON_SEGFAULT
- RUSTC_TRANSLATION_NO_DEBUG_ASSERT
- RUST_DEP_GRAPH_FILTER
- RUST_DEP_GRAPH
- RUST_FORBID_DEP_GRAPH_EDGE
- RUST_MIN_STACK
- RUST_TARGET_PATH
- UNSTABLE_RUSTDOC_TEST_LINE
- UNSTABLE_RUSTDOC_TEST_PATH

rendered: ![screenshot of unstable-book running locally, with 14 environment variables shown in the sidebar](https://github.com/user-attachments/assets/8238d094-fb7a-456f-ad43-7c07aa2c44dd)
2025-08-10 19:45:45 +10:00
Jakub Beránek
8d53418bd4
Bless tests 2025-08-10 11:40:43 +02:00
Jakub Beránek
89a27d26dc
Review remarks 2025-08-10 11:39:07 +02:00
Jakub Beránek
c843e1d28f
Add change tracker entry 2025-08-10 11:39:07 +02:00
Jakub Beránek
6443dc0964
Update tests 2025-08-10 11:39:07 +02:00
Jakub Beránek
fe01f580e2
Update doc CI steps stage 2
As they were previously.
2025-08-10 11:39:07 +02:00
Jakub Beránek
8f3f060c02
Update Std doc step 2025-08-10 11:39:07 +02:00
Jakub Beránek
bec8e1dc38
Fix documentation of tools 2025-08-10 11:39:07 +02:00
Jakub Beránek
c35e847a40
Update Standalone and Releases doc steps 2025-08-10 11:39:06 +02:00
Jakub Beránek
5217eddf04
Update RustcBook doc step 2025-08-10 11:39:06 +02:00
Jakub Beránek
02fc091c9d
Update Reference doc step 2025-08-10 11:39:06 +02:00
Jakub Beránek
980fe06c62
Fix staging for doc compiler 2025-08-10 11:39:06 +02:00
Jakub Beránek
b3d90afb56
Forbid documenting anything on stage 0 2025-08-10 11:39:06 +02:00
bors
7f7b8ef27d Auto merge of #145144 - scottmcm:unsigned_overflow_intr, r=nikic
Stop using uadd.with.overflow

As discussed in [#t-compiler/llvm > &#96;uadd.with.overflow&#96; (again) @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/187780-t-compiler.2Fllvm/topic/.60uadd.2Ewith.2Eoverflow.60.20.28again.29/near/533041085), stop emitting `uadd.with.overflow` in favour of `add`+`icmp` instead.

r? nikic
2025-08-10 09:24:56 +00:00
Jonathan Brouwer
b2b4bd41fa
Start reporting future breakage for ILL_FORMED_ATTRIBUTE_INPUT in dependencies
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-10 10:48:08 +02:00
Josh Triplett
caa6d3615b mbe: Fix typo in attribute tracing 2025-08-09 23:01:08 -07:00
bors
8712e45675 Auto merge of #144873 - cjgillot:implications, r=lqd
Implement `stability_implications` without a visitor.

Since https://github.com/rust-lang/rust/pull/143845, the `Annotator` visitor was a no-op when the crate is not staged_api. This PR avoids using a visitor altogether, making `stability_implications` truly a no-op in most cases.
2025-08-10 05:44:53 +00:00
ltdk
bb32e31e65 Constify remaining operators 2025-08-10 01:11:45 -04:00
ltdk
f604dd117d Let forward_ref_* macros accept multiple attributes, and require attributes explicitly 2025-08-10 01:09:56 -04:00
xizheyin
cf1a1b7b76
Use eq_ignore_ascii_case to avoid heap alloc in detect_confuse_type
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-08-10 12:35:12 +08:00
bors
915a766b2f Auto merge of #144787 - Kobzol:codegen-backend-restructure, r=jieyouxu
Refactor codegen backends in bootstrap

This PR refactors the codegen backend steps, in preparation to make more progress on the integration of the GCC codegen backend in bootstrap. It does several things:

1) Splits the `CodegenBackend` step into two, one for clif and another one for gcc. Even though their code is mostly similar, that's IMO mostly fake similarity, and they do (or will) ultimately require different handling. This was already visible in the requirement of building GCC for cg_gcc, of course.
2) It is now possible to build both backends (and dist cranelift) even if they are not specified in `rust.codegen-backends`. It was quite weird that it wasn't possible to even invoke the corresponding codegen backend if the backend wasn't specified in that array, as that array should ideally only change defaults (see later below).
3) Changes the path specification of these steps to an alias. In other words, instead of `compiler/rustc_codegen_cranelift`, the step is now built only using `rustc_codegen_cranelift` or `cg_clif`. This is done to avoid an annoying clash with `x build compiler`, which would otherwise build both codegen backends after the 2) change.
4) Made the copying of codegen backend artifacts more explicit, in particular in the `Assemble` step.
5) Codifies the semantics of `rust.codegen-backends`, which now only affects the defaults of whether a codegen backend will be included in rustc's sysroot and whether it will be disted in `x dist` by default. We can change the behavior later, e.g. to dist cranelift by default in `x dist` once it becomes stabilized. Currently I left the existing behavior that we use on CI, I just tried to document it better.

I don't think that this requires a change tracker entry, because the defaults should work the same as before. It is just now possible to do `x build/dist rustc_codegen_cranelift` even if CLIF is not in the `codegen-backends` array. It is no longer possible to do `./x build compiler/rustc_codegen_cranelift` though, not sure if that requires a change tracker entry.

There is one thing that I didn't touch yet, and that is the fact that `rust.codegen-backends` not only affects the default behavior of `x dist` w.r.t. Cranelift, but also of `x test`. In other words, `x test rustc_codegen_cranelift` still does not hing if cranelift isn't in `rust.codegen-backends`. I plan to take a look at this once I get to refactoring the test steps.

r? `@jieyouxu`
2025-08-10 02:32:41 +00:00
Michael Goulet
b4aa629186 Ignore coroutine witness type region args in auto trait confirmation 2025-08-10 02:21:48 +00:00
dianne
a70a312f17 suggest_borrow_generic_arg: use the correct generic args 2025-08-09 18:31:35 -07:00