about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
AgeCommit message (Collapse)AuthorLines
2021-10-21Use SortedMap in HIR.Camille GILLOT-29/+16
2021-10-18Auto merge of #89124 - cjgillot:owner-info, r=michaelwoeristerbors-84/+503
Index and hash HIR as part of lowering Part of https://github.com/rust-lang/rust/pull/88186 ~Based on https://github.com/rust-lang/rust/pull/88880 (see merge commit).~ Once HIR is lowered, it is later indexed by the `index_hir` query and hashed for `crate_hash`. This PR moves those post-processing steps to lowering itself. As a side objective, the HIR crate data structure is refactored as an `IndexVec<LocalDefId, Option<OwnerInfo<'hir>>>` where `OwnerInfo` stores all the relevant information for an HIR owner. r? `@michaelwoerister` cc `@petrochenkov`
2021-10-17rustc_span: `Ident::invalid` -> `Ident::empty`Vadim Petrochenkov-1/+1
The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s.
2021-10-15Use more lowered spans in for loopCameron Steffen-12/+14
2021-10-15Don't mark for loop head span with desugaringCameron Steffen-10/+5
2021-10-15allow `potential_query_instability` everywherelcnr-0/+1
2021-10-12Use invalid local id for zeroth node parent.Camille GILLOT-1/+4
2021-10-11Make naming more explicit.Camille GILLOT-6/+10
2021-10-10Compute full HIR hash during lowering.Camille GILLOT-1/+22
2021-10-10Directly use AttributeMap inside OwnerInfo.Camille GILLOT-0/+7
2021-10-09Perform indexing during lowering.Camille GILLOT-2/+369
Do not access DefId<->HirId maps before they are initialized.
2021-10-09Hash during lowering.Camille GILLOT-1/+26
2021-10-09Forbid hashing HIR outside of indexing.Camille GILLOT-40/+5
2021-10-09Use an IndexVec for bodies.Camille GILLOT-3/+4
2021-10-09Store lowering outputs per owner.Camille GILLOT-46/+72
2021-10-09Rollup merge of #89641 - asquared31415:asm-feature-attr-regs, r=oli-obkMatthias Krüger-62/+2
make #[target_feature] work with `asm` register classes Fixes #89289
2021-10-08clippy::complexity fixesMatthias Krüger-2/+1
2021-10-07make #[target_feature] work with `asm` register classesasquared31415-62/+2
2021-10-02Add desugaring mark to while loopCameron Steffen-4/+7
2021-09-30Rollup merge of #89344 - jackh726:maybe-bound-eror, r=cjgillotManish Goregaokar-26/+39
Cleanup lower_generics_mut and make span be the bound itself Closes #86298 (supersedes those changes) r? `@cjgillot` since you reviewed the other PR (Used wrong branch for #89338)
2021-09-29Cleanup lower_generics_mut and make span be the bound itself, not the typejackh726-26/+39
2021-09-22rustc_index: Add some map-like APIs to `IndexVec`Vadim Petrochenkov-18/+11
2021-09-20Make with_hir_id_owner responsible for registering the item.Camille GILLOT-140/+91
2021-09-20Remove lower_node_id_with_owner.Camille GILLOT-63/+34
2021-09-20Do not store visibility in *ItemRef.Camille GILLOT-36/+14
2021-09-19Auto merge of #88703 - cjgillot:lazymod, r=petrochenkovbors-23/+2
Gather module items after lowering. This avoids having a non-local analysis inside lowering. By implementing `hir_module_items` using a visitor, we make sure that iterations and visitors are consistent.
2021-09-19Auto merge of #88627 - cjgillot:noallocuse, r=petrochenkovbors-94/+31
Do not preallocate HirIds Part of https://github.com/rust-lang/rust/pull/87234 r? `@petrochenkov`
2021-09-18Do not preallocate UseTree HirIds.Camille GILLOT-48/+12
2021-09-18Do not preallocate item HirIds.Camille GILLOT-47/+20
2021-09-15Rollup merge of #88775 - pnkfelix:revert-anon-union-parsing, r=davidtwcoManish Goregaokar-13/+1
Revert anon union parsing Revert PR #84571 and #85515, which implemented anonymous union parsing in a manner that broke the context-sensitivity for the `union` keyword and thus broke stable Rust code. Fix #88583.
2021-09-12Gather module items after lowering.Camille GILLOT-23/+2
2021-09-11Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkovbors-5/+19
Encode spans relative to the enclosing item The aim of this PR is to avoid recomputing queries when code is moved without modification. MCP at https://github.com/rust-lang/compiler-team/issues/443 This is achieved by : 1. storing the HIR owner LocalDefId information inside the span; 2. encoding and decoding spans relative to the enclosing item in the incremental on-disk cache; 3. marking a dependency to the `source_span(LocalDefId)` query when we translate a span from the short (`Span`) representation to its explicit (`SpanData`) representation. Since all client code uses `Span`, step 3 ensures that all manipulations of span byte positions actually create the dependency edge between the caller and the `source_span(LocalDefId)`. This query return the actual absolute span of the parent item. As a consequence, any source code motion that changes the absolute byte position of a node will either: - modify the distance to the parent's beginning, so change the relative span's hash; - dirty `source_span`, and trigger the incremental recomputation of all code that depends on the span's absolute byte position. With this scheme, I believe the dependency tracking to be accurate. For the moment, the spans are marked during lowering. I'd rather do this during def-collection, but the AST MutVisitor is not practical enough just yet. The only difference is that we attach macro-expanded spans to their expansion point instead of the macro itself.
2021-09-11Rebase fallout.Camille GILLOT-0/+1
2021-09-11Auto merge of #88214 - notriddle:notriddle/for-loop-span-drop-temps-mut, ↵bors-2/+7
r=nagisa rustc: use more correct span data in for loop desugaring Fixes #82462 Before: help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | LL | for x in DroppingSlice(&*v).iter(); { | + After: help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | LL | }; | + This seems like a reasonable fix: since the desugared "expr_drop_temps_mut" contains the entire desugared loop construct, its span should contain the entire loop construct as well.
2021-09-10Give spans their parent item during lowering.Camille GILLOT-3/+9
We only do this operation when incremental compilation is enabled. This avoids pessimizing the span handling for non-incremental compilation.
2021-09-10Add sanity check.Camille GILLOT-2/+2
We force the relative span's parent to be absolute. This avoids having to handle long dependency chains.
2021-09-10Encode spans relative to their parent.Camille GILLOT-0/+7
2021-09-09Revert "Implement Anonymous{Struct, Union} in the AST"Felix S. Klock II-13/+1
This reverts commit 059b68dd677808e14e560802d235ad40beeba71e. Note that this was manually adjusted to retain some of the refactoring introduced by commit 059b68dd677808e14e560802d235ad40beeba71e, so that it could likewise retain the correction introduced in commit 5b4bc05fa57be19bb5962f4b7c0f165e194e3151
2021-09-07Change is_unsized to add_implicitly_sizedjackh726-1/+1
2021-09-07Don't move ?Trait bounds to param bounds if they're in where clausesjackh726-50/+21
2021-09-03Replace Vec by Option.Camille GILLOT-35/+14
2021-09-03Simplify lifetimes_from_impl_trait_bounds.Camille GILLOT-200/+181
2021-09-03Auto merge of #88597 - cjgillot:lower-global, r=petrochenkovbors-79/+6
Move global analyses from lowering to resolution Split off https://github.com/rust-lang/rust/pull/87234 r? `@petrochenkov`
2021-09-02Auto merge of #87114 - cjgillot:abilint, r=estebankbors-48/+15
Lint missing Abi in ast validation instead of lowering.
2021-09-01Compute proc_macros in resolutions.Camille GILLOT-4/+0
2021-09-01Compute all_traits_impls during resolution.Camille GILLOT-13/+0
2021-09-01Compute item_generics_num_lifetimes during resolution.Camille GILLOT-52/+6
2021-09-01Stop sorting bodies by span.Camille GILLOT-10/+0
The definition order is already close to the span order, and only differs in corner cases.
2021-09-01Auto merge of #87688 - camsteffen:let-else, r=cjgillotbors-95/+187
Introduce `let...else` Tracking issue: #87335 The trickiest part for me was enforcing the diverging else block with clear diagnostics. Perhaps the obvious solution is to expand to `let _: ! = ..`, but I decided against this because, when a "mismatched type" error is found in typeck, there is no way to trace where in the HIR the expected type originated, AFAICT. In order to pass down this information, I believe we should introduce `Expectation::LetElseNever(HirId)` or maybe add `HirId` to `Expectation::HasType`, but I left that as a future enhancement. For now, I simply assert that the block is `!` with a custom `ObligationCauseCode`, and I think this is clear enough, at least to start. The downside here is that the error points at the entire block rather than the specific expression with the wrong type. I left a todo to this effect. Overall, I believe this PR is feature-complete with regard to the RFC.
2021-08-31Lint Abi in ast validation.Camille GILLOT-48/+15