35300 Commits

Author SHA1 Message Date
Jakub Beránek
bc5c05c9fe
Rollup merge of #143881 - orlp:once-state-repr, r=tgross35
Use zero for initialized Once state

By re-labeling which integer represents which internal state for `Once` we can ensure that the initialized state is the all-zero state. This is beneficial because some CPU architectures (such as Arm) have specialized instructions to specifically branch on non-zero, and checking for the initialized state is by far the most important operation.

As an example, take this:

```rust
use std::sync::atomic::{AtomicU32, Ordering};

const INIT: u32 = 3;

#[inline(never)]
#[cold]
pub fn slow(state: &AtomicU32) {
    state.store(INIT, Ordering::Release);
}

pub fn ensure_init(state: &AtomicU32) {
    if state.load(Ordering::Acquire) != INIT {
        slow(state)
    }
}
```

If `INIT` is 3 (as is currently the state for `Once`), we see the following assembly on `aarch64-apple-darwin`:

```asm
example::ensure_init::h332061368366e313:
        ldapr   w8, [x0]
        cmp     w8, #3
        b.ne    LBB1_2
        ret
LBB1_2:
        b       example::slow::ha042bd6a4f33724e
```

By changing the `INIT` state to zero we get the following:

```asm
example::ensure_init::h332061368366e313:
        ldapr   w8, [x0]
        cbnz    w8, LBB1_2
        ret
LBB1_2:
        b       example::slow::ha042bd6a4f33724e
```

So this PR saves 1 instruction every time a `LazyLock` gets accessed on platforms such as these.
2025-07-14 11:04:55 +02:00
Jakub Beránek
4da2bbaac8
Rollup merge of #143875 - fee1-dead-contrib:push-zvqrmzrprpzt, r=compiler-errors
update issue number for `const_trait_impl`

r? project-const-traits

cc rust-lang/rust#67792 rust-lang/rust#143874
2025-07-14 11:04:55 +02:00
Jakub Beránek
9e6a0a49d5
Rollup merge of #143724 - hkBst:tidy-cleanup, r=Mark-Simulacrum
Tidy cleanup
2025-07-14 11:04:53 +02:00
Jakub Beránek
1251660bb2
Rollup merge of #143681 - RalfJung:bootstrap-miri-rebuilds, r=Kobzol
bootstrap/miri: avoid rebuilds for test builds

When building Miri in its own repo, we always build with `--all-targets`:
a009612691/src/tools/miri/miri-script/src/util.rs (L167-L174)
This saves a bunch of time since some of Miri's dependencies get more features enabled by some of Miri's dev-dependencies, and they all get built twice otherwise if you do `cargo build && cargo test` (which is typically what you end up doing inside `./miri test` and also inside `./x test miri`).

This applies the same approach to bootstrap, drastically reducing the edit-compile cycle for Miri work here. :)
2025-07-14 11:04:52 +02:00
bors
bcc0a79a81 Auto merge of #143461 - folkertdev:cfg-select-builtin-macro, r=petrochenkov
make `cfg_select` a builtin macro

tracking issue: https://github.com/rust-lang/rust/issues/115585

This parses mostly the same as the `macro cfg_select` version, except:

1. wrapping in double brackets is no longer supported (or needed): `cfg_select {{ /* ... */ }}` is now rejected.
2. in an expression context, the rhs is no longer wrapped in a block, so that this now works:
  ```rust
  fn main() {
      println!(cfg_select! {
          unix => { "foo" }
          _ => { "bar" }
      });
  }
  ```
3. a single wildcard rule is now supported: `cfg_select { _ => 1 }` now works

I've also added an error if none of the rules evaluate to true, and warnings for any arms that follow the `_` wildcard rule.

