summary refs log tree commit diff
path: root/compiler/rustc_middle/src/hir/map
AgeCommit message (Collapse)AuthorLines
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-2/+2
2023-01-12fix fmt and blessDeadbeef-1/+3
2023-01-12attempt to make a minimal example workDeadbeef-1/+1
2023-01-04get_parent and find_parentMichael Goulet-5/+13
2023-01-04rename find_parent_node to opt_parent_idMichael Goulet-2/+2
2023-01-04rename get_parent_node to parent_idMichael Goulet-13/+13
2023-01-02Auto merge of #84762 - cjgillot:resolve-span-opt, r=petrochenkovbors-1/+1
Encode spans relative to the enclosing item -- enable on nightly Follow-up to #84373 with the flag `-Zincremental-relative-spans` set by default. This PR seeks to remove one of the main shortcomings of incremental: the handling of spans. Changing the contents of a function may require redoing part of the compilation process for another function in another file because of span information is changed. Within one file: all the spans in HIR change, so typechecking had to be re-done. Between files: spans of associated types/consts/functions change, so type-based resolution needs to be re-done (hygiene information is stored in the span). The flag `-Zincremental-relative-spans` encodes local spans relative to the span of an item, stored inside the `source_span` query. Trap: stashed diagnostics are referenced by the "raw" span, so stealing them requires to remove the span's parent. In order to avoid too much traffic in the span interner, span encoding uses the `ctxt_or_tag` field to encode: - the parent when the `SyntaxContext` is 0; - the `SyntaxContext` when the parent is `None`. Even with this, the PR creates a lot of traffic to the Span interner, when a Span has both a LocalDefId parent and a non-root SyntaxContext. They appear in lowering, when we add a parent to all spans, including those which come from macros, and during inlining when we mark inlined spans. The last commit changes how queries of `LocalDefId` manage their cache. I can put this in a separate PR if required. Possible future directions: - validate that all spans are marked in HIR validation; - mark macro-expanded spans relative to the def-site and not the use-site.
2022-12-25Only enable relative span hashing on nightly.Camille GILLOT-1/+1
2022-12-25Enable relative span hashing.Camille GILLOT-1/+1
2022-12-25fix more clippy::style findingsMatthias Krüger-6/+4
match_result_ok obfuscated_if_else single_char_add writeln_empty_string collapsible_match iter_cloned_collect unnecessary_mut_passed
2022-12-24Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholkMatthias Krüger-2/+2
rustc: Remove needless lifetimes
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-2/+2
2022-12-20Some track_caller additionsOli Scherer-0/+8
2022-12-20Some hir cleanupsOli Scherer-2/+2
2022-12-09Move the untracked cstore and source_span into a structOli Scherer-2/+2
2022-12-03Rollup merge of #104199 - SarthakSingh31:issue-97417-1, r=cjgillotMatthias Krüger-1/+1
Keep track of the start of the argument block of a closure This removes a call to `tcx.sess.source_map()` from [compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs](https://github.com/rust-lang/rust/compare/master...SarthakSingh31:issue-97417-1?expand=1#diff-8406bbc0d0b43d84c91b1933305df896ecdba0d1f9269e6744f13d87a2ab268a) as required by #97417. VsCode automatically applied `rustfmt` to the files I edited under `src/tools`. I can undo that if its a problem. r? `@cjgillot`
2022-11-28Keep track of the start of the argument block of a closureSarthak Singh-1/+1
2022-11-23Separate lifetime ident from resolution in HIR.Camille GILLOT-1/+1
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-4/+4
2022-11-13Do not use `local_def_id` in `node_to_string`.Camille GILLOT-30/+24
2022-11-13Store a LocalDefId in hir::AnonConst.Camille GILLOT-1/+1
2022-11-13Store a LocalDefId in hir::GenericParam.Camille GILLOT-2/+2
2022-11-13Store LocalDefId in hir::Closure.Camille GILLOT-2/+2
2022-11-11Tweak signatures in rustc_middle::hir::map.Camille GILLOT-2/+9
2022-10-29Rename some `OwnerId` fields.Nicholas Nethercote-8/+8
spastorino noticed some silly expressions like `item_id.def_id.def_id`. This commit renames several `def_id: OwnerId` fields as `owner_id`, so those expressions become `item_id.owner_id.def_id`. `item_id.owner_id.local_def_id` would be even clearer, but the use of `def_id` for values of type `LocalDefId` is *very* widespread, so I left that alone.
2022-10-09ImplItemKind::TyAlias => ImplItemKind::TypeMichael Goulet-2/+2
2022-10-02Rollup merge of #102538 - cjgillot:def-span-ctxt, r=fee1-deadDylan DPC-6/+26
Give `def_span` the same SyntaxContext as `span_with_body`. https://github.com/rust-lang/rust/issues/102217 I'm not sure how to add a test, since the erroneous span was crafted using a proc macro. The debug assertion in `def_span` will ensure we have the correct behaviour.
2022-10-01Do not fetch HIR node when iterating to find lint.Camille GILLOT-8/+12
2022-10-01Give `def_span` the same SyntaxContext as `span_with_body`.Camille GILLOT-6/+26
2022-09-30create def ids for impl traits during ast loweringSantiago Pastorino-2/+2
2022-09-24separate definitions and `HIR` ownersTakayuki Maeda-28/+31
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
2022-09-22Revert "Auto merge of #101862 - cjgillot:lint-regression, r=oli-obk"Camille GILLOT-12/+8
This reverts commit bc7b17cfe3bf08b618d1c7b64838053faeb1f590, reversing changes made to 5253b0a0a1f366fad0ebed57597fcf2703b9e893.
2022-09-15Do not fetch HIR node when iterating to find lint.Camille GILLOT-8/+12
2022-09-12Auto merge of #101688 - cjgillot:verify-hir-parent, r=petrochenkovbors-0/+2
Assert that HIR nodes are not their own parent. Fixes https://github.com/rust-lang/rust/issues/101505. Replaces #101513 r? `@petrochenkov` `@nnethercote`
2022-09-11Assert that HIR nodes are not their own parent.Camille GILLOT-0/+2
2022-09-09Handle generic parameters.Camille GILLOT-4/+14
2022-09-09RPITIT placeholder itemsMichael Goulet-0/+2
2022-08-31Use parent_iter instead of a find_parent_node loopEric Holk-0/+3
2022-08-29Rollup merge of #99821 - cjgillot:ast-lifetimes-2, r=compiler-errorsDylan DPC-2/+6
Remove separate indexing of early-bound regions ~Based on https://github.com/rust-lang/rust/pull/99728.~ This PR copies some modifications from https://github.com/rust-lang/rust/pull/97839 around object lifetime defaults. These modifications allow to stop counting generic parameters during lifetime resolution, and rely on the indexing given by `rustc_typeck::collect`.
2022-08-27Rollup merge of #101057 - cjgillot:one-fn-sig, r=compiler-errorsYuki Okushi-24/+2
Merge implementations of HIR fn_decl and fn_sig.
2022-08-26Merge implementations of HIR fn_decl and fn_sig.Camille GILLOT-24/+2
2022-08-22Auto merge of #99963 - cjgillot:iter-submodule, r=compiler-errorsbors-19/+13
Simplify implementation for par_for_each_module
2022-08-11Check attributes on struct expression fields.Eric Huss-0/+3
Attributes on struct expression fields were not being checked for validity. This adds the fields as HIR nodes so that `CheckAttrVisitor` can visit those nodes to check their attributes.
2022-08-11Check attributes on pattern fields.Eric Huss-0/+3
Attributes on pattern struct fields were not being checked for validity. This adds the fields as HIR nodes so that the `CheckAttrVisitor` can visit those nodes to check their attributes.
2022-08-03Create a specific `ObjectLifetimeDefault` enum.Camille GILLOT-2/+6
2022-07-30Inline a few short methods.Camille GILLOT-0/+9
2022-07-30Simplify implementation for par_for_each_module.Camille GILLOT-19/+4
2022-07-29Change enclosing_body_owner to return LocalDefIdMiguel Guarniz-4/+4
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29Change maybe_body_owned_by to take local def idMiguel Guarniz-7/+8
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-19use `par_for_each_in` in `par_body_owners` and `collect_crate_mono_items`SparrowLii-3/+1