304366 Commits

Author SHA1 Message Date
Guillaume Gomez
f948c79911
Rollup merge of #142472 - GuillaumeGomez:doc-attribute-attribute, r=fmease
Add new `doc(attribute = "...")` attribute

Fixes rust-lang/rust#141123.

The implementation and purpose of this new `#[doc(attribute = "...")]` attribute is very close to `#[doc(keyword = "...")]`. Which means that luckily for us, most of the code needed was already in place and `@Noratrieb` nicely wrote a first draft that helped me implement this new attribute very fast.

Now with all this said, there is one thing I didn't do yet: adding a `rustdoc-js-std` test. I added GUI tests with search results for attributes so should be fine but I still plan on adding one for it once documentation for builtin attributes will be written into the core/std libs.

You can test it [here](https://rustdoc.crud.net/imperio/doc-attribute-attribute/foo/index.html).

cc `@Noratrieb` `@Veykril`
2025-08-28 21:41:00 +02:00
bjorn3
23e72ab41e Move ___asan_globals_registered export
All other sanitizer symbols are handled in prepare_lto already.
2025-08-28 19:36:51 +00:00
bjorn3
d76cff3f06 Only export the sanitizer symbols for LTO and move export code to cg_llvm
Don't export them from cdylibs. There is no need to do so and it
complicates exported_non_generic_symbols. In addition the GCC backend
likely uses different symbols and may potentially not even need us to
explicitly tell it to export the symbols it needs.
2025-08-28 19:36:44 +00:00
Martin Nordholts
4edfeb2f60 compiler: Include span of too huge enum with -Cdebuginfo=2
We have a ui test to ensure we emit an error if we encounter too big
enums. Before this fix, compiling the test with `-Cdebuginfo=2` would
not include the span of the instantiation site, because the error is
then emitted from a different code path that does not include the span.

Propagate the span to the error also in the debuginfo case, so the test
passes regardless of debuginfo level.
2025-08-28 20:37:09 +02:00
Jonathan Brouwer
e0bdc46d94
Update uitest stderr
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-28 20:05:04 +02:00
Jonathan Brouwer
f328709276
Improve error messages around invalid literals in attribute arguments
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-28 20:05:04 +02:00
Jonathan Brouwer
2c7dfa91b5
Add another case to the bad-lit-suffixes test
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-28 19:23:55 +02:00
bors
35d55b34bf Auto merge of #145807 - zachs18:only-consider-auto-traits-empty, r=compiler-errors
When determining if a trait has no entries for the purposes of omitting vptrs from subtrait vtables, consider its transitive supertraits' entries, instead of just its own entries.

When determining if a non-first supertrait vptr can be omitted from a subtrait vtable, check if the supertrait or any of its (transitive) supertraits have methods, instead of only checking if the supertrait itself has methods.

This fixes the soundness issue where a vptr would be omitted for a supertrait with no methods but that itself had a supertrait with methods, while still optimizing the case where the supertrait is "truly" empty (it has no own vtable entries, and none of its (transitive) supertraits have any own vtable entries).

Fixes <https://github.com/rust-lang/rust/issues/145752>

-----

Old description:

~~Treat all non-auto traits as non-empty (possibly having methods) for purposes of determining if we need to emit a vptr for a non-direct supertrait (and for new "sibling" entries after a direct or non-direct supertrait).~~

This fixes (I believe) the soundness issue, ~~but regresses vtable sizes and possibly upcasting perf in some cases when using trait hierarchies with empty non-auto traits (see `tests/ui/traits/vtable/multiple-markers.stderr`) since we use vptrs in some cases where we could re-use the vtable.~~

Fixes <https://github.com/rust-lang/rust/issues/145752>

Re-opens (not anymore) <https://github.com/rust-lang/rust/issues/114942>

Should not affect <https://github.com/rust-lang/rust/issues/131813> (i.e. the soundness issue is still fixed, ~~though the relevant vtables in the `trait Evil` example will be larger now~~)

cc implementation history <https://github.com/rust-lang/rust/pull/131864> <https://github.com/rust-lang/rust/pull/113856>

-----

~~It should be possible to check if a trait has any methods from itself *or* supertraits (instead of just from itself), but to fix the immediate soundness issue, just assume any non-auto trait could have methods. A more optimistic check can be implemented later (or if someone does it soon it could just supercede this PR 😄).~~ Done in latest push

`@rustbot` label A-dyn-trait F-trait_upcasting
2025-08-28 16:49:32 +00:00
Guillaume Gomez
f3c023433f Add ui test for unsupported doc(attribute = "...") case for attributes with namespace 2025-08-28 18:24:58 +02:00
Guillaume Gomez
10bd61dcf2 Create new Item::is_fake_item method as equivalent to check for is_primitive, is_keyword and is_attribute methods 2025-08-28 18:24:58 +02:00
Guillaume Gomez
38e8963b14 Add documentation for doc(attribute = "...") attribute 2025-08-28 18:24:58 +02:00
Guillaume Gomez
75cbd05d19 Add tests for doc(attribute = "...") attribute 2025-08-28 15:56:30 +02:00
Guillaume Gomez
ab0ee84eac Add new doc(attribute = "...") attribute 2025-08-28 15:56:29 +02:00
bors
1f7dcc878d Auto merge of #145958 - Zalathar:rollup-ii9z77c, r=Zalathar
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#142727 (wasm: rm static mut)
 - rust-lang/rust#143193 (Port `#[link]` to the new attribute parsing infrastructure )
 - rust-lang/rust#144864 (No source fixes)
 - rust-lang/rust#145913 (Add spin_loop hint for LoongArch)
 - rust-lang/rust#145926 (compiletest: Remove several remnants of the old libtest-based executor)
 - rust-lang/rust#145928 (Rename `Location::file_with_nul` to `file_as_c_str`)
 - rust-lang/rust#145930 (`const`ify (the unstable) `str::as_str`)
 - rust-lang/rust#145941 (Disable `integer_to_ptr_transmutes` suggestion for unsized types)
 - rust-lang/rust#145953 (Update `icu_list` to 2.0)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-28 13:41:38 +00:00
Stuart Cook
556d2fa94b
Rollup merge of #145953 - robertbastian:master, r=Manishearth
Update `icu_list` to 2.0

This updates the `icu_list` crate, which is used for error formatting, from 1.5 to 2.0.
2025-08-28 23:10:37 +10:00
Stuart Cook
72727b1654
Rollup merge of #145941 - Urgau:int_to_ptr_transmutes-unsized, r=lcnr
Disable `integer_to_ptr_transmutes` suggestion for unsized types

This PR disables the machine-applicable `integer_to_ptr_transmutes` lint suggestion for unsized types, as [`std::ptr::with_exposed_provenance`](https://doc.rust-lang.org/std/ptr/fn.with_exposed_provenance.html) requires sized types.

We should probably mention [`std::ptr::from_raw_parts`](https://doc.rust-lang.org/std/ptr/fn.from_raw_parts.html) when it becomes stable.

Related to https://github.com/rust-lang/rust/issues/145935
2025-08-28 23:10:37 +10:00
Stuart Cook
f6c56bcd66
Rollup merge of #145930 - GrigorenkoPV:const_str_as_str, r=joshtriplett
`const`ify (the unstable) `str::as_str`

Tracking issue: rust-lang/rust#130366

The method was not initially marked `const` presumably because it is only useful with `Deref`. But now that const traits seem to be a thing that can actually become real, why not make it `const`?

PR `const`ifying `Deref`: rust-lang/rust#145279
2025-08-28 23:10:36 +10:00
Stuart Cook
c838117620
Rollup merge of #145928 - Darksonn:file_as_c_str, r=joshtriplett
Rename `Location::file_with_nul` to `file_as_c_str`

This renames the method to be consistent with the ongoing T-libs-api FCP found at https://github.com/rust-lang/rust/issues/141727#issuecomment-3228016708.

I did not rename the unstable feature as we are going to be stabilizing it soon anyway. This will probably break RfL, so it will require an updated commit hash for the Linux Kernel that I will add here soon.

r? `@Amanieu`
2025-08-28 23:10:35 +10:00
Stuart Cook
d2ce84e306
Rollup merge of #145926 - Zalathar:no-libtest, r=jieyouxu
compiletest: Remove several remnants of the old libtest-based executor

I noticed a few bits of low-hanging cleanup that are possible now that the non-libtest executor is well and truly established.
2025-08-28 23:10:35 +10:00
Stuart Cook
3f89664f64
Rollup merge of #145913 - heiher:loong-hint, r=joshtriplett
Add spin_loop hint for LoongArch
2025-08-28 23:10:34 +10:00
Stuart Cook
2fae59ac96
Rollup merge of #144864 - Muscraft:no-source-fixes, r=jieyouxu
No source fixes

This PR started as a fix for a rendering bug that [got noticed in #143661](https://github.com/rust-lang/rust/pull/143661#discussion_r2199109530), but turned into a fix for any rendering bugs related to files with no source.
- Don't add an end column separator after a file with no source
- Add column separator before secondary messages with no source
- Render continuation between no source labels

Before
```
error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap`
   ╭▸ $DIR/multi-suggestion.rs:17:13
   │
LL │     let _ = std::collections::HashMap();
   │             ━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
   │
   ╰ note: `std::collections::HashMap` defined here
   ╰╴
note: constructor is not visible here due to private fields
   ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL
   │
   ╰ note: private field
   │
   ╰ note: private field
```

After
```
error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap`
   ╭▸ $DIR/multi-suggestion.rs:17:13
   │
LL │     let _ = std::collections::HashMap();
   │             ━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ╰╴
   ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
   │
   ╰ note: `std::collections::HashMap` defined here
note: constructor is not visible here due to private fields
   ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL
   │
   ├ note: private field
   │
   ╰ note: private field
```

Note: This PR also makes it so `rustc` and `annotate-snippets` match in these cases
2025-08-28 23:10:34 +10:00
Stuart Cook
a65ed63b3b
Rollup merge of #143193 - JonathanBrouwer:link_rework, r=jdonszelmann
Port `#[link]` to the new attribute parsing infrastructure

Ports `link` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197
2025-08-28 23:10:33 +10:00
Stuart Cook
bd8fb60977
Rollup merge of #142727 - hkBst:rm-static-mut-wasm, r=ChrisDenton
wasm: rm static mut

More https://github.com/rust-lang/rust/issues/125035. I'm not sure this is correct, but it compiles.
2025-08-28 23:10:32 +10:00
Nicholas Nethercote
475c29d30f Add rustc-demangle to [workspace.dependencies]. 2025-08-28 20:12:16 +10:00
Nicholas Nethercote
b16c66ee83 Add polonius-engine to [workspace.dependencies]. 2025-08-28 20:12:16 +10:00
Nicholas Nethercote
20d03752c5 Add odht to [workspace.dependencies]. 2025-08-28 20:12:16 +10:00
Nicholas Nethercote
42359b7026 Add scoped-tls to [workspace.dependencies]. 2025-08-28 20:12:16 +10:00
Nicholas Nethercote
8fc0813e29 Add measureme to [workspace.dependencies]. 2025-08-28 20:12:14 +10:00
Nicholas Nethercote
e692c97ad3 Add derive-where to [workspace.dependencies]. 2025-08-28 20:11:52 +10:00
Nicholas Nethercote
2b26476ccd Add rustc-hash to [workspace.dependencies]. 2025-08-28 20:11:43 +10:00
Nicholas Nethercote
77b047aaab Add indexmap to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
Nicholas Nethercote
77d2f0c16e Add tempfile to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
Nicholas Nethercote
ce02d34b2f Add rustc_apfloat to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
Nicholas Nethercote
1ed5660266 Add proc-macro2 and quote to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
Nicholas Nethercote
d263d3a88c Add either to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
Nicholas Nethercote
daf6fe2c1b Add serde_json to [workspace.dependencies]. 2025-08-28 20:10:54 +10:00
Nicholas Nethercote
12dc789bc6 Add libc to [workspace.dependencies]. 2025-08-28 20:10:54 +10:00
Nicholas Nethercote
75060001c0 Add an overlooked tracing to [workspace.dependencies]. 2025-08-28 20:10:54 +10:00
Robert Bastian
359cbd205f Use default locale fallback data 2025-08-28 09:48:54 +00:00
Robert Bastian
d82a20e025 Bump icu_list to 2.0 2025-08-28 09:38:55 +00:00
bors
b41634205b Auto merge of #145891 - nikic:llvm-21.1.0, r=cuviper
Update to LLVM 21.1.0
2025-08-28 06:14:22 +00:00
The rustc-josh-sync Cronjob Bot
e36d827a4e Merge ref 'd36f96412516' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: d36f964125163c2e698de5559efefb8217b8b7f0
Filtered ref: 92461731ae79cfe5044e4826160665b77c0363a2

This merge was created using https://github.com/rust-lang/josh-sync.
2025-08-28 04:13:43 +00:00
The rustc-josh-sync Cronjob Bot
202eb0b375 Prepare for merging from rust-lang/rust
This updates the rust-version file to d36f964125163c2e698de5559efefb8217b8b7f0.
2025-08-28 04:11:40 +00:00
bors
43a216604a Auto merge of #145949 - jhpratt:rollup-smzd7tr, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#145382 (Add assembly test for `-Zreg-struct-return` option)
 - rust-lang/rust#145746 (Fix STD build failing for target_os = "espidf")
 - rust-lang/rust#145826 (Use AcceptContext in AttribueParser::check_target)
 - rust-lang/rust#145894 (Ensure the coordinator thread terminates before its channels drop)
 - rust-lang/rust#145946 (Remove unnecessary `[dependencies.unicode-properties]` entries.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-28 03:06:52 +00:00
Jacob Pratt
27d6005f7a
Rollup merge of #145946 - nnethercote:cargo-style, r=jdonszelmann
Remove unnecessary `[dependencies.unicode-properties]` entries.

The Cargo style guide says to put dependencies on a single line if they fit.

r? `@jdonszelmann`
2025-08-27 21:51:54 -04:00
Jacob Pratt
5527156d92
Rollup merge of #145894 - zetanumbers:issue-142949, r=WaffleLapkin
Ensure the coordinator thread terminates before its channels drop

Fixes rust-lang/rust#142949

Explanation: https://github.com/rust-lang/rust/issues/142949#issuecomment-3224573185
2025-08-27 21:51:54 -04:00
Jacob Pratt
64d0d1d668
Rollup merge of #145826 - scrabsha:push-vrpwttmzqwpt, r=jdonszelmann
Use AcceptContext in AttribueParser::check_target
2025-08-27 21:51:53 -04:00
Jacob Pratt
ad42340e39
Rollup merge of #145746 - ivmarkov:fix-nofollow-espidf, r=ibraheemdev
Fix STD build failing for target_os = "espidf"

A regression from rust-lang/rust#142938

cc `@lolbinarycat`
cc `@ibraheemdev`

ESP-IDF (and a few other embedded Tier-3 systems) is considered `cfg(unix)`, but it does not have the `O_NOFOLLOW` flag because neither of its three supported filesystems (FATFS, LitteLF and Spiffs) has symbolic links in the first place.

What this fix does is to keep the `set_permissions_nofollow` method available and non-failing for ESP-IDF, but it behaves as if no `O_NONFOLLOW` was set. This should be fine as there is nothing to follow in the first place, as there are no symbolic links there.

EDIT: Also added the same fix for Horizon, as requested by `@Meziu.`
2025-08-27 21:51:53 -04:00
Jacob Pratt
a1c543e165
Rollup merge of #145382 - winstonallo:reg-struct-return-asm-test, r=tgross35
Add assembly test for `-Zreg-struct-return` option

r? `@tgross35`

As discussed in rust-lang/rust#145309 with `@tgross35` and `@ojeda,` I added assembly tests for the `-Zreg-struct-return` option verifying that it changes the ABI from hidden pointer to register-return on x86_32.

The test covers:
- Direct struct construction, showing register return vs hidden pointer
- External function calls returning structs, showing ABI mismatch handling

Different memory layouts affect ABI mismatch handling, but register returns use the same register allocation regardless of struct field layout (apart from the fact that they use smaller registers for smaller structs, of course).

[Here](https://godbolt.org/z/dcW6rnMG3) is a compiler explorer with 2 examples. Let me know if there is anything more I could add. Since register returns only happen for structs up to the size of 2 registers, I figured testing the pivot value (8 bytes) would be most critical.
2025-08-27 21:51:52 -04:00
bors
d36f964125 Auto merge of #145877 - nikic:capture-address, r=tmiasko
Use captures(address) instead of captures(none) for indirect args

While provenance cannot be captured through these arguments, the address / object identity can.

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

r? `@ghost`
2025-08-28 00:01:22 +00:00