about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-07-04Lighten formatting.Camille GILLOT-5/+4
2025-07-04Reuse metadata file from work products.Camille GILLOT-28/+82
2025-07-04Save metadata among work products.Camille GILLOT-4/+34
2025-07-04Remove names_imported_by_glob_use query.Camille GILLOT-7/+0
2025-07-04Auto merge of #143247 - cjgillot:metadata-no-red, r=petrochenkovbors-28/+23
Avoid depending on forever-red DepNode when encoding metadata. Split from https://github.com/rust-lang/rust/pull/114669 for perf r? `@petrochenkov`
2025-07-04bump termize depklensy-2/+2
2025-07-04treat box patterns as deref patterns in THIR and usefulness analysisdianne-66/+28
This removes special-casing of boxes from `rustc_pattern_analysis`, as a first step in replacing `box_patterns` with `deref_patterns`. Incidentally, it fixes a bug caused by box patterns being represented as structs rather than pointers, where `exhaustive_patterns` could generate spurious `unreachable_patterns` lints on arms required for exhaustiveness; following the lint's advice would result in an error.
2025-07-04Auto merge of #143237 - JonathanBrouwer:no_implicit_prelude_parser, ↵bors-8/+56
r=jdonszelmann,oli-obk Port `#[no_implicit_prelude]` to the new attribute parsing infrastructure Ports no_implicit_prelude to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? `@oli-obk` cc `@jdonszelmann`
2025-07-03Allow all MIR `Aggregate`s to take the operand path (if layout permits)Scott McMurray-67/+149
2025-07-03Block SIMD in transmute_immediate; delete `OperandValueKind`Scott McMurray-148/+81
See conversation in <https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Is.20transmuting.20a.20.60T.60.20to.20.60Tx1.60.20.28one-element.20SIMD.20vector.29.20UB.3F/near/526262799>.
2025-07-04Enable xgot feature for mips64 musl targetsJens Reidel-2/+2
This was missed in b65c2afdfd9aaee977302516c9ef177861abfe74, which only enabled it for the glibc targets. I didn't feel comfortable touching the OpenWRT target, whoever maintains that will probably want to take a look whether it is necessary there as well. Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-07-03mbe: Gracefully handle macro rules that end after `=>`Josh Triplett-0/+9
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-12/+14
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 #143380 - cjgillot:kw_span, r=compiler-errorsJacob Pratt-18/+26
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 #143307 - compiler-errors:fast-path-nitpicks, r=lcnrJacob Pratt-24/+8
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-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/+4
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-03refactor: add `Tables<'tcx, B: Bridge>` and `SmirContainer`Makai-153/+87
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-03Remove PointerLike traitMichael Goulet-196/+11
2025-07-03Always use the pure Rust fallback instead of `llvm.{maximum,minimum}`Urgau-12/+14
2025-07-03Port `#[no_implicit_prelude]` to the new attribute parsing infrastructureJonathan Brouwer-8/+56
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-03Add tidy-alphabetical for cross-crate attribute matchPavel Grigorenko-6/+8
2025-07-03Make __rust_alloc_error_handler_should_panic a functionDaniel Paoliello-33/+99
2025-07-03Rollup merge of #143369 - bjorn3:cleanup_metadata_loading, r=lcnrGuillaume Gomez-95/+134
Various refactorings to the metadata loader
2025-07-03Merge run_fat_lto, optimize_fat and autodiff into run_and_optimize_fat_ltobjorn3-69/+26
2025-07-03Rework logic and provide structured suggestionEsteban Küber-10/+71
2025-07-03Remove unused config param from WriteBackendMethods::autodiffbjorn3-8/+2
2025-07-03Remove unnecessary check for fat LTObjorn3-1/+1
2025-07-03Move run_fat_lto call into execute_fat_lto_work_itembjorn3-32/+36
This will allow merging all fat LTO steps together. In addition it reduces the amount of work done on the coordinator thread without jobserver token.
2025-07-03Return early when `self` resolve failure because of `let self = ...`xizheyin-4/+12
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>