Commit graph

315110 commits

Author SHA1 Message Date
Urgau
a8028abedb
Rollup merge of #150822 - fix-149981, r=@Kivooeo
Fix for ICE: eii: fn / macro rules None in find_attr()

Closes rust-lang/rust#149981

This used to ICE:
```rust
macro_rules! foo_impl {}
#[eii]
fn foo_impl() {}
```

`#[eii]` generates a macro (called `foo_impl`) and a default impl. So the partial expansion used to roughly look like the following:

```rust
macro_rules! foo_impl {} // actually resolves here

extern "Rust" {
    fn foo_impl();
}

#[eii_extern_target(foo_impl)]
macro foo_impl {
    () => {};
}

const _: () = {
    #[implements_eii(foo_impl)] // assumed to name resolve to the macro v2 above
    fn foo_impl() {}
};
```

Now, shadowing rules for macrov2 and macrov1 are super weird! Take a look at this: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=23f21421921360478b0ec0276711ad36

So instead of resolving to the macrov2, we resolve the macrov1 named the same thing.

A regression test was added to this, and some span_delayed_bugs were added to make sure we catch this in the right places. But that didn't fix the root cause.

To make sure this simply cannot happen again, I made it so that we don't even need to do a name resolution for the default. In other words, the new partial expansion looks more like:

```rust
macro_rules! foo_impl {}

extern "Rust" {
    fn foo_impl(); // resolves to here now!!!
}

#[eii_extern_target(foo_impl)]
macro foo_impl {
    () => {};
}

const _: () = {
    #[implements_eii(known_extern_target=foo_impl)] // still name resolved, but directly to the foreign function.
    fn foo_impl() {}
};
```

The reason this helps is that name resolution for non-macros is much more predictable. It's not possible to have two functions like that with the same name in scope.

We used to key externally implementable items off of the defid of the macro, but now the unique identifier is the foreign function's defid which seems much more sane.

Finally, I lied a tiny bit because the above partial expansion doesn't actually work.
```rust
extern "Rust" {
    fn foo_impl(); // not to here
}

const _: () = {
    #[implements_eii(known_extern_target=foo_impl)] // actually resolves to this function itself
    fn foo_impl() {} // <--- so to here
};
```

So the last few commits change the expansion to actually be this:

```rust
macro_rules! foo_impl {}

extern "Rust" {
    fn foo_impl(); // resolves to here now!!!
}

#[eii_extern_target(foo_impl)]
macro foo_impl {
    () => {};
}

const _: () = {
    mod dflt { // necessary, otherwise `super` doesn't work
        use super::*;
        #[implements_eii(known_extern_target=super::foo_impl)] // now resolves to outside the `dflt` module, so the foreign item.
        fn foo_impl() {}
    }
};
```

I apologize to whoever needs to review this, this is very subtle and I hope this makes it clear enough 😭.
2026-01-09 23:28:16 +01:00
Urgau
3bb7de6408
Rollup merge of #150805 - fix-def-path-ice, r=davidtwco
Fix ICE in inline always warning emission.

The calls to `def_path_str` were outside the decorate callback in `node_span_lint` which caused an ICE when the warning was an allowed warning due to the call to `def_path_str` being executed but the warning not actually being emitted.

r? @davidtwco
2026-01-09 23:28:16 +01:00
Urgau
65c0847f2d
Rollup merge of #149318 - slice_partial_sort_unstable, r=tgross35
Implement partial_sort_unstable for slice

This refers to https://github.com/rust-lang/rust/issues/149046.
2026-01-09 23:28:15 +01:00
rust-bors[bot]
a3f2d5abe4
Auto merge of #150739 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

