about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2025-07-31Remove `TyCtxt::get_attrs_unchecked`.Nicholas Nethercote-10/+2
It's identical to `TyCtxt::get_all_attrs` except it takes `DefId` instead of `impl Into<DefIf>`.
2025-07-31Remove `ParamEnvAnd::into_parts`.Nicholas Nethercote-6/+0
The fields are public, so this doesn't need a method, normal deconstruction and/or field access is good enough.
2025-07-31Move `TermVid` out of `rustc_middle`.Nicholas Nethercote-18/+0
It's only used in `rustc_infer`.
2025-07-31Move `rustc_middle::parameterized` to `rustc_metadata`.Nicholas Nethercote-144/+0
It's only used there.
2025-07-31Remove unused `ParameterizedOverTcx` impls.Nicholas Nethercote-13/+0
2025-07-31Move `ParamTerm` out of `rustc_middle`.Nicholas Nethercote-15/+0
It's only used in `rustc_hir_typeck`.
2025-07-31Move an `EarlyParamRegion` impl block.Nicholas Nethercote-9/+9
Next to all the other `EarlyParamRegion` pieces.
2025-07-31Move `ImplHeader` out of `rustc_middle`.Nicholas Nethercote-12/+0
It's not used in `rustc_middle`, and `rustc_trait_selection` is a better place for it.
2025-07-31Move `ResolverOutputs` out of `rustc_middle`.Nicholas Nethercote-5/+0
It's not used in `rustc_middle`, and `rustc_resolve` is a better place for it.
2025-07-31Remove unused `impl_decodable_via_ref!` entries.Nicholas Nethercote-3/+0
2025-07-30Auto merge of #116316 - cjgillot:incr-privacy, r=petrochenkovbors-1/+0
Remove eval_always from check_private_in_public. This PR attempts to avoid re-computing `check_private_in_public` query. First by marking the query as non-`eval_always`, and by reducing the amount of accesses to HIR as much as possible. Latest perf https://github.com/rust-lang/rust/pull/116316#issuecomment-3094672105 shows that we manage it. The cost is extra dep-graph bookkeeping.
2025-07-30const-eval: full support for pointer fragmentsRalf Jung-116/+129
2025-07-30Auto merge of #144577 - oli-obk:wrapping-niche, r=scottmcmbors-3/+3
Pick the largest niche even if the largest niche is wrapped around fixes rust-lang/rust#144388 r? `@scottmcm`
2025-07-29Reuse `sign_extend` helperOli Scherer-1/+1
2025-07-29Pick the largest niche even if the largest niche is wrapped aroundOli Scherer-2/+2
2025-07-29Rollup merge of #144573 - BoxyUwU:patkind_constant_ptr_docs, r=lcnrStuart Cook-0/+2
Raw Pointers are Constant PatKinds too raw pointers can be matched on with a const pattern: ```rust const FOO: *const u8 = core::ptr::null(); fn foo(a: *const u8) { match a { FOO => (), _ => todo!(), } } ``` as far as I can tell this is represented with a `PatKind::Constant`: https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs#L333-L337
2025-07-28Tweak docsCameron Steffen-5/+4
2025-07-28Rename impl_of_method -> impl_of_assocCameron Steffen-2/+2
2025-07-28Rename trait_of_item -> trait_of_assocCameron Steffen-2/+2
2025-07-28Introduce assoc_parentCameron Steffen-14/+7
2025-07-28Remove TraitAlias from trait_of_itemCameron Steffen-1/+1
This is dead code.
2025-07-28Raw Pointers are Constant PatKinds tooBoxy-0/+2
2025-07-28Auto merge of #144469 - Kivooeo:chains-cleanup, r=SparrowLiibors-29/+28
Some `let chains` clean-up Not sure if this kind of clean-up is welcoming because of size, but I decided to try out one r? compiler
2025-07-28use let chains in hir, lint, mirKivooeo-29/+28
2025-07-28Rollup merge of #144535 - RalfJung:abi-mismatch-err, r=compiler-errorsMatthias Krüger-1/+6
miri: for ABI mismatch errors, say which argument is the problem
2025-07-28Rollup merge of #143607 - JonathanBrouwer:proc_macro_attrs, ↵Matthias Krüger-1/+4
r=jdonszelmann,traviscross Port the proc macro attributes to the new attribute parsing infrastructure Ports `#[proc_macro]`, `#[proc_macro_attribute]`, `#[proc_macro_derive]` and `#[rustc_builtin_macro]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163 I've split this PR into commits for reviewability, and left some comments to clarify things I did 4 related attributes in one PR because they share a lot of their code and logic, and doing them separately is kind of annoying as I need to leave both the old and new parsing in place then. r? ``@oli-obk`` cc ``@jdonszelmann``
2025-07-27miri: for ABI mismatch errors, say which argument is the problemRalf Jung-1/+6
2025-07-27Auto merge of #144434 - nnethercote:preintern-ty-bounds, r=compiler-errorsbors-9/+38
Preintern some `TyKind::Bound` values The new trait solver produces a lot of these. r? `@compiler-errors`
2025-07-26Perform check_private_in_public by module.Camille GILLOT-2/+5
2025-07-26Use the new attributes throughout the codebaseJonathan Brouwer-1/+4
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-26Rollup merge of #144412 - camsteffen:localkey-cell-refactors, r=petrochenkovTrevor Gross-3/+3
Small cleanup: Use LocalKey<Cell> methods more
2025-07-25Improve and regularize comment placement in doc codeJosh Triplett-5/+10
Because doc code does not get automatically formatted, some doc code has creative placements of comments that automatic formatting can't handle. Reformat those comments to make the resulting code support standard Rust formatting without breaking; this is generally an improvement to readability as well. Some comments are not indented to the prevailing indent, and are instead aligned under some bit of code. Indent them to the prevailing indent, and put spaces *inside* the comments to align them with code. Some comments span several lines of code (which aren't the line the comment is about) and expect alignment. Reformat them into one comment not broken up by unrelated intervening code. Some comments are placed on the same line as an opening brace, placing them effectively inside the subsequent block, such that formatting would typically format them like a line of that block. Move those comments to attach them to what they apply to. Some comments are placed on the same line as a one-line braced block, effectively attaching them to the closing brace, even though they're about the code inside the block. Reformat to make sure the comment will stay on the same line as the code it's commenting.
2025-07-25Pre-intern some `TyKind::Bound` values.Nicholas Nethercote-1/+30
We already do the same thing for bound regions. This is a small perf win for the new trait solver.
2025-07-25Tweak bound region pre-interning.Nicholas Nethercote-8/+8
- Cover `DebruijnIndex(2)`, for slightly better coverage. - Rename some things, to account for other region things that were renamed.
2025-07-25Remove eval_always from check_private_in_public.Camille GILLOT-1/+0
2025-07-24Use LocalKey<Cell> methods moreCameron Steffen-3/+3
2025-07-24Rollup merge of #144094 - saethlin:codegen-the-main-fn, r=petrochenkovLeón Orell Valerian Liehr-4/+16
Ensure we codegen the main fn This fixes two bugs. The one that was identified in the linked issue is that when we have a `main` function, mono collection didn't consider it as an extra collection root. The other is that since CGU partitioning doesn't know about the call edges between the entrypoint functions, naively it can put them in different CGUs and mark them all as internal. Which would result in LLVM just deleting all of them. There was an existing hack to exclude `lang = "start"` from internalization, which I've extended to include `main`. Fixes https://github.com/rust-lang/rust/issues/144052
2025-07-24Rollup merge of #143374 - cjgillot:bare-extern-crate-map, r=petrochenkovLeón Orell Valerian Liehr-5/+5
Unquerify extern_mod_stmt_cnum. Based on https://github.com/rust-lang/rust/pull/143247 r? `````@ghost````` for perf
2025-07-23Remove useless lifetime parameter.Camille GILLOT-26/+26
2025-07-23Give an AllocId to ConstValue::Slice.Camille GILLOT-32/+44
2025-07-23properly use caller-side panic location for some GenericArgs methodsRalf Jung-5/+12
2025-07-22Unquerify extern_mod_stmt_cnum.Camille GILLOT-5/+5
2025-07-22Rollup merge of #143373 - cjgillot:bare-unused-trait-imports, r=petrochenkovMatthias Krüger-5/+0
Unquerify maybe_unused_trait_imports. Based on https://github.com/rust-lang/rust/pull/143247 r? ```@ghost``` for perf
2025-07-21Ensure we codegen and don't internalize the entrypointBen Kimock-4/+16
2025-07-22Rollup merge of #144080 - jieyouxu:realign, r=BoxyUwU许杰友 Jieyou Xu (Joe)-0/+1
Mitigate `#[align]` name resolution ambiguity regression with a rename Mitigates beta regression rust-lang/rust#143834 after a beta backport. ### Background on the beta regression The name resolution regression arises due to rust-lang/rust#142507 adding a new feature-gated built-in attribute named `#[align]`. However, unfortunately even [introducing new feature-gated unstable built-in attributes can break user code](https://www.github.com/rust-lang/rust/issues/134963) such as ```rs macro_rules! align { () => { /* .. */ }; } pub(crate) use align; // `use` here becomes ambiguous ``` ### Mitigation approach This PR renames `#[align]` to `#[rustc_align]` to mitigate the beta regression by: 1. Undoing the introduction of a new built-in attribute with a common name, i.e. `#[align]`. 2. Renaming `#[align]` to `#[rustc_align]`. The renamed attribute being `rustc_align` will not introduce new stable breakages, as attributes beginning with `rustc` are reserved and perma-unstable. This does mean existing nightly code using `fn_align` feature will additionally need to specify `#![feature(rustc_attrs)]`. This PR is very much a short-term mitigation to alleviate time pressure from having to fully fix the current limitation of inevitable name resolution regressions that would arise from adding any built-in attributes. Long-term solutions are discussed in [#t-lang > namespacing macro attrs to reduce conflicts with new adds](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/namespacing.20macro.20attrs.20to.20reduce.20conflicts.20with.20new.20adds/with/529249622). ### Alternative mitigation options [Various mitigation options were considered during the compiler triage meeting](https://github.com/rust-lang/rust/issues/143834#issuecomment-3084415277), and those consideration are partly reproduced here: - Reverting the PR doesn't seem very minimal/trivial, and carries risks of its own. - Rename to a less-common but aim-to-stabilization name is itself not safe nor convenient, because (1) that risks introducing new regressions (i.e. ambiguity against the new name), and (2) lang would have to FCP the new name hastily for the mitigation to land timely and have a chance to be backported. This also makes the path towards stabilization annoying. - Rename the attribute to a rustc attribute, which will be perma-unstable and does not cause new ambiguities in stable code. - This alleviates the time pressure to address *this* regression, or for lang to have to rush an FCP for some new name that can still break user code. - This avoids backing out a whole implementation. ### Review advice This PR is best reviewed commit-by-commit. - Commit 1 adds a test `tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs` which demonstrates the current name resolution regression re. `align`. This test fails against current master. - Commit 2 carries out the renames and test reblesses. Notably, commit 2 will cause `tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs` to change from fail (nameres regression) to pass. This PR, if the approach still seems acceptable, will need a beta-backport to address the beta regression.
2025-07-20Rollup merge of #144216 - Nadrieril:revert-pin-hack, r=compiler-errorsJacob Pratt-16/+0
Don't consider unstable fields always-inhabited This reverts the hack in https://github.com/rust-lang/rust/pull/133889 now that `Pin`'s field is no longer public. Fixes https://github.com/rust-lang/rust/issues/143468. r? ```@compiler-errors```
2025-07-20Don't consider unstable fields always-inhabitedNadrieril-16/+0
This reverts the hack in https://github.com/rust-lang/rust/pull/133889 now that `Pin`'s field is no longer public.
2025-07-20Unquerify maybe_unused_trait_imports.Camille GILLOT-5/+0
2025-07-20Rollup merge of #144148 - compiler-errors:async-print-hack, r=lqdMatthias Krüger-25/+1
Remove pretty print hack for async blocks I introduced this hack 3 years ago, but it's not needed anymore, probably due to https://github.com/rust-lang/rust/pull/104321.
2025-07-19Auto merge of #144145 - matthiaskrgr:rollup-swc74s4, r=matthiaskrgrbors-2/+5
Rollup of 9 pull requests Successful merges: - rust-lang/rust#138554 (Distinguish delim kind to decide whether to emit unexpected closing delimiter) - rust-lang/rust#142673 (Show the offset, length and memory of uninit read errors) - rust-lang/rust#142693 (More robustly deal with relaxed bounds and improve their diagnostics) - rust-lang/rust#143382 (stabilize `const_slice_reverse`) - rust-lang/rust#143928 (opt-dist: make llvm builds optional) - rust-lang/rust#143961 (Correct which exploit mitigations are enabled by default) - rust-lang/rust#144050 (Fix encoding of link_section and no_mangle cross crate) - rust-lang/rust#144059 (Refactor `CrateLoader` into the `CStore`) - rust-lang/rust#144123 (Generalize `unsize` and `unsize_into` destinations) r? `@ghost` `@rustbot` modify labels: rollup