Commit graph

315915 commits

Author SHA1 Message Date
Nikita Popov
08da3685ed Don't use evex512 with LLVM 22
As Intel has walked back on the existence of AVX 10.1-256, LLVM
no longer uses evex512 and avx-10.n-512 are now avx-10.n instead,
so we can skip all the special handling on LLVM 22.
2026-01-20 14:47:09 +01:00
Nikita Popov
0be66603ac Avoid passing addrspacecast to lifetime intrinsics
Since LLVM 22 the alloca must be passed directly. Do this by
stripping the addrspacecast if it exists.
2026-01-20 14:47:04 +01:00
Nikita Popov
bf3ac98d69 Update amdgpu data layout
This changed in:
853760bca6
2026-01-20 14:46:58 +01:00
bors
fffc4fcf96 Auto merge of #151395 - Zalathar:rollup-8gANGZS, r=Zalathar
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#149587 (coverage: Sort the expansion tree to help choose a single BCB for child expansions)
 - rust-lang/rust#150071 (Add dist step for Enzyme)
 - rust-lang/rust#150288 (Add scalar support for offload)
 - rust-lang/rust#151091 (Add new "hide deprecated items" setting in rustdoc)
 - rust-lang/rust#151255 (rustdoc: Fix ICE when deprecated note is not resolved on the correct `DefId`)
 - rust-lang/rust#151375 (Fix terminal  width dependent tests)
 - rust-lang/rust#151384 (add basic `TokenStream` api tests)
 - rust-lang/rust#151391 (rustc-dev-guide subtree update)

r? @ghost
2026-01-20 09:01:18 +00:00
Stuart Cook
7c33b49e87
Rollup merge of #151391 - rdg-sync, r=tshepang
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to 64f0f77d34.

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

r? @ghost
2026-01-20 18:00:11 +11:00
Stuart Cook
8461682729
Rollup merge of #151384 - pm-tokenstream-tests, r=Kivooeo
add basic `TokenStream` api tests

There were none so far. Especially helpful for rust-lang/rust#130856.
2026-01-20 18:00:11 +11:00
Stuart Cook
8221b5e622
Rollup merge of #151375 - terminal_width_independence, r=lqd
Fix terminal  width dependent tests

