about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/middle/region.rs
AgeCommit message (Collapse)AuthorLines
2025-08-13fix scope of `super let` bindings within `if let`dianne-0/+39
They now use the enclosing temporary scope as their scope, regardless of which `ScopeData` was used to mark it.
2025-08-07add a scope for `if let` guard temporaries and bindingsdianne-0/+6
This ensures `if let` guard temporaries and bindings are dropped before the match arm's pattern's bindings.
2025-07-28use let chains in hir, lint, mirKivooeo-17/+16
2025-07-05Remove yields_in_scope from the scope tree.Camille GILLOT-92/+0
2025-04-02Move methods from `Map` to `TyCtxt`, part 5.Nicholas Nethercote-1/+1
This eliminates all methods on `Map`. Actually removing `Map` will occur in a follow-up PR.
2025-03-28Remove ScopeDepth entirely.Mara Bos-5/+3
The scope depth was tracked, but never actually used for anything.
2025-03-26Simplify RvalueCandidateType.Mara Bos-18/+13
There is no difference between the Patternand Borrow cases. Reduce it to a simple struct.
2024-12-19Rename Scope.id to Scope.local_id, remove trivial accessorMichael Goulet-21/+11
2024-11-20reduce false positives of tail-expr-drop-order from consumed valuesDing Xiang Fei-0/+5
take 2 open up coroutines tweak the wordings the lint works up until 2021 We were missing one case, for ADTs, which was causing `Result` to yield incorrect results. only include field spans with significant types deduplicate and eliminate field spans switch to emit spans to impl Drops Co-authored-by: Niko Matsakis <nikomat@amazon.com> collect drops instead of taking liveness diff apply some suggestions and add explantory notes small fix on the cache let the query recurse through coroutine new suggestion format with extracted variable name fine-tune the drop span and messages bugfix on runtime borrows tweak message wording filter out ecosystem types earlier apply suggestions clippy check lint level at session level further restrict applicability of the lint translate bid into nop for stable mir detect cycle in type structure
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-09-11rescope temp lifetime in let-chain into IfElseDing Xiang Fei-0/+6
apply rules by span edition
2024-07-29Reformat `use` declarations.Nicholas Nethercote-3/+4
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_middle`.Nicholas Nethercote-0/+1
2024-04-29Remove `extern crate rustc_data_structures` from numerous crates.Nicholas Nethercote-1/+1
2024-04-29Remove `extern crate rustc_macros` from `rustc_middle`.Nicholas Nethercote-1/+1
2024-04-16Avoid lots of `hir::HirId{,Map,Set}` qualifiers.Nicholas Nethercote-9/+5
Because they're a bit redundant.
2024-01-26ScopeTree: remove destruction_scopes as unusedklensy-8/+0
last usages removed by https://github.com/rust-lang/rust/pull/116170
2024-01-04Make iteration order of region_scope_tree query stableMichael Woerister-25/+4
2023-12-25Remove unnecessary body_expr_countMichael Goulet-14/+0
2023-12-12Move some methods from `tcx.hir()` to `tcx`zetanumbers-1/+1
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`
2023-12-04Don't include destruction scopes in THIRMatthew Jasper-4/+0
They are not used by anyone, and add memory/performance overhead.
2023-11-22Replace `no_ord_impl` with `orderable`.Nicholas Nethercote-0/+1
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-11-22Replace `custom_encodable` with `encodable`.Nicholas Nethercote-0/+1
By default, `newtype_index!` types get a default `Encodable`/`Decodable` impl. You can opt out of this with `custom_encodable`. Opting out is the opposite to how Rust normally works with autogenerated (derived) impls. This commit inverts the behaviour, replacing `custom_encodable` with `encodable` which opts into the default `Encodable`/`Decodable` impl. Only 23 of the 59 `newtype_index!` occurrences need `encodable`. Even better, there were eight crates with a dependency on `rustc_serialize` just from unused default `Encodable`/`Decodable` impls. This commit removes that dependency from those eight crates.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-14finish `RegionKind` renamelcnr-1/+1
- `ReFree` -> `ReLateParam` - `ReEarlyBound` -> `ReEarlyParam`
2023-10-20s/generator/coroutine/Oli Scherer-2/+2
2023-07-14Enable potential_query_instability lint in rustc_hir_typeck.Michael Woerister-2/+2
Fix linting errors by using FxIndex(Map|Set) and Unord(Map|Set) as appropriate.
2023-04-28Remove some unnecessary derives.Nicholas Nethercote-3/+3
I was curious about how many `Encodable`/`Decodable` derives we have. Some grepping revealed that it's over 500 of each, but the number of `Encodable` ones was higher, which was weird. Most of the `Encodable`-only ones were in `hir.rs`. This commit removes them all, plus some other unnecessary derives in that file and others that I found via trial and error.
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-2/+1
Remove the `..` from the body, only a few invocations used it and it's inconsistent with rust syntax. Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-18Use `#[derive]` instead of custom syntax in all `newtype_index`Nilstrieb-1/+1
2022-06-03Replace `&Vec<_>`s with `&[_]`sMaybe Waffle-2/+3
2022-05-22factor out the rvalue lifetime ruleDing Xiang Fei-45/+33
remove region_scope_tree from RegionCtxt Apply suggestions from code review Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2022-04-14Update issue-92893.stderrouz-a-6/+3
2022-04-12Remove NodeIdHashingMode.Camille GILLOT-5/+2
2022-03-11Auto merge of #90253 - Kobzol:hash-stable-sort-index-map, r=cjgillotbors-4/+4
Change several HashMaps to IndexMap to improve incremental hashing performance Stable hashing hash maps in incremental mode takes a lot of time, especially for some benchmarks like `clap`. As noted by `@Mark-Simulacrum` [here](https://github.com/rust-lang/rust/pull/89404#issuecomment-950043892), this cost could be reduced by replacing some hash maps by indexmaps. I gathered some statistics and found several hash maps that took a lot of time to hash and replaced them by indexmaps. However, in order for this to work, we need to make sure that these indexmaps have deterministic insertion order. These three are used only in visitors as far as I can see, which seems deterministic. Can we enforce this somehow? Or should some explaining comment be included for these maps?
2022-02-19Adopt let else in more placesest31-3/+2
2022-01-18Track drops across multiple yieldsEric Holk-3/+3
2021-12-28Change several HashMaps to IndexMap to improve incremental hashing performanceJakub Beránek-4/+4
2021-11-28Remove unused root_parent.Camille GILLOT-12/+4
2021-10-03Remove re-export.Camille GILLOT-1/+1
2021-09-20Adjust documentation for compatibility with 2021Mark Rousskov-1/+2
This also adjusts the lint docs generation to accept (and ignore) an allow attribute, rather than expecting the documentation to be immediately followed by the lint name.
2021-09-01Fix drop handling for `if let` expressionsMatthew Jasper-0/+5
MIR lowering for `if let` expressions is now more complicated now that `if let` exists in HIR. This PR adds a scope for the variables bound in an `if let` expression and then uses an approach similar to how we handle loops to ensure that we reliably drop the correct variables.
2021-08-23Rollup merge of #88230 - steffahn:a_an, r=oli-obkMara Bos-1/+1
Fix typos “a”→“an” Fix typos in comments; found using a regex to find some easy instance of incorrect usage of a vs. an. While automation was used to find these, every change was checked manually. Changes in submodules get separate PRs: * https://github.com/rust-lang/stdarch/pull/1201 * https://github.com/rust-lang/cargo/pull/9821 * https://github.com/rust-lang/miri/pull/1874 * https://github.com/rust-lang/rls/pull/1746 * https://github.com/rust-analyzer/rust-analyzer/pull/9984 _folks @ rust-analyzer are fast at merging…_ * https://github.com/rust-analyzer/rust-analyzer/pull/9985 * https://github.com/rust-analyzer/rust-analyzer/pull/9987 * https://github.com/rust-analyzer/rust-analyzer/pull/9989 _For `clippy`, I don’t know if the changes should better better be moved to a PR to the original repo._ <hr> This has some overlap with #88226, but neither is a strict superset of the other. If you want multiple commits, I can split it up; in that case, make sure to suggest a criterion for splitting.
2021-08-22Fix typos “a”→“an”Frank Steffahn-1/+1
2021-08-21cleanup: `Span::new` -> `Span::with_lo`Vadim Petrochenkov-1/+1
2021-04-19Remove closure_treeCameron Steffen-31/+0
2021-03-27Remove (lots of) dead codeJoshua Nelson-0/+2
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
2020-12-22docs: Update rustc_middle::middle::region::ScopeTreepierwill-4/+2
This corrects the return type in docs for yield_in_source method. Closes #80287.
2020-10-21Clean up and improve some docsCamelid-11/+11
* compiler docs * Don't format list as part of a code block * Clean up some other formatting * rustdoc book * Update CommonMark spec version to latest (0.28 -> 0.29) * Clean up some various wording and formatting
2020-10-14documentation fixDing Xiang Fei-3/+7