299335 Commits

Author SHA1 Message Date
Martin Nordholts
aa364cac52 compiler: Deduplicate must_emit_unwind_tables() comments
There is one comment at a call site and one comment in the function
definition that are mostly saying the same thing. Fold the call site
comment into the function definition comment to reduce duplication.

There are actually some inaccuracies in the comments but let's
deduplicate before we address the inaccuracies.
2025-07-07 09:34:34 +02:00
Martin Nordholts
1eff043e7a rustc_codegen_llvm: Remove reference to non-existing no_landing_pads()
Removing this reference was forgotten in eb4725fc54056. Grepping for
no_landing_pads returns no hits after this.
2025-07-07 09:34:34 +02:00
bors
0d11be5aab Auto merge of #143556 - jhpratt:rollup-nid39y2, r=jhpratt
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#143206 (Align attr fixes)
 - rust-lang/rust#143236 (Stabilize `mixed_integer_ops_unsigned_sub`)
 - rust-lang/rust#143344 (Port `#[path]` to the new attribute parsing infrastructure )
 - rust-lang/rust#143359 (Link to 2024 edition page for `!` fallback changes)
 - rust-lang/rust#143456 (mbe: Change `unused_macro_rules` to a `DenseBitSet`)
 - rust-lang/rust#143529 (Renamed retain_mut to retain on LinkedList as mentioned in the ACP)
 - rust-lang/rust#143535 (Remove duplicate word)
 - rust-lang/rust#143544 (compiler: rename BareFn to FnPtr)
 - rust-lang/rust#143552 (lib: more eagerly return `self.len()` from `ceil_char_boundary`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-07 02:03:03 +00:00
Jacob Pratt
2992997f6f
Rollup merge of #143552 - nagisa:makes-ceil-char-boundary-go-zoom, r=jhpratt
lib: more eagerly return `self.len()` from `ceil_char_boundary`

There is no reason to go through the complicated branch as it would
always return `self.len()` in this case. Also helps debug code somewhat
and I guess might make optimizations easier (although I haven't really a
sample to demonstrate this.)

ref. https://github.com/rust-lang/rust/issues/93743
Suggested by `@chrisduerr`
2025-07-07 03:26:09 +02:00
Jacob Pratt
7eea141b87
Rollup merge of #143544 - workingjubilee:rename-bare-fn, r=fmease
compiler: rename BareFn to FnPtr

At some point "BareFn" was the chosen name for a "bare" function, without the niceties of `~fn`, `&fn`, or a few other ways of writing a function type. However, at some point the syntax for a "bare function" and any other function diverged even more. We started calling them what they are: function pointers, denoted by their own syntax.

However, we never changed the *internal* name for these, as this divergence was very gradual. Personally, I have repeatedly searched for "FnPtr" and gotten confused until I find the name is BareFn, only to forget this until the next time, since I don't routinely interact with the higher-level AST and HIR. But even tools that interact with these internal types only touch on them in a few places, making a migration easy enough. Let's use a more intuitive and obvious name, as this 12+ year old name has little to do with current Rust.
2025-07-07 03:26:09 +02:00
Jacob Pratt
3e76cd796f
Rollup merge of #143535 - reallesee:patch-1, r=jdonszelmann
Remove duplicate word

Deleted a duplicated word to improve text clarity.

contains contains - contains
2025-07-07 03:26:08 +02:00
Jacob Pratt
02da294965
Rollup merge of #143529 - pixel27:master, r=jhpratt
Renamed retain_mut to retain on LinkedList as mentioned in the ACP

This is for proposal: https://github.com/rust-lang/libs-team/issues/250

