about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/util.rs
AgeCommit message (Collapse)AuthorLines
2025-09-23revert change removing `has_infer` check. Commit conservatively patches for ↵ash-1/+10
now, but more development proceeding. Also contains a more concise test
2025-09-18Rollup merge of #146597 - modhanami:add-struct-tail-recursion-limit-span, ↵Matthias Krüger-4/+13
r=oli-obk Add span for struct tail recursion limit error Fixes rust-lang/rust#135629 Changes 1. Add span to RecursionLimitReached 2. Add ObligationCause parameter to struct_tail_raw 4. Update call sites to pass nearby ObligationCause or create one 5. Update affected .stderr
2025-09-16Add span for struct tail recursion limit errorTawan Muadmuenwai-4/+13
2025-09-15remove FIXME from `has_significant_drop`, replaced with checking ↵ash-8/+1
non_region_infer
2025-09-12Auto merge of #146328 - zetanumbers:fix-141951, r=lcnrbors-4/+1
Skip typeck for items w/o their own typeck context Skip items which forward typeck to their ancestor. Should remove some potential but unnecessary typeck query waits, hence might improve performance for the parallel frontend. Thanks to `@ywxt` for a fix suggestion Fixes rust-lang/rust#141951
2025-09-09Auto merge of #145717 - BoxyUwU:erase_regions_rename, r=lcnrbors-6/+5
rename erase_regions to erase_and_anonymize_regions I find it consistently confusing that `erase_regions` does more than replacing regions with `'erased`. it also makes some code look real goofy to be writing manual folders to erase regions with a comment saying "we cant use erase regions" :> or code that re-calls erase_regions on types with regions already erased just to anonymize all the bound regions. r? lcnr idk how i feel about the name being almost twice as long now
2025-09-09Driveby fixesBoxy-3/+2
2025-09-09erase_regions to erase_and_anonymize_regionsBoxy-5/+5
2025-09-08fixup limit handling codeJana Dönszelmann-1/+1
2025-09-08Skip typeck for items w/o their own typeck contextDaria Sukhonina-4/+1
More details on about this fix: https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/ICE.3A.20typecks.20AnonConst.20under.20parallel.20rustc.28.23141951.29/with/538200980 Co-authored-by: ywxt <ywxtcwh@gmail.com>
2025-07-29Reuse `sign_extend` helperOli Scherer-1/+1
2025-07-13Generalize TyCtxt::item_name.Camille GILLOT-1/+1
2025-07-10Properly track the depth when expanding free alias typesLeón Orell Valerian Liehr-2/+4
2025-06-27Report infer ty errors during hir ty loweringOli Scherer-0/+1
This centralizes the placeholder type error reporting in one location, but it also exposes the granularity at which we convert things from hir to ty more. E.g. previously infer types in where bounds were errored together with the function signature, but now they are independent.
2025-06-16trait_sel: extend fast path with sized hierarchyDavid Wood-1/+3
Extend the fast path for `Sized` traits to include constness and `MetaSized`.
2025-05-27Fix some var namesMichael Goulet-2/+2
2025-05-27Rename unpack to kindMichael Goulet-2/+2
2025-05-20Querify coroutine_hidden_typesMichael Goulet-35/+1
2025-05-15Async drop fix for dropee from another crate (#140858)Andrew Zhogin-1/+1
2025-05-01Set groundwork for proper const normalizationBoxy-0/+2
2025-04-28Auto merge of #140388 - GuillaumeGomez:rollup-aj9o3ch, r=GuillaumeGomezbors-21/+21
Rollup of 7 pull requests Successful merges: - #140056 (Fix a wrong error message in 2024 edition) - #140220 (Fix detection of main function if there are expressions around it) - #140249 (Remove `weak` alias terminology) - #140316 (Introduce `BoxMarker` to improve pretty-printing correctness) - #140347 (ci: clean more disk space in codebuild) - #140349 (ci: use aws codebuild for the `dist-x86_64-linux` job) - #140379 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-28AsyncDrop implementation using shim codegen of ↵Andrew Zhogin-81/+28
async_drop_in_place::{closure}, scoped async drop added.
2025-04-24Remove `weak` alias terminologyBoxy-21/+21
2025-04-16Auto merge of #139768 - compiler-errors:split-fold, r=lcnrbors-0/+36
Split `TypeFolder` and `FallibleTypeFolder` atwain Right now there is a coherence problem with `TypeFolder` and `FallibleTypeFolder`. Namely, it's impossible to implement a `FallibleTypeFolder` that is generic over interner, b/c it has a *downstream* conflict with the blanket impl: ``` impl<I, F> FallibleTypeFolder<I> for F where F: TypeFolder<I> {} ``` Because downstream crates may implement `TypeFolder<SomeLocalInterner>` for the fallible type folder. This PR removes the relationship between `FallibleTypeFolder` and `TypeFolder`; it leads to *modest* code duplication, but otherwise does not affect perf and really doesn't matter in general.
2025-04-15Split TypeFolder and FallibleTypeFolderMichael Goulet-0/+36
2025-04-14Move `has_self` field to `hir::AssocKind::Fn`.Nicholas Nethercote-2/+2
`hir::AssocItem` currently has a boolean `fn_has_self_parameter` field, which is misplaced, because it's only relevant for associated fns, not for associated consts or types. This commit moves it (and renames it) to the `AssocKind::Fn` variant, where it belongs. This requires introducing a new C-style enum, `AssocTag`, which is like `AssocKind` but without the fields. This is because `AssocKind` values are passed to various functions like `find_by_ident_and_kind` to indicate what kind of associated item should be searched for, and having to specify `has_self` isn't relevant there. New methods: - Predicates `AssocItem::is_fn` and `AssocItem::is_method`. - `AssocItem::as_tag` which converts `AssocItem::kind` to `AssocTag`. Removed `find_by_name_and_kinds`, which is unused. `AssocItem::descr` can now distinguish between methods and associated functions, which slightly improves some error messages.
2025-04-06remove compiler support for `extern "rust-intrinsic"` blocksSkgland-5/+2
2025-04-04Rollup merge of #139348 - meithecatte:async-destructor-minify, r=petrochenkovMatthias Krüger-12/+3
AsyncDestructor: replace fields with impl_did The future and ctor fields aren't actually used, and the way they are extracted is obviously wrong – swapping the order of the items in the source code will give wrong results. Instead, store just the LocalDefId of the impl, which is enough for the only use of this data.
2025-04-04Rollup merge of #139041 - nnethercote:rm-rustc_middle-ty-util-ExplicitSelf, ↵Matthias Krüger-49/+0
r=BoxyUwU Remove `rustc_middle::ty::util::ExplicitSelf`. It's an old (2017 or earlier) type that describes a `self` receiver. It's only used in `rustc_hir_analysis` for two error messages, and much of the complexity isn't used. I suspect it used to be used for more things. This commit removes it, and moves a greatly simplified version of the `determine` method into `rustc_hir_analysis`, renamed as `get_self_string`. The big comment on the method is removed because it no longer seems relevant. r? `@BoxyUwU`
2025-04-04adt_destructor: sanity-check returned itemMaja Kądziołka-0/+5
Fixes #139278
2025-04-04AsyncDestructor: replace fields with impl_didMaja Kądziołka-12/+3
The future and ctor fields aren't actually used, and the way they are extracted is obviously wrong – swapping the order of the items in the source code will give wrong results. Instead, store just the LocalDefId of the impl, which is enough for the only use of this data.
2025-04-02Fetch the destructor constness lazilyOli Scherer-4/+4
2025-04-02Only look at trait impls in the current crate when looking for `Drop` implsOli Scherer-12/+22
2025-04-01Ensure `calculcate_dtor` is only ever called on local typesOli Scherer-2/+2
2025-03-28Remove `rustc_middle::ty::util::ExplicitSelf`.Nicholas Nethercote-49/+0
It's an old (2017 or earlier) type that describes a `self` receiver. It's only used in `rustc_hir_analysis` for two error messages, and much of the complexity isn't used. I suspect it used to be used for more things. This commit removes it, and moves a greatly simplified version of the `determine` method into `rustc_hir_analysis`, renamed as `get_self_string`. The big comment on the method is removed because it no longer seems relevant.
2025-03-15Squash fold into tyMichael Goulet-2/+1
2025-03-06Account for UseCloned on expr_use_visitorSantiago Pastorino-0/+12
2025-03-01Rollup merge of #137689 - compiler-errors:coroutine, r=lcnrMatthias Krüger-40/+26
Use `Binder<Vec<Ty>>` instead of `Vec<Binder<Ty>>` in both solvers for sized/auto traits/etc. It's more conceptually justified IMO, especially when binders get implications. r? lcnr
2025-02-26Use bound_coroutine_witnesses in old solverMichael Goulet-18/+1
2025-02-26Use Binder<Vec<T>> instead of Vec<Binder<T>> in new solverMichael Goulet-22/+25
2025-02-24ssa/mono: deduplicate `type_has_metadata`David Wood-0/+14
The implementation of the `type_has_metadata` function is duplicated in `rustc_codegen_ssa` and `rustc_monomorphize`, so move this to `rustc_middle`.
2025-02-24remove support for rustc_intrinsic_must_be_overridden from the compilerRalf Jung-7/+6
2025-02-16Move hashes from rustc_data_structure to rustc_hashes so they can be shared ↵Ben Kimock-1/+2
with rust-analyzer
2025-02-08Rustfmtbjorn3-4/+5
2025-02-07Rollup merge of #136554 - compiler-errors:opt-alias-variances, r=lcnrMatthias Krüger-0/+23
Add `opt_alias_variances` and use it in outlives code ...so to fix some subtle outlives bugs with precise capturing in traits, and eventually make it easier to compute variances for "forced unconstrained" trait lifetimes. r? lcnr
2025-02-06Add opt_alias_variances and use it in outlives codeMichael Goulet-0/+23
2025-02-05Eagerly detect coroutine recursion pre-mono when possibleMichael Goulet-56/+2
2025-02-01Rename `tcx.ensure()` to `tcx.ensure_ok()`Zalathar-2/+2
2025-01-20Get rid of mir::Const::from_ty_constMichael Goulet-4/+5
2025-01-14Make `#[rustc_private]` override dependency visibilityTrevor Gross-0/+5
Really this is always-visible override only needs to happen when the crate is a dependency of itself. However, this is a very internal feature, so it doesn't seem worth doing any additional filtering here.