about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-07-04Auto merge of #143407 - jhpratt:rollup-ekkoubw, r=jhprattbors-125/+247
Rollup of 11 pull requests Successful merges: - rust-lang/rust#142749 (Add methods for converting bool to `Result<(), E>`) - rust-lang/rust#143288 (Fix `x clean` with a fifo) - rust-lang/rust#143307 (Fast path nitpicks) - rust-lang/rust#143346 (update coherence example) - rust-lang/rust#143356 (use unsigned_abs instead of `abs` on signed int to silence clippy) - rust-lang/rust#143370 (remove redundant #[must_use]) - rust-lang/rust#143378 (simplify receivers for some array method calls) - rust-lang/rust#143380 (Replace kw_span by full span for generic const parameters.) - rust-lang/rust#143381 (rustdoc: don't treat methods under const impls or traits as const) - rust-lang/rust#143394 (compiler: Document and reduce `fn provide`s in hir crates) - rust-lang/rust#143395 (Always use the pure Rust fallback instead of `llvm.{maximum,minimum}`) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-03mbe: Gracefully handle macro rules that end after `=>`Josh Triplett-0/+87
Add a test for various cases of invalid macro definitions. Closes: https://github.com/rust-lang/rust/issues/143351
2025-07-04Rollup merge of #143395 - Urgau:llvm-fallback-minimum-maximum, r=tgross35Jacob Pratt-14/+16
Always use the pure Rust fallback instead of `llvm.{maximum,minimum}` While https://github.com/llvm/llvm-project/pull/142170 was merged, it was reverted and next attempt (https://github.com/llvm/llvm-project/pull/140193) at fixing the LLVM implementation seems to have stall, so let's reverted back to pure Rust with the LLVM codegen. cc [#t-compiler/llvm > &#96;llvm.minimum&#96;/&#96;llvm.maximum&#96; issues @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/187780-t-compiler.2Fllvm/topic/.60llvm.2Eminimum.60.2F.60llvm.2Emaximum.60.20issues/near/527044712) Fixes https://github.com/rust-lang/rust/issues/141087 r? `@tgross35`
2025-07-04Rollup merge of #143394 - workingjubilee:reorganize-hir-analysis-provide-fn, ↵Jacob Pratt-52/+36
r=compiler-errors compiler: Document and reduce `fn provide`s in hir crates I found it hard to follow all these tiny micro-indirections. Much like you shouldn't pass around `&u32` if you can help it, you probably shouldn't use an indirection if the indirection overhead itself is literally bigger than the amount of data you are organizing. Generally a new `fn provide` amounts to around 3 LOC: - the signature with opening brace - the `rustc_middle::query::Providers` import - an end brace I am not even counting the cost in time and thought to go find the other `provide`, read it, understand, "Ah, yes, these functions", and then go to those. Thus I say we should collapse indirections of `provide` for modules that only export 1~2 queries. For higher-count indirections, I left them as-is, as I don't understand the crate well enough to judge their worth. Then I dropped a pointer to the actual module of interest for all these instances of the same function. I think documenting them is important because the comment that it relates to the query system makes it obvious that they have **nothing** to do with the rest of the module's logic and I can carry on ignoring them. Actively doing so is another cognitive cost, but much more minimal. There is also a small correctness issue in that all of these functions are technically mutating state. It's not a huge deal, but it's still easier to check all these mutations do not overlap if we have less instances of `fn provide` to check.
2025-07-04Rollup merge of #143381 - fee1-dead-contrib:push-pzxuvlnymxpu, r=GuillaumeGomezJacob Pratt-1/+50
rustdoc: don't treat methods under const impls or traits as const Fixes rust-lang/rust#143071
2025-07-04Rollup merge of #143380 - cjgillot:kw_span, r=compiler-errorsJacob Pratt-23/+31
Replace kw_span by full span for generic const parameters. Small simplification extracted from https://github.com/rust-lang/rust/pull/127241
2025-07-04Rollup merge of #143378 - hkBst:clippy-fix-6, r=tgross35Jacob Pratt-4/+4
simplify receivers for some array method calls
2025-07-04Rollup merge of #143370 - hkBst:clippy-fix-4, r=tgross35Jacob Pratt-4/+0
remove redundant #[must_use] Fixes these clippy warnings: ``` warning: this function has a `#[must_use]` attribute with no message, but returns a type already marked as `#[must_use]` --> library/core/src/cmp.rs:1456:5 | 1456 | fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: either add some descriptive message or remove the attribute = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_must_use = note: `-D clippy::double-must-use` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::double_must_use)]` warning: this function has a `#[must_use]` attribute with no message, but returns a type already marked as `#[must_use]` --> library/core/src/cmp.rs:1465:5 | 1465 | fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: either add some descriptive message or remove the attribute = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_must_use warning: this function has a `#[must_use]` attribute with no message, but returns a type already marked as `#[must_use]` --> library/core/src/cmp.rs:1474:5 | 1474 | fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: either add some descriptive message or remove the attribute = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_must_use warning: this function has a `#[must_use]` attribute with no message, but returns a type already marked as `#[must_use]` --> library/core/src/cmp.rs:1483:5 | 1483 | fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: either add some descriptive message or remove the attribute = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_must_use ```
2025-07-04Rollup merge of #143356 - hkBst:clippy-fix-2, r=scottmcmJacob Pratt-1/+1
use unsigned_abs instead of `abs` on signed int to silence clippy Use `unsigned_abs` instead of `abs` on signed int to silence clippy. Alternatively we could allow the lint, but if codegen is not affected, then this seems preferable.
2025-07-04Rollup merge of #143346 - emmanuel-ferdman:master, r=tshepangJacob Pratt-1/+1
update coherence example ## PR Summary Small PR - Commit 0533ff7d4169692e05d11d219c287a477a5471bb moved the `coherence_different_hidden_ty.rs` file. This PR adjusts sources to changes.
2025-07-04Rollup merge of #143307 - compiler-errors:fast-path-nitpicks, r=lcnrJacob Pratt-24/+31
Fast path nitpicks Miscellaneous commits that I didn't really want to fold into anything else. Fixes one theoretical bug with the fast path not considering polarity for `T: !Sized` bounds.
2025-07-04Rollup merge of #143288 - ehuss:fix-clean-fifo, r=KobzolJacob Pratt-1/+1
Fix `x clean` with a fifo `x clean` was failing when it encountered a special file like a fifo because it thought it was a directory.
2025-07-04Rollup merge of #142749 - LimpSquid:bool_to_result, r=scottmcmJacob Pratt-0/+76
Add methods for converting bool to `Result<(), E>` ## Tracking Issue https://github.com/rust-lang/rust/issues/142748 ## ACP https://github.com/rust-lang/libs-team/issues/606
2025-07-04refactor: implement a new bridge trait `Allocation`Makai-15/+54
2025-07-04refactor: rewrite `adt_repr()`, `adt_discr_for_variant()` and ↵Makai-19/+88
`coroutine_discr_for_variant()`
2025-07-04refactor: don't use rustc_type_ir directlyMakai-13/+8
2025-07-04refactor: avoid calling internal functions in `predicates_of()` and ↵Makai-54/+82
`explicit_predicates_of()`
2025-07-04refactor: move `convert` to `unstable`Makai-386/+317
We want to keep StableMIR definitions and logic separate from any sort of conversion and usage of internal rustc code. So we bundle all unstable items that have no stability guarantees into `stable_mir::unstable`.
2025-07-04fix: resolve the unsoundnessMakai-288/+422
add a new trait `InternalCx`, which defines the methods that are fine to call from `RustcInternal`. `RustcInternal::internal()` then takes a `impl InternalCx<'tcx>` instead of `TyCtxt<'tcx>`. make `tcx` in `SmirCtxt` public, since we need to pass it to `RustcInternal::internal()` in `SmirInterface`.
2025-07-04refactor: move `IndexMap` to `rustc_smir`Makai-41/+35
we should no longer keep `IndexMap` in `rustc_internal`, as we've decided to migrate `rustc_internal` to `stable_mir` under a feature.
2025-07-04refactor: unify `Tables` implementation with bridge types and re-export ↵Makai-194/+285
`IndexedVal` define bridge types for `***Def`s. consolidate scattered `Tables` implementations into single inherent impl.
2025-07-04refactor: remove the `tcx` field in `Tables`Makai-119/+100
the only functionality of `Tables` is caching results. this commit moves calls to rustc queries from `Tables` to `SmirCtxt`.
2025-07-04fix: rewrite some parts of `rustc_smir::builder.rs`Makai-4/+4
2025-07-04refactor: move `convert` module to `stable_mir`Makai-668/+1225
note that this commit delete `convert/error.rs`, we would use `SmirError::from_internal` instead. **Unresolved questions:** - There are still a few direct calls to rustc's internals scattered across `impl Stable`s, but most of them appear to be relatively stable, e.g., `mir::interpret::ConstAllocation::inner(self)` and `mir::syntax::SwitchTargets::otherwise(self)`.
2025-07-04refactor: rewrite the whole `rustc_smir::context`Makai-1000/+901
This commit removes the `Tables` field from `SmirCtxt`, since borrows of `tables` should only be managed by `SmirInterface`. This change prevents `SmirCtxt` from holding separate borrows and requires passing `tables` explicitly when needed. We use the `traits.rs` file to define traits that are used for encapsulating the associated functions in the rustc's internals. This is much easier to use and maintain than directly cramming everything into `SmirCtxt`.
2025-07-04refactor: split `rustc_smir::alloc` into two partsMakai-99/+151
The previous `rustc_smir::alloc` had many direct calls to rustc queries. This commit splits it into two parts: `rustc_smir::alloc` and `stable_mir::alloc`. Following the same pattern as `SmirCtxt` and `SmirInterface`, the `rustc_smir::alloc` handles all direct interactions with rustc queries and performs the actual memory allocations, while the `stable_mir::alloc` is responsible for constructing stable components.
2025-07-04refactor: impl `SmirError` for `stable_mir::Error`Makai-4/+13
2025-07-04refactor: move `IndexedVal` from `stable_mir` to `rustc_smir`Makai-19/+21
2025-07-04refactor: make `SmirInterface` a trait and impl it for `SmirContainer`Makai-255/+912
- rewrite all `SmirInterface` apis. - add `BridgeTys` to impl those associated types in `Bridge`. - move `**_def()` stuffs living in `impl Tables` from `rustc_internal` to `stable_mir`.
2025-07-03Remove some unnecessary `unsafe` in VecCacheScott McMurray-2/+2
2025-07-03Auto merge of #142890 - kornelski:unused-var-debug, r=saethlinbors-2/+54
MIR inliner maintains unused var_debug_info Only `full` debuginfo level promises variable-level debug information, but the MIR inline pass needlessly preserved the local variable debug info for the `limited` level too.
2025-07-03Merge pull request #20144 from regexident/load-workspace-into-dbChayim Refael Friedman-8/+25
Add `fn load_workspace_into_db` variant for `ra_ap_load_cargo`'s `fn load_workspace`
2025-07-03refactor: add `Tables<'tcx, B: Bridge>` and `SmirContainer`Makai-153/+87
2025-07-03Merge pull request #2488 from rust-lang/autodiff-doc-updatesManuel Drehwald-2/+2
adjust autodiff docs, after splitting up autodiff into two macros
2025-07-03adjust docs, after splitting up autodiff into two forward and reverse macrosManuel Drehwald-2/+2
2025-07-03fix: allow emccJayden Qi-1/+2
2025-07-03Add `fn load_workspace_into_db` variant for `ra_ap_load_cargo`'s `fn ↵Vincent Esche-8/+25
load_workspace`
2025-07-04Port `#[rustc_pass_by_value]` to the new attribute systemPavel Grigorenko-7/+24
2025-07-03compiler: document all provide fn in hir_analysis and hir_typeckJubilee Young-2/+7
2025-07-03compiler: inline 1-2 query provide fn in hir_analysis and hir_typeckJubilee Young-50/+29
Many small indirections with 1-2 items actively hinders understanding. Inlines various tiny submodule provides into - hir_analysis::provide - hir_analysis::check::provide - hir_typeck::provide
2025-07-03Fix several issues with `manual_is_multiple_of`Samuel Tardieu-3/+210
- `&a % &b == 0` compiles, but requires dereferencing `b` when replacing with `a.is_multiple_of(b)`. - In `a % b == 0`, if type of `a` is not certain, `a.is_multiple_of(b)` might not be typable. - In `a % b == 0`, `a` and `b` must be unsigned integers, not any arbitrary types implementing `Rem` and outputing an integer.
2025-07-03Do not always consider parameters of closures as type-certainSamuel Tardieu-3/+18
`Node::Param(…)` can represent function parameters as well as closure parameters. In the second case, a type is not always given. When no type is given, consider it uncertain.
2025-07-03Mark unsuffixed type literals are type uncertain by defaultSamuel Tardieu-13/+40
However, if they appear within the context of a function argument, they will be marked as certain, as they might eventually be considered `i32` by default if the context is not more specific. Also, in the case of binary expressions, if one of the side is uncertain, then the certainty will come from the other side.
2025-07-03Fix some things with builtin derivesChayim Refael Friedman-72/+190
1. Err on unions on derive where it's required. 2. Err on `#[derive(Default)]` on enums without `#[default]` variant. 3. Don't add where bounds `T: Default` when expanding `Default` on enums (structs need that, enums not). Also, because I was annoyed by that, in minicore, add a way to filter on multiple flags in the line-filter (`// :`). This is required for the `Debug` and `Hash` derives, because the derive should be in the prelude but the trait not.
2025-07-03Remove PointerLike traitMichael Goulet-288/+14
2025-07-03gai: remove typo from test file, and add a reference idTshepang Mbambo-0/+1
2025-07-03Auto merge of #143390 - GuillaumeGomez:rollup-2avj41s, r=GuillaumeGomezbors-130/+279
Rollup of 5 pull requests Successful merges: - rust-lang/rust#141831 (rustdoc: fix attrs of locally reexported foreign items) - rust-lang/rust#143364 (don't include `.md` in title) - rust-lang/rust#143369 (Various refactorings to the metadata loader) - rust-lang/rust#143379 (Post {beta,stable}-accepted notifications to compiler/bootstrap backport zulip channels on `{beta,stable}-accepted` label application) - rust-lang/rust#143384 (Update browser-ui-test version to `0.21.1`) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-03Always use the pure Rust fallback instead of `llvm.{maximum,minimum}`Urgau-14/+16
2025-07-03Port `#[no_implicit_prelude]` to the new attribute parsing infrastructureJonathan Brouwer-26/+77
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-03Add tidy-alphabetical for cross-crate attribute matchPavel Grigorenko-6/+8