summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2021-09-30Rollup merge of #89344 - jackh726:maybe-bound-eror, r=cjgillotManish Goregaokar-1/+1
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-1/+1
2021-09-22rustc_index: Add some map-like APIs to `IndexVec`Vadim Petrochenkov-15/+7
2021-09-20Make with_hir_id_owner responsible for registering the item.Camille GILLOT-97/+48
2021-09-20Remove lower_node_id_with_owner.Camille GILLOT-63/+34
2021-09-19Auto merge of #88703 - cjgillot:lazymod, r=petrochenkovbors-17/+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-60/+5
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-40/+1
2021-09-18Do not preallocate item HirIds.Camille GILLOT-21/+5
2021-09-15Rollup merge of #88775 - pnkfelix:revert-anon-union-parsing, r=davidtwcoManish Goregaokar-9/+0
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-17/+2
2021-09-10Give spans their parent item during lowering.Camille GILLOT-2/+7
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-9/+0
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-07Don't move ?Trait bounds to param bounds if they're in where clausesjackh726-20/+5
2021-09-03Replace Vec by Option.Camille GILLOT-9/+8
2021-09-03Simplify lifetimes_from_impl_trait_bounds.Camille GILLOT-200/+181
2021-09-03Auto merge of #88597 - cjgillot:lower-global, r=petrochenkovbors-61/+4
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-24/+2
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-4/+0
2021-09-01Compute item_generics_num_lifetimes during resolution.Camille GILLOT-43/+4
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/+2
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-24/+2
2021-08-30Move some methods to block moduleCameron Steffen-95/+2
2021-08-30Add let-else to ASTCameron Steffen-1/+1
2021-08-30Remove unused arena macro argsbjorn3-1/+1
2021-08-29ast_lowering: Introduce `lower_span` for catching all spans entering HIRVadim Petrochenkov-65/+102
2021-08-28Treat macros as HIR itemsinquisitivecrystal-10/+0
2021-08-27Introduce `~const`Deadbeef-1/+1
- [x] Removed `?const` and change uses of `?const` - [x] Added `~const` to the AST. It is gated behind const_trait_impl. - [x] Validate `~const` in ast_validation. - [ ] Add enum `BoundConstness` to the HIR. (With variants `NotConst` and `ConstIfConst` allowing future extensions) - [ ] Adjust trait selection and pre-existing code to use `BoundConstness`. - [ ] Optional steps (*for this PR, obviously*) - [ ] Fix #88155 - [ ] Do something with constness bounds in chalk
2021-08-24Auto merge of #87739 - Aaron1011:remove-used-attrs, r=wesleywiserbors-1/+1
Remove `Session.used_attrs` and move logic to `CheckAttrVisitor` Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-22Fix typos “a”→“an”Frank Steffahn-2/+2
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-1/+1
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-10/+0
2021-07-30Do not discard `?Sized` type params and suggest their removalEsteban Küber-5/+5
2021-07-27Auto merge of #83484 - JulianKnodt:infer, r=oli-obk,lcnrbors-41/+52
Add hir::GenericArg::Infer In order to extend inference to consts, make an Infer type on hir::GenericArg.
2021-07-26Actually infer args in visitorskadmin-3/+7
2021-07-25Introduce OwnerNode::Crate.Camille GILLOT-2/+4
2021-07-25Merge the BTreeMap in hir::Crate.Camille GILLOT-18/+41
2021-07-25Add generic arg inferkadmin-40/+47
2021-07-19Improve impl trait disallowed context error textSantiago Pastorino-1/+1
2021-07-18Remove impl_trait_in_bindings feature flagSantiago Pastorino-7/+1
2021-07-18Remove origin field from TypeAliasesOpaqueTySantiago Pastorino-8/+4
2021-07-18Remove OpaqueTyOrigin::Misc, use TyAlias insteadSantiago Pastorino-2/+2
2021-07-17Remove impl traits bindings error message handling on AST loweringSantiago Pastorino-6/+1
2021-07-17Fix TypeAliasesOpaqueTy origin docsSantiago Pastorino-1/+1
2021-07-17Rename OtherOpaqueTy to TypeAliasesOpaqueTySantiago Pastorino-9/+13
2021-07-17Remove OpaqueTyOrigin::BindingSantiago Pastorino-16/+5