cc `@traviscross` if I'm missing any feature that should/should not be included
r? `@petrochenkov` for the macro logic details
2025-07-13 18:34:13 +00:00
Deadbeef
cc08f71756 update issue number for const_trait_impl 2025-07-13 23:55:06 +08:00
bors
f9f09e54d0 Auto merge of #143617 - aDotInTheVoid:devdesktoptestattr, r=Mark-Simulacrum
Run `tests/rustdoc-json/attrs/target_features` on all hosts.

Makes it more convenient to test rustdoc on non x86_64. I mainly care about the aarch64 dev-desktops.

This works because rustdoc uses all target features, not just that of the target.
2025-07-13 12:28:47 +00:00
bors
14d7e8819b Auto merge of #143213 - dianne:lower-cond-tweaks, r=cjgillot
de-duplicate condition scoping logic between AST→HIR lowering and `ScopeTree` construction

There was some overlap between `rustc_ast_lowering::LoweringContext::lower_cond` and `rustc_hir_analysis::check::region::resolve_expr`, so I've removed the former and migrated its logic to the latter, with some simplifications.

Consequences:
- For `while` and `if` expressions' `let`-chains, this changes the `HirId`s for the `&&`s to properly correspond to their AST nodes. This is how guards were handled already.
- This makes match guards share previously-duplicated logic with `if`/`while` expressions. This will also be used by guard pattern[^1] guards.
- Aside from legacy syntax extensions (e.g. some builtin macros) that directly feed AST to the compiler, it's currently impossible to put attributes directly on `&&` operators in `let` chains[^2]. Nonetheless, attributes on `&&` operators in `let` chains in `if`/`while` expression conditions are no longer silently ignored and will be lowered.
- This no longer wraps conditions in `DropTemps`, so the HIR and THIR will be slightly smaller.
- `DesugaringKind::CondTemporary` is now gone. It's no longer applied to any spans, and all uses of it were dead since they were made to account for `if` and `while` being desugared to `match` on a boolean scrutinee.
- Should be a marginal perf improvement beyond that due to leveraging [`ScopeTree` construction](5e749eb66f/compiler/rustc_hir_analysis/src/check/region.rs (L312-L355))'s clever handling of `&&` and `||`:
  - This removes some unnecessary terminating scopes that were placed around top-level `&&` and `||` operators in conditions. When lowered to MIR, logical operator chains don't create intermediate boolean temporaries, so there's no temporary to drop. The linked snippet handles wrapping the operands in terminating scopes as necessary, in case they create temporaries.
  - The linked snippet takes care of letting `let` temporaries live and terminating other operands, so we don't need separate traversals of `&&` chains for that.

