Commit graph

311669 commits

Author SHA1 Message Date
reddevilmidzy
941a17a15a Relocate 5 tests from tests/ui/issues
Relocate issues/issue-51154.rs to closures/box-generic-closure.rs

Relocate issues/issue-51515.rs to
borrowck/assignment-to-immutable-ref.rs

Relocate issues/issue-53348.rs to mismatched_types/deref-string-assign.rs

Relocate issues/issue-52717.rs to
pattern/match-enum-struct-variant-field-missing.rs

Relocate issues/issue-53300.rs to
type/cannot-find-wrapper-with-impl-trait.rs
2025-11-27 00:39:52 +09:00
bors
6840234806 Auto merge of #147799 - Enselic:slash-slash-at-debuginfo-tests, r=saethlin
compiletest: Use `//@` prefixes also for debuginfo test directives

So that when we later add support for revisions we can use the same syntax for revisions as elsewhere (for https://github.com/rust-lang/rust/pull/147426).

This also prevents people from making typos for commands since `src/tools/compiletest/src/directives/directive_names.rs` will catch such typos now.

Note that we add one FIXME for a non-trivial change for later:
```
// FIXME(#148097): Change `// cdb-checksimple_closure` to `//@ cdb-check:simple_closure`
```

### TODO
- [x] Triple-check that all tests still run and all directives are still applied. Done: https://github.com/rust-lang/rust/pull/147799#issuecomment-3478986910

### Zulip discussion

https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/.2F.2F.40.20syntax.20for.20debuginfo.20tests/with/545015582
2025-11-26 06:51:20 +00:00
bors
d8a7534127 Auto merge of #149330 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

7 commits in 9fa462fe3a81e07e0bfdcc75c29d312c55113ebb..2a7c4960677971f88458b0f8b461a866836dff59
2025-11-21 20:49:51 +0000 to 2025-11-25 19:58:07 +0000
- docs(config-include): prepare for doc stabilization  (rust-lang/cargo#16301)
- fix(config-include): remove support of single string shorthand (rust-lang/cargo#16298)
- Revert "feat: Do not lock the artifact-dir for check builds" (rust-lang/cargo#16299)
- clean: Add --workspace support (rust-lang/cargo#16263)
- feat(tree): Add more native completions (rust-lang/cargo#16296)
- fix(package): exclude target/package from backups (rust-lang/cargo#16272)
- test: re-enable test since not flaky anymore (rust-lang/cargo#16287)
2025-11-26 03:37:04 +00:00
Weihang Lo
c2bbd6be1e
Update cargo submodule 2025-11-25 15:31:45 -05:00
bors
80d8f292d8 Auto merge of #149322 - matthiaskrgr:rollup-uf0hmx6, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#147736 (Stabilize `asm_cfg`)
 - rust-lang/rust#148652 (Cleanup and refactor FnCtxt::report_no_match_method_error)
 - rust-lang/rust#149167 (skip checking supertraits in object candidate for `NormalizesTo` goal)
 - rust-lang/rust#149210 (fix: Do not ICE on normalization failure of an extern static item)
 - rust-lang/rust#149268 (add implementation-internal namespace for globalasm)
 - rust-lang/rust#149274 (Fix invalid link generation for type alias methods)
 - rust-lang/rust#149302 (Fix comment wording in simplify_comparison_integral.rs)
 - rust-lang/rust#149305 (Simplify OnceCell Clone impl)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-25 17:52:25 +00:00
Matthias Krüger
f40d8256eb
Rollup merge of #149305 - tisonkun:oncecell-simplify, r=chenyukang
Simplify OnceCell Clone impl

Noticed when developing https://github.com/fast/mea/pull/79.

This may also apply to `OnceLock`. But unfortunately, we can't construct a completed `Once` beforehand.

Note that `OnceCell::from` is marked as [`rustc_const_unstable`](https://github.com/rust-lang/rust/issues/143773) so we don't need an extra `const fn from_value` to leverage possible const convert benefit.
2025-11-25 17:51:19 +01:00
Matthias Krüger
ac7b0bd7a8
Rollup merge of #149302 - zjumathcode:main, r=jackh726
Fix comment wording in simplify_comparison_integral.rs

This change corrects the wording in a comment within `simplify_comparison_integral.rs`, changing "user" to "used" to accurately describe that a moved value cannot be used later on.

The adjustment improves code documentation clarity while maintaining consistency with our standards for precise terminology in comments.
2025-11-25 17:51:17 +01:00
Matthias Krüger
d6966fa15a
Rollup merge of #149274 - GuillaumeGomez:tyalias-method-link, r=lolbinarycat
Fix invalid link generation for type alias methods

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

That one was quite the wild ride. First commit is the actual fix, the second commit is just a small name variable improvement while I was going through the code. Anyway, let's go through it:

 * We don't generate directly implementations in the HTML files for local impls (which I think is a mistake and should be changed, gonna do that as a follow-up) but instead generate a JS file for each type alias containing the HTML for these impls.
 * So in `write_shared.rs::TypeAliasPart::get`, when generating the JS file, we generate the impl into a `String` by calling `render_impl`. This method expects an `AssocItemLink` to help it generate the correct link to the item (I'm planning to also remove this enum because it's yet another way to generate anchors/hrefs).
 * Problem was: we call the `provided_trait_methods` method on the impl item... which is empty if not a trait impl. This becomes an issue when we arrive in `render::assoc_href_attr` because of this code:
     ```rust
            AssocItemLink::GotoSource(did, provided_methods) => {
                let item_type = match item_type {
                    ItemType::Method | ItemType::TyMethod => {
                        if provided_methods.contains(&name) {
                            ItemType::Method
                        } else {
                            ItemType::TyMethod
                        }
                    }
                    item_type => item_type,
                };
                // ...
            }
    ```

     Since `provided_methods` is always empty, it means all methods on type aliases will be `TyMethod`, generating `#tymethod.` URLs instead of `#method.`.
 * So generating `AssocItemLink::GoToSource` only on traits (when `provided_trait_methods` is supposed to return something) was the fix.
 * And finally, because it's (currently) generating implementations only through JS, it means we cannot test it in `tests/rustdoc` so I had to write the test in `tests/rustdoc-gui`. Once I change how we generate local implementations for type aliases, I'll move it to `tests/rustdoc`.

r? ```@lolbinarycat```
2025-11-25 17:51:17 +01:00
Matthias Krüger
50237b33d6
Rollup merge of #149268 - davidtwco:v0-mangling-global-asm-namespace, r=Kivooeo
add implementation-internal namespace for globalasm

Fixes rust-lang/rust#138261

Adds a namespace for `global_asm` with a lowercase letter which [is reserved for implementation-internal disambiguation](https://doc.rust-lang.org/rustc/symbol-mangling/v0.html#namespace:~:text=Lowercase%20letters%20are%20reserved%20for%20implementation%2Dinternal%20disambiguation%20categories%20(and%20demanglers%20should%20never%20show%20them)):

> Lowercase letters are reserved for implementation-internal disambiguation categories (and demanglers should never show them)

As a implementation-internal disambiguation category, the demangler implementations shouldn't need updated (i.e. if this were an uppercase letter, then our mangle-then-demangle checks would fail because the demangler would expect to have explicit handling). `'a'` is chosen arbitrarily, for **a**sm, but I can change it to something else if preferred.

`#[rustc_symbol_name]` only looks at top-level items, and would need a bunch of changes to be able to check the symbol for `foo::{constant}::{closure}` in the `global_asm` in this test, so for now the test just checks this compiles.

The alternative to this would be to prohibit declaration of items in the operand of a `global_asm`, which is a breaking change.
2025-11-25 17:51:16 +01:00
Matthias Krüger
2f566a88f4
Rollup merge of #149210 - ShoyuVanilla:issue-148161, r=jdonszelmann
fix: Do not ICE on normalization failure of an extern static item

Fixes https://github.com/rust-lang/rust/issues/148161
2025-11-25 17:51:16 +01:00
Matthias Krüger
53276ad027
Rollup merge of #149167 - adwinwhite:next-245, r=lcnr
skip checking supertraits in object candidate for `NormalizesTo` goal

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/245.

r? `@lcnr`
2025-11-25 17:51:15 +01:00
Matthias Krüger
7c96106cb0
Rollup merge of #148652 - rperier:report_no_match_method_error-refactoring, r=lcnr
Cleanup and refactor FnCtxt::report_no_match_method_error

As discussed on zulip with ```@lcnr,``` this is a proposal for refactorizing this method.

See [#t-compiler/help > (PR #144674) Merge multiple suggestions into a single @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.28PR.20.23144674.29.20Merge.20multiple.20suggestions.20into.20a.20single/near/539991695)
2025-11-25 17:51:14 +01:00
Matthias Krüger
04e4f95e7e
Rollup merge of #147736 - folkertdev:stabilize-asm-cfg, r=jdonszelmann
Stabilize `asm_cfg`

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

Reference PR:

- https://github.com/rust-lang/reference/pull/2063

# Request for Stabilization

## Summary

The `cfg_asm` feature allows `#[cfg(...)]` and `#[cfg_attr(...)]` on  the arguments of the assembly macros, for instance:

```rust
asm!( // or global_asm! or naked_asm!
    "nop",
    #[cfg(target_feature = "sse2")]
    "nop",
    // ...
    #[cfg(target_feature = "sse2")]
    a = const 123, // only used on sse2
);
```

## Semantics

Templates, operands, `options` and `clobber_abi` in the assembly macros (`asm!`, `naked_asm!` and `global_asm!`) can be annotated with `#[cfg(...)]` and `#[cfg_attr(...)]`. When the condition evaluates to true, the annotated argument has no effect, and is completely ignored when expanding the assembly macro.
## Documentation

reference PR: https://github.com/rust-lang/reference/pull/2063

## Tests

- [tests/ui/asm/cfg.rs](https://github.com/rust-lang/rust/blob/master/tests/ui/asm/cfg.rs) checks that `cfg`'d arguments where the condition evaluates to false have no effect
- [tests/ui/asm/cfg-parse-error.rs](https://github.com/rust-lang/rust/blob/master/tests/ui/asm/cfg.rs) checks the parsing rules (parsing effectively assumes that the cfg conditions are all true)

## History

- https://github.com/rust-lang/rust/issues/140279
- https://github.com/rust-lang/rust/pull/140367

# Resolved questions

**how are other attributes handled**

Other attributes are parsed,  but explicitly rejected.

# unresolved questions

**operand before template**

The current implementation expects at least one template string before any operands. In the example below, if the `cfg` condition evaluates to true, the assembly block is ill-formed. But even when it evaluates to `false` this block is rejected, because the parser still expects just a template (a template is parsed as an expression and then validated to ensure that it is or expands to a string literal).

Changing how this works is difficult.
```rust
// This is rejected because `a = out(reg) x` does not parse as an expresion.
asm!(
	#[cfg(false)]
	a = out(reg) x, //~ ERROR expected token: `,`
	"",
);
```

**lint on positional arguments?**

Adding a lint to warn on the definition or use of positional arguments being `cfg`'d out was discussed in https://github.com/rust-lang/rust/issues/140279#issuecomment-2832237372 and subsequent comments. Such a lint is not currently implemented, but that may not be a blocker based on the comments there.

r? `@traviscross` (I'm assuming you'll reassign as needed)
2025-11-25 17:51:13 +01:00
David Wood
8ed8f1892c
add implementation-internal namespace for globalasm 2025-11-25 13:56:43 +00:00
bors
0f6dae4afc Auto merge of #148122 - saethlin:deny-deref-nullptr, r=petrochenkov
Make deref_nullptr deny by default instead of warn

This lint was added 4 years ago in https://github.com/rust-lang/rust/pull/83948 and I cannot find any discussion on that PR or its issue about whether it should be warn or deny by default.

I think keeping this lint to warn was at one point in the past justifiable because of the old bindgen behavior of generating tests that do null pointer derefs. I've certainly heard that argument. I don't think it holds up now, so I think we should be more firm about code that is definitely UB.

We merged https://github.com/rust-lang/rust/pull/134424 which adds a runtime check for null pointer reads/writes, with very little fanfare. So now we know things like: This lint warns on 111 crates in crater, but 106 crates are encountering the runtime UB check. 65 crates hit both the lint and a runtime check. Of the 46 crates that only hit the lint, 25 look to me like machine-generated bindings, and all hits except 3a0eff4bd1/src/main.rs (L454) are trying to compute a field offset, and should use `offset_of!`.

Based on the contents of the crater runs for 1.91, I'd expect these crates to go from test-fail to build-fail as a result of this change:
```
gh/bernardjason/rust-invaders
gh/Leinnan/doppler
gh/Max-E/rust-gl-python-gtk
gh/nslebruh/rust-opengl-glfw
gh/nslebruh/rust_physics_gl_test
gh/oraoto/php-stacktrace
gh/playXE/jsrs
gh/Plecra/asm-w-ownership
gh/TateKennington/ROpenGL
gh/WillFarris/voxel-game
reg/ochre
```
Most of the crates where the lint fires already don't build for other reasons (note there are a lot of C bindings wrapper crates in the set).
2025-11-25 13:51:31 +00:00
bors
7934bbdf84 Auto merge of #149148 - davidtwco:v0-mangling-on-nightly-std, r=Kobzol
v0 mangling for std on nightly

Following rust-lang/rust#89917 and rust-lang/compiler-team#938, it doesn't make sense that `std` for these channels would have legacy mangling while the user's code would use `v0`.

r? `@Kobzol`
2025-11-25 10:25:47 +00:00
tison
a700e47675
Simplify OnceCell Clone impl
Signed-off-by: tison <wander4096@gmail.com>
2025-11-25 15:16:43 +08:00
zjumathcode
d8c9d70508 Fix comment wording in simplify_comparison_integral.rs
Signed-off-by: zjumathcode <pai314159@2980.com>
2025-11-25 14:16:14 +08:00
bors
cdb4236e65 Auto merge of #149200 - yaahc:helper-compat-test, r=petrochenkov
Add test for derive helper compat collisions

Resolves https://github.com/rust-lang/reference/pull/2055#discussion_r2549423194

r? `@petrochenkov`
2025-11-25 05:53:58 +00:00
Martin Nordholts
5b57d02e9f compiletest: Use //@ prefixes also for debuginfo test directives
So that when we later add support for revisions we can use the same
syntax for revisions as elsewhere.

This also prevents people from making typos for commands since
`src/tools/compiletest/src/directives/directive_names.rs` will catch such
typos now.

Note that we one FIXME for a non-trivial change for later:
```
// FIXME(148097): Change `// cdb-checksimple_closure` to `//@ cdb-check:simple_closure`
```
2025-11-25 06:13:45 +01:00
Adwin White
525cdc75dc skip checking supertraits in assembly_object_bound_candidate for NormalizesTo goal 2025-11-25 11:36:16 +08:00
Ben Kimock
4752322343 Add a little cfg_attr(bootstrap) to make the doctest work on stage1 2025-11-24 21:50:02 -05:00
Ben Kimock
bef49a02ef Don't lint on derefs of null pointers to ZSTs 2025-11-24 21:45:28 -05:00
Ben Kimock
c0097978aa Make deref_nullptr deny by default instead of warn 2025-11-24 21:45:28 -05:00
bors
c871d09d1c Auto merge of #149276 - matthiaskrgr:rollup-wlrpdrr, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#148234 (rustdoc: make mergeable crate info more usable)
 - rust-lang/rust#149201 (Add suggest alternatives for Out-of-range \x escapes)
 - rust-lang/rust#149208 ([rustdoc] Make more functions return `fmt::Result` and reduce number of `.unwrap()` calls)
 - rust-lang/rust#149252 (miri: use `tikv-jemalloc-sys` from sysroot)
 - rust-lang/rust#149255 (Use `let...else` consistently in user-facing diagnostics)
 - rust-lang/rust#149275 (Fix missing double-quote in `std::env::consts::OS` values)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-24 20:22:07 +00:00
Jane Losare-Lusby
7537b0bc06 Update tests/ui/proc-macro/helper-attr-compat-collision.rs
Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2025-11-24 10:52:03 -08:00
Jane Losare-Lusby
30c2e26506 Add test for derive helper compat collisions 2025-11-24 10:52:03 -08:00
Matthias Krüger
5ec55d3afd
Rollup merge of #149275 - KeyWeeUsr:fix-solid-os-typo, r=bjorn3
Fix missing double-quote in `std::env::consts::OS` values

Noticed this one while reading the docs. Hopefully it's not too small change.
2025-11-24 19:10:47 +01:00
Matthias Krüger
738e87282e
Rollup merge of #149255 - reddevilmidzy:let-else, r=Kivooeo
Use `let...else` consistently in user-facing diagnostics

resolve: rust-lang/rust#148772

Standardize `let...else` terminology in user-facing diagnostics.

Goal: Consistently use `let...else` in all error/warning messages.

Internal technical names (`let-else`) in comments and documentation remain unchanged.

cc ``@carols10cents,`` ``@jieyouxu``
2025-11-24 19:10:46 +01:00
Matthias Krüger
b9fdf6a0d8
Rollup merge of #149252 - madsmtm:miri-jemalloc, r=RalfJung
miri: use `tikv-jemalloc-sys` from sysroot

This allows LTO to work when compiling jemalloc (which is currently broken due to https://github.com/rust-lang/cc-rs/issues/1613), which should yield a small performance boost, and makes Miri's behaviour here match Clippy
and Rustdoc.

Follow-up to https://github.com/rust-lang/rust/pull/148925 / https://github.com/rust-lang/rust/pull/146627 after discussion in https://github.com/rust-lang/rust/pull/148925#pullrequestreview-3465393783.

r? RalfJung
2025-11-24 19:10:45 +01:00
Matthias Krüger
a68aff6a53
Rollup merge of #149208 - GuillaumeGomez:less-unwraps, r=yotamofek,lolbinarycat
[rustdoc] Make more functions return `fmt::Result` and reduce number of `.unwrap()` calls

Following our discussion in https://github.com/rust-lang/rust/pull/149028#discussion_r2550675531, this PR makes more function return `fmt::Result`, allowing to use `?` a lot more, and also reducing number of `.unwrap()` calls.

r? `@lolbinarycat`
2025-11-24 19:10:44 +01:00
Matthias Krüger
ade1581dc7
Rollup merge of #149201 - chenyukang:fix-str-format, r=Kivooeo
Add suggest alternatives for Out-of-range \x escapes

Fixes rust-lang/rust#148917

seems add two notes seems better.

r? `@scottmcm`
2025-11-24 19:10:44 +01:00
Matthias Krüger
be49e00109
Rollup merge of #148234 - notriddle:doc-cci, r=GuillaumeGomez
rustdoc: make mergeable crate info more usable

Part of https://github.com/rust-lang/rust/issues/130676

Adds documentation and a feature change aimed at making this usable without breaking backwards compat.

cc ``@EtomicBomb``
2025-11-24 19:10:43 +01:00
bors
b64df9d101 Auto merge of #149265 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to cf4b1faea3.

Created using https://github.com/rust-lang/josh-sync.

r? `@ghost`
2025-11-24 17:08:47 +00:00
Peter Badida
6173a56716
Fix missing double-quote in std::env::consts::OS values 2025-11-24 18:02:24 +01:00
Guillaume Gomez
3181c21b6c Improve variable naming 2025-11-24 17:01:32 +01:00
Guillaume Gomez
a21affabf8 Fix invalid link generation for type alias methods 2025-11-24 17:01:32 +01:00
Shoyu Vanilla
cf4668285f fix: Do not ICE on normalization failure of an extern static item 2025-11-24 23:50:49 +09:00
David Wood
62c5ea65dc
v0 mangling for std on nightly 2025-11-24 12:16:01 +00:00
yukang
4d4f3151fb Add suggest alternatives for Out-of-range \x escapes 2025-11-24 19:36:20 +08:00
Laurențiu Nicola
87e4974fa8 Reformat python script 2025-11-24 13:07:39 +02:00
Guillaume Gomez
c524ed710d Make more functions return fmt::Result and reduce number of .unwrap() calls 2025-11-24 11:41:03 +01:00
bors
42ec52baba Auto merge of #149258 - reddevilmidzy:ice, r=Kivooeo
Fix None handling for simplify_type in for_each_relevant_impl

resolve: rust-lang/rust#148062
2025-11-24 09:44:26 +00:00
Lukas Wirth
59dafb3896
Merge pull request #21097 from Veykril/push-zpqupukpkrts
proc-macro-srv: Reimplement token trees via immutable trees
2025-11-24 09:09:16 +00:00
Mads Marquart
522e47fd60 miri: use tikv-jemalloc-sys from sysroot
This allows LTO to work when compiling jemalloc, which should yield a
small performance boost, and makes miri's behaviour here match clippy
and rustdoc.
2025-11-24 10:00:23 +01:00
Lukas Wirth
bb89b62ed5 Couple more tests 2025-11-24 09:59:07 +01:00
Chayim Refael Friedman
320c881baa
Merge pull request #21116 from xdBronch/push-okwnouotntqt
add deprecated semantic token for extern crate shorthand
2025-11-24 07:51:21 +00:00
reddevilmidzy
eb72e6764e Fix None handling for simplify_type in for_each_relevant_impl 2025-11-24 16:06:15 +09:00
bors
69408a877e Auto merge of #147760 - Walnut356:gnu_enum_viz, r=Mark-Simulacrum,saethlin
[Debugger Visualizers] Unify `*-gnu` and `*-msvc` enum output

Followup patch to rust-lang/rust#145218

Ports the msvc enum synthetic/summary logic to the gnu handlers so they have identical output. Also removes the "look-through-pointers" logic that caused rust-lang/rust#147450

<img width="629" height="220" alt="image" src="https://github.com/user-attachments/assets/d6ae44d5-232f-412d-b291-64ac52850c74" />

I know we don't run the test suite in CI anymore, but it's still useful locally so I updated the relevant tests.
2025-11-24 06:30:24 +00:00
Walnut
af1c2b277d update tests 2025-11-24 00:17:53 -06:00