about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/hir/map
AgeCommit message (Collapse)AuthorLines
2023-09-02Add `Freeze` type and use it to store `Definitions`John Kåre Alsaker-1/+1
2023-09-01Auto merge of #113126 - Bryanskiy:delete_old, r=petrochenkovbors-1/+0
Replace old private-in-public diagnostic with type privacy lints Next part of RFC https://github.com/rust-lang/rust/issues/48054. r? `@petrochenkov`
2023-08-30Make get_return_block() return Some only for HIR nodes in bodyGurinder Singh-1/+12
Fixes # 114918
2023-08-14Use `{Local}ModDefId` in many queriesNilstrieb-13/+15
2023-08-09rustc: Move `stable_crate_id` from `Session` to `GlobalCtxt`Vadim Petrochenkov-1/+1
Removes a piece of mutable state. Follow up to #114578.
2023-08-08Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, ↵Matthias Krüger-1/+3
r=oli-obk Store the laziness of type aliases in their `DefKind` Previously, we would treat paths referring to type aliases as *lazy* type aliases if the current crate had lazy type aliases enabled independently of whether the crate which the alias was defined in had the feature enabled or not. With this PR, the laziness of a type alias depends on the crate it is defined in. This generally makes more sense to me especially if / once lazy type aliases become the default in a new edition and we need to think about *edition interoperability*: Consider the hypothetical case where the dependency crate has an older edition (and thus eager type aliases), it exports a type alias with bounds & a where-clause (which are void but technically valid), the dependent crate has the latest edition (and thus lazy type aliases) and it uses that type alias. Arguably, the bounds should *not* be checked since at any time, the dependency crate should be allowed to change the bounds at will with a *non*-major version bump & without negatively affecting downstream crates. As for the reverse case (dependency: lazy type aliases, dependent: eager type aliases), I guess it rules out anything from slight confusion to mild annoyance from upstream crate authors that would be caused by the compiler ignoring the bounds of their type aliases in downstream crates with older editions. --- This fixes #114468 since before, my assumption that the type alias associated with a given weak projection was lazy (and therefore had its variances computed) did not necessarily hold in cross-crate scenarios (which [I kinda had a hunch about](https://github.com/rust-lang/rust/pull/114253#discussion_r1278608099)) as outlined above. Now it does hold. `@rustbot` label F-lazy_type_alias r? `@oli-obk`
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-1/+3
2023-08-05parent_module_from_def_id does not need to be a query.Camille GILLOT-11/+0
2023-08-02Replace old private-in-public diagnostic with type privacy lintsBryanskiy-1/+0
2023-07-30inline format!() args up to and including rustc_middleMatthias Krüger-1/+1
2023-07-28Lower generic const items to HIRLeón Orell Valerian Liehr-1/+1
2023-07-14fix the issue of shorthand in suggest_cloningyukang-0/+27
2023-07-08Replace RPITIT current impl with new strategy that lowers as a GATSantiago Pastorino-7/+1
2023-06-02Separate AnonConst from ConstBlock in HIR.Camille GILLOT-9/+10
2023-05-24Use `Option::is_some_and` and `Result::is_ok_and` in the compilerMaybe Waffle-1/+1
2023-05-16Move DebuggerVisualizerFile types from rustc_span to rustc_middleMichael Woerister-1/+2
2023-05-16Turn debugger_visualizers from feed- into regular query.Michael Woerister-0/+5
2023-05-16Fix dependency tracking for debugger visualizersMichael Woerister-1/+11
2023-05-06introduce `DynSend` and `DynSync` auto traitSparrowLii-8/+3
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-21Allow `LocalDefId` as the argument to `def_path_str`Oli Scherer-1/+1
2023-04-16Remove some unnecessary hash truncationsBen Kimock-1/+1
2023-04-11Auto merge of #109778 - petrochenkov:allkind, r=cjgillotbors-3/+18
rustc_middle: Document which exactly `DefId`s don't have `DefKind`s I don't currently have time to investigate when and how to create these missing HIR nodes, but if someone else could do that it would be great.
2023-04-09Delete useless loopNilstrieb-9/+8
2023-03-30rustc_middle: Document which exactly `DefId`s don't have `DefKind`sVadim Petrochenkov-3/+18
2023-03-21RPITITs are DefKind::Opaque with new lowering strategyMichael Goulet-1/+1
2023-03-21LocalCrate keyMichael Goulet-1/+2
2023-03-21Use local key in providersMichael Goulet-3/+2
2023-03-14Remove some direct calls to local_def_id_to_hir_id on diagnosticsSantiago Pastorino-2/+2
2023-03-08Only compute the crate hash when necessary.Nicholas Nethercote-1/+1
The crate hash is needed: - if debug assertions are enabled, or - if incr. comp. is enabled, or - if metadata is being generated, or - if `-C instrumentation-coverage` is enabled. This commit avoids computing the crate hash when these conditions are all false, such as when doing a release build of a binary crate. It uses `Option` to store the hashes when needed, rather than computing them on demand, because some of them are needed in multiple places and computing them on demand would make compilation slower. The commit also removes `Owner::hash_without_bodies`. There is no benefit to pre-computing that one, it can just be done in the normal fashion.
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-1/+1
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-26Access upvars through a query.Camille GILLOT-0/+5
2023-02-19Add associated_items_for_impl_trait_in_trait querySantiago Pastorino-0/+7
2023-02-16`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`Maybe Waffle-1/+1
2023-02-14Add `of_trait` to DefKind::Impl.Camille GILLOT-1/+1
2023-02-01Improve pretty-printing of `HirIdValidator` errorsArpad Borsos-15/+12
This now uses `node_to_string` for both missing and seen Ids, which includes the snippet of code for which the Id was allocated. Also removes the duplicated printing of `HirId`, as `node_to_string` includes that already. Similarly, changes all other users of `node_to_string` that do so, and changes the output of `node_to_string`, which is now "$hirid ($what `$span` in $path)".
2023-01-28Remove `HirId -> LocalDefId` map from HIR.Camille GILLOT-40/+19
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