about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-05-21eagerly check nested obligations when coercing fndefslcnr-3/+47
2025-05-21Auto merge of #141320 - matthiaskrgr:rollup-ag3vf3a, r=matthiaskrgrbors-82/+507
Rollup of 6 pull requests Successful merges: - #140981 (Add match guard let chain drop order and scoping tests) - #141042 (ci: split powerpc64le-linux job) - #141078 (ci: split dist-arm-linux job) - #141222 (Implement `ptr::try_cast_aligned` and `NonNull::try_cast_aligned`.) - #141308 (Do not call name() on rpitit assoc_item) - #141316 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-21Rollup merge of #141316 - rustbot:docs-update, r=ehussMatthias Krüger-0/+0
Update books ## rust-lang/edition-guide 1 commits in 1b1bb49babd65c732468cfa515b0c009bd1d26bc..aa6ce337c0adf7a63e33960d184270f2a45ab9ef 2025-05-20 23:47:34 UTC to 2025-05-20 23:47:34 UTC - Update references to the `missing_fragment_specifier` lint (rust-lang/edition-guide#376) ## rust-lang/reference 3 commits in acd0231ebc74849f6a8907b5e646ce86721aad76..118fd1f1f0854f50e3ae1fe4b64862aad23009ca 2025-05-20 22:52:38 UTC to 2025-05-20 21:45:13 UTC - Explain why nested receivers are dyn-incompatible (rust-lang/reference#1822) - Enable `[canonicalize-issue-links]` and `[no-mentions]` in triagebot (rust-lang/reference#1788) - Mention the temporary scope of `while let`. (rust-lang/reference#1779)
2025-05-21Rollup merge of #141308 - spastorino:fix-rpitit-error-reporting-ice, ↵Matthias Krüger-11/+35
r=nnethercote Do not call name() on rpitit assoc_item Fixes #141143 r? `@nnethercote`
2025-05-21Rollup merge of #141222 - mathisbot:ptr_trycastaligned, r=tgross35Matthias Krüger-0/+85
Implement `ptr::try_cast_aligned` and `NonNull::try_cast_aligned`. Implement three common methods on raw pointers and `NonNull`s: `try_cast_aligned`. ## Related links - Tracking Issue: https://github.com/rust-lang/rust/issues/141221 ## About `#[inline]` Since the result of a call to `align_of` is a power of two known at compile time, the compiler is able to reduce a call to `try_cast_aligned` to only test and sete (or test and jne if followed by `unwrap`), at least on every tier 1 target's arch. This seemed like a good reason to `#[inline]` the function. - https://godbolt.org/z/ocehvPWMx (raw inlining) - https://godbolt.org/z/3qa4j4Yrn (comparison with no inlining)
2025-05-21Rollup merge of #141078 - marcoieni:split-dist-arm-linux, r=KobzolMatthias Krüger-10/+55
ci: split dist-arm-linux job try-job: `dist-arm-linux-*`
2025-05-21Rollup merge of #141042 - marcoieni:split-dist-powerpc64le-linux, r=KobzolMatthias Krüger-13/+63
ci: split powerpc64le-linux job try-job: `dist-powerpc64le-linux-*`
2025-05-21Rollup merge of #140981 - est31:guard_let_chains_tests, r=petrochenkovMatthias Krüger-48/+269
Add match guard let chain drop order and scoping tests We have a bunch of tests for if let chain drop order, but those tests don't cover match guard chains to the same depth. This PR adds the following tests: * match guard equivalents of the if let chains tests in the `drop-order-comparisons.rs` test, added by #133605. * match guard equivalent of the `mir_let_chains_drop_order.rs` test, added by #107251 * match guard equivalent of `temporary-early-drop.rs`, added by #133093 The added tests all have variants for 2021 and 2024, showing that the behavior on both editions matches that of if let chains on 2024. tracking issue: https://github.com/rust-lang/rust/issues/51114
2025-05-21Auto merge of #127721 - bvanjoi:issue-124273, r=petrochenkovbors-32/+357
collect doc alias as tips during resolution Close #124273 Collect the symbol in the doc alias attributes and provide a tip when a match is found. r? `@estebank`
2025-05-21Update booksrustbot-0/+0
2025-05-20Auto merge of #141305 - matthiaskrgr:rollup-l6nwaht, r=matthiaskrgrbors-995/+1064
Rollup of 7 pull requests Successful merges: - #140972 (Add TRACING_ENABLED to Machine and add enter_trace_span!()) - #141282 (`core_float_math`: Move functions to `math` module) - #141288 (Get rid of unnecessary `BufDisplay` abstraction) - #141289 (use `Self` alias in self types rather than manually substituting it) - #141291 (link tracking issue in explicit-extern-abis.md) - #141294 (triagebot: ping me if rustdoc js is modified) - #141303 (Fix pagetoc inactive color in rustc book) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-20Implement `ptr::try_cast_aligned` and `NonNull::try_cast_aligned`.Mathis Bottinelli-0/+85
2025-05-20Do not call name() on rpitit assoc_itemSantiago Pastorino-11/+35
2025-05-20Auto merge of #140757 - dpaoliello:llvm20, r=Kobzolbors-2/+2
[win][ci] Update LLVM toolchain used to build LLVM to 20 While trying to get the aarch64-msvc build working correctly (#140136), I needed to update the version of LLVM used to build LLVM in Windows CI runners to 20 (as this has improved support for Arm64 and Arm64EC on Windows). This catches Windows up to Linux which was updated to 20 by #137189 try-job: `x86_64-apple-*` try-job: `aarch64-apple` try-job: `x86_64-msvc-*` try-job: `i686-msvc-*` try-job: `x86_64-mingw-*`
2025-05-20Rollup merge of #141303 - Urgau:pagetoc-fix-color, r=ehussMatthias Krüger-1/+1
Fix pagetoc inactive color in rustc book This PR fixes the color of inactive entry in rustc pagetoc, particularly with the "Rust" theme. | Before | After | |--------|-------| | ![image](https://github.com/user-attachments/assets/c6c8fe9a-0016-46cb-a638-71a62787b629) | ![image](https://github.com/user-attachments/assets/7146be5b-6ac3-4c9b-8e5a-eedd6ce61314) | Live preview at: http://urgau.rf.gd/book Related to https://github.com/rust-lang/rust/pull/140113#issuecomment-2888615781 r? `@ehuss`
2025-05-20Rollup merge of #141294 - lolbinarycat:triagebot-js-ping, r=aDotInTheVoidMatthias Krüger-0/+1
triagebot: ping me if rustdoc js is modified r? `@aDotInTheVoid`
2025-05-20Rollup merge of #141291 - ComputerDruid:patch-1, r=workingjubileeMatthias Krüger-1/+3
link tracking issue in explicit-extern-abis.md
2025-05-20Rollup merge of #141289 - compiler-errors:more-self, r=jhprattMatthias Krüger-5/+5
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-20Rollup merge of #141288 - yotamofek:pr/rustdoc/nuke-bufdisplay, r=GuillaumeGomezMatthias Krüger-55/+39
Get rid of unnecessary `BufDisplay` abstraction r? `@GuillaumeGomez` , since you reviewed the introduction of `BufDisplay` in #136784 . Not sure when it became unnecessary, but it did :) (feel free to reassign if you wish)
2025-05-20Rollup merge of #141282 - DJMcNab:core-float-math-math, r=tgross35Matthias Krüger-933/+990
`core_float_math`: Move functions to `math` module When these functions were added in https://github.com/rust-lang/rust/pull/138087 It made a relatively common pattern for emulating these functions using an extension trait (which internally uses `libm`) much more fragile. If `core::f32` happened to be imported by the user (to access a constant, say), then that import in the module namespace would take precedence over the `f32` in the type namespace for resolving these functions, running headfirst into the stability attribute. We ran into this in [Color](https://github.com/linebender/color) and chose to release the remedial 0.3.1 and 0.2.4, to allow downstream crates to build on `docs.rs`. As these methods are perma-unstable, moving them into a new module should not have any long-term concerns, and ensures that this "breakage" doesn't adversely impact anyone else. I believe that I've made the module unstable correctly. I presume that this does not require a test to make sure stable code can't depend on the module existing? I've left the stability attribute on each function - happy to tweak this if a different pattern is more correct. Tracking issue for `core_float_math`: https://github.com/rust-lang/rust/issues/137578. This PR is as requested in https://github.com/rust-lang/rust/pull/138087. r? `@tgross35` Recommended reviewing with whitespace hidden. (This is my first PR to `std/core`/this repository, as far as I can remember)
2025-05-20Rollup merge of #140972 - Stypox:machine-tracing-flag, r=RalfJungMatthias Krüger-0/+25
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-20Fix pagetoc inactive color in rustc bookUrgau-1/+1
2025-05-21collect doc alias as tips during resolutionbohan-32/+357
2025-05-20Auto merge of #141292 - matthiaskrgr:rollup-9nhhk7k, r=matthiaskrgrbors-303/+279
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`core_float_math`: Move functions to `math` folderDaniel McNab-933/+990
When these functions were added in https://github.com/rust-lang/rust/pull/138087 It made a relatively common pattern for emulating these functions using an extension trait (which internally uses `libm`) much more fragile. If `core::f32` happened to be imported by the user (to access a constant, say), then that import in the module namespace would take precedence over `f32` in the type namespace for resolving these functions, running headfirst into the stability attribute. We ran into this in Color - https://github.com/linebender/color - and chose to release the remedial 0.3.1 and 0.2.4, to allow downstream crates to build on `docs.rs`. As these methods are perma-unstable, moving them into a new module should not have any long-term concerns, and ensures that this breakage doesn't adversely impact anyone else.
2025-05-20Add enter_trace_span!() that checks if tracing is enabledStypox-0/+19
2025-05-20triagebot: ping me if rustdoc js is modifiedbinarycat-0/+1
2025-05-20Rollup merge of #141285 - compiler-errors:tick, r=lcnrMatthias Krüger-1/+1
Add tick to `RePlaceholder` debug output Present when debug printing canonical queries r? lcnr
2025-05-20Rollup merge of #141279 - nnethercote:lower_to_hir, r=compiler-errorsMatthias Krüger-38/+26
`lower_to_hir` cleanups Some minor cleanups I made when reading this code. r? `@Nadrieril`
2025-05-20Rollup merge of #141275 - dianne:gather-guard-pat-locals-once, r=compiler-errorsMatthias Krüger-1/+21
`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-20Rollup merge of #141269 - tshepang:rdg-push, r=jieyouxuMatthias Krüger-27/+20
rustc-dev-guide subtree update r? `@ghost`
2025-05-20Rollup merge of #141253 - ↵Matthias Krüger-3/+3
azhogin:azhogin/async-drop-feature-inconsistency-warning, r=oli-obk Warning added when dependency crate has async drop types, and the feature is disabled In continue of https://github.com/rust-lang/rust/pull/141031. When dependency crate has non-empty `adt_async_destructor` table in metadata, and `async_drop` feature is disabled for local crate, warning will be emitted. Test `dependency-dropped` has two revisions - with and without feature enabled. With feature enabled, async drop for dropee is executed ("Async drop" printed). Without the feature enabled, sync drop is executed ("Sync drop" printed) and warning is emitted. Warning example: ``` warning: found async drop types in dependecy `async_drop_dep`, but async_drop feature is disabled for `dependency_dropped` --> $DIR/dependency-dropped.rs:7:1 | LL | #![cfg_attr(with_feature, feature(async_drop))] | ^ | = help: if async drop type will be dropped in a crate without `feature(async_drop)`, sync Drop will be used ```
2025-05-20Rollup merge of #141236 - jagunter:issue-140823, r=compiler-errorsMatthias Krüger-15/+46
Resolved issue with mismatched types triggering ICE in certain scenarios ## Background The function `annotate_mut_binding_to_immutable_binding` called in `emit_coerce_suggestions` performs a type comparison between the `expected` and `found` types from `ExpectedFound` in the `TypeError`. This can fail if the `found` type contains a region variable that's been rolled back. ## What is being changed? This updates `annotate_mut_binding_to_immutable_binding` to use `expr_ty` and `expected` from the parent function instead of the types from the `TypeError`. This sidesteps the issue of using `found` from `TypeError` which may leak lingering inference region variables. This does change the diagnostic behavior to _only_ support cases where the expected outermost type is `&T`, but that seems to be the intended functionality. Also fixed the example in the `annotate_mut_binding_to_immutable_binding` rustdocs. r? rust-lang/types Fixes #140823
2025-05-20Rollup merge of #139419 - compiler-errors:recursive-opaque, r=lcnrMatthias Krüger-218/+162
Error on recursive opaque ty in HIR typeck "Non-trivially recursive" opaques are opaques whose hidden types are inferred to be equal to something other than themselves. For example, if we have a TAIT like `type TAIT = impl Sized`, if we infer the hidden type to be `TAIT := (TAIT,)`, that would be a non-trivial recursive definition. We don't want to support opaques that are non-trivially recursive, since they will (almost!! -- see caveat below) always result in borrowck errors, and are generally a pain to deal with. On the contrary, trivially recursive opaques may occur today because the old solver overagerly uses `replace_opaque_types_with_inference_vars`. This infer var can then later be constrained to be equal to the opaque itself. These cases will not necessarily result in borrow-checker errors, since other uses of the opaque may properly constrain the opaque. If there are no other uses we may instead fall back to `()` today. The only weird case that we have to unfortunately deal with was discovered in https://github.com/rust-lang/rust/issues/139406: ```rust #![allow(unconditional_recursion)] fn what1<T>(x: T) -> impl Sized { what1(x) } fn what2<T>(x: T) -> impl Sized { what2(what2(x)) } fn print_return_type<T, U>(_: impl Fn(T) -> U) { println!("{}", std::any::type_name::<U>()) } fn main() { print_return_type(what1::<i32>); // () print_return_type(what2::<i32>); // i32 } ``` > HIR typeck eagerly replaces the return type with an infer var, ending up with `RPIT<T> = RPIT<RPIT<T>>` in the storage. While we return this in the `TypeckResults`, it's never actually used anywhere. > > MIR building then results in the following statement > ```rust > let _0: impl RPIT<T> /* the return place */ = build<RPIT<T>>(_some_local); > ``` > Unlike HIR typeck MIR typeck now directly equates `RPIT<T>` with `RPIT<RPIT<T>>`. This does not try to define `RPIT` but instead relates its generic arguments https://github.com/rust-lang/rust/blob/b9856b6e400709392dd14599265b6fd52fc19f3e/compiler/rustc_infer/src/infer/relate/type_relating.rs#L185-L190 > > This means we relate `T` with `RPIT<T>`, which results in a defining use `RPIT<T> = T` I think it's pretty obvious that this is not desirable behavior, and according to the crater run there were no regressions, so let's break this so that we don't have any inference hazards in the new solver. In the future `what2` may end up compiling again by also falling back to `()`. However, that is not yet guaranteed and the transition to this state is made significantly harder by not temporarily breaking it on the way. It is also concerning to change the inferred hidden type like this without any notification to the user, even if likely not an issue in this concrete case.
2025-05-20link tracking issue in explicit-extern-abis.mdDan Johnson-1/+3
2025-05-20use Self alias in self types rather than manually substituting itMichael Goulet-5/+5
2025-05-20Get rid of unnecessary `BufDisplay` abstractionYotam Ofek-28/+6
2025-05-20Replace some `unwrap`s with `?`s where possibleYotam Ofek-2/+2
2025-05-20Make some fns return `fmt::Result` to get rid of a few `unwrap`sYotam Ofek-27/+33
2025-05-20ci: split powerpc64le-linux jobMarcoIeni-13/+63
2025-05-20Auto merge of #140932 - onur-ozkan:llvm-tools, r=Kobzolbors-13/+22
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-20Add tick to RePlaceholder debug outputMichael Goulet-1/+1
2025-05-20Revert "Fix stack overflow in exhaustiveness due to recursive HIR opaque ↵Michael Goulet-35/+5
type values" This reverts commit b08e9c2a60f4dbab4bdaa733727947b3395de329.
2025-05-20Just error on recursive opaque ty in HIR typeckMichael Goulet-183/+157
2025-05-20Auto merge of #141278 - lnicola:sync-from-ra, r=lnicolabors-1358/+3449
Subtree update of `rust-analyzer` r? `@ghost`
2025-05-20Merge pull request #19826 from lnicola/sync-from-rustLaurențiu Nicola-25334/+43255
minor: Sync from downstream
2025-05-20Bump rustc cratesLaurențiu Nicola-22/+29
2025-05-20Merge from rust-lang/rustLaurențiu Nicola-25313/+43227
2025-05-20Preparing for merge from rust-lang/rustLaurențiu Nicola-1/+1
2025-05-19`gather_locals`: only visit guard pattern guards when checking the guarddianne-1/+21
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 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".