summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
AgeCommit message (Collapse)AuthorLines
2021-11-26Auto merge of #85102 - estebank:point-at-assignment, r=oli-obkbors-4/+12
Diagnostic tweaks * On type mismatch caused by assignment, point at the source of the expectation * Hide redundant errors * Suggest `while let` when `let` is missing in some cases
2021-11-25On type mismatch caused by assignment, point at assigneeEsteban Küber-4/+12
* Do not emit unnecessary E0308 after E0070 * Show fewer errors on `while let` missing `let` * Hide redundant E0308 on `while let` missing `let` * Point at binding definition when possible on invalid assignment * do not point at closure twice * do not suggest `if let` for literals in lhs * account for parameter types
2021-11-23Do not visit attributes in `ItemLowerer`.Camille GILLOT-0/+5
By default, AST visitors visit expressions that appear in key-value attributes. Those expressions should not be lowered to HIR, as they do not correspond to actually compiled code. Since an attribute cannot produce meaningful HIR, just skip them altogether.
2021-11-21Simplify for loop desugarCameron Steffen-99/+38
2021-11-19Rollup merge of #90990 - nnethercote:arenas-cleanup, r=oli-obkYuki Okushi-1/+1
Arenas cleanup I was looking closely at the arenas code and here are some small improvement to readability.
2021-11-18rustc: Remove `#[rustc_synthetic]`Vadim Petrochenkov-10/+2
This function parameter attribute was introduced in https://github.com/rust-lang/rust/pull/44866 as an intermediate step in implementing `impl Trait`, it's not necessary or used anywhere by itself.
2021-11-17Remove unnecessary lifetime argument from arena macros.Nicholas Nethercote-1/+1
Because it's always `'tcx`. In fact, some of them use a mixture of passed-in `$tcx` and hard-coded `'tcx`, so no other lifetime would even work. This makes the code easier to read.
2021-11-10Add support for specifying multiple clobber_abi in `asm!`asquared31415-7/+40
Allow multiple clobber_abi in asm Update docs Fix aarch64 test Combine abis Emit duplicate ABI error, empty ABI list error multiple clobber_abi
2021-11-07ast: Fix naming conventions in AST structuresVadim Petrochenkov-23/+23
TraitKind -> Trait TyAliasKind -> TyAlias ImplKind -> Impl FnKind -> Fn All `*Kind`s in AST are supposed to be enums. Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order. Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-11-07Add features gates for experimental asm featuresAmanieu d'Antras-4/+46
2021-10-29Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnrbors-1/+0
Revert "Add rustc lint, warning when iterating over hashmaps" Fixes perf regressions introduced in https://github.com/rust-lang/rust/pull/90235 by temporarily reverting the relevant PR.
2021-10-28Revert "Add rustc lint, warning when iterating over hashmaps"Mark Rousskov-1/+0
2021-10-28Auto merge of #90145 - cjgillot:sorted-map, r=michaelwoeristerbors-29/+16
Use SortedMap in HIR. Closes https://github.com/rust-lang/rust/issues/89788 r? `@ghost`
2021-10-26Remove unnecessary check for registersYuki Okushi-3/+1
`is_clobber()` already checks if `reg` is a register and the both values should be the same.
2021-10-26Fix some typosYuki Okushi-2/+2
2021-10-24Rollup merge of #89558 - lcnr:query-stable-lint, r=estebankMatthias Krüger-0/+1
Add rustc lint, warning when iterating over hashmaps r? rust-lang/wg-incr-comp
2021-10-22Rollup merge of #89895 - camsteffen:for-loop-head-span, r=davidtwcoYuki Okushi-21/+18
Don't mark for loop iter expression as desugared We typically don't mark spans of lowered things as desugared. This helps Clippy rightly discern when code is (not) from expansion. This was discovered by ``@flip1995`` at https://github.com/rust-lang/rust-clippy/pull/7789#issuecomment-939289501.
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