[^1]: rust-lang/rust#129967
[^2]: Case-by-case, here's my justification: `#[attr] e1 && e2` applies the attribute to `e1`. In `#[attr] (e1 && e2)` , the attribute is on the parentheses in the AST, plus it'd fail to parse if `e1` or `e2` contains a `let`. In `#[attr] expands_to_let_chain!()`, the attribute would already be ignored (rust-lang/rust#63221) and it'd fail to parse anyway; even if the expansion site is a condition, the expansion wouldn't be parsed with `Restrictions::ALLOW_LET`. If it *was* allowed, the notion of a "reparse context" from https://github.com/rust-lang/rust/issues/61733#issuecomment-509626449 would be necessary in order to make `let`-chains left-associative; multiple places in the compiler assume they are.
2025-07-13 04:20:07 +00:00
bors
5ed4757acd Auto merge of #140717 - mejrs:diagnostic_lints, r=oli-obk
Split up the `unknown_or_malformed_diagnostic_attributes` lint

This splits up the lint into the following lint group:
- `unknown_diagnostic_attributes` - triggers if the attribute is unknown to the current compiler
- `misplaced_diagnostic_attributes` - triggers if the attribute exists but it is not placed on the item kind it's meant for
- `malformed_diagnostic_attributes` - triggers if the attribute's syntax or options are invalid
- `malformed_diagnostic_format_literals` - triggers if the format string literal is invalid, for example if it has unpaired curly braces or invalid parameters
- this pr doesn't create it, but future lints for things like deprecations can also go here.

This PR does not start emitting lints in places that previously did not.

## Motivation

I want to have finer control over what `unknown_or_malformed_diagnostic_attributes` does

I have a project with fairly low msrv that is/will have a lower msrv than future diagnostic attributes. So lints will be emitted when I or others compile it on a lower msrv.

At this time, there are two options to silence these lints:

-  `#[allow(unknown_or_malformed_diagnostic_attributes)]` - this risks diagnostic regressions if I (or others) mess up using the attribute, or if the attribute's syntax ever changes.
- write a build script to detect the compiler version and emit cfgs, and then conditionally enable the attribute:
    ```rust
    #[cfg_attr(rust_version_99, diagnostic::new_attr_in_rust_99(thing = ..))]`
    struct Foo;
    ```
    or conditionally `allow`  the lint:
    ```rust
   // lib.rs
   #![cfg_attr(not(current_rust), allow(unknown_or_malformed_diagnostic_attributes))]
   ```

I like to avoid using build scripts if I can, so the following works much better for me. That is what this PR will let me do in the future:
```rust
    #[allow(unknown_diagnostic_attribute, reason = "attribute came out in rust 1.99 but msrv is 1.70")]
    #[diagnostic::new_attr_in_rust_99(thing = ..)]`
    struct Foo;
2025-07-13 01:11:56 +00:00
bors
1b863629d9 Auto merge of #143624 - tmiasko:copy-prop-borrowed, r=cjgillot
Propagate from borrowed locals in CopyProp

r? cjgillot
2025-07-12 13:48:36 +00:00
bors
d51d10b1a4 Auto merge of #143810 - matthiaskrgr:rollup-iw7a23z, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#143403 (Port several trait/coherence-related attributes the new attribute system)
 - rust-lang/rust#143633 (fix: correct assertion to check for 'noinline' attribute presence before removal)
 - rust-lang/rust#143647 (Clarify and expand documentation for std::sys_common dependency structure)
 - rust-lang/rust#143716 (compiler: doc/comment some codegen-for-functions interfaces)
 - rust-lang/rust#143747 (Add target maintainer information for aarch64-unknown-linux-musl)
 - rust-lang/rust#143759 (Fix typos in function names in the `target_feature` test)
 - rust-lang/rust#143767 (Bump `src/tools/x` to Edition 2024 and some cleanups)
 - rust-lang/rust#143769 (Remove support for SwitchInt edge effects in backward dataflow)
 - rust-lang/rust#143770 (build-helper: clippy fixes)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-12 10:46:43 +00:00
bors
12994a02e4 Auto merge of #143766 - matthiaskrgr:rollup-0x7t69s, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#142391 (rust: library: Add `setsid` method to `CommandExt` trait)
 - rust-lang/rust#143302 (`tests/ui`: A New Order [27/N])
 - rust-lang/rust#143303 (`tests/ui`: A New Order [28/28] FINAL PART)
 - rust-lang/rust#143568 (std: sys: net: uefi: tcp4: Add timeout support)
 - rust-lang/rust#143611 (Mention more APIs in `ParseIntError` docs)
 - rust-lang/rust#143661 (chore: Improve how the other suggestions message gets rendered)
 - rust-lang/rust#143708 (fix: Include frontmatter in -Zunpretty output )
 - rust-lang/rust#143718 (Make UB transmutes really UB in LLVM)

r? `@ghost`
`@rustbot` modify labels: rollup

try-job: i686-gnu-nopt-1
try-job: test-various
2025-07-12 07:44:04 +00:00
Matthias Krüger
4d46c703ab
Rollup merge of #143767 - hkBst:cleanup-x, r=jieyouxu
Bump `src/tools/x` to Edition 2024 and some cleanups

- Some clippy fixes
- Bump `src/tools/x` to Edition 2024
2025-07-11 19:45:25 +02:00
Matthias Krüger
2d9d3df025
Rollup merge of #143716 - workingjubilee:document-some-codegen-backend-stuff, r=bjorn3,fee1-dead
compiler: doc/comment some codegen-for-functions interfaces

An out-of-date comment gets updated and some underdocumented functions get documented.
2025-07-11 19:45:24 +02:00
Matthias Krüger
4a25513995
Rollup merge of #143647 - ColtenOuO:master, r=ChrisDenton
Clarify and expand documentation for std::sys_common dependency structure

This PR makes a minor improvement to the module-level documentation of std::sys_common:

Replaces the lowercase “dag” with the more standard and explicit form “DAG (Directed Acyclic Graph)” for clarity.
2025-07-11 19:45:23 +02:00
Matthias Krüger
2f15436268
Rollup merge of #143633 - dillona:noinline-assert, r=fee1-dead
fix: correct assertion to check for 'noinline' attribute presence before removal
2025-07-11 19:45:23 +02:00
Matthias Krüger
51c23699d8
Rollup merge of #143403 - GrigorenkoPV:attributes/traits, r=jdonszelmann
Port several trait/coherence-related attributes the new attribute system

Part of rust-lang/rust#131229

This ports:
- `#[const_trait]`
- `#[rustc_deny_explicit_impl]`
- `#[rustc_do_not_implement_via_object]`
- `#[rustc_coinductive]`
- `#[type_const]`
- `#[rustc_specialization_trait]`
- `#[rustc_unsafe_specialization_marker]`
- `#[marker]`
- `#[fundamental]`
- `#[rustc_paren_sugar]`
- `#[rustc_allow_incoherent_impl]`
- `#[rustc_coherence_is_core]`

This also changes `#[marker]` to error on duplicates instead of warning.
cc rust-lang/rust#142838, but I don't think it matters too much, since it's unstable.

r? ``@oli-obk``
2025-07-11 19:45:22 +02:00
Matthias Krüger
ee0ad71148
Rollup merge of #143718 - scottmcm:ub-transmute-is-ub, r=WaffleLapkin
Make UB transmutes really UB in LLVM

Ralf suggested in <https://github.com/rust-lang/rust/pull/143410#discussion_r2184928123> that UB transmutes shouldn't be trapping, which happened for the one path *that* PR was changing, but there's another path as well, so *this* PR changes that other path to match.

r? codegen
2025-07-11 07:35:22 +02:00
Matthias Krüger
562dab675c
Rollup merge of #143708 - epage:pretty, r=compiler-errors
fix: Include frontmatter in -Zunpretty output

In the implementation (rust-lang/rust#140035), this was left as an open question for
the tracking issue (rust-lang/rust#136889).  My assumption is that this should be
carried over.

The test was carried over from rust-lang/rust#137193 which was superseded by rust-lang/rust#140035.

Thankfully, either way, `-Zunpretty` is unstable and we can always
change it even if we stabilize frontmatter.
2025-07-11 07:35:21 +02:00
Matthias Krüger
273d24e0a4
Rollup merge of #143661 - Muscraft:other-suggestion-message, r=estebank
chore: Improve how the other suggestions message gets rendered

Note: This change is part of my ongoing work to use `annotate-snippets` as `rustc`'s emitter

This change started as a way to remove some specialty code paths from `annotate-snippets`, by making the "and {} other candidates" message get rendered like a secondary message with no level, but turned into a fix for the message's Unicode output. Before this change, when using the Unicode output, the other suggestions message would get rendered outside of the main suggestion block, making it feel disconnected from what it was referring to. This change makes it so that the message is on the last line of the block, aligning its rendering with other secondary messages, and making it clear what the message is referring to.

Before:
```
error[E0433]: failed to resolve: use of undeclared type `IntoIter`
   ╭▸ $DIR/issue-82956.rs:28:24
   │
LL │         let mut iter = IntoIter::new(self);
   │                        ━━━━━━━━ use of undeclared type `IntoIter`
   ╰╴
help: consider importing one of these structs
   ╭╴
LL + use std::array::IntoIter;
   ├╴
LL + use std::collections::binary_heap::IntoIter;
   ├╴
LL + use std::collections::btree_map::IntoIter;
   ├╴
LL + use std::collections::btree_set::IntoIter;
   ╰╴
     and 9 other candidates
```

After:
```
error[E0433]: failed to resolve: use of undeclared type `IntoIter`
   ╭▸ $DIR/issue-82956.rs:28:24
   │
LL │         let mut iter = IntoIter::new(self);
   │                        ━━━━━━━━ use of undeclared type `IntoIter`
   ╰╴
help: consider importing one of these structs
   ╭╴
LL + use std::array::IntoIter;
   ├╴
LL + use std::collections::binary_heap::IntoIter;
   ├╴
LL + use std::collections::btree_map::IntoIter;
   ├╴
LL + use std::collections::btree_set::IntoIter;
   │
   ╰ and 9 other candidates
```
2025-07-11 07:35:20 +02:00
Matthias Krüger
3b38f25bc3
Rollup merge of #143611 - GrigorenkoPV:ParseIntError, r=tgross35
Mention more APIs in `ParseIntError` docs

Fixes rust-lang/rust#143602

r? `@lolbinarycat`

`@rustbot` label +A-docs
2025-07-11 07:35:20 +02:00
Matthias Krüger
a38083c896
Rollup merge of #143568 - Ayush1325:uefi-tcp4-timeout, r=tgross35
std: sys: net: uefi: tcp4: Add timeout support

- Implement timeout support for read, write and connect.
- A software implementation using Instant.
2025-07-11 07:35:19 +02:00
Matthias Krüger
ba2001fabd
Rollup merge of #143303 - Kivooeo:tf28, r=tgross35
`tests/ui`: A New Order [28/28] FINAL PART

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? ``@tgross35``
2025-07-11 07:35:19 +02:00
Matthias Krüger
337a3018d1
Rollup merge of #143302 - Kivooeo:tf27, r=tgross35
`tests/ui`: A New Order [27/N]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? ``@tgross35``
2025-07-11 07:35:18 +02:00
Matthias Krüger
05b19877bf
Rollup merge of #142391 - LevitatingBusinessMan:setsid, r=workingjubilee
rust: library: Add `setsid` method to `CommandExt` trait

Add a setsid method to the CommandExt trait so that callers can create a process in a new session and process group whilst still using the POSIX spawn fast path.

Tracking issue: rust-lang/rust#105376

ACP: https://github.com/rust-lang/libs-team/issues/184

This PR was previously submitted by ``@HarveyHunt`` (whom I marked as Co-Author in the commit message) in rust-lang/rust#105377. However that PR went stale.

I applied the [suggestion](231d19fcbf (r1893457943)) to change the function signature to `fn setsid(&mut self, setsid: bool) -> &mut Command`.
2025-07-11 07:35:17 +02:00
bors
f934bcf4f6 Auto merge of #142911 - mejrs:unsized, r=compiler-errors
Remove support for dynamic allocas

Followup to rust-lang/rust#141811
2025-07-11 05:27:32 +00:00
bors
06a4210458 Auto merge of #143525 - Shourya742:2025-07-06-add-profiler, r=Kobzol
Add profiler to bootstrap command

This PR adds command profiling to the bootstrap command. It tracks the total execution time and records cache hits for each command. It also provides the ability to export execution result to a JSON file. Integrating this with Chrome tracing could further enhance observability.

r? `@Kobzol`
2025-07-10 16:51:58 +00:00
bors
622a598ac1 Auto merge of #143731 - matthiaskrgr:rollup-lm9q7vc, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#136906 (Add checking for unnecessary delims in closure body)
 - rust-lang/rust#143652 (docs: document trait upcasting rules in `Unsize` trait)
 - rust-lang/rust#143657 (Resolver: refact macro map into external and local maps)
 - rust-lang/rust#143659 (Use "Innermost" & "Outermost" terminology for `AttributeOrder`)
 - rust-lang/rust#143663 (fix: correct typo in attr_parsing_previously_accepted message key)
 - rust-lang/rust#143666 (Re-expose nested bodies in rustc_borrowck::consumers)
 - rust-lang/rust#143668 (Fix VxWorks build errors)
 - rust-lang/rust#143670 (Add a new maintainer to the wasm32-wasip1 target)
 - rust-lang/rust#143675 (improve lint doc text)
 - rust-lang/rust#143683 (Assorted `run-make-support` maintenance)
 - rust-lang/rust#143695 (Auto-add `S-waiting-on-author` when the PR is/switches to draft state)
 - rust-lang/rust#143706 (triagebot.toml: ping lolbinarycat if tidy extra checks were modified)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-10 13:49:36 +00:00
Matthias Krüger
caabaa9d4a
Rollup merge of #143706 - lolbinarycat:triagebot-extra-checks-ping, r=Kobzol
triagebot.toml: ping lolbinarycat if tidy extra checks were modified

I rewrote a large chunk of this module, and plan to do further changes to it (namely moving rustdoc_js checks into it), so it would be nice to keep up with and provide feedback on any changes to it, at least for the immediate future.

r? `@Kobzol`
2025-07-10 15:19:36 +02:00
Matthias Krüger
4e15daadee
Rollup merge of #143695 - Urgau:waiting-on-author-new_draft, r=Kobzol
Auto-add `S-waiting-on-author` when the PR is/switches to draft state

This PR adds the `S-waiting-on-author` as a `new_draft` when the PR is/switches to draft state.

Related to https://github.com/rust-lang/triagebot/issues/2102 & https://github.com/rust-lang/triagebot/pull/2104

cc `@jieyouxu`
r? `@Kobzol`
2025-07-10 15:19:35 +02:00
Matthias Krüger
1ae2375a49
Rollup merge of #143683 - jieyouxu:rms-cleanup, r=Kobzol
Assorted `run-make-support` maintenance

This PR should contain no functional changes.

- Commit 1: Removes the support library's CHANGELOG. In the very beginning, I thought maybe we would try to version this library. But this is a purely internal test support library, and it's just extra busywork trying to maintain changelog/versions. It's also hopelessly outdated.
- Commit 2: Resets version number to `0.0.0`. Ditto on busywork.
- Commit 3: Bump `run-make-support` to Edition 2024. The support library was already "compliant" with Edition 2024.
- Commit 4: Slightly organizes the support library dependencies.
- Commit 5: Previously, I tried hopelessly to maintain some manual formatting, but that was annoying because it required skipping rustfmt (so export ordering etc. could not be extra formatted). Give up, and do some rearrangements / module prefix tricks to get the `lib.rs` looking at least *reasonable*. IMO this is not a strict improvement, but I rather regain the ability to auto-format it with rustfmt.
- Commit {6,7}: Noticed in rust-lang/rust#143669 that we apparently had *both* {`is_msvc`, `is_windows_msvc`}. This PR removes `is_msvc` in favor of `is_windows_msvc` to make it unambiguous (and only retain one way of gating) as there are some UEFI targets which are MSVC but not Windows.

Best reviewed commit-by-commit.

r? `@Kobzol`
2025-07-10 15:19:35 +02:00
Matthias Krüger
291a97b508
Rollup merge of #143675 - hkBst:overflowing-1, r=oli-obk
improve lint doc text
2025-07-10 15:19:34 +02:00
Matthias Krüger
9ad71e7934
Rollup merge of #143670 - loganek:loganek/wasm32-wasip1-new-maintainer, r=alexcrichton
Add a new maintainer to the wasm32-wasip1 target

cc: `@alexcrichton`
2025-07-10 15:19:34 +02:00
Matthias Krüger
8672a28c8a
Rollup merge of #143668 - biabbas:vxworks, r=Noratrieb
Fix VxWorks build errors

fixes rust-lang/rust#143442

r? ``@Noratrieb``
2025-07-10 15:19:33 +02:00
Matthias Krüger
f618825f3c
Rollup merge of #143666 - nilehmann:nested_bodies_in_consumers, r=lcnr
Re-expose nested bodies in rustc_borrowck::consumers

After https://github.com/rust-lang/rust/pull/138499, it's not possible anymore to get borrowck information for nested bodies via `get_body_with_borrowck_facts`. This PR re-exposes nested bodies by returning a map containing the typeck root and all its nested bodies. To collect the bodies, a map is added to `BorrowCheckRootCtxt`, and a body is inserted every time `do_mir_borrowck` is called.

r? ``@lcnr``
2025-07-10 15:19:32 +02:00
Matthias Krüger
64282ebc90
Rollup merge of #143663 - dillona:fix-typo, r=jdonszelmann
fix: correct typo in attr_parsing_previously_accepted message key
2025-07-10 15:19:32 +02:00
Matthias Krüger
51b7c257e8
Rollup merge of #143659 - GrigorenkoPV:attributes/inner-outer, r=jdonszelmann
Use "Innermost" & "Outermost" terminology for `AttributeOrder`

Follow-up to rust-lang/rust#143603.

https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/attribute.20parsing.20rework/near/527768926

Also remove some outdated comments. cc `@jdonszelmann`
2025-07-10 15:19:31 +02:00
Matthias Krüger
22205b60f3
Rollup merge of #143657 - LorrensP-2158466:split-macro-map, r=petrochenkov
Resolver: refact macro map into external and local maps

Puts `MacroData` inside of the `ResolverArena` and splits `macro_map` into 2 maps: `local_macro_map` and `external_macro_map`. This way `get_macro_by_def_id` can take a `&Resolver` instead of a mutable one.

Part of [#gsoc > Project: Parallel Macro Expansion](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Parallel.20Macro.20Expansion/with/516965603)

r? `@petrochenkov`
2025-07-10 15:19:31 +02:00
Matthias Krüger
28f4ae318a
Rollup merge of #143652 - moulins:doc-unsize-trait-upcasting, r=compiler-errors
docs: document trait upcasting rules in `Unsize` trait

The trait upcasting feature stabilized in 1.86 added new `Unsize` implementation, but this wasn't reflected in the trait's documentation.
2025-07-10 15:19:30 +02:00
Matthias Krüger
b86999e93e
Rollup merge of #136906 - chenyukang:yukang-fix-136741-closure-body, r=oli-obk
Add checking for unnecessary delims in closure body

Fixes #136741
2025-07-10 15:19:29 +02:00
yukang
c37949c628 remove unnecessary parens in rust-analyzer 2025-07-10 13:50:02 +08:00
bors
816b4a6b52 Auto merge of #143405 - tgross35:update-builtins, r=tgross35
Update the `compiler-builtins` subtree

Update the Josh subtree to https://github.com/rust-lang/compiler-builtins/commit/8aba4c899ee8.

r? `@ghost`
2025-07-09 22:42:11 +00:00
Ed Page
f4d9018a48 feat(lexer): Allow including frontmatter with 'tokenize' 2025-07-09 16:42:27 -05:00
bors
57b64a7d1a Auto merge of #143538 - compiler-errors:instantiate-auto-trait, r=lcnr
Instantiate auto trait/`Copy`/`Clone`/`Sized` before computing constituent types binder

This makes the binder logic w.r.t. coroutines a bit simpler.

r? lcnr
2025-07-09 19:38:39 +00:00
bors
d64ef7403c Auto merge of #143502 - scottmcm:aggregate-simd, r=oli-obk
Let `rvalue_creates_operand` return true for *all* `Rvalue::Aggregate`s

~~Draft for now because it's built on Ralf's rust-lang/rust#143291~~

Inspired by https://github.com/rust-lang/rust/pull/138759#discussion_r2156375342 where I noticed that we were nearly at this point, plus the comments I was writing in rust-lang/rust#143410 that reminded me a type-dependent `true` is fine.

This PR splits the `OperandRef::builder` logic out to a separate type, with the updates needed to handle SIMD as well.  In doing so, that makes the existing `Aggregate` path in `codegen_rvalue_operand` capable of handing SIMD values just fine.

As a result, we no longer need to do layout calculations for aggregate result types when running the analysis to determine which things can be SSA in codegen.
2025-07-09 16:37:20 +00:00
bors
3a5e13a8b3 Auto merge of #143472 - dianne:deref-pat-column-check, r=Nadrieril
`rustc_pattern_analysis`: always check that deref patterns don't match on the same place as normal constructors

In rust-lang/rust#140106, deref pattern validation was tied to the `deref_patterns` feature to temporarily avoid affecting perf. However:
- As of rust-lang/rust#143414, box patterns are represented as deref patterns in `rustc_pattern_analysis`. Since they can be used by enabling `box_patterns` instead of `deref_patterns`, it was possible for them to skip validation, resulting in an ICE. This fixes that and adds a regression test.
- External tooling (e.g. rust-analyzer) will also need to validate matches containing deref patterns, which was not possible. This fixes that by making `compute_match_usefulness` validate deref patterns by default.

In order to avoid doing an extra pass for anything with patterns, the second commit makes `RustcPatCtxt` keep track of whether it encounters a deref pattern, so that it only does the check if so. This is purely for performance. If the perf impact of the first commit is negligible and the complexity cost introduced by the second commit is significant, it may be worth dropping the latter.

r? `@Nadrieril`
2025-07-09 09:45:36 +00:00
bors
d0188bdb3d Auto merge of #142707 - ashivaram23:drop_wildcard, r=dianqk
Apply effects to `otherwise` edge in dataflow analysis

This allows `ElaborateDrops` to remove drops when a `match` wildcard arm covers multiple no-Drop enum variants. It modifies dataflow analysis to update the `MaybeUninitializedPlaces` and `MaybeInitializedPlaces` data for a block reached through an `otherwise` edge.

Fixes rust-lang/rust#142705.
2025-07-09 03:42:01 +00:00
bors
82c8efd2c8 Auto merge of #134628 - estebank:const-default, r=oli-obk
Make `Default` const and add some `const Default` impls

Full list of `impl const Default` types:

- ()
- bool
- char
- std::ascii::Char
- usize
- u8
- u16
- u32
- u64
- u128
- i8
- i16
- i32
- i64
- i128
- f16
- f32
- f64
- f128
- std::marker::PhantomData<T>
- Option<T>
- std::iter::Empty<T>
- std::ptr::Alignment
- &[T]
- &mut [T]
- &str
- &mut str
- String
- Vec<T>
2025-07-08 14:04:40 +00:00
bors
bd73e9e1fb Auto merge of #143540 - yotamofek:pr/library/simplify-num-fmt, r=tgross35
Simplify num formatting helpers

Noticed `ilog10` was being open-coded when looking at this diff: 85d6768f4c..76d9775912 (diff-6be9b44b52d946ccac652ddb7c98146a01b22ea0fc5737bc10db245a24796a45)
That, and two other small cleanups 😁

(should probably go through perf just to make sure it doesn't regress formatting)
2025-07-08 10:54:22 +00:00
bors
766712c269 Auto merge of #142869 - nnethercote:join_path-mini, r=camelid
Use `join_with_double_colon` in `write_shared.rs`.

For consistency. Also, it's faster because `join_with_double_colon` does a better job estimating the allocation size than `join` from `itertools`.

r? `@camelid`
2025-07-08 06:32:37 +00:00