about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/closure.rs
AgeCommit message (Collapse)AuthorLines
2025-06-20Use gen blocks in the compiler instead of from_coroutineMichael Goulet-43/+39
2025-05-28Handle e2021 precise capturing of unsafe binderMichael Goulet-0/+4
2025-04-02Move methods from `Map` to `TyCtxt`, part 5.Nicholas Nethercote-4/+4
This eliminates all methods on `Map`. Actually removing `Map` will occur in a follow-up PR.
2025-03-12Move methods from `Map` to `TyCtxt`, part 4.Nicholas Nethercote-1/+1
Continuing the work from #137350. Removes the unused methods: `expect_variant`, `expect_field`, `expect_foreign_item`. Every method gains a `hir_` prefix.
2025-03-06Generate the right MIR for by use closuresSantiago Pastorino-2/+5
2025-02-22Greatly simplify lifetime captures in edition 2024Michael Goulet-2/+1
2025-01-19Run `clippy --fix` for `unnecessary_map_or` lintYotam Ofek-1/+1
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-11-04Remove BorrowKind glob, make names longerMichael Goulet-9/+8
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-09-05Don't store region in CapturedPlaceMichael Goulet-3/+0
2024-07-29Reformat `use` declarations.Nicholas Nethercote-8/+6
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-02chore: remove duplicate wordshattizai-1/+1
2024-05-01Step bootstrap cfgsMark Rousskov-1/+1
2024-04-29Remove `extern crate rustc_macros` from `rustc_middle`.Nicholas Nethercote-0/+1
2024-04-24Error on using `yield` without also using `#[coroutine]` on the closureOli Scherer-39/+43
And suggest adding the `#[coroutine]` to the closure
2024-04-16Avoid lots of `hir::HirId{,Map,Set}` qualifiers.Nicholas Nethercote-6/+7
Because they're a bit redundant.
2024-04-10Use a helper to zip together parent and child captures for coroutine-closuresMichael Goulet-0/+67
2024-04-08Shrink the size of ClosureTypeInfo to fit into 64 bytes againOli Scherer-6/+6
2024-02-11is_closure_likeMichael Goulet-2/+2
2023-12-30is_coroutine -> is_coroutine_or_closureMichael Goulet-2/+2
2023-12-12Uplift ClosureKindMichael Goulet-70/+3
2023-11-26Auto merge of #118316 - Mark-Simulacrum:delete-copy-to-upvars, r=cjgillotbors-0/+7
Remove borrowck Upvar duplication This cuts out an extra allocation and copying over from the already cached closure capture information.
2023-11-26Remove Upvar duplicationMark Rousskov-0/+7
This cuts out an extra allocation and copying over from the already cached closure capture information.
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-1/+1
cleanup
2023-08-07Migrate a trait selection error to use diagnostic translationDeadbeef-2/+17
2023-08-04Rollup merge of #114022 - oli-obk:tait_ice_alias_field_projection, r=cjgillotMatthias Krüger-0/+2
Perform OpaqueCast field projection on HIR, too. fixes #105819 This is necessary for closure captures in 2021 edition, as they capture individual fields, not the full mentioned variables. So it may try to capture a field of an opaque (because the hidden type is known to be something with a field). See https://github.com/rust-lang/rust/pull/99806 for when and why we added OpaqueCast to MIR.
2023-07-30inline format!() args up to and including rustc_middleMatthias Krüger-1/+1
2023-07-24Perform OpaqueCast field projection on HIR, too.Oli Scherer-0/+2
This is necessary for closure captures in 2021 edition, as they capture individual fields, not the full mentioned variables. So it may try to capture a field of an opaque (because the hidden type is known to be something with a field).
2023-07-14Enable potential_query_instability lint in rustc_hir_typeck.Michael Woerister-5/+3
Fix linting errors by using FxIndex(Map|Set) and Unord(Map|Set) as appropriate.
2023-06-20address most easy commentsZiru Niu-0/+2
2023-05-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn Kåre Alsaker-2/+3
2023-03-30Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>`Scott McMurray-4/+4
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-02-26Wrap more into into closure_typeinfo query.Camille GILLOT-8/+32
2023-02-26Access upvars through a query.Camille GILLOT-18/+18
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-4/+1
2022-11-28Rollup merge of #104732 - WaffleLapkin:from_def_idn't, r=compiler-errorsDylan DPC-31/+14
Refactor `ty::ClosureKind` related stuff I've tried to fix all duplication and weirdness, but if I missed something do tell :p r? `@compiler-errors`
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-3/+3
2022-11-27micro doc fixesMaybe Waffle-11/+11
2022-11-27Simplify `ty::ClosureKind::extends`Maybe Waffle-9/+1
This is valid per the comment of the `ClosureKind` defition
2022-11-27Remove `ty::ClosureKind::from_def_id`Maybe Waffle-12/+3
…in favour of `TyCtxt::fn_trait_kind_from_def_id`
2022-11-22Fix `ClosureKind::to_def_id`Maybe Waffle-5/+9
2022-07-30Use LocalDefId for closures moreCameron Steffen-2/+2
2022-07-18Use span_bug for unexpected field projection typeJordan McQueen-1/+5
Improves the compiler error backtrace information, as shown in #99363, by using `span_bug` instead of `bug`. New output: ``` build/aarch64-apple-darwin/stage1/bin/rustc /tmp/test.rs --edition=2021 error: internal compiler error: compiler/rustc_middle/src/ty/closure.rs:185:25: Unexpected type Opaque(DefId(0:5 ~ test[db0f]::main::T::{opaque#0}), []) for `Field` projection --> /tmp/test.rs:11:27 | 11 | let Foo((a, b)) = foo; | ^^^ thread 'rustc' panicked at 'Box<dyn Any>', /Users/jmq/src/forked/rust/compiler/rustc_errors/src/lib.rs:1331:9 stack backtrace: ``` (Remainder of output truncated.)
2022-07-14Point out custom Fn-family trait implMichael Goulet-0/+8
2022-07-05Add #[derive(TypeVisitable)]Alan Egerton-17/+12
2022-05-02fix most compiler/ doctestsElliot Roberts-11/+14
2022-03-23Better suggestions for Fn trait selection errorsMichael Goulet-3/+15
2022-03-12Auto merge of #94733 - nnethercote:fix-AdtDef-interning, r=fee1-deadbors-2/+2
Improve `AdtDef` interning. This commit makes `AdtDef` use `Interned`. Much of the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`. r? `@fee1-dead`
2022-03-11Improve `AdtDef` interning.Nicholas Nethercote-2/+2
This commit makes `AdtDef` use `Interned`. Much the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`.