summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2025-02-13Revert "Stabilize `extended_varargs_abi_support`"Jubilee Young-2/+29
This reverts commit 685f189b4307435b83d625fea397ef36dff4e955.
2024-12-01Rollup merge of #132047 - compiler-errors:rbv-rtn-cleanup, r=cjgillotMatthias Krüger-0/+2
Robustify and genericize return-type-notation resolution in `resolve_bound_vars` #129629 implemented return-type-notation (RTN) in its path form, like `where T::method(..): Bound`. As part of lowering, we must record the late-bound vars for the where clause introduced by the method (namely, its early- and late-bound lifetime arguments, since `where T::method(..)` turns into a higher-ranked where clause over all of the lifetimes according to [RFC 3654](https://rust-lang.github.io/rfcs/3654-return-type-notation.html#converting-to-higher-ranked-trait-bounds)). However, this logic was only looking at the where clauses of the parent item that the `T::method(..)` bound was written on, and not any parent items. This PR generalizes that logic to look at the parent item (i.e. the outer impl or trait) instead and fixes a (debug only) assertion as an effect. This logic is also more general and likely easier to adapt to more interesting (though likely very far off) cases like non-lifetime binder `for<T: Trait> T::method(..): Send` bounds. Tracking: - https://github.com/rust-lang/rust/issues/109417
2024-11-27Stabilize `extended_varargs_abi_support`Soveu-29/+2
2024-11-27Robustify and genericize RTN resolution in RBVMichael Goulet-0/+2
2024-11-20Auto merge of #133212 - lcnr:questionable-uwu, r=compiler-errorsbors-2/+2
continue `ParamEnv` to `TypingEnv` transition cc #132279 r? `@compiler-errors`
2024-11-19`InterpCx` store `TypingEnv` instead of a `ParamEnv`lcnr-2/+2
2024-11-19Introduce `min_generic_const_args` and directly represent pathsNoah Lev-1/+14
Co-authored-by: Boxy UwU <rust@boxyuwu.dev> Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2024-11-03compiler: Directly use rustc_abi in hir_{analysis,typeck}Jubilee Young-3/+8
2024-10-28Hack out effects support for old solverMichael Goulet-6/+0
2024-10-23nightly feature tracking: get rid of the per-feature bool fieldsRalf Jung-3/+3
2024-10-04Rollup merge of #130518 - scottmcm:stabilize-controlflow-extra, r=dtolnayJubilee-1/+0
Stabilize the `map`/`value` methods on `ControlFlow` And fix the stability attribute on the `pub use` in `core::ops`. libs-api in https://github.com/rust-lang/rust/issues/75744#issuecomment-2231214910 seemed reasonably happy with naming for these, so let's try for an FCP. Summary: ```rust impl<B, C> ControlFlow<B, C> { pub fn break_value(self) -> Option<B>; pub fn map_break<T>(self, f: impl FnOnce(B) -> T) -> ControlFlow<T, C>; pub fn continue_value(self) -> Option<C>; pub fn map_continue<T>(self, f: impl FnOnce(C) -> T) -> ControlFlow<B, T>; } ``` Resolves #75744 ``@rustbot`` label +needs-fcp +t-libs-api -t-libs --- Aside, in case it keeps someone else from going down the same dead end: I looked at the `{break,continue}_value` methods and tried to make them `const` as part of this, but that's disallowed because of not having `const Drop`, so put it back to not even unstably-const.
2024-10-02Handle `rustc-hir-analysis` cases of `rustc::potential_query_instability` lintismailarilik-1/+0
2024-09-25Stabilize the `map`/`value` methods on `ControlFlow`Scott McMurray-1/+0
And fix the stability attribute on the `pub use` in `core::ops`.
2024-09-24Separate collection of crate-local inherent impls from error reportingMichael Goulet-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-08-30Remove `#[macro_use] extern crate tracing` from `rustc_hir_analysis`.Nicholas Nethercote-3/+0
2024-08-27Auto merge of #128506 - compiler-errors:by-move-body, r=cjgillotbors-4/+0
Stop storing a special inner body for the coroutine by-move body for async closures ...and instead, just synthesize an item which is treated mostly normally by the MIR pipeline. This PR does a few things: * We synthesize a new `DefId` for the by-move body of a closure, which has its `mir_built` fed with the output of the `ByMoveBody` MIR transformation, and some other relevant queries. * This has the `DefKind::ByMoveBody`, which we use to distinguish it from "real" bodies (that come from HIR) which need to be borrowck'd. Introduce `TyCtxt::is_synthetic_mir` to skip over `mir_borrowck` which is called by `mir_promoted`; borrowck isn't really possible to make work ATM since it heavily relies being called on a body generated from HIR, and is redundant by the construction of the by-move-body. * Remove the special `PassManager` hacks for handling the inner `by_move_body` stored within the coroutine's mir body. Instead, this body is fed like a regular MIR body, so it's goes through all of the `tcx.*_mir` stages normally (build -> promoted -> ...etc... -> optimized) ✨. * Remove the `InstanceKind::ByMoveBody` shim, since now we have a "regular" def id, we can just use `InstanceKind::Item`. This also allows us to remove the corresponding hacks from codegen, such as in `fn_sig_for_fn_abi` ✨. Notable remarks: * ~~I know it's kind of weird to be using `DefKind::Closure` here, since it's not a distinct closure but just a new MIR body. I don't believe it really matters, but I could also use a different `DefKind`... maybe one that we could use for synthetic MIR bodies in general?~~ edit: We're doing this now.
2024-08-27Add `warn(unreachable_pub)` to `rustc_hir_analysis`.Nicholas Nethercote-0/+1
2024-08-26Stop using a special inner body for the coroutine by-move body for async ↵Michael Goulet-4/+0
closures
2024-08-11Use assert_matches around the compilerMichael Goulet-0/+1
2024-07-29Delegation: support generics for delegation from free functionsBryanskiy-0/+5
2024-07-29Reformat `use` declarations.Nicholas Nethercote-1/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-28stabilize `is_sorted`Slanterns-1/+0
2024-07-08Remove `structured_errors` moduleOli Scherer-1/+0
2024-07-07Uplift trait_ref_is_knowable and friendsMichael Goulet-0/+1
2024-07-01Rollup merge of #127181 - BoxyUwU:dump_def_parents, r=compiler-errorsMatthias Krüger-0/+1
Introduce a `rustc_` attribute to dump all the `DefId` parents of a `DefId` We've run into a bunch of issues with anon consts having the wrong generics and it would have been incredibly helpful to be able to quickly slap a `rustc_` attribute to check what `tcx.parent(` will return on the relevant DefIds. I wasn't sure of a better way to make this work for anon consts than requiring the attribute to be on the enclosing item and then walking the inside of it to look for any anon consts. This particular method will honestly break at some point when we stop having a `DefId` available for anon consts in hir but that's for another day... r? ``@compiler-errors``
2024-06-30add `rustc_dump_def_parents` attributeBoxy-0/+1
2024-06-30Make `feature(effects)` require `-Znext-solver`Deadbeef-0/+6
2024-06-22Add `#[rustc_dump_{predicates,item_bounds}]`León Orell Valerian Liehr-0/+1
2024-06-20Slightly refactor the dumping of HIR analysis dataLeón Orell Valerian Liehr-9/+3
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-2/+4
We already do this for a number of crates, e.g. `rustc_middle`, `rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`. For the ones we don't, in many cases the attributes are a mess. - There is no consistency about order of attribute kinds (e.g. `allow`/`deny`/`feature`). - Within attribute kind groups (e.g. the `feature` attributes), sometimes the order is alphabetical, and sometimes there is no particular order. - Sometimes the attributes of a particular kind aren't even grouped all together, e.g. there might be a `feature`, then an `allow`, then another `feature`. This commit extends the existing sorting to all compiler crates, increasing consistency. If any new attribute line is added there is now only one place it can go -- no need for arbitrary decisions. Exceptions: - `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`, because they have no crate attributes. - `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's ignored in `rustfmt.toml`).
2024-06-07Revert "Create const block DefIds in typeck instead of ast lowering"Oli Scherer-4/+4
This reverts commit ddc5f9b6c1f21da5d4596bf7980185a00984ac42.
2024-05-28Create const block DefIds in typeck instead of ast loweringOli Scherer-4/+4
2024-02-20Stabilize `LazyCell` and `LazyLock` (`lazy_cell`)Peter Jaszkowiak-1/+0
2024-05-19Add and use generics.is_empty() and generics.is_own_empty, rather than using ↵Santiago Pastorino-1/+1
generics' attributes
2024-05-13Remove `extern crate rustc_middle` from `rustc_hir_analysis`.Nicholas Nethercote-3/+0
2024-05-09Rename Generics::params to Generics::own_paramsMichael Goulet-1/+1
2024-04-22Stabilize generic `NonZero`.Markus Reiter-1/+0
2024-04-13remove some ancient debug output, looks unused?klensy-1/+0
2024-04-08Ensure we do not accidentally insert new early aborts in the analysis passesOli Scherer-7/+4
2024-03-26Auto merge of #121387 - oli-obk:eager_const_failures_regression, r=lcnrbors-2/+8
Avoid some unnecessary query invocations. Specifically this inlines `const_eval_poly` and avoids computing the generic params, the param env, normalizing the param env and erasing lifetimes on everything. should fix the perf regression from https://github.com/rust-lang/rust/pull/121087
2024-03-22Rename module astconv to hir_ty_loweringLeón Orell Valerian Liehr-2/+2
Split from the main renaming commit to make git generate a proper diff for ease of reviewing.
2024-03-22Update (doc) commentsLeón Orell Valerian Liehr-4/+12
Several (doc) comments were super outdated or didn't provide enough context. Some doc comments shoved everything in a single paragraph without respecting the fact that the first paragraph should be a single sentence because rustdoc treats these as item descriptions / synopses on module pages.
2024-03-22Rename AstConv to HIR ty loweringLeón Orell Valerian Liehr-2/+2
This includes updating astconv-related items and a few local variables.
2024-03-20step cfgsMark Rousskov-1/+0
2024-03-19Avoid computing generic params or a param env for free const itemsOli Scherer-2/+8
2024-03-15Rollup merge of #122527 - fmease:clean-up-hir-ty-lowering, r=compiler-errorsMatthias Krüger-33/+4
Clean up AstConv Split off from #120926 to make it only contain the renaming & (doc) comment updates. Any changes other than that which have accumulated over time are now part of this PR. Let's be disciplined ;) Inspired by https://github.com/rust-lang/rust/pull/120926#issuecomment-1997984483. --- * Remove `hir_trait_to_predicates` * Unused since #113671 * Inline `create_args_for_ast_trait_ref` * Only had a single call site * Having it as a separate method didn't gain us anything * Use an if-let guard somewhere to avoid unwrapping * Avoid explicit trait object lifetimes * More legible, stylistic-only (the updated code is 100% semantically identical) * Use explicitly elided lifetimes in impl headers, they get elaborated to distinct lifetimes * Make use of [object lifetime defaulting](https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes) for a trait object type inside of a reference type somewhere * Use preexisting dedicated method `ItemCtxt::to_ty` over `<dyn AstConv<'_>>::ast_ty_to_ty` * Use preexisting dedicated method `AstConv::astconv` over explicit coercions * Simplify the function signature of `create_args_for_ast_path` and of `check_generic_arg_count` * In both cases redundant information was passed rendering the call sites verbose and confusing * No perf impact (tested in [#120926](https://github.com/rust-lang/rust/pull/120926)) * Move diagnostic method `report_ambiguous_associated_type` from `astconv` to `astconv::errors` * The submodule `errors` exists specifically for that purpose * Use it to keep the main module clean & short
2024-03-15Clean up AstConvLeón Orell Valerian Liehr-33/+4
2024-03-14Auto merge of #122347 - oli-obk:track_errors13, r=compiler-errorsbors-4/+26
Revert "Auto merge of #122140 - oli-obk:track_errors13, r=davidtwco" This reverts commit 65cd843ae06ad00123c131a431ed5304e4cd577a, reversing changes made to d255c6a57c393db6221b1ff700daea478436f1cd. reverts https://github.com/rust-lang/rust/pull/122140 It was a large regression in wall time due to trashing CPU caches
2024-03-12Change `DefKind::Static` to a struct variantOli Scherer-1/+1