[#t-compiler > What is -Zui-testing=no and why are we using it](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/What.20is.20-Zui-testing.3Dno.20and.20why.20are.20we.20using.20it/with/568842970)

See zulip thread. I've verified locally that this lets me run the ui test suite without problems even with a very thin terminal 😆
2026-01-20 18:00:10 +11:00
Stuart Cook
0a5d1e8059
Rollup merge of #151255 - fix-rustdoc-ice-reexported-deprecated-note, r=lolbinarycat
rustdoc: Fix ICE when deprecated note is not resolved on the correct `DefId`

Supersedes https://github.com/rust-lang/rust/pull/151237.
Follow-up of rust-lang/rust#151120.

The `span` overlapping approach wasn't good enough so instead we now check if the reexport itself has the `deprecated` attribute, and if so, we resolve the path to the reexport `DefId`, otherwise we resolve it on the reexported item's `DefId`.

cc @Zalathar
r? @lolbinarycat
2026-01-20 18:00:10 +11:00
Stuart Cook
88df8fd3ef
Rollup merge of #151091 - hide-deprecated-items, r=lolbinarycat
Add new "hide deprecated items" setting in rustdoc

This PR adds a new JS setting which allows the JS to hide deprecated items. This is especially useful for crates like `std` which accumulates deprecated items but never removes them.

Nicely enough, the "deprecation" information was already in the search index, meaning I didn't need to change anything there. Before this PR, it was only used to make the deprecated items rank lower. Well now it's also used to generate an extra CSS class, allowing the JS setting to work.

This is taking over https://github.com/rust-lang/rust/pull/149551.

This feature got approved by the rustdoc team in the [meeting of december](https://rust-lang.zulipchat.com/#narrow/channel/393423-t-rustdoc.2Fmeetings/topic/2025-12-08/near/562553156).

You can give it a try [here](https://rustdoc.crud.net/imperio/hide-deprecated-items/foo/index.html).

r? @lolbinarycat
2026-01-20 18:00:09 +11:00
Stuart Cook
1262ff906b
Rollup merge of #150288 - offload-bench-fix, r=ZuseZ4
Add scalar support for offload

This PR adds scalar support to the offload feature. The scalar management has two main parts:

On the host side, each scalar arg is casted to `ix` type, zero extended to `i64` and passed to the kernel like that.
On the device, the each scalar arg (`i64` at that point), is truncated to `ix` and then casted to the original type.

r? @ZuseZ4
2026-01-20 18:00:08 +11:00
Stuart Cook
02ee05ab0e
Rollup merge of #150071 - dist-enzyme, r=ZuseZ4
Add dist step for Enzyme

Now that Enzyme can be distributed as a separate dylib outside libLLVM.so, we can create a dist step for it. This is the bulk of the work required to make it distributable through rustup, once CI works and we check that the built component works locally, we can add it to Rustup through the manifest.

Note that this PR does not enable Enzyme distribution in CI yet, it just adds the dist step.

r? @ZuseZ4

try-job: dist-x86_64-linux
2026-01-20 18:00:07 +11:00
Stuart Cook
dd5c7eb526
Rollup merge of #149587 - tree-sort, r=davidtwco
coverage: Sort the expansion tree to help choose a single BCB for child expansions

This PR is another incremental step on the road towards proper coverage instrumentation of expansion regions.

When creating coverage mappings for each relevant span in a function body, the current implementation also needs to do a separate tree traversal for each child expansion (e.g. macro calls like `println!("foo")`), in order to associate a single control-flow point (BCB) with that macro call's span.

This PR changes things so that we now keep track of the “minimum” and ”maximum” BCB associated with each node in the expansion tree, which makes it much easier for the parent node to get a single BCB (min or max) for each of its child expansions.

In order to make this (relatively) easy, we first need to sort the tree nodes into depth-first order. Once that's taken care of, we can iterate over all the nodes in reverse order, knowing that each node's children will have been visited before visiting the node itself.
2026-01-20 18:00:06 +11:00
bors
7981818138 Auto merge of #151076 - cuviper:compiler-hashbrown-0.16.1, r=Amanieu
compiler: upgrade to hashbrown 0.16.1

See also rust-lang/rust#135634, rust-lang/rust#149159, and rust-lang/hashbrown#662.

This includes an in-tree upgrade of `indexmap` as well, which uses the
new `HashTable` buckets API internally, hopefully impacting performance
for the better.

And finally, we can remove `#[rustc_unsafe_specialization_marker]` on `Copy`!

cc @joboet
r? @Amanieu
2026-01-20 05:44:13 +00:00
Zalathar
986db13c17 coverage: Use the sorted expansion tree to determine min/max BCBs 2026-01-20 13:29:09 +11:00
Zalathar
7a3e5cd57e coverage: Sort the expansion tree in depth-first order
This makes it possible for subsequent operations to iterate over all nodes,
while assuming that every node occurs before all of its descendants.
2026-01-20 13:29:09 +11:00
Zalathar
1f423a6e42 coverage: Add a test for macros that only contain other macros 2026-01-20 13:29:09 +11:00
bors
058a763dd2 Auto merge of #151230 - BoxyUwU:relnotes_1_93, r=Mark-Simulacrum
Add release notes for 1.93.0

r? @mark-simulacrum
cc @rust-lang/release 
@rustbot ping relnotes-interest-group
2026-01-20 02:25:33 +00:00
Josh Stone
279f8799e3
Update slice assume_init_* relnotes 2026-01-19 16:08:11 -08:00
bors
63f4513795 Auto merge of #151381 - JonathanBrouwer:rollup-zvO3tIH, r=JonathanBrouwer
Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#148623 (Ignore `#[doc(hidden)]` items when computing trimmed paths for printing)
 - rust-lang/rust#150550 (Miscellaneous cleanups to borrowck related code)
 - rust-lang/rust#150879 (Remove the diagnostic lints)
 - rust-lang/rust#150895 (rustc_errors: Add (heuristic) Syntax Highlighting for `rustc --explain`)
 - rust-lang/rust#150987 (remote-test-server: Fix header in batch mode)
 - rust-lang/rust#151004 (std: implement `sleep_until` on Apple platforms)
 - rust-lang/rust#151045 (Simplify some literal-value negations with `u128::wrapping_neg`)
 - rust-lang/rust#151119 (Support pointers in type reflection)
 - rust-lang/rust#151171 (Do not recover from `Trait()` if generic list is unterminated)
 - rust-lang/rust#151231 (HIR typeck cleanup: clarify and re-style `check_expr_unop`)
 - rust-lang/rust#151249 (Parse ident with allowing recovery when trying to diagnose)
 - rust-lang/rust#151295 (THIR patterns: Use `ty::Value` in more places throughout `const_to_pat`)
 - rust-lang/rust#151326 (Remove `DiagMessage::Translated` in favour of `DiagMessage::Str`)
 - rust-lang/rust#151361 (add test for issue 61463)
 - rust-lang/rust#151371 (Add `S-blocked` to `labels_blocking_approval`)

r? @ghost
2026-01-19 23:08:48 +00:00
Guillaume Gomez
aef8112b26 Add test for search results of not yet deprecated search items
Improve the `perform-search` goml function to work when search is already open
2026-01-19 23:14:09 +01:00
Guillaume Gomez
9e5e432662 Simplify IndexItem::deprecation field: since we only need a boolean value in the end, no need to keep it around. Also: takes into account "is_in_effect" 2026-01-19 23:10:20 +01:00
cyrgani
60e488ec07 add basic TokenStream api tests 2026-01-19 21:46:52 +00:00
Marcelo Domínguez
307a4fcdf8 Add scalar support for both host and device 2026-01-19 22:28:42 +01:00
Guillaume Gomez
bf49068b72 Rename sans-serif CSS class into sans-serif-fonts to match the JS setting, allowing to simplify JS code 2026-01-19 21:37:15 +01:00
Guillaume Gomez
5561167fbd Improve JS source code for settings 2026-01-19 21:37:15 +01:00
Guillaume Gomez
9f965bcf76 Add rustdoc GUI test to ensure that the "hide deprecated items" setting is working as expected 2026-01-19 21:37:15 +01:00
Tshepang Mbambo
3e62e12c58
Merge pull request #2726 from rust-lang/tshepang/range-diff
add range-diff triagebot option
2026-01-19 22:19:49 +02:00
Jonathan Brouwer
a3c45759d1
Rollup merge of #151371 - blocked, r=Kobzol
Add `S-blocked` to `labels_blocking_approval`

r? @Kobzol

I think this makes sense, was this left out for a particular reason?
2026-01-19 20:53:25 +01:00
Jonathan Brouwer
0833ace2fd
Rollup merge of #151361 - test-issue-61463, r=lqd
add test for issue 61463

A test for the issue where the variable meta is mistakenly treated as a reserved keyword.

close rust-lang/rust#61463
2026-01-19 20:53:25 +01:00
Jonathan Brouwer
e8c3dd36f8
Rollup merge of #151326 - translated, r=davidtwco
Remove `DiagMessage::Translated` in favour of `DiagMessage::Str`

This variant did not seem to be meaningfully different from `DiagMessage::Str`.
Am I missing something or was this just an oversight?

r? @davidtwco
2026-01-19 20:53:24 +01:00
Jonathan Brouwer
b41e8f0897
Rollup merge of #151295 - const-to-pat, r=BoxyUwU
THIR patterns: Use `ty::Value` in more places throughout `const_to_pat`

This PR changes `ConstToPat::valtree_to_pat` to take a `ty::Value` instead of separate type and valtree arguments, and propagates that change throughout other parts of the overall `const_to_pat` implementation.

The biggest under-the-hood change is that instead of combining valtrees from the constant with child types from the parent type, we now just rely on the types already embedded in children of the valtree.

I'm not *entirely* sure that this is correct, but it doesn't seem to cause any failures in the test suite, and from what I can tell the old way was a holdover from a time when the types weren't readily available from the value side.

---

My ulterior motive for this cleanup is that I'm hoping to eventually add some extra data to `thir::PatKind::Const`, which will be a little easier if creation of that `PatKind::Const` doesn't have to assemble a `ty::Value` from component parts.
2026-01-19 20:53:24 +01:00
Jonathan Brouwer
8c5e10bb11
Rollup merge of #151249 - fix/151238, r=petrochenkov
Parse ident with allowing recovery when trying to diagnose

Fixes rust-lang/rust#151238

rust-lang/rust#146978 made parsing ident not always allowed-recovery ([change](https://github.com/rust-lang/rust/pull/146978/changes#diff-ef8d6186dc7fb1d03a71446d0c9e6cc9e72158ec6896703dcf05686ee7dc83fcL469-R469)), so when matching macro with `NoopTracker`, which has `Recovery::Forbidden`, ICE happens when trying to parse kw as ident and then unwraping it.

This PR introduces a new method for parsing ident with allowing recovery when trying to diagnose. Then errors will behave like previous.

r? @petrochenkov
2026-01-19 20:53:24 +01:00
Jonathan Brouwer
a1392615ef
Rollup merge of #151231 - clarify-check-expr-unop, r=davidtwco
HIR typeck cleanup: clarify and re-style `check_expr_unop`

Two small cleanups:
- The `oprnd_t` variable was previously used both for the type of unary operators' operands and for the type of the operator expression as a whole. I found this confusing, so I've changed it to only be used for the operand type. This also allowed for removing some negations from `if` conditions.
- I did a bit of re-styling in the second commit to remove some indentation levels, which also means fewer things have to be spread across multiple lines. This part is more to-taste; I'd be fine dropping it if it doesn't actually help.
2026-01-19 20:53:23 +01:00
Jonathan Brouwer
1968df85fb
Rollup merge of #151171 - issue-141436, r=davidtwco
Do not recover from `Trait()` if generic list is unterminated

If we encounter `fn foo<T: Trait()`, the recovery logic would it as if `Trait` was intended to use the Fn-like trait syntax, but if we don't know for certain that we've parsed a full trait bound (`fn foo<T: Trait()>`), we bail from the recovery as more likely there could have been a missing closing `>` and the `(` corresponds to the start of the fn parameter list.

Fix rust-lang/rust#141436.
2026-01-19 20:53:23 +01:00
Jonathan Brouwer
25e6f5cda7
Rollup merge of #151119 - reflect-pointers, r=oli-obk
Support pointers in type reflection

Tracking issue: rust-lang/rust#146922

This PR adds support for inspecting pointers `*const T` and `*mut T` through type reflection. It does so by adding the new `Pointer` struct + variant:

```rust
pub struct Pointer {
    /// The type of the value being pointed to.
    pub ty: TypeId,
    /// Whether this pointer is mutable or not.
    pub mutable: bool,
}
```

This can be gathered using `Type::of`, for example:

```rust
match const { Type::of::<*const u8>() }.kind {
    TypeKind::Pointer(pointer) => {
        assert_eq!(pointer.ty, TypeId::of::<u8>());
        assert!(!pointer.mutable);
    }
    _ => unreachable!(),
}
```
2026-01-19 20:53:22 +01:00
Jonathan Brouwer
be69cc22a1
Rollup merge of #151045 - wrapping-neg, r=lcnr
Simplify some literal-value negations with `u128::wrapping_neg`

- Calling `overflowing_neg` and then discarding the overflow bit is the same as just calling `wrapping_neg`.
- Casting to `u128` to `i128`, negating, and then casting back produces the same result as just performing an unsigned `wrapping_neg`.

There should be no actual change to compiler behaviour.
2026-01-19 20:53:22 +01:00
Jonathan Brouwer
f1922ffe3b
Rollup merge of #151004 - apple-sleep-until, r=ChrisDenton
std: implement `sleep_until` on Apple platforms

On Apple platforms, `nanosleep` is internally [implemented](55b54c0a0c/gen/nanosleep.c (L281)) using `mach_wait_until`, a function that waits until a deadline specified in terms of `mach_absolute_time`. Since `mach_wait_until` is [public](f6217f891a/osfmk/mach/mach_time.h (L50-L51))[^1], we can use it to implement `sleep_until` by converting `Instant`s (which are measured against `CLOCK_UPTIME_RAW`, which is equivalent to `mach_absolute_time`) into `mach_absolute_time` values.

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

[^1]: It's badly documented, but it's defined in the same header as `mach_absolute_time`, which  `std` used to use for `Instant` before rust-lang/rust#116238.
2026-01-19 20:53:21 +01:00
Jonathan Brouwer
08eb24bda2
Rollup merge of #150987 - bishop-fix-batch-copy, r=Mark-Simulacrum
remote-test-server: Fix header in batch mode

In https://github.com/rust-lang/rust/pull/119999, the length field of the header was changed from 4 bytes to 8. One of the headers in `batch_copy` was missed though, so it sends the wrong size. Fix by switching to `create_header` in that spot too.
2026-01-19 20:53:21 +01:00
Jonathan Brouwer
8a22babce9
Rollup merge of #150895 - rustc_colored_explain, r=Kivooeo
rustc_errors: Add (heuristic) Syntax Highlighting for `rustc --explain`

This PR adds a feature that enables `rustc --explain <error>` to have syntax highlighted code blocks. Due to performance, size and complexity constraints, the highlighter is very heuristc, relying on conventions for capitalizations and such to infer what an identifier represents. The details for the implementation are specified below.
# Changes
1. Change `term::entrypoint` to `term::entrypoint_with_formatter`, which takes an optional third argument, which is a function pointer to a formatter. ([compiler/rustc_errors/src/markdown/mod.rs](https://github.com/rust-lang/rust/compare/main...JayanAXHF:rust:rustc_colored_explain?expand=1#diff-a6e139cadbc2e6922d816eb08f9e2c7b48304d09e6588227e2b70215c4f0725c))
2. Change `MdStream::write_anstream_buf` to be a wrapper around a new function, `MdStream::write_anstream_buf_with_formatter`, which takes a function pointer to a formatter. ([compiler/rustc_errors/src/markdown/mod.rs](https://github.com/rust-lang/rust/compare/main...JayanAXHF:rust:rustc_colored_explain?expand=1#diff-a6e139cadbc2e6922d816eb08f9e2c7b48304d09e6588227e2b70215c4f0725c))
3. Change [`compiler/rustc_driver_impl/src/lib.rs`](https://github.com/rust-lang/rust/compare/main...JayanAXHF:rust:rustc_colored_explain?expand=1#diff-39877a2556ea309c89384956740d5892a59cef024aa9473cce16bbdd99287937) to call `MdStream::write_anstream_buf_with_formatter` instead of `MdStream::write_anstream_buf`.
4. Add a `compiler/rustc_driver_impl/src/highlighter.rs` file, which contains the actual syntax highlighter.

# Implementation Details
1. The highlighter starts from the `highlight` function defined in `compiler/rustc_driver_impl/src/highlighter.rs`. It creates a new instance of the `Highlighter` struct, and calls its `highlight_rustc_lexer` function to start highlighting.
2. The `highlight_rustc_lexer` function uses `rustc_lexer` to lex the code into `Token`s. `rustc_lexer` was chosen since it preserves the newlines after scanning.
3. Based on the kind of token (`TokenKind`), we color the corresponding lexeme.
## Highlighter Implementation
### Identifiers
1. All identifiers that match a (non-exhaustive and minimal) list of keywords are coloured magenta.
2. An identifier that begins with a capital letter is assumed as a type. There is no distinction between a `Trait` and a type, since that would involve name resolution, and the parts of `rustc` that perform name resolution on code do not preserve the original formatting. (An attempt to use `rustc_parse`'s lexer and `TokenStream` was made, which was then printed with the pretty printer, but failed to preserve the formatting and was generally more complex to work with)
3. An identifier that is immediately followed by a parenthesis is recognized as a function identifier, and coloured blue.
## Literals
5. A `String` literal (or its corresponding `Raw`, `C` and `Byte` versions) is colored green.
6. All other literals are colored bright red (orange-esque)
## Everything Else

Everything else is colored bright white and dimmed, to create a grayish colour.

---
# Demo
<img width="1864" height="2136" alt="image" src="https://github.com/user-attachments/assets/b17d3a71-e641-4457-be85-5e5b1cea2954" />

<caption> Command: <code>rustc --explain E0520</code> </caption>

---
This description was not generated by an LLM (:p)

cc: @bjorn3
2026-01-19 20:53:21 +01:00
Jonathan Brouwer
958d1f907b
Rollup merge of #150879 - remove_diag_lints, r=Kivooeo
Remove the diagnostic lints

Removes the `untranslatable_diagnostic` and `diagnostic_outside_of_impl` lints
These lints are allowed for a while already. Per https://github.com/rust-lang/compiler-team/issues/959, we no longer want to enforce struct diagnostics for all usecases, so this is no longer useful.

r? @Kivooeo
I recommend reviewing commit by commit (also feel free to wait with reviewing until the MCP is accepted)

@rustbot +S-blocked
Blocked by https://github.com/rust-lang/compiler-team/issues/959
2026-01-19 20:53:20 +01:00
Jonathan Brouwer
a66a2e31eb
Rollup merge of #150550 - borrowck_cleanup_2, r=lcnr
Miscellaneous cleanups to borrowck related code

r? lcnr
2026-01-19 20:53:20 +01:00
Jonathan Brouwer
619f1378ed
Rollup merge of #148623 - trimmed-paths, r=davidtwco
Ignore `#[doc(hidden)]` items when computing trimmed paths for printing

The `trimmed_def_paths` query examines all items in the current crate, and all pub items in immediate-dependency crates (including the standard library), to see which item names are unique and can therefore be printed unambiguously as a bare name without a module path.

Currently that query has no special handling for `#[doc(hidden)]` items, which has two consequences:
- Hidden names can be considered unique, and will therefore be printed without a path, making it hard to find where that name is defined (since it normally isn't listed in documentation).
- Hidden names can conflict with visible names that would otherwise be considered unique, causing diagnostics to mysteriously become more verbose based on internal details of other crates.

This PR therefore makes the `trimmed_def_paths` query ignore external-crate items that are `#[doc(hidden)]`, along with their descendants.

As a result, hidden item names are never considered unique for trimming, and no longer interfere with visible item names being considered unique.

---
- Fixes https://github.com/rust-lang/rust/issues/148387.
2026-01-19 20:53:19 +01:00
Boxy
8a573580f8 Fix terminal dependent tests 2026-01-19 18:54:02 +00:00
Tshepang Mbambo
0b2584fbcc
Merge pull request #2732 from tejom/patch-1
Fix issue query deadlink in getting-started.md
2026-01-19 18:58:36 +02:00
Matthew Tejo
b0958e58bf
Fix issue query deadlink in getting-started.md
The link for finding issues leads to a 404. This adds the repo to the query in the url so the search works.
2026-01-19 08:53:43 -08:00
Jonathan Brouwer
0fa5589e0a
Remove obsolote diagnostic tests 2026-01-19 17:40:42 +01:00
Jonathan Brouwer
b7f6e85fa0
Remove #[rustc_lint_diagnostics] 2026-01-19 17:40:42 +01:00
Jonathan Brouwer
f50f5dc494
Remove all usages of #[rustc_lint_diagnostics] 2026-01-19 17:39:54 +01:00
Jonathan Brouwer
14484ec016
Remove the UNTRANSLATABLE_DIAGNOSTIC and DIAGNOSTIC_OUTSIDE_OF_IMPL lints 2026-01-19 17:39:54 +01:00
Jonathan Brouwer
0ee7d96253
Remove all allows for diagnostic_outside_of_impl and untranslatable_diagnostic throughout the codebase
This PR was mostly made by search&replacing
2026-01-19 17:39:49 +01:00