summary refs log tree commit diff
path: root/compiler/rustc_middle/src/hir/map
AgeCommit message (Collapse)AuthorLines
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.
2021-09-09Ignore automatically derived impls of `Clone` and `Debug` in dead code analysisFabian Wolff-7/+0
2021-09-02Rename walk_crate.Camille GILLOT-1/+1
2021-09-02Stop using walk_crate.Camille GILLOT-3/+20
2021-08-28Remove obsolete `MacroDef` variant of `OwnerNode`inquisitivecrystal-13/+0
2021-08-28Treat macros as HIR itemsinquisitivecrystal-25/+2
2021-08-22Fix typos “a”→“an”Frank Steffahn-1/+1
2021-07-31rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tablesVadim Petrochenkov-8/+0
and passes using them - primarily privacy checking, stability checking and dead code checking. WIP
2021-07-27Auto merge of #83484 - JulianKnodt:infer, r=oli-obk,lcnrbors-0/+11
Add hir::GenericArg::Infer In order to extend inference to consts, make an Infer type on hir::GenericArg.
2021-07-25Auto merge of #83723 - cjgillot:ownernode, r=petrochenkovbors-180/+96
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-25Use more of OwnerNode.Camille GILLOT-54/+43
2021-07-25Use OwnerNode in indexing.Camille GILLOT-104/+51
2021-07-25Introduce OwnerNode::Crate.Camille GILLOT-18/+2
2021-07-25Merge the BTreeMap in hir::Crate.Camille GILLOT-8/+4
2021-07-25Add inferred args to typeckkadmin-1/+1
2021-07-25Add generic arg inferkadmin-0/+11