about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/hir/map
AgeCommit message (Collapse)AuthorLines
2022-03-30Auto merge of #95436 - cjgillot:static-mut, r=oli-obkbors-21/+18
Remember mutability in `DefKind::Static`. This allows to compute the `BodyOwnerKind` from `DefKind` only, and removes a direct dependency of some MIR queries onto HIR. As a side effect, it also simplifies metadata, since we don't need 4 flavours of `EntryKind::*Static` any more.
2022-03-30Spellchecking compiler commentsYuri Astrakhan-1/+1
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30rework implementation for inherent impls for builtin typeslcnr-0/+4
2022-03-29Remember mutability in `DefKind::Static`.Camille GILLOT-21/+18
This allows to compute the `BodyOwnerKind` from `DefKind` only, and removes a direct dependency of some MIR queries onto HIR. As a side effect, it also simplifies metadata, since we don't need 4 flavours of `EntryKind::*Static` any more.
2022-02-24resolve: Fix incorrect results of `opt_def_kind` query for some built-in macrosVadim Petrochenkov-2/+1
Previously it always returned `MacroKind::Bang` while some of those macros are actually attributes and derives
2022-02-10Make all hir::Map methods consistently by-valueFrank Steffahn-78/+78
(hir::Map only consists of a single reference anyways)
2022-01-29Make local_def_id_to_hir_id query directly returh HirIdSantiago Pastorino-6/+1
2022-01-28Separate hir_owner query into two queries to avoid using extensive data on ↵Santiago Pastorino-15/+15
incr comp most of the time
2022-01-27Store def_id_to_hir_id as variant in hir_owner.Camille GILLOT-31/+38
If hir_owner is Owner(_), the LocalDefId is pointing to an owner, so the ItemLocalId is 0. If the HIR node does not exist, we store Phantom. Otherwise, we store the HirId associated to the LocalDefId.
2022-01-25Store hir_id_to_def_id in OwnerInfo.Camille GILLOT-2/+5
2022-01-16Replace NestedVisitorMap with NestedFilterCameron Steffen-3/+4
2022-01-15Reduce use of local_def_id_to_hir_id.Camille GILLOT-2/+1
2022-01-15Make ty_param_owner return a LocalDefId.Camille GILLOT-3/+5
2022-01-15Return a LocalDefId in get_parent_item.Camille GILLOT-18/+29
2022-01-15Add fast path to `opt_local_def_id`.Camille GILLOT-2/+6
2021-12-12Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"Deadbeef-1/+2
This reverts commit ff2439b7b9bafcfdff86b7847128014699df8442, reversing changes made to 2a9e0831d6603d87220cedd1b1293e2eb82ef55c.
2021-12-03Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"Santiago Pastorino-2/+1
This reverts commit 18bb8c61a975fff6424cda831ace5b0404277145, reversing changes made to d9baa361902b172be716f96619b909f340802dea.
2021-12-02Auto merge of #91354 - fee1-dead:const_env, r=spastorinobors-1/+2
Cleanup: Eliminate ConstnessAnd This is almost a behaviour-free change and purely a refactoring. "almost" because we appear to be using the wrong ParamEnv somewhere already, and this is now exposed by failing a test using the unstable `~const` feature. We most definitely need to review all `without_const` and at some point should probably get rid of many of them by using `TraitPredicate` instead of `TraitRef`. This is a continuation of https://github.com/rust-lang/rust/pull/90274. r? `@oli-obk` cc `@spastorino` `@ecstatic-morse`
2021-11-29Re-use `constness_for_typeck` instead of rolling it ourselvesOli Scherer-17/+5
2021-11-29Add constness to ParamEnvOli Scherer-6/+19
This now causes a lot of queries to be executed twice, as reveal_all forces NotConst
2021-11-28Take a LocalDefId in expect_*item.Camille GILLOT-12/+14
2021-11-07Give inline const separate DefKindGary Guo-1/+9
2021-10-21Use SortedMap in HIR.Camille GILLOT-15/+9
2021-10-19Replace FnLikeNode by FnKind.Camille GILLOT-83/+0
2021-10-19Cleanup dead code in hir::map::blocks.Camille GILLOT-172/+14
2021-10-18Auto merge of #89124 - cjgillot:owner-info, r=michaelwoeristerbors-496/+72
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-10Compute full HIR hash during lowering.Camille GILLOT-26/+19
2021-10-10Directly use AttributeMap inside OwnerInfo.Camille GILLOT-1/+1
2021-10-09Perform indexing during lowering.Camille GILLOT-404/+7
Do not access DefId<->HirId maps before they are initialized.
2021-10-09Make index_hir incremental.Camille GILLOT-121/+86
2021-10-09Hash during lowering.Camille GILLOT-27/+4
2021-10-09Forbid hashing HIR outside of indexing.Camille GILLOT-13/+17
2021-10-09Use an IndexVec for bodies.Camille GILLOT-12/+14
2021-10-09Store lowering outputs per owner.Camille GILLOT-19/+51
2021-10-03Remove re-export.Camille GILLOT-1/+1
2021-09-30Apply suggestions from code reviewCamille Gillot-1/+1
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2021-09-30Do not pass hir::Crate to lints.Camille GILLOT-1/+1
2021-09-29Move body_owners to tcx.hir().Camille GILLOT-0/+11
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-0/+55
2021-09-21Rollup merge of #89078 - camsteffen:map-ref, r=cjgillotthe8472-8/+8
Cleanup: Remove needless reference in ParentHirIterator It forces an intermediate binding of `Map` which is a Copy type.
2021-09-20Do not store visibility in *ItemRef.Camille GILLOT-4/+4
2021-09-19Auto merge of #88703 - cjgillot:lazymod, r=petrochenkovbors-5/+104
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-18Remove needless hir Map refCameron Steffen-8/+8
2021-09-18Do not preallocate UseTree HirIds.Camille GILLOT-6/+1
2021-09-12Use non-recursive algorithm in non-parallel compiler.Camille GILLOT-4/+10
2021-09-12Use boxed slice instead of BTreeSet.Camille GILLOT-25/+31
2021-09-12Gather module items after lowering.Camille GILLOT-1/+88
2021-09-11Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkovbors-13/+13
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-10Add actual spans to the crate hash.Camille GILLOT-13/+13
Now that we encode spans relative to the items, the item's own span is never actually hashed as part of the HIR. In consequence, we explicitly include it in the crate hash to avoid missing cross-crate invalidations.