27 commits in 94c368ad2b9db0f0da5bdd8421cea13786ce4412..8c133afcd5e0d69932fe11f5907683723f8d361d
2025-12-26 19:39:15 +0000 to 2026-01-09 03:50:15 +0000
- Isolate build script metadata progation between std and non-std crates (rust-lang/cargo#16489)
- Add Clippy like lint groups (rust-lang/cargo#16464)
- feat: in-memory only `Manifest` (rust-lang/cargo#16409)
- Fixed incorrect version comparision during build script dependency selection (rust-lang/cargo#16486)
- refactor: new type for unit index (rust-lang/cargo#16485)
- feat(test): Make CARGO_BIN_EXE_ available at runtime  (rust-lang/cargo#16421)
- fix(package): detect dirty files when run from workspace member (rust-lang/cargo#16479)
- fix(timing)!: remove `--timings=&lt;FMT&gt;` optional format values (rust-lang/cargo#16420)
- docs(unstable): expand docs for `-Zbuild-analysis` (rust-lang/cargo#16476)
- test: add `-Zunstable-options` with custom targets (rust-lang/cargo#16467)
- feat(report): add cargo report rebuilds  (rust-lang/cargo#16456)
- feat(test-support): Use test name for dir when running tests (rust-lang/cargo#16121)
- refactor: Migrate some cases to expect/reason (rust-lang/cargo#16461)
- docs(build-script): clarify OUT_DIR is not cleaned between builds (rust-lang/cargo#16437)
- chore: Update dependencies (rust-lang/cargo#16460)
- Update handlebars to 6.4.0 (rust-lang/cargo#16457)
- chore(deps): update alpine docker tag to v3.23 (rust-lang/cargo#16454)
- Any build scripts can now use cargo::metadata=KEY=VALUE (rust-lang/cargo#16436)
- fix(log): add `dependencies` field to `UnitRegistered` (rust-lang/cargo#16448)
- Implement fine grain locking for `build-dir` (rust-lang/cargo#16155)
- feat(resolver): List features when no close match (rust-lang/cargo#16445)
- feat(report): new command `cargo report sessions` (rust-lang/cargo#16428)
- feat (patch): Display where the patch was defined in patch-related error messages (rust-lang/cargo#16407)
- test(build-rs): Reduce from 'build' to 'check' where possible (rust-lang/cargo#16444)
- feat(toml): TOML 1.1 parse support (rust-lang/cargo#16415)
- feat(report): support --manifest-path in `cargo report timings` (rust-lang/cargo#16441)
- fix(vendor): recursively filter git files in subdirectories (rust-lang/cargo#16439)
2026-01-09 15:35:19 +00:00
rust-bors[bot]
1b39278a31
Auto merge of #150866 - GuillaumeGomez:rollup-puFKE8I, r=GuillaumeGomez
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#150272 (docs(core): update `find()` and `rfind()` examples)
 - rust-lang/rust#150385 (fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions)
 - rust-lang/rust#150561 (Finish transition from `semitransparent` to `semiopaque` for `rustc_macro_transparency`)
 - rust-lang/rust#150574 (Clarify `MoveData::init_loc_map`.)
 - rust-lang/rust#150762 (Use functions more in rustdoc GUI tests)
 - rust-lang/rust#150808 (rename the `derive_{eq, clone_copy}` features to `*_internals`)
 - rust-lang/rust#150816 (Fix trait method anchor disappearing before user can click on it)
 - rust-lang/rust#150821 (tests/ui/borrowck/issue-92157.rs: Remove (bug not fixed))
 - rust-lang/rust#150829 (make attrs actually use `Target::GenericParam`)
 - rust-lang/rust#150834 (Add tracking issue for `feature(multiple_supertrait_upcastable)`)
 - rust-lang/rust#150864 (The aarch64-unknown-none target requires NEON, so the docs were wrong.)

r? @ghost
2026-01-09 12:19:48 +00:00
Guillaume Gomez
8f89503777
Rollup merge of #150864 - fix-aarch64-platform-docs, r=jdonszelmann
The aarch64-unknown-none target requires NEON, so the docs were wrong.

As discussed [on zulip](https://rust-lang.zulipchat.com/#narrow/channel/242906-t-compiler.2Farm/topic/aarch64-unknown-none.20platform.20docs/with/567045743), we think the docs for the aarch64-unknown-none target don't match the target spec.
2026-01-09 12:00:03 +01:00
Guillaume Gomez
ab854dac28
Rollup merge of #150834 - multiple_supertrait_upcastable-not-internal, r=Kivooeo
Add tracking issue for `feature(multiple_supertrait_upcastable)`

Move feature(multiple_supertrait_upcastable) to the actual feature gates section (from the internal feature gates section) and give it a tracking issue.

Tracking issue: rust-lang/rust#150833

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

This feature is for the `multiple_supertrait_upcastable` lint, which was added as `unstable` without a tracking issue, but was placed in the internal feature gates section. This PR moves its listing to the actual feature gates section and gives it a tracking issue.

If the lint is intended to stay internal-only, then this can be changed to instead mark it as `internal` (and maybe close the tracking issue).
2026-01-09 12:00:03 +01:00
Guillaume Gomez
0548617ca0
Rollup merge of #150829 - fix_generic_param_target, r=JonathanBrouwer
make attrs actually use `Target::GenericParam`

currently attributes lower `GenericParam` -> `Target::Param` this PR fixes this, so that `GenericParam` is lowered to `Target::GenericParam`

r? @JonathanBrouwer
2026-01-09 12:00:02 +01:00
Guillaume Gomez
19769da8f1
Rollup merge of #150821 - remove-test, r=jackh726
tests/ui/borrowck/issue-92157.rs: Remove (bug not fixed)

The bug the test tests for is masked by the wrong `#[lang = "start"]` signature. If the signature is corrected, the test builds. But that is not because the bug is fixed, but because the test has been changed too much from the original reproducer. The original reproducer still ICE:s. See https://github.com/rust-lang/rust/issues/92157#issuecomment-3722060317.

But that's fine since in the latest compiler says:

> note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly

So let's remove the test and close the issue as "won't fix". See https://github.com/rust-lang/rust/issues/92157#issuecomment-3725036997.

r? @JohnTitor since you added the test in https://github.com/rust-lang/rust/pull/106878
2026-01-09 12:00:02 +01:00
Guillaume Gomez
fe307c5452
Rollup merge of #150816 - method-anchor, r=camelid
Fix trait method anchor disappearing before user can click on it

A good example of this bug is going to https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/collect/struct.ItemCtxt.html#impl-HirTyLowerer%3C'tcx%3E-for-ItemCtxt%3C'tcx%3E, and then try to click on the `§` anchor of the `tcx` method.

The solution to this bug is to simply "glue" the anchor to the method, so when the mouse cursor moves to it, there is no gap between the two, preventing the anchor to disappear (hopefully this explanation doesn't make sense only to me ^^').

First commit fixes the bug by expanding the anchor size.
Second commit is a small clean-up of the GUI test.
Third commit actually adds the GUI regression test.

cc @BoxyUwU
r? @camelid
2026-01-09 12:00:01 +01:00
Guillaume Gomez
e99f5f63a6
Rollup merge of #150808 - derive-internals, r=jhpratt
rename the `derive_{eq, clone_copy}` features to `*_internals`

Features like `derive_from` and `derive_coerce_pointee` refer to actual unstable derive macros, but the `derive_eq` and `derive_clone_copy` features are internal hacks. Rename them accordingly by adding the suffix `_internals`.
2026-01-09 12:00:00 +01:00
Guillaume Gomez
10e24f1926
Rollup merge of #150762 - cleanup-gui, r=lolbinarycat
Use functions more in rustdoc GUI tests

Now that conditions are supported in `browser-ui-test`, we can start simplify some parts of the tests. This is a first cleanup, but I guess a lot more could be simplified. For follow-ups I guess. :)

I made some improvements in backtrace display in `browser-ui-test`, hence the version update once more.

r? @lolbinarycat
2026-01-09 12:00:00 +01:00
Guillaume Gomez
7702fb2a7e
Rollup merge of #150574 - MoveData-init_loc_map, r=cjgillot
Clarify `MoveData::init_loc_map`.

Change the `SmallVec` size from 4 to 1, because that's sufficient in the vast majority of cases. (This doesn't affect performance in practice, so it's more of a code clarity change than a performance change.)

r? @cjgillot
2026-01-09 11:59:59 +01:00
Guillaume Gomez
3daf9935c5
Rollup merge of #150561 - semiopaque, r=BoxyUwU
Finish transition from `semitransparent` to `semiopaque` for `rustc_macro_transparency`

Since it's a bit annoying to have different names for the same thing.

My understanding is that this is just internal stuff that is not part of any public API even tough rust-analyzer knows about it.

Continuation of
- https://github.com/rust-lang/rust/pull/139084.

Discovered while investigating
- https://github.com/rust-lang/rust/issues/150514
2026-01-09 11:59:59 +01:00
Guillaume Gomez
09575ecde1
Rollup merge of #150385 - fix-expr-can-have-side-effects, r=jdonszelmann,samueltardieu
fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions

AFAIK `[0; 3]` is basically a syntax sugar for `[0, 0, 0]` so it should return whether the repeat's element can have side effects, like what it does on arrays.
And it seems that the rule for unary operators and indexings can be applied to binary operators as well.
2026-01-09 11:59:58 +01:00
Guillaume Gomez
2ce7a5deaf
Rollup merge of #150272 - doc/improve-iter-find-docs, r=scottmcm
docs(core): update `find()` and `rfind()` examples

[find()](https://doc.rust-lang.org/std/iter/trait.Iterator.html) has a missing example. In the docs there is mention of an example with double reference but it doesn't exist.

<img width="1476" height="1229" alt="image" src="https://github.com/user-attachments/assets/b99062ed-3a47-4b87-8e0c-58afd7de1332" />

[rfind()](https://doc.rust-lang.org/core/iter/trait.DoubleEndedIterator.html#method.rfind) is also very similar to `find()`, however it has the double reference example and no owned value example like `find()` does.

<img width="1473" height="1163" alt="image" src="https://github.com/user-attachments/assets/7977ae5c-9888-4513-8dfc-a7c03c7ef072" />

This commit adds the missing examples and making them look consistent.
2026-01-09 11:59:57 +01:00
rust-bors[bot]
85d0cdfe34
Auto merge of #150265 - scottmcm:vec-less-ubchecks, r=jhpratt
Stop emitting UbChecks on every Vec→Slice

Spotted this in rust-lang/rust#148766's test changes.  It doesn't seem like this ubcheck would catch anything useful; let's see if skipping it helps perf.  (After all, this is inside *every* `[]` on a vec, among other things.)
2026-01-09 09:04:56 +00:00
Jonathan Pallant
025ac8f512
The aarch64-unknown-none target requires NEON, so the docs were wrong. 2026-01-09 08:37:01 +00:00
Jana Dönszelmann
7791bc2213
mark ICE regression test as fixed 2026-01-09 09:29:02 +01:00
Jana Dönszelmann
52b3ac476c
trick with super imports that fixes nameres in anonymous modules 2026-01-09 09:29:02 +01:00
Jana Dönszelmann
5ddda0c37b
fix up diagnostics referring to the right items 2026-01-09 09:29:02 +01:00
Jana Dönszelmann
e3cff18370
dont resolve defaults anymore, store foreign item defid instead of macro 2026-01-09 09:29:02 +01:00
Jana Dönszelmann
5e5c724194
turn panics into span_delayed_bug to make sure this pattern doesn't go unnoticed 2026-01-09 09:29:02 +01:00
Jana Dönszelmann
3c8265a29f
add test for 149981 2026-01-09 09:29:02 +01:00
andjsrk
561b59255c add test for binary ops 2026-01-09 15:45:05 +09:00
Weihang Lo
a97825c3f3
Update cargo submodule 2026-01-08 23:34:46 -05:00
tison
45e0fbf7c5
Implement partial_sort_unstable for slice
Signed-off-by: tison <wander4096@gmail.com>
Co-Authored-By: Orson Peters <orsonpeters@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
2026-01-09 09:58:08 +08:00
Scott McMurray
c48df5dcf1 Move the rustc_no_mir_inline down a level 2026-01-08 17:14:02 -08:00
Scott McMurray
5932078c79 Stop emitting UbChecks on every Vec→Slice
Spotted this in PR148766's test changes.  It doesn't seem like this ubcheck would catch anything useful; let's see if skipping it helps perf.
2026-01-08 17:14:02 -08:00
rust-bors[bot]
3fda0e426c
Auto merge of #150839 - matthiaskrgr:rollup-3a0ebXJ, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#149961 (tidy: add if-installed prefix condition to extra checks system)
 - rust-lang/rust#150475 (std: sys: fs: uefi: Implement initial File)
 - rust-lang/rust#150533 (std: sys: fs: uefi: Implement remove_dir_all)
 - rust-lang/rust#150549 (fix missing_panics_doc in `std::os::fd::owned`)
 - rust-lang/rust#150699 (MGCA: Support literals as direct const arguments)
 - rust-lang/rust#150721 (Deprecated doc intra link)
 - rust-lang/rust#150802 (Minor cleanups to fn_abi_new_uncached)
 - rust-lang/rust#150803 (compiler-builtins subtree update)
 - rust-lang/rust#150809 (Update `literal-escaper` version to `0.0.7`)
 - rust-lang/rust#150811 (Store defids instead of symbol names in the aliases list)
 - rust-lang/rust#150825 (Query associated_item_def_ids when needed)

r? @ghost
2026-01-08 23:40:03 +00:00
Matthias Krüger
0fbcfb9a05
Rollup merge of #150825 - move-items, r=JonathanBrouwer
Query associated_item_def_ids when needed

This commit moves a query to `associated_item_defs` from above an error condition caused independently of it to below it.

It looks generally cleaner and might potentially save some runtime in case the error condition is met, rendering `items` to be left unused, yet still queried.
2026-01-08 22:21:21 +01:00
Matthias Krüger
d464630301
Rollup merge of #150811 - defid-aliases, r=bjorn3
Store defids instead of symbol names in the aliases list

I was honestly surprised this worked in the past. This causes a cycle error since we now compute a symbol name in codegen_attrs, and then compute codegen attrs when we try to get the symbol name.

It only worked when there weren't any codegen attributes to begin with, causing symbol name computation to skip the call to codegen_attrs.

Like this we won't have the same problem.

r? @bjorn3
2026-01-08 22:21:21 +01:00
Matthias Krüger
74ab9a4784
Rollup merge of #150809 - update-literal-escaper, r=Urgau
Update `literal-escaper` version to `0.0.7`

It removes the `std` dependency for this crate (which doesn't change anything for rustc 😄 ).

cc @bjorn3
r? @Urgau
2026-01-08 22:21:21 +01:00
Matthias Krüger
d1aaf26d83
Rollup merge of #150803 - update-builtins, r=tgross35
compiler-builtins subtree update

Subtree update of `compiler-builtins` to 65624df7f5.

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

r? @ghost
2026-01-08 22:21:20 +01:00
Matthias Krüger
36d0f35d3d
Rollup merge of #150802 - fn_abi_cleanup, r=lqd
Minor cleanups to fn_abi_new_uncached
2026-01-08 22:21:19 +01:00
Matthias Krüger
d763ffaf04
Rollup merge of #150721 - deprecated-doc-intra-link, r=GuillaumeGomez
Deprecated doc intra link

fixes https://github.com/rust-lang/rust/issues/98342
r? @GuillaumeGomez

Renders intra-doc links in the note text of the `#[deprecated]` attribute. It is quite natural to suggest some other function to use there. So e.g.

```rust
#[deprecated(since = "0.0.0", note = "use [`std::mem::size_of`] instead")]
```

renders as

<img width="431" height="74" alt="Screenshot from 2026-01-06 12-08-21" src="https://github.com/user-attachments/assets/8f608f08-13ee-4bbf-a631-6008058a51e2" />
2026-01-08 22:21:19 +01:00
Matthias Krüger
cb3b2d8655
Rollup merge of #150699 - literals-as-direct-const-args, r=BoxyUwU
MGCA: Support literals as direct const arguments

Fixes [#150168](https://github.com/rust-lang/rust/issues/150618)

- **initial changes for mcga literals**
- **rustfmt**

r? @BoxyUwU
2026-01-08 22:21:17 +01:00
Matthias Krüger
e7560df897
Rollup merge of #150549 - patch-1, r=ChrisDenton
fix missing_panics_doc in `std::os::fd::owned`

https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
2026-01-08 22:21:16 +01:00
Matthias Krüger
836ff9c06d
Rollup merge of #150533 - uefi-fs-rmdirall, r=ChrisDenton
std: sys: fs: uefi: Implement remove_dir_all

- Using the implementation from sys::fs::common since UEFI does not have a built-in for this functionality.

@rustbot label +O-UEFI
2026-01-08 22:21:15 +01:00
Matthias Krüger
d21770710b
Rollup merge of #150475 - uefi-fs-file, r=ChrisDenton
std: sys: fs: uefi: Implement initial File

- Implement basic opening and creating files.
- Also implement debug.

@rustbot label +O-UEFI
2026-01-08 22:21:15 +01:00
Matthias Krüger
aee575713d
Rollup merge of #149961 - add-optional-spellcheck-in-pre-hook, r=lolbinarycat
tidy: add if-installed prefix condition to extra checks system

Ref: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Should.20Spellcheck.20check.20all.20files.3F/with/543227610

tidy now runs spellcheck (typos-cli) without adding `--extra-checks=spellcheck` option if the tool is already installed under ./build/misc-tools and the version is expected.
It will improve code quality without bothering engineers who doesn't want to use typos or who cleans up ./build directory frequently.
2026-01-08 22:21:14 +01:00
Zachary S
5466c6b255 Move feature(multiple_supertrait_upcastable) to the actual feature gates section (from the internal feature gates section) and give it a tracking issue. 2026-01-08 14:57:32 -06:00
Guillaume Gomez
945e7c78d2 Use functions more in rustdoc GUI tests 2026-01-08 21:49:29 +01:00
Guillaume Gomez
16fbf6a27b Add check for trait impl method anchor 2026-01-08 21:47:12 +01:00
Guillaume Gomez
bfb117ac74 Clean up tests/rustdoc-gui/anchors.goml test code 2026-01-08 21:47:12 +01:00
Guillaume Gomez
c502d7fce0 Fix trait method anchor disappearing before user can click on it 2026-01-08 21:47:12 +01:00
rust-bors[bot]
31cd367b9c
Auto merge of #148545 - cramertj:alloc-map, r=Amanieu
Add allocator parameter to HashMap

Hashbrown support originally added in https://github.com/rust-lang/hashbrown/pull/133
Part of https://github.com/rust-lang/wg-allocators/issues/7

~See also: hashset support in https://github.com/rust-lang/rust/pull/148550~ (Edit: merged into this PR for crater)
2026-01-08 20:22:35 +00:00
Edvin Bryntesson
742d276dc1
make attrs actually use Target::GenericParam 2026-01-08 20:26:45 +01:00
Clara Engler
1eb605f634
Query associated_item_def_ids when needed
This commit moves a query to `associated_item_defs` from above an error
condition caused independently of it to below it.

It looks generally cleaner and might potentially save some runtime in
case the error condition is met, rendering `items` to be left unused,
yet still queried.
2026-01-08 19:41:24 +01:00
Martin Nordholts
9e00663d73 rust-analyzer: Also use semiopaque instead of semitransparent
Like in rustc.
2026-01-08 19:14:45 +01:00