Commit Graph

4285 Commits

Author SHA1 Message Date
Matthias Krüger c375f0bc25
Rollup merge of #141294 - lolbinarycat:triagebot-js-ping, r=aDotInTheVoid
triagebot: ping me if rustdoc js is modified

r? `@aDotInTheVoid`
2025-05-20 20:57:29 +02:00
Matthias Krüger 62d2bbe691
Rollup merge of #141289 - compiler-errors:more-self, r=jhpratt
use `Self` alias in self types rather than manually substituting it

Of the rougly 145 uses of `self: Ty` in the standard library, 5 of them don't use `Self` but instead choose to manually "substitute" the `impl`'s self type into the type.

This leads to weird behavior sometimes (https://github.com/rust-lang/rust/issues/140611#issuecomment-2883761300) -- **to be clear**, none of these usages actually trigger any bugs, but it's possible that they may break in the future (or at least lead to lints), so let's just "fix" them proactively.
2025-05-20 20:57:28 +02:00
Matthias Krüger 16cad94753
Rollup merge of #140972 - Stypox:machine-tracing-flag, r=RalfJung
Add TRACING_ENABLED to Machine and add enter_trace_span!()

This PR adds the necessary infrastructure to make it possible to do tracing calls from within `rustc_const_eval` when running Miri, while making sure they don't impact the performance of normal compiler execution. This is done by adding a `const` boolean to `Machine`, false by default, but that will be set to true in Miri only. The tracing macro `enter_trace_span!()` checks if it is true before doing anything, and since the value of a `const` is known at compile time, if it it false it the whole tracing call should be optimized out.

I will soon open further PRs to add tracing macro calls similar to this one, so that afterwards it will be possible to learn more about Miri's time spent in the various interpretation steps:
```rs
let _guard = enter_trace_span!(M, "eval_statement", "{:?}", stmt);
```

r? `@RalfJung`
2025-05-20 20:57:26 +02:00
bors 8dd9b427c4 Auto merge of #141292 - matthiaskrgr:rollup-9nhhk7k, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #139419 (Error on recursive opaque ty in HIR typeck)
 - #141236 (Resolved issue with mismatched types triggering ICE in certain scenarios)
 - #141253 (Warning added when dependency crate has async drop types, and the feature is disabled)
 - #141269 (rustc-dev-guide subtree update)
 - #141275 (`gather_locals`: only visit guard pattern guards when checking the guard)
 - #141279 (`lower_to_hir` cleanups)
 - #141285 (Add tick to `RePlaceholder` debug output)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-20 15:48:56 +00:00
Boxy 5d24aedfa5
Merge pull request #2400 from smanilov/patch-13
Make it clear we talk about early bound params
2025-05-20 16:36:21 +01:00
Boxy c693842a05
Merge pull request #2398 from smanilov/patch-12
Update links between ty-module and binders
2025-05-20 16:18:22 +01:00
Matthias Krüger 50088cce03
Rollup merge of #141285 - compiler-errors:tick, r=lcnr
Add tick to `RePlaceholder` debug output

Present when debug printing canonical queries

r? lcnr
2025-05-20 16:50:43 +02:00
Matthias Krüger f021be80bb
Rollup merge of #141279 - nnethercote:lower_to_hir, r=compiler-errors
`lower_to_hir` cleanups

Some minor cleanups I made when reading this code.

r? `@Nadrieril`
2025-05-20 16:50:42 +02:00
Matthias Krüger 5b4115f059
Rollup merge of #141275 - dianne:gather-guard-pat-locals-once, r=compiler-errors
`gather_locals`: only visit guard pattern guards when checking the guard

When checking a pattern with guards in it, `GatherLocalsVisitor` will visit both the pattern (when type-checking the let, arm, or param containing it) and local declarations in the guard expression (when checking the guard itself). This keeps it from visiting the guard when visiting the pattern, since otherwise it would gather locals from the guard twice, which would lead to a delayed bug: "evaluated expression more than once".

Tracking issue for guard patterns: #129967
2025-05-20 16:50:41 +02:00
Matthias Krüger e3d1a4e545
Rollup merge of #141269 - tshepang:rdg-push, r=jieyouxu
rustc-dev-guide subtree update

r? `@ghost`
2025-05-20 16:50:41 +02:00
Stan Manilov 731daeed50
Make it clear we talk about early bound params 2025-05-20 16:25:11 +03:00
bors e38407fb02 Auto merge of #140932 - onur-ozkan:llvm-tools, r=Kobzol
update llvm-tools logic for `dist` and `install` steps

First commit aligns `build_steps::compile` and `build_steps::dist` logics for copying llvm-tools, and the second commit adds the correct `should_run` condition for `LlvmTools` step as the previous one was clearly incorrect.

Fixes #140913
2025-05-20 12:44:14 +00:00
León Orell Valerian Liehr e5b1e372e2
Merge pull request #2399 from steffahn/fix-tenv-link
Fix misdirected link for `TypingEnv`
2025-05-20 13:57:50 +02:00
Frank Steffahn 011f51231e Fix misdirected link for `TypingEnv` 2025-05-20 13:26:22 +02:00
Stan Manilov 05a7dc42d4 Update links between ty-module and binders
The order might have been reversed at some point, leading to the two
chapters talking about each other in the wrong order.
2025-05-20 13:52:33 +03:00
nora bcf2bab5dd
Merge pull request #2396 from smanilov/patch-11
Small typo and style fixes in  binders.md
2025-05-20 11:10:30 +02:00
Stan Manilov 3a949427fd
Small typo and style fixes in binders.md
Normally I refrain from nit picking, but this seamed worth it.
2025-05-20 11:41:55 +03:00
Laurențiu Nicola 404670a818
Merge pull request #19826 from lnicola/sync-from-rust
minor: Sync from downstream
2025-05-20 07:15:48 +00:00
Laurențiu Nicola ab41234b8f Merge from rust-lang/rust 2025-05-20 10:01:00 +03:00
Tshepang Mbambo 178cc75469
Merge pull request #2392 from rust-lang/rustc-pull
Rustc pull update
2025-05-20 04:37:19 +02:00
许杰友 Jieyou Xu (Joe) 126b4dd4bf
Merge pull request #2395 from smanilov/patch-10 2025-05-19 22:36:58 +08:00
Stan Manilov 6ec183f9bc
Update link to Forge guide on new flags 2025-05-19 17:32:29 +03:00
nora 25b50b3770
Merge pull request #2394 from smanilov/patch-9
Make run instructions first
2025-05-19 14:34:27 +02:00
nora 5a60a685ad
Merge pull request #2393 from smanilov/patch-8
Remove unused references and simplify one
2025-05-19 14:33:57 +02:00
Stan Manilov 007a7a109c
Make run instructions first
Better, because then one knows how to run the examples.
2025-05-19 14:44:36 +03:00
Stan Manilov eae6f4ce66
Remove unused references and simplify one 2025-05-19 14:41:19 +03:00
nora d4e4ad1ba9
Merge pull request #2389 from fuzzypixelz/typos
Fix typos in "Libraries and Metadata"
2025-05-19 12:39:24 +02:00
bors 6d82b4656b Auto merge of #140754 - dpaoliello:cygwinpath, r=marcoieni
[win][CI] Convert paths to Windows format before adding to PATH

While trying to get the `aarch64-msvc` build working correctly (#140136), I noticed that the `PATH` observed during the Rust steps of the build on Windows builds had some entries still in MinGW format, which means that Windows would not be able to use them correctly:

From <https://github.com/rust-lang/rust/actions/runs/14606167901/job/40975555680#step:28:192> note the path for `ninja` and `sccache`.

```
PATH = Some(C:\a\rust\rust\src\ci\citool\../../../build/citool\debug\deps;C:\a\rust\rust\src\ci\citool\../../../build/citool\debug;C:\Users\runneradmin\.rustup\toolchains\stable-aarch64-pc-windows-msvc\lib\rustlib\aarch64-pc-windows-msvc\lib;C:\Program Files\Git\clangarm64/bin;C:\Program Files\Git\usr\bin;C:\Users\runneradmin\bin;/c/a/rust/rust/ninja;/c/a/rust/rust/sccache;C:\Users\runneradmin/.cargo/bin;C:\aliyun-cli;C:\vcpkg;C:\Program Files (x86)\NSIS\;C:\Program Files\Mercurial\;C:\hostedtoolcache\windows\stack\3.3.1\x64;C:\mingw64\bin;C:\Program Files\dotnet;C:\Program Files\MySQL\MySQL Server 8.0\bin;C:\Program Files (x86)\R\R-4.4.2\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\SeleniumWebDrivers\EdgeDriver\;C:\SeleniumWebDrivers\ChromeDriver;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hostedtoolcache\windows\go\1.21.13\arm64\bin;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\hostedtoolcache\windows\Ruby\3.0.7\x64\bin;C:\Program Files\OpenSSL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.442-6\x64\bin;C:\Program Files (x86)\ImageMagick-7.1.1-Q16-HDRI;C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\ProgramData\Chocolatey\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Microsoft SQL Server\160\DTS\Binn\;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\CMake\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.9.9\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\clangarm64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI\;c:\tools\php;C:\Program Files (x86)\sbt\bin;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Amazon\SessionManagerPlugin\bin\;C:\Program Files\Amazon\AWSSAMCLI\bin\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\LLVM\bin;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps)
```
The fix for this is to use `cygpath` to convert from the Cygwin format back to native Windows format before adding to the `PATH`.

---
try-job: dist-aarch64-msvc
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
try-job: i686-msvc-1
try-job: i686-msvc-2
try-job: x86_64-mingw-1
try-job: x86_64-mingw-2
try-job: dist-i686-mingw
2025-05-19 09:51:31 +00:00
The rustc-dev-guide Cronjob Bot 360823ca60 Merge from rustc 2025-05-19 04:16:41 +00:00
The rustc-dev-guide Cronjob Bot 1962be7988 Preparing for merge from rustc 2025-05-19 04:10:52 +00:00
bors ef2d6adbfc Auto merge of #140154 - Berrysoft:cygwin-host, r=jieyouxu
Cygwin support in rustc

This PR builds host rustc targeting cygwin.

- [x] https://github.com/rust-lang/stacker/pull/122
- [x] https://github.com/nagisa/rust_libloading/pull/173
- [x] https://github.com/Detegr/rust-ctrlc/pull/131
- [x] https://github.com/rust-random/getrandom/pull/654
- [x] https://github.com/msys2/MSYS2-packages/issues/5350
- [x] https://github.com/rust-lang/rust/pull/140886
- [x] https://github.com/rust-lang/rust/pull/140921
- [x] https://github.com/rust-lang/rust/pull/140973

Currently supported:
* rustc
* rustdoc
* rustfmt
* clippy

Blocking:
* cargo: blocked by https://github.com/rust-lang/socket2/pull/568
* rust-analyzer: needs `cargo update`, fixed upstream

```
$ rustc --version --verbose
rustc 1.88.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-pc-cygwin
release: 1.88.0-dev
LLVM version: 20.1.4
```
2025-05-18 23:53:04 +00:00
bors c2a9fb30f3 Auto merge of #127013 - tgross35:f16-format-parse, r=Mark-Simulacrum
Add `f16` formatting and parsing

Use the same algorithms as for `f32` and `f64` to implement `f16` parsing and printing.

try-job: x86_64-gnu-aux
2025-05-18 20:38:01 +00:00
León Orell Valerian Liehr 6f524a2f7e
Merge pull request #2391 from fmease/excl-iss-w-pr
Exclude issues with an associated PR from the "What should I work on" GH query
2025-05-18 20:05:13 +02:00
León Orell Valerian Liehr 4123a275be
Exclude issues with an associated PR from the "What should I work on" GH query 2025-05-18 20:01:47 +02:00
Mahmoud Mazouz ef032e8c8d
Fix typos in "Libraries and Metadata" 2025-05-18 15:37:18 +02:00
bors bf41ec2a81 Auto merge of #141216 - fmease:rollup-pa5mvx3, r=fmease
Rollup of 8 pull requests

Successful merges:

 - #140113 (Add per page TOC in the `rustc` book)
 - #140511 (Stabilize `#![feature(non_null_from_ref)]`)
 - #140924 (Make some `f32`/`f64` tests also run in const-context)
 - #140966 (Remove #![feature(let_chains)] from library and src/librustdoc)
 - #141045 ([win][arm64] Remove 'Arm64 Hazard' undocumented MSVC option and instead disable problematic test)
 - #141071 (Enable [behind-upstream] triagebot option for rust-lang/rust)
 - #141132 (Use `crate::` prefix for root macro suggestions)
 - #141139 (Fix Rust for Linux ping group label)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-18 12:05:55 +00:00
León Orell Valerian Liehr 57af1ce1f0
Rollup merge of #141139 - jieyouxu:fix-rfl, r=Urgau
Fix Rust for Linux ping group label

Noticed in https://github.com/rust-lang/rust/pull/140966#issuecomment-2886704667. Seems like a broken label can cause the triagebot ping message to not be issued.

See https://github.com/rust-lang/triagebot/issues/1992.

```@rustbot``` label: +A-rust-for-linux
2025-05-18 11:03:48 +02:00
León Orell Valerian Liehr 7e9ba552d8
Rollup merge of #141071 - xizheyin:behind-upstream, r=Urgau
Enable [behind-upstream] triagebot option for rust-lang/rust

After testing in [rustc-develop-guide](https://github.com/rust-lang/rustc-dev-guide/pull/2384#issuecomment-2876631306), we can turn on `behind-upstream` here.

Doc: https://forge.rust-lang.org/triagebot/behind-upstream.html

r? ```@Urgau```
2025-05-18 11:03:46 +02:00
León Orell Valerian Liehr 33cb9ed899
Rollup merge of #141045 - dpaoliello:noarmhazard, r=jieyouxu
[win][arm64] Remove 'Arm64 Hazard' undocumented MSVC option and instead disable problematic test

PR #140758 added the undocumented `/arm64hazardfree` MSVC linker flag to work around a test failure where LLVM generated code that would trip a hazard in an outdated ARM processor.

Adding this flag caused issues with LLD, as it doesn't recognize it.

Rethinking the issue, using the undocumented flag seems like the incorrect solution: there's no guarantee that the flag won't be removed in the future, or change its meaning.

Instead, I've disabled the problematic test for Arm64 Windows and have filed a bug with the MSVC team to have the check removed: <https://developercommunity.microsoft.com/t/Remove-checking-for-and-fixing-Cortex-A/10905134>

This PR supersedes #140977

r? ```@jieyouxu```
2025-05-18 11:03:46 +02:00
León Orell Valerian Liehr d997cc2656
Rollup merge of #140966 - est31:let_chains_library, r=tgross35
Remove #![feature(let_chains)] from library and src/librustdoc

PR https://github.com/rust-lang/rust/pull/132833 has stabilized the `let_chains` feature. This PR removes the last occurences from the library, the compiler, and librustdoc (also because #140887 missed the conditional in one of the crates as it was behind the "rustc" feature).

We keep `core` as exercise for the future as updating it is non-trivial (see PR thread).
2025-05-18 11:03:45 +02:00
León Orell Valerian Liehr f511a90ee3
Rollup merge of #140924 - Urgau:f32_f64_const_tests, r=Mark-Simulacrum
Make some `f32`/`f64` tests also run in const-context
2025-05-18 11:03:45 +02:00
León Orell Valerian Liehr d9edc4c0ee
Rollup merge of #140511 - mathisbot:master, r=dtolnay
Stabilize `#![feature(non_null_from_ref)]`

This PR stabilizes the following:
```rust
impl<T: ?Sized> NonNull<T> {
    pub const fn from_ref(reference: &T) -> NonNull<T>;
    pub const fn from_mut(reference: &mut T) -> NonNull<T>;
}
```
The feature is tracked in [#130823](https://github.com/rust-lang/rust/issues/130823).
2025-05-18 11:03:44 +02:00
León Orell Valerian Liehr 7f26df9852
Rollup merge of #140113 - Urgau:rustc-book-page-toc, r=ehuss
Add per page TOC in the `rustc` book

This PR adds per page Table of Content (TOC) in the `rustc` book (to be extended in the future to our other books).

The goal is to easy the navigation inside the page by providing quick overview of the page content and our position inside that page.

That functionality is unfortunately not available natively in `mdbook`, which prompted community members to create [mdBook-pagetoc](https://github.com/JorelAli/mdBook-pagetoc/) (which this PR is heavily inspired by). It's "only" a JS file (to handle the TOC) and a CSS file (to handle the margin, colors, screen size, ...), there is no "post-processor" needed (in mdbook sense).

![image](https://github.com/user-attachments/assets/9e790bea-059d-414e-b4a5-ac8170f57e27)

Live preview at: http://urgau.rf.gd/book

r? ```@jieyouxu```
2025-05-18 11:03:44 +02:00
Lukas Wirth 4defb12046
Merge pull request #19687 from gohome001/highlight_unsafe
feat: highlight unsafe operations
2025-05-18 08:44:10 +00:00
bors 71605a271f Auto merge of #141063 - dianqk:llvm-20.1.5, r=cuviper
Update to LLVM 20.1.5

`@rustbot` label A-LLVM T-compiler
2025-05-18 04:54:07 +00:00
bors b83011e94d Auto merge of #141039 - lqd:expensive-sanity, r=compiler-errors
move expensive layout sanity check to debug assertions

It is [hard to fix](https://github.com/rust-lang/rust/issues/141006#issuecomment-2883415000) the slowness in the uninhabitedness computation for very big types but we can fix the very specific case of them being called during the layout sanity checks, as described in #140944.

So this PR moves this uninhabitedness check to the other expensive layout sanity checks that are ran under `debug_assertions`.

It makes building the `lemmy_api_routes` crate's self-profile `layout_of` query go from

```
+--------------------------------------------------------+-----------+-----------------+----------+------------+---------------------------------+
| Item                                                   | Self time | % of total time | Time     | Item count | Incremental result hashing time |
+--------------------------------------------------------+-----------+-----------------+----------+------------+---------------------------------+
| layout_of                                              | 63.02s    | 41.895          | 244.26s  | 123703     | 50.30ms                         |
+--------------------------------------------------------+-----------+-----------------+----------+------------+---------------------------------+
```

on master (2m17s total), to

```
| layout_of                                              | 330.21ms  | 0.372           | 26.90s   | 123703     | 53.19ms                         |
```

with this PR (1m15s total).

(Note that the [perf run results](https://github.com/rust-lang/rust/pull/141039#issuecomment-2884688756) below look a bit better than [an earlier run](https://perf.rust-lang.org/compare.html?start=4eca99a18eab3d4e28ed1ce3ee620d442955a470&end=c4a00993f8ee02c7565e7be652608817ea2fb97d&stat=instructions:u) I did in another PR. There may be some positive noise there, or post-merge results could differ a bit)

Since we discussed this today, r? `@compiler-errors` — and cc `@lcnr` and `@RalfJung.`
2025-05-18 01:30:48 +00:00
bors d1d10b1756 Auto merge of #140856 - oli-obk:merge-queries2, r=nnethercote
Merge mir query analysis invocations

r? `@ghost`

same thing as https://github.com/rust-lang/rust/pull/140854 just a different set of queries

Doing this in general has some bad cache coherence issues because the query caches are laid out in Vec<QueryResult> lists per query where each index refers to a DefId in the same order as we're iterating. Iterating two or more lists at the same time does have cache issues, so I want to poke a bit at it to see if we can't merge just a few of them at a time.
2025-05-17 22:31:43 +00:00
bors f9359ce598 Auto merge of #138087 - tgross35:core-float-math, r=Amanieu
Initial implementation of `core_float_math`

Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1], with the exception of `powi` that has been there longer.

Details for each of the changes is in the commit messages.

Tracking issue: https://github.com/rust-lang/rust/issues/137578

[1]: https://github.com/rust-lang/compiler-builtins/pull/763

try-job: aarch64-gnu
tru-job: armhf-gnu
try-job: i686-msvc-1
try-job: test-various
try-job: x86_64-mingw-1
try-job: x86_64-mingw-2
2025-05-17 19:31:39 +00:00
Jieyou Xu 2ef17aa39b
rustc-dev-guide: fix Rust for Linux rust-lang/rust label 2025-05-17 23:51:50 +08:00
bors 6054ba4e95 Auto merge of #141024 - jieyouxu:revert-arm64ec, r=wesleywiser
Revert "Fix linking statics on Arm64EC #140176"

This reverts PR #140176.
Unfortunately, this will reopen https://github.com/rust-lang/rust/issues/138541 (re-breaking the `arm64ec-pc-windows-msvc` target).

Unfortunately, multiple people are [reporting linker warnings related to `__rust_no_alloc_shim_is_unstable`](https://github.com/rust-lang/rust/pull/140176#issuecomment-2879715554) after this change in `x86_64-pc-windows-msvc` as well. The solution isn't quite clear yet, let's revert to avoid the linker warnings on the Tier 1 MSVC target for now[^timing], and try a reland with a determined solution for `__rust_no_alloc_shim_is_unstable`.

Judging from [people reporting that they are observing this also when bootstrapping w/ stage0 rustc](https://github.com/rust-lang/rust/pull/140176#issuecomment-2881867433), we may have to cut a new beta and then repoint stage0 against that newer beta?

cc `@dpaoliello` `@wesleywiser`

r? `@wesleywiser` (or compiler)

[^timing]: Note that it's still RustWeek this week, so most team members are N/A.
2025-05-17 07:00:46 +00:00