about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-06-22Rollup merge of #142600 - GrigorenkoPV:attributes/rustc_pub_transparent, ↵Jacob Pratt-4/+29
r=jdonszelmann Port `#[rustc_pub_transparent]` to the new attribute system Very similar to rust-lang/rust#142498. This is a part of rust-lang/rust#131229, so r? ````@jdonszelmann```` --- For reference, the `#[rustc_pub_transparent]` attribute was created by me back in rust-lang/rust#129487. As mentioned back in https://github.com/rust-lang/rust/pull/129487#discussion_r1730120385, this attribute does not check that it is applied to an ADT, because it checks that `#[repr(transparent)]` is also applied to the same item, which, in turn, should check for ADT.
2025-06-22Rollup merge of #140254 - bjorn3:rustc_panic_abort_abort, r=petrochenkovJacob Pratt-12/+10
Pass -Cpanic=abort for the panic_abort crate The panic_abort crate must be compiled with panic=abort, but cargo doesn't allow setting the panic strategy for a single crate the usual way using `panic="abort"`, but luckily per-package rustflags do allow this. Bootstrap previously handled this in its rustc wrapper, but for example the build systems of cg_clif and cg_gcc don't use the rustc wrapper, so they would either need to add one, patch the standard library or be unable to build a sysroot suitable for both panic=abort and panic=unwind (as is currently the case). Required for https://github.com/rust-lang/rustc_codegen_cranelift/issues/1567
2025-06-22Auto merge of #141856 - folkertdev:run-make-forward-compiletest-runner, ↵bors-2/+30
r=jieyouxu forward the bootstrap `runner` to `run-make` The runner was already forwarded to `compiletest`, this just passes it on to `run-make` and uses it in the `run` functions. The configuration can look like this ```toml # in bootstrap.toml [target.s390x-unknown-linux-gnu] runner = "qemu-s390x -L /usr/s390x-linux-gnu" ``` Any C compilation automatically sets the correct target. Calls to rustc must use `.target(target())`. Then, a command like below will work by cross-compiling to the given target, and using the given runner for that target to execute the binary: ``` ./x test tests/run-make/c-link-to-rust-va-list-fn --target s390x-unknown-linux-gnu ``` The runner can also be used for e.g. running with `valgrind`. This PR also enables its use in the test case that I care about, hopefully that actually does work on the platforms that CI uses. We should probably run some try jobs to be sure? r? `@jieyouxu` try-job: test-various try-job: armhf-gnu
2025-06-22forward the bootstrap `runner` to `run-make`Folkert de Vries-2/+30
The runner was already forwarded to `compiletest`, this just passes it on to `run-make` and uses it in the `run` functions.
2025-06-21Auto merge of #142667 - yotamofek:pr/rustdoc/more-write-shared-perf, ↵bors-27/+12
r=nnethercote Avoid a few more allocations in `write_shared.rs` Inspired by rust-lang/rust#141421 , avoids a few `Vec`, `PathBuf` and `String` allocations in `write_shared.rs`. I don't think these will show up on benchmarks, but are still worthwhile IMHO. Also includes a few small cleanups. r? nnethercote - if you'd like :)
2025-06-21Auto merge of #142546 - cjgillot:reachable-jump, r=compiler-errorsbors-2/+13
Only traverse reachable blocks in JumpThreading. Fixes https://github.com/rust-lang/rust/issues/131451 We only compute loop headers for reachable blocks. We shouldn't try to perform an opt on unreachable blocks anyway.
2025-06-21Port `#[rustc_pub_transparent]` to the new attribute systemPavel Grigorenko-4/+29
2025-06-21Auto merge of #142826 - jdonszelmann:rollup-1wxomvb, r=jdonszelmannbors-88/+215
Rollup of 3 pull requests Successful merges: - rust-lang/rust#142539 (Port `#[may_dangle]` to the new attribute system) - rust-lang/rust#142690 (expand: Remove some unnecessary generic parameters) - rust-lang/rust#142698 (Improve diagnostics for `concat_bytes!` with C string literals) Failed merges: - rust-lang/rust#142600 (Port `#[rustc_pub_transparent]` to the new attribute system) - rust-lang/rust#142776 (All HIR attributes are outer) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-21Rollup merge of #142698 - tgross35:concat-byte-cstr-diag, r=petrochenkovJana Dönszelmann-39/+136
Improve diagnostics for `concat_bytes!` with C string literals Use the same error as other invalid types for `concat_bytes!`, rather than using `ConcatCStrLit` from `concat!`. Also add more information with a note about why this doesn't work, and a suggestion to use a null-terminated byte string instead.
2025-06-21Rollup merge of #142690 - petrochenkov:expnoparam, r=compiler-errorsJana Dönszelmann-46/+46
expand: Remove some unnecessary generic parameters
2025-06-21Rollup merge of #142539 - GrigorenkoPV:attributes/may_dangle, r=jdonszelmannJana Dönszelmann-3/+33
Port `#[may_dangle]` to the new attribute system Very similar to rust-lang/rust#142498. This is a part of rust-lang/rust#131229, so r? `@jdonszelmann`
2025-06-21Auto merge of #142817 - matthiaskrgr:rollup-mrobovy, r=matthiaskrgrbors-425/+1635
Rollup of 7 pull requests Successful merges: - rust-lang/rust#142502 (rustdoc_json: improve handling of generic args) - rust-lang/rust#142597 (error on calls to ABIs that cannot be called) - rust-lang/rust#142785 (fix(linkcheck): Build using the lockfile) - rust-lang/rust#142787 (Add diagnostic items for Clippy) - rust-lang/rust#142788 (add doc(alias("AsciiChar")) to core::ascii::Char) - rust-lang/rust#142801 (Use gen blocks in the compiler instead of `from_coroutine`) - rust-lang/rust#142804 (Rename `LayoutS` to `LayoutData` in comments) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-21Rollup merge of #142804 - zachs18:rename-layouts-to-layoutdata-in-comments, ↵Matthias Krüger-9/+9
r=saethlin Rename `LayoutS` to `LayoutData` in comments `LayoutS` was renamed to `LayoutData`, but some comments in the compiler were not changed. This updates comments in the compiler (and one section of commented-out code in rust-analyzer) to refer to `LayoutData` instead of `LayoutS`. cc <https://github.com/rust-lang/rust/pull/132252>, `@workingjubilee`
2025-06-21Rollup merge of #142801 - compiler-errors:gen-blocks, r=oli-obkMatthias Krüger-154/+139
Use gen blocks in the compiler instead of `from_coroutine` r? oli-obk
2025-06-21Rollup merge of #142788 - lolbinarycat:core-AsciiChar-alias, r=tgross35Matthias Krüger-0/+13
add doc(alias("AsciiChar")) to core::ascii::Char Added it to the reexported, which is intended rustdoc behavior, but is apparently untested, so I also added a test for it.
2025-06-21Rollup merge of #142787 - samueltardieu:diag-items-for-clippy, ↵Matthias Krüger-34/+30
r=Manishearth,Urgau Add diagnostic items for Clippy Clippy still uses some paths to access items from the standard library. Adding the missing diagnostic items allows removing the last remaining paths. Closes rust-lang/rust-clippy#5393
2025-06-21Rollup merge of #142785 - epage:link, r=ehussMatthias Krüger-0/+1
fix(linkcheck): Build using the lockfile This is to unblock cargo from servo/html5ever#623 I ran `linkcheck.sh` locally and it now works
2025-06-21Rollup merge of #142597 - folkertdev:abi-cannot-be-called, r=workingjubileeMatthias Krüger-209/+1359
error on calls to ABIs that cannot be called We recently added `extern "custom"`, which cannot be called using a rust call expression. But there are more ABIs that can't be called in that way, because the call does not semantically make sense. More details are in https://github.com/rust-lang/rust/issues/140566#issuecomment-2846205457 r? `@workingjubilee` try-job: x86_64-gnu-llvm-19-3
2025-06-21Rollup merge of #142502 - nnethercote:rustdoc-json-GenericArgs, r=aDotInTheVoidMatthias Krüger-19/+84
rustdoc_json: improve handling of generic args This PR fixes some inconsistencies and inefficiencies in how generic args are handled by rustdoc-json-types. r? `@aDotInTheVoid`
2025-06-21Auto merge of #142814 - tgross35:rollup-fioob6s, r=tgross35bors-267/+8440
Rollup of 8 pull requests Successful merges: - rust-lang/rust#142384 (Bringing `rustc_rayon_core` in tree as `rustc_thread_pool`) - rust-lang/rust#142476 (Insert parentheses around binary operation with attribute) - rust-lang/rust#142485 (Marks ADT live if it appears in pattern) - rust-lang/rust#142571 (Reason about borrowed classes in CopyProp.) - rust-lang/rust#142677 (Add CI check to ensure that rustdoc JSON `FORMAT_VERSION` is correctly updated) - rust-lang/rust#142716 (Adjust `with_generic_param_rib`.) - rust-lang/rust#142756 (Make `Clone` a `const_trait`) - rust-lang/rust#142765 (rustc_target: document public AbiMap-related fn and variants) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-21rustdoc_json: represent generic args consistently.Nicholas Nethercote-23/+21
They show up in three places: once as `Option<Box<GenericArgs>>`, once as `Box<GenericArgs>`, and once as `GenericArgs`. The first option is best. It is more compact because generic args are often missing. This commit changes the latter two to the former. Example output, before and after, for the `AssocItemConstraint` change: ``` {"name":"Offset","args":{"angle_bracketed":{"args":[],"constraints":[]}},"binding":{...}} {"name":"Offset","args":null,"binding":{...}} ``` Example output, before and after, for the `Type::QualifiedPath` change: ``` {"qualified_path":{"name":"Offset","args":{"angle_bracketed":{"args":[],"constraints":[]}}, ...}} {"qualified_path":{"name":"Offset","args":null, ...}} ``` This reduces JSON output size, but not by much (e.g. 0.5%), because `AssocItemConstraint` and `Type::QualifiedPath` are uncommon.
2025-06-21Fix some comments.Nicholas Nethercote-3/+3
As per the previous commit, generic args here can only appear on the final segment. So make the comments obey that constraint.
2025-06-21rustdoc_json: Fix handling of paths with no generic args.Nicholas Nethercote-2/+19
A path without generic args, like `Reader`, currently has JSON produced like this: ``` {"path":"Reader","id":286,"args":{"angle_bracketed":{"args":[],"constraints":[]}}} ``` Even though `types::Path::args` is `Option` and allows for "no args", instead it gets represented as "empty args". (More like `Reader<>` than `Reader`.) This is due to a problem in `clean::Path::from_clean`. It only produces `None` if the path is an empty string. This commit changes it to also produce `None` if there are no generic args. The example above becomes: ``` {"path":"Reader","id":286,"args":null} ``` I looked at a few examples and saw this reduce the size of the JSON output by 3-9%. The commit also adds an assertion that non-final segments don't have any generics; something the old code was implicitly relying on. Note: the original sin here is that `clean::PathSegment::args` is not an `Option`, unlike `{ast,hir}::PathSegment::args`. I want to fix that, but it can be done separately.
2025-06-21rustdoc_json: Add a test for some `GenericArgs` cases.Nicholas Nethercote-0/+20
2025-06-21rustdoc_json: Add static asserts for the size of important types.Nicholas Nethercote-0/+30
A lot of these are large! Lots of room for improvement in the future.
2025-06-20Rollup merge of #142765 - workingjubilee:more-abimap-docs, r=compiler-errorsTrevor Gross-0/+6
rustc_target: document public AbiMap-related fn and variants
2025-06-20Rollup merge of #142756 - Daniel-Aaron-Bloom:const-clone, r=oli-obkTrevor Gross-2/+8
Make `Clone` a `const_trait` See [tracking issue](https://github.com/rust-lang/rust/issues/142757) for justification.
2025-06-20Rollup merge of #142716 - nnethercote:adjust-with_generic_param_rib, ↵Trevor Gross-119/+77
r=petrochenkov Adjust `with_generic_param_rib`. Currently all of its call sites construct a `LifetimeRibKind::Generics` value, which `with_generic_param_rib` then deconstructs (and panics if it's a different `LifetimeRibKind` variant). This commit makes the code simpler and shorter: the call sites just pass in the three values and `with_generic_param_rib` constructs the `LifetimeRibKind::Generics` value from them. r? `@petrochenkov`
2025-06-20Rollup merge of #142677 - GuillaumeGomez:check-format-version-update, r=KobzolTrevor Gross-2/+109
Add CI check to ensure that rustdoc JSON `FORMAT_VERSION` is correctly updated Follow-up of https://github.com/rust-lang/rust/pull/142601. Tested it locally with: `BASE_COMMIT=1bb335244c311a07cee165c28c553c869e6f64a9 src/ci/docker/host-x86_64/mingw-check-1/validate-rustdoc-json-format-version-update.sh` (where `BASE_COMMIT` value was the commit before I made a wrong change with the `FORMAT_VERSION` update). This is a first version. I plan to send a follow-up to also ensure that `FORMAT_VERSION` is updated if any code change is done in `rustdoc-json-types`. For that I just need to check that a line not starting with `/` and not an empty line was updated. Fun times with `grep` ahead. :') cc `@aDotInTheVoid` r? `@nnethercote`
2025-06-20Rollup merge of #142571 - cjgillot:borrowed-classes, r=oli-obkTrevor Gross-27/+105
Reason about borrowed classes in CopyProp. Fixes https://github.com/rust-lang/rust/issues/141122 The current implementation of `CopyProp` avoids unifying two borrowed locals, as this would change the result of address comparison. However, the implementation was inconsistent with the general algorithm, which identifies equivalence classes of locals and then replaces all locals by a single representative of their equivalence class. This PR fixes it by forbidding the unification of two *classes* if any of those contain a borrowed local.
2025-06-20Rollup merge of #142485 - mu001999-contrib:dead-code/adt-pattern, r=petrochenkovTrevor Gross-67/+161
Marks ADT live if it appears in pattern Marks ADT live if it appears in pattern, it implies the construction of the ADT. 1. Then we can detect unused private ADTs impl `Default`, without special logics for `Default` and other std traits. 2. We can also remove `rustc_trivial_field_reads` on `Default`, and the logic in `should_ignore_item` (introduced by rust-lang/rust#126302). Fixes rust-lang/rust#120770 Extracted from rust-lang/rust#128637. r? `@petrochenkov`
2025-06-20Rollup merge of #142476 - dtolnay:attrbinop, r=fmeaseTrevor Gross-12/+58
Insert parentheses around binary operation with attribute Fixes the bug found by `@fmease` in https://github.com/rust-lang/rust/pull/134661#pullrequestreview-2538983253. Previously, `-Zunpretty=expanded` would expand this program as follows: ```rust #![feature(stmt_expr_attributes)] #![allow(unused_attributes)] macro_rules! group { ($e:expr) => { $e }; } macro_rules! extra { ($e:expr) => { #[allow()] $e }; } fn main() { let _ = #[allow()] 1 + 1; let _ = group!(#[allow()] 1) + 1; let _ = 1 + group!(#[allow()] 1); let _ = extra!({ 0 }) + 1; let _ = extra!({ 0 } + 1); } ``` ```console let _ = #[allow()] 1 + 1; let _ = #[allow()] 1 + 1; let _ = 1 + #[allow()] 1; let _ = #[allow()] { 0 } + 1; let _ = #[allow()] { 0 } + 1; ``` The first 4 statements are the correct expansion, but the last one is not. The attribute is supposed to apply to the entire binary operation, not only to the left operand. After this PR, the 5th statement will expand to: ```console let _ = #[allow()] ({ 0 } + 1); ``` In the future, as some subset of `stmt_expr_attributes` approaches stabilization, it is possible that we will need to do parenthesization for a number of additional cases depending on the outcome of https://github.com/rust-lang/rust/issues/127436. But for now, at least this PR makes the pretty-printer align with the current behavior of the parser. r? fmease
2025-06-20Rollup merge of #142384 - celinval:chores-rayon-mv, r=oli-obkTrevor Gross-38/+7916
Bringing `rustc_rayon_core` in tree as `rustc_thread_pool` This PR moves [`rustc_rayon_core`](https://github.com/rust-lang/rustc-rayon/tree/5fadf44/rayon-core) from commit `5fadf44` as suggested in [this zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/Bringing.20.60rustc_rayon_core.60.20in.20tree). I tried to split the work into separate commits so it is easy to review. The first commit is a simple copy and paste from the fork, and subsequent changes were made to use the new crate and to ensure the new crate complies with different format and lint expectations. **Call-out:** I was also wondering if I need to make any further changes to accommodate licensing requirements. r? oli-obk
2025-06-20Auto merge of #142794 - tgross35:rollup-iae7okj, r=tgross35bors-757/+997
Rollup of 9 pull requests Successful merges: - rust-lang/rust#142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.) - rust-lang/rust#142491 (Rework #[cold] attribute parser) - rust-lang/rust#142494 (Fix missing docs in `rustc_attr_parsing`) - rust-lang/rust#142495 (Better template for `#[repr]` attributes) - rust-lang/rust#142497 (Fix random failure when JS code is executed when the whole file was not read yet) - rust-lang/rust#142575 (Ensure copy* intrinsics also perform the static self-init checks) - rust-lang/rust#142650 (Refactor Translator) - rust-lang/rust#142713 (mbe: Refactor transcription) - rust-lang/rust#142755 (rustdoc: Remove `FormatRenderer::cache`) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-20Add an attribute-related parenthesization edge caseDavid Tolnay-0/+6
2025-06-20Insert parentheses around binary operation with attributeDavid Tolnay-12/+38
2025-06-20Add AST pretty-printer tests involving attr on binary operationDavid Tolnay-0/+9
This test currently fails (as expected). --- stderr ------------------------------- Pretty-printer lost necessary parentheses BEFORE: #[attr] (1 + 1) AFTER: #[attr] 1 + 1 Pretty-printer lost necessary parentheses BEFORE: #[attr] (1 as T) AFTER: #[attr] 1 as T Pretty-printer lost necessary parentheses BEFORE: #[attr] (x = 1) AFTER: #[attr] x = 1 Pretty-printer lost necessary parentheses BEFORE: #[attr] (x += 1) AFTER: #[attr] x += 1 ------------------------------------------
2025-06-20Auto merge of #142795 - Kobzol:rollup-vvnnjno, r=Kobzolbors-261/+550
Rollup of 10 pull requests Successful merges: - rust-lang/rust#142629 (Add config builder for bootstrap tests) - rust-lang/rust#142715 (correct template for `#[align]` attribute) - rust-lang/rust#142720 (De-dup common code from `ExternalCrate` methods) - rust-lang/rust#142736 (add issue template for rustdoc) - rust-lang/rust#142743 (rustc-dev-guide subtree update) - rust-lang/rust#142744 (Add a mailmap entry for y21) - rust-lang/rust#142758 (Make sure to rebuild rustdoc if `src/rustdoc-json-types` is changed) - rust-lang/rust#142764 (Convert `ilog(10)` to `ilog10()`) - rust-lang/rust#142767 (Some symbol and PathRoot cleanups) - rust-lang/rust#142769 (remove equivalent new method on context) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-20Port `#[may_dangle]` to the new attribute systemPavel Grigorenko-3/+33
2025-06-20Use gen blocks in the compiler instead of from_coroutineMichael Goulet-154/+139
2025-06-20Rollup merge of #142769 - jdonszelmann:remove-useless-new-method, r=tgross35Jakub Beránek-9/+3
remove equivalent new method on context Noticed the two had converged so much they literally became equivalent. So one could go hehe
2025-06-20Rollup merge of #142767 - nnethercote:symbol-cleanups, r=petrochenkovJakub Beránek-24/+29
Some symbol and PathRoot cleanups I'm looking into unifying how we join and print paths. Here are some preliminary cleanups. r? ``@petrochenkov``
2025-06-20Rollup merge of #142764 - ChaiTRex:ilog_10_to_ilog10, r=workingjubileeJakub Beránek-7/+7
Convert `ilog(10)` to `ilog10()` Except in tests, convert `integer.ilog(10)` to `integer.ilog10()` for better speed and to provide better examples of code that efficiently counts decimal digits. I couldn't find any instances of `integer.ilog(2)`.
2025-06-20Rollup merge of #142758 - jieyouxu:rustdoc-json-types, r=KobzolJakub Beránek-1/+1
Make sure to rebuild rustdoc if `src/rustdoc-json-types` is changed I think `rustdoc-json-types` was more recently split out, so this download-rustc logic became outdated as it wasn't tracked. This PR adds `src/rustdoc-json-types` to be tracked for difference versus upstream, so that we properly rebuild rustdoc if it has changes versus upstream. Fixes rust-lang/rust#142738. ### Local testing This is not so easy to test locally because it requires download-rustc. To test this, you need to: 1. Disable `download-rustc` inhibition from bootstrap changes versus upstream, by including `:!src/bootstrap` in https://github.com/rust-lang/rust/blob/255aa220821c05c3eac7605fce4ea1c9ab2cbdb4/src/bootstrap/src/core/config/config.rs#L67-L74. 2. Then, use a config like `profile = "tools"` which by default uses `download-rustc = "if-unchanged"`. 3. Run `./x test tests/rustdoc-json` one time, to "prime" initial build caches. 4. Change the `FORMAT_VERSION` in `src/rustdoc-json-types`, i.e. ```diff diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 1f93895ae07..72a3720c7b4 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs ``@@`` -38,7 +38,7 ``@@`` // are deliberately not in a doc comment, because they need not be in public docs.) // // Latest feature: Pretty printing of inline attributes changed -pub const FORMAT_VERSION: u32 = 48; +pub const FORMAT_VERSION: u32 = 666; ``` 5. Observe that without this patch, `rustdoc-json` tests fail because `FORMAT_VERSION` mismatch. Observe that with this patch, rustdoc gets properly rebuilt and `rustdoc-json` tests pass. cc ``@aDotInTheVoid`` r? Kobzol
2025-06-20Rollup merge of #142744 - tgross35:y21-mailmap, r=y21Jakub Beránek-0/+1
Add a mailmap entry for y21
2025-06-20Rollup merge of #142743 - tshepang:rdg-push, r=jieyouxuJakub Beránek-96/+252
rustc-dev-guide subtree update r? ``@ghost``
2025-06-20Rollup merge of #142736 - lolbinarycat:rustdoc-issue-template, ↵Jakub Beránek-0/+54
r=GuillaumeGomez,fmease add issue template for rustdoc ~~This also expands the scope of the "diagnostic issue" template to include rustdoc lints, meaning diagnostic issues will need triaging again. I think this is preferable to the alternative of cramming even more cases under a single issue template.~~ r? t-rustdoc
2025-06-20Rollup merge of #142720 - yotamofek:pr/rustdoc/ext-crate-cleanup, ↵Jakub Beránek-71/+53
r=GuillaumeGomez De-dup common code from `ExternalCrate` methods Also, return an `impl Iterator` instead of collecting into a `Vec`. Not sure if that'll have a measurable perf impact, but I think this PR still cleans up the two methods it touches quite nicely. (I'm having trouble finding a name for the common method I extracted, currently called `foobar`, would love suggestions!)
2025-06-20Rollup merge of #142715 - folkertdev:fn-align-corrections, r=jdonszelmannJakub Beránek-34/+36
correct template for `#[align]` attribute Tracking issue: https://github.com/rust-lang/rust/issues/82232 related: https://github.com/rust-lang/rust/pull/142507 I didn't fully understand what `template!` did, clearly. An empty `#[align]` attribute was still rejected later, but without this change it does get suggested in certain cases. I've also updated some outdated references to `#[repr(align)]` on functions. r? ``@jdonszelmann``
2025-06-20Rollup merge of #142629 - Kobzol:bootstrap-tests-builder, r=jieyouxuJakub Beránek-19/+114
Add config builder for bootstrap tests I started writing a bunch of snapshot tests for build/check steps, and quickly realized that the current interface for defining them won't be enough, so I created a simple builder, which can scale to pretty much any kind of configuration in the future.