The original check-in (https://github.com/rust-lang/rust/pull/114136) contained both methods **retain** and **retain_mut**, which does not conform to https://github.com/rust-lang/libs-team/issues/250#issuecomment-1766822671.

I updated the retain documentation to specify **&mut e**, removed the **retain** method and renamed **retain_mut** to **retain** to conform to the request.

The pull request doesn't really contain much that is new, just removes the unwanted method to meet the requirements.

I've run the tests "library/alloc" on the code and no issues.

Hopefully I'm not stepping on the original author's toes. I just ran across a need for the method and wondered why it was unstable.
2025-07-07 03:26:08 +02:00
Jacob Pratt
a1b51aa400
Rollup merge of #143456 - joshtriplett:mbe-unused-rules-bitset, r=lqd
mbe: Change `unused_macro_rules` to a `DenseBitSet`

Now that it only contains indexes, and no other information, a bitset provides a more compact and simpler representation.

This builds on <https://github.com/rust-lang/rust/pull/143416>. Only the last commit is new.
2025-07-07 03:26:07 +02:00
Jacob Pratt
11d8667f21
Rollup merge of #143359 - clubby789:fallback-2024-doc, r=ibraheemdev
Link to 2024 edition page for `!` fallback changes

Closes rust-lang/rust#143207
2025-07-07 03:26:07 +02:00
Jacob Pratt
11b24c108d
Rollup merge of #143344 - JonathanBrouwer:path-parser, r=jdonszelmann
Port `#[path]` to the new attribute parsing infrastructure

Ports `#[path]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

This PR duplicates a change from https://github.com/rust-lang/rust/pull/143237
Draft until that one is merged
2025-07-07 03:26:06 +02:00
Jacob Pratt
00c67d1a12
Rollup merge of #143236 - nxsaken:mixed_integer_ops_unsigned_sub, r=ibraheemdev
Stabilize `mixed_integer_ops_unsigned_sub`

Closes rust-lang/rust#126043.
2025-07-07 03:26:06 +02:00
Jacob Pratt
d748e70fea
Rollup merge of #143206 - Jules-Bertholet:align-attr-fixes, r=workingjubilee
Align attr fixes

- Remove references to the superseded `repr(align)` syntax
- Allow the attribute on fn items in `extern` blocks
- Test attribute in combination with `async fn` and `dyn`

r? workingjubilee

Tracking issue: https://github.com/rust-lang/rust/issues/82232
`@rustbot` label A-attributes F-fn_align T-compiler
2025-07-07 03:26:05 +02:00
Simonas Kazlauskas
49806a5486 lib: more eagerly return self.len() from ceil_char_boundary
There is no reason to go through the complicated branch as it would
always return `self.len()` in this case. Also helps debug code somewhat
and I guess might make optimizations easier (although I haven't really a
sample to demonstrate this.)

ref. #93743
Suggested by @chrisduerr
2025-07-07 02:14:58 +03:00
bors
ca98d4d4b3 Auto merge of #141829 - dvdsk:sleep_until_linux, r=cuviper,RalfJung
Specialize sleep_until implementation for unix (except mac)

related tracking issue: https://github.com/rust-lang/rust/issues/113752
Supersedes https://github.com/rust-lang/rust/pull/118480 for the reasons see: https://github.com/rust-lang/rust/issues/113752#issuecomment-2902594469

Replaces the generic catch all implementation with target_os specific ones for: linux/netbsd/freebsd/android/solaris/illumos etc. Other platforms like wasi, macos/ios/tvos/watchos and windows will follow in later separate PR's (once this is merged).
2025-07-06 23:00:51 +00:00
Jules Bertholet
8f86c4abec
Skip align tests on wasm 2025-07-06 18:10:52 -04:00
Jubilee Young
3c9b98699d rustfmt: migrate BareFn -> FnPtr 2025-07-06 15:03:14 -07:00
Jubilee Young
e47f5657e1 clippy: migrate BareFn -> FnPtr 2025-07-06 15:03:14 -07:00
Jubilee Young
5c8ac15dbd rustdoc: migrate BareFn -> FnPtr 2025-07-06 15:03:14 -07:00
Jubilee Young
0a4f87a144 compiler: rename {ast,hir}::BareFn* to FnPtr*
Fix some comments and related types and locals where it is obvious, e.g.
- bare_fn -> fn_ptr
- LifetimeBinderKind::BareFnType -> LifetimeBinderKind::FnPtrType

Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2025-07-06 15:03:08 -07:00
Jules Bertholet
196e3ed943
Add more tests for invalid alignments 2025-07-06 16:56:42 -04:00
Jules Bertholet
1c93e16c10
Add FIXME for gen et al 2025-07-06 16:56:42 -04:00
Jules Bertholet
a144fd64bb
Add test for dyn alignment 2025-07-06 16:56:42 -04:00
Jules Bertholet
ce8ab082cc
Test async fn 2025-07-06 16:56:42 -04:00
Jules Bertholet
a1cefee8d5
Support #[align(…)] on fns in extern blocks 2025-07-06 16:56:41 -04:00
Jules Bertholet
97a7b9b1b4
Remove repr(align) code 2025-07-06 16:56:39 -04:00
Jonathan Brouwer
244d64e60b
Port #[path] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 22:19:16 +02:00
Jonathan Brouwer
ef3d7741e5
Move check for new attribute to check_builtin_meta_item
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 22:18:58 +02:00
bors
a84ab0ce6c Auto merge of #143509 - cjgillot:copy-prop-noborrow, r=tmiasko
Do not unify borrowed locals in CopyProp.

Instead of trying yet another scheme to unify borrowed locals in CopyProp, let's just stop trying. We had already enough miscompilations because of this.

I'm convinced it's possible to have both unification of some borrowed locals and soundness, but I don't have a simple and convincing formulation yet.

Fixes https://github.com/rust-lang/rust/issues/143491
2025-07-06 19:58:07 +00:00
Josh Triplett
8ee1e9817c mbe: Change unused_macro_rules to a DenseBitSet
Now that it only contains indexes, and no other information, a bitset
provides a more compact and simpler representation.
2025-07-06 12:02:23 -07:00
Micke
8b65c2f85f
Remove duplicate word 2025-07-06 20:06:46 +02:00
bors
de031bbcb1 Auto merge of #143526 - matthiaskrgr:rollup-pm69g5v, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#143252 (Rewrite empty attribute lint for new attribute parser)
 - rust-lang/rust#143492 (Use `object` crate from crates.io to fix windows build error)
 - rust-lang/rust#143514 (Organize macro tests a bit more)
 - rust-lang/rust#143518 (rustc_builtin_macros: Make sure registered attributes stay sorted)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-06 16:56:16 +00:00
Camille GILLOT
b1fdb4bdc8 Do not optimize stable-mir ui tests. 2025-07-06 16:11:43 +00:00
dvdsk
61cf174dce
sleep_until: add clock_nanosleep support to Miri
The clock_nanosleep support is there to allow code using `sleep_until`
to run under Miri. Therefore the implementation is minimal.
- Only the clocks REALTIME and MONOTONIC are supported. The first is supported simply
because it was trivial to add not because it was needed for sleep_until.
- The only supported flag combinations are no flags or TIMER_ABSTIME only.
If an unsupported flag combination or clock is passed in this throws
unsupported.
2025-07-06 17:49:35 +02:00
dvdsk
f24ee2c9b1
sleep_until: use clock_nanosleep where possible
Using clock nanosleep leads to more accurate sleep times on platforms
where it is supported.

To enable using clock_nanosleep this makes `sleep_until` platform
specific. That unfortunatly requires identical placeholder
implementations for the other platforms (windows/mac/wasm etc).

we will land platform specific implementations for those later. See the
`sleep_until` tracking issue.

This requires an accessors for the Instant type. As that accessor is only
used on the platforms that have clock_nanosleep it is marked as allow_unused.

32bit time_t targets do not use clock_nanosleep atm, they instead rely
on the same placeholder as the other platforms. We could make them
use clock_nanosleep too in the future using `__clock_nanosleep_time64`.

__clock_nanosleep_time64 is documented at:
https://www.gnu.org/software/libc/manual/html_node/64_002dbit-time-symbol-handling.html
2025-07-06 17:36:49 +02:00
Joshua Gentry
39575d39c5 Renamed retain_mut to retain on LinkedList as mentioned in the ACP 2025-07-06 10:40:55 -04:00
Matthias Krüger
bff79a7517
Rollup merge of #143518 - joshtriplett:sort-attrs, r=Kobzol
rustc_builtin_macros: Make sure registered attributes stay sorted

As with the list of builtin macros, use tidy to make sure the list of
builtin attributes stays sorted.
2025-07-06 15:56:14 +02:00
Matthias Krüger
05146ab802
Rollup merge of #143514 - joshtriplett:macro-test-organization, r=jieyouxu
Organize macro tests a bit more

- Move some macro parsing tests from `tests/ui/parser` to `tests/ui/parser/macro`.

- Most macro tests use `macro` in the name, making it easy to find and run tests relevant to macros. However, a few use `mbe` instead. Rename those to say `macro`.
2025-07-06 15:56:13 +02:00
Matthias Krüger
bae6714fe2
Rollup merge of #143492 - Diggsey:db-fix-object-ambiguity, r=RalfJung
Use `object` crate from crates.io to fix windows build error

See https://rust-lang.zulipchat.com/#narrow/channel/386786-rustc-codegen-gcc/topic/Cannot.20compile.20rustc.20on.20Windows.2010/with/527240094
2025-07-06 15:56:13 +02:00
Matthias Krüger
017fe2fb8f
Rollup merge of #143252 - JonathanBrouwer:rewrite_empty_attribute, r=jdonszelmann
Rewrite empty attribute lint for new attribute parser

cc `@jdonszelmann`
2025-07-06 15:56:12 +02:00
bors
3c95364c4a Auto merge of #143515 - rust-lang:cargo_update, r=clubby789
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.
r? dep-bumps

The following is the output from `cargo update`:

```txt

compiler & tools dependencies:
     Locking 6 packages to latest compatible versions
      Adding io-uring v0.7.8
    Updating jsonpath-rust v1.0.2 -> v1.0.3
    Updating libffi v4.1.0 -> v4.1.1
    Updating libffi-sys v3.3.1 -> v3.3.2
    Updating tokio v1.45.1 -> v1.46.1
    Updating wasm-component-ld v0.5.14 -> v0.5.15
note: pass `--verbose` to see 41 unchanged dependencies behind latest

library dependencies:
     Locking 0 packages to latest compatible versions
note: pass `--verbose` to see 4 unchanged dependencies behind latest

rustbook dependencies:
     Locking 1 package to latest compatible version
    Updating cc v1.2.27 -> v1.2.29
```
2025-07-06 13:53:52 +00:00
bors
c83e217d26 Auto merge of #143521 - matthiaskrgr:rollup-kpv1og3, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#143416 (mbe: Defer checks for `compile_error!` until reporting an unused macro rule)
 - rust-lang/rust#143470 (std: sys: net: uefi: tcp4: Implement read)
 - rust-lang/rust#143477 (use `is_multiple_of` and `div_ceil`)
 - rust-lang/rust#143484 (distinguish the duplicate item of rpitit)
 - rust-lang/rust#143493 (tidy: use --bless for tidy spellcheck instead of spellcheck:fix)
 - rust-lang/rust#143504 (compiletest: print slightly more information on fs::write failure)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-06 10:20:27 +00:00
Camille GILLOT
bab9c752e8 Do not unify borrowed locals in CopyProp. 2025-07-06 10:14:07 +00:00
Matthias Krüger
097efc07cc
Rollup merge of #143504 - RalfJung:compiletest-err, r=jieyouxu
compiletest: print slightly more information on fs::write failure

See [#t-infra > compiletest: panic in dump_output_file: No such file or dire @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/compiletest.3A.20panic.20in.20dump_output_file.3A.20No.20such.20file.20or.20dire/near/527294714)
2025-07-06 10:03:24 +02:00
Matthias Krüger
e25654fb94
Rollup merge of #143493 - lolbinarycat:tidy-spellcheck-bless, r=Kobzol
tidy: use --bless for tidy spellcheck instead of spellcheck:fix

previous behavior was inconsistent with existing extra checks.

unsure if this needs a change tracker entry or a warning for people who try to use the old behavior.

unsure if we should call this `spellcheck:lint` for consistency.

making this consistent is a prerequisite for https://github.com/rust-lang/rust/pull/143398

cc `@nnethercote`

r? `@Kobzol`
2025-07-06 10:03:24 +02:00
Matthias Krüger
534c09a779
Rollup merge of #143484 - bvanjoi:issue-140796, r=compiler-errors
distinguish the duplicate item of rpitit

Fixes rust-lang/rust#140796

r? compiler

cc `@Zoxc`
2025-07-06 10:03:23 +02:00
Matthias Krüger
6fb00b1514
Rollup merge of #143477 - folkertdev:use-is-multiple-of, r=joshtriplett
use `is_multiple_of` and `div_ceil`

In tricky logic, these functions are much more informative than the manual implementations. They also catch subtle bugs:

- the manual `is_multiple_of` often does not handle division by zero
- manual `div_ceil` often does not consider overflow

The transformation is free for `is_multiple_of` if the divisor is compile-time known to be non-zero. For `div_ceil` there is a small cost to considering overflow. Here is some assembly https://godbolt.org/z/5zP8KaE1d.
2025-07-06 10:03:23 +02:00
Matthias Krüger
19f8ba4733
Rollup merge of #143470 - Ayush1325:uefi-tcp4-recv, r=joshtriplett
std: sys: net: uefi: tcp4: Implement read

- A blocking implementation of tcp4 read.
- Basically a copy of [write](https://github.com/rust-lang/rust/pull/141532)
2025-07-06 10:03:22 +02:00
Matthias Krüger
71b73e529a
Rollup merge of #143416 - joshtriplett:mbe-simplifications, r=nnethercote
mbe: Defer checks for `compile_error!` until reporting an unused macro rule

The current MBE parser checks rules at initial parse time to see if their RHS has `compile_error!` in it, and returns a list of rule indexes and LHS spans that don't map to `compile_error!`, for use in unused macro rule checking.

Instead, have the unused macro rule reporting ask the macro for the rule to report, and let the macro check at that time. That avoids checking rules unless they're unused.

In the process, refactor the data structure used to store macro rules, to group the LHS and RHS (and LHS span) of each rule together, and refactor the unused rule tracking to only track rule indexes.

This builds atop a couple of minor MBE refactors. I would suggest reviewing commit-by-commit.

The overall result is a further simplification of the macro code.
2025-07-06 10:03:22 +02:00
Jonathan Brouwer
33f2cc7eda
Fix line break after ":" in unpretty attribute print
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 09:51:47 +02:00
Jonathan Brouwer
3fa0ec91d8
Rewrite empty attribute lint
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 09:51:35 +02:00