summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
AgeCommit message (Collapse)AuthorLines
2021-09-16Revert "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 (cherry picked from commit 91feb76d133952825e3eb32bed399ec6e4bd9219)
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
2021-08-31Rollup merge of #88445 - inquisitivecrystal:ast-lowering, r=cjgillotMara Bos-33/+29
Clean up the lowering of AST items This PR simplifies and improves `rustc_ast_lowering::item` in various minor ways. The reasons for the changes should mostly be self evident, though I'm happy to specifically explain anything if needed. These changes used to be part of #88019, but I removed them after it was pointed out that some of my other changes to `rustc_ast_lowering` were unnecessary. It felt like a bad idea to clean up code which I didn't even need to touch anymore. r? `@cjgillot`
2021-08-30Add let_else feature gateCameron Steffen-0/+10
2021-08-30Lower let-else to HIRCameron Steffen-16/+81
2021-08-30Refactor lower_stmtsCameron Steffen-55/+56
2021-08-30Move some methods to block moduleCameron Steffen-95/+111
2021-08-30Add let-else to ASTCameron Steffen-1/+1
2021-08-30Remove unused arena macro argsbjorn3-1/+1
2021-08-29Clean up the lowering of AST itemsinquisitivecrystal-33/+29
2021-08-29ast_lowering: Introduce `lower_span` for catching all spans entering HIRVadim Petrochenkov-169/+330
2021-08-28Treat macros as HIR itemsinquisitivecrystal-34/+6
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-24Move `named_asm_labels` to a HIR lintasquared31415-1/+3
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-217/+56
2021-08-15Use correct drop scopes for if expressionsMatthew Jasper-3/+14
2021-08-12Add support for clobber_abi to asm!Amanieu d'Antras-1/+55
2021-08-01Inline make_if macroCameron Steffen-12/+4
2021-07-30Do not discard `?Sized` type params and suggest their removalEsteban Küber-15/+18
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-25Auto merge of #83723 - cjgillot:ownernode, r=petrochenkovbors-31/+50
Store all HIR owners in the same container This replaces the previous storage in a BTreeMap for each of Item/ImplItem/TraitItem/ForeignItem. This should allow for a more compact storage. Based on https://github.com/rust-lang/rust/pull/83114
2021-07-25Introduce OwnerNode::Crate.Camille GILLOT-2/+4
2021-07-25Merge the BTreeMap in hir::Crate.Camille GILLOT-29/+46
2021-07-25Add generic arg inferkadmin-40/+47
2021-07-21Correct fmtsurechen-10/+7
2021-07-21Simplify the collecting of `? Trait` bounds in where clausesurechen-33/+20
2021-07-20Auto merge of #87244 - jackh726:issue-71883, r=estebankbors-0/+1
Better diagnostics with mismatched types due to implicit static lifetime Fixes #78113 I think this is my first diagnostics PR...definitely happy to hear thoughts on the direction/implementation here. I was originally just trying to solve the error above, where the lifetime on a GAT was causing a cryptic "mismatched types" error. But as I was writing this, I realized that this (unintentionally) also applied to a different case: `wf-in-foreign-fn-decls-issue-80468.rs`. I'm not sure if this diagnostic should get a new error code, or even reuse an existing one. And, there might be some ways to make this even more generalized. Also, the error is a bit more lengthy and verbose than probably needed. So thoughts there are welcome too. This PR essentially ended up adding a new nice region error pass that triggers if a type doesn't match the self type of an impl which is selected because of a predicate because of an implicit static bound on that self type. r? `@estebank`
2021-07-19Better errors when we don't have implicit statics in trait objectsjackh726-0/+1
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-10/+4
2021-07-18Remove OpaqueTyOrigin::Misc, use TyAlias insteadSantiago Pastorino-2/+2
2021-07-18Remove impl trait bindings handling on const AST loweringSantiago Pastorino-11/+1
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-12/+16
2021-07-17Remove OpaqueTyOrigin::BindingSantiago Pastorino-16/+5
2021-07-15Remove refs from pat slicesCameron Steffen-26/+48
2021-07-13Cache expansion hash.Camille GILLOT-3/+43