about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-04-21Make `check_match` and `check_liveness` take a `LocalDefId`Oli Scherer-2/+2
2023-04-21Allow `LocalDefId` as the argument to `def_path_str`Oli Scherer-43/+57
2023-04-21Leave it to the query system to invoke the typeck query instead of invoking ↵Oli Scherer-4/+0
it eagerly. Later queries that are run on all body owners will invoke typeck as they need information from its result to perform their own logic
2023-04-21Actually keep `PlaceMention` if requested.Camille GILLOT-2/+0
2023-04-21Evaluate place expression in `PlaceMention`.Camille GILLOT-1/+2
2023-04-21Changes from reviewKyle Matsuda-1/+1
2023-04-21rustc_metadata: Split `children` into multiple tablesVadim Petrochenkov-2/+3
instead of merging everything into a single bag. If it's acceptable from performance point of view, then it's more clear to keep this stuff organized more in accordance with its use.
2023-04-21test improvementsDrMeepster-1/+5
2023-04-21intern offsetof fieldsDrMeepster-7/+29
2023-04-21offset_ofDrMeepster-3/+25
2023-04-21Auto merge of #96840 - cjgillot:query-feed, r=oli-obkbors-522/+141
Allow to feed a value in another query's cache and remove `WithOptConstParam` I used it to remove `WithOptConstParam` queries, as an example. The idea is that a query (here `typeck(function)`) can write into another query's cache (here `type_of(anon const)`). The dependency node for `type_of` would depend on all the current dependencies of `typeck`. There is still an issue with cycles: if `type_of(anon const)` is accessed before `typeck(function)`, we will still have the usual cycle. The way around this issue is to `ensure` that `typeck(function)` is called before accessing `type_of(anon const)`. When replayed, we may the following cases: - `typeck` is green, in that case `type_of` is green too, and all is right; - `type_of` is green, `typeck` may still be marked as red (it depends on strictly more things than `type_of`) -> we verify that the saved value and the re-computed value of `type_of` have the same hash; - `type_of` is red, then `typeck` is red -> it's the caller responsibility to ensure `typeck` is recomputed *before* `type_of`. As `anon consts` have their own `DefPathData`, it's not possible to have the def-id of the anon-const point to something outside the original function, but the general case may have to be resolved before using this device more broadly. There is an open question about loading from the on-disk cache. If `typeck` is loaded from the on-disk cache, the side-effect does not happen. The regular `type_of` implementation can go and fetch the correct value from the decoded `typeck` results, and the dep-graph will check that the hashes match, but I'm not sure we want to rely on this behaviour. I specifically allowed to feed the value to `type_of` from inside a call to `type_of`. In that case, the dep-graph will check that the fingerprints of both values match. This implementation is still very sensitive to cycles, and requires that we call `typeck(function)` before `typeck(anon const)`. The reason is that `typeck(anon const)` calls `type_of(anon const)`, which calls `typeck(function)`, which feeds `type_of(anon const)`, and needs to build the MIR so needs `typeck(anon const)`. The latter call would not cycle, since `type_of(anon const)` has been set, but I'd rather not remove the cycle check.
2023-04-20Derive `HashStable` on `GenericArgKind` instead of implementing it by handMaybe Waffle-29/+1
2023-04-20Use `impl Tag for $T` syntax for `impl_tag!`Maybe Waffle-1/+1
2023-04-20add subst_identity_iter and subst_identity_iter_copied methods on ↵Kyle Matsuda-1/+13
EarlyBinder; use this to simplify some EarlyBinder noise around explicit_item_bounds calls
2023-04-20add EarlyBinder to output of explicit_item_bounds; replace ↵Kyle Matsuda-10/+3
bound_explicit_item_bounds usages; remove bound_explicit_item_bounds query
2023-04-20change usages of explicit_item_bounds to bound_explicit_item_boundsKyle Matsuda-1/+1
2023-04-20Give more descriptive names to queries.Camille GILLOT-1/+1
2023-04-20Remove opt_const_param_of.Camille GILLOT-23/+0
2023-04-20Remove WithOptconstParam.Camille GILLOT-487/+113
2023-04-20Add `impl_tag!` macro to implement `Tag` for tagged pointer easilyMaybe Waffle-23/+6
2023-04-20Feed type_of query instead of using WithOptconstParam.Camille GILLOT-16/+32
2023-04-20Rollup merge of #110599 - WaffleLapkin:bonk_tygenericarg_transmutes, ↵Matthias Krüger-13/+0
r=compiler-errors Remove an unused `&[Ty]` <-> `&[GenericArg]` Missed this one in #110496, oops. r? `@compiler-errors`
2023-04-20Remove an unused `&[Ty]` <-> `&[GenericArg]`Maybe Waffle-13/+0
2023-04-20Rollup merge of #110545 - WaffleLapkin:generic_arg_as_x, r=cjgillotMatthias Krüger-35/+35
Add `GenericArgKind::as_{type,const,region}` This allows to make code nicer in some cases
2023-04-19Auto merge of #110546 - matthiaskrgr:rollup-346kik6, r=matthiaskrgrbors-4/+4
Rollup of 10 pull requests Successful merges: - #110123 ('./configure' now checks if 'config.toml' exists before writing to that destination) - #110429 (Spelling src bootstrap) - #110430 (Spelling src ci) - #110515 (Don't special-case download-rustc in `maybe_install_llvm`) - #110521 (Fix `x test lint-docs linkchecker` when download-rustc is enabled) - #110525 (Fix `tests/run-make-translation` when download-rustc is enabled) - #110531 (small type system cleanup) - #110533 (Missing blanket impl trait not public) - #110540 (Fix wrong comment in rustc_hir/src/hir.rs) - #110541 (Fix various configure bugs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-19Move `GenericArgKind::as_{type,const,region}` to `GenericArg`Maybe Waffle-48/+32
2023-04-19Auto merge of #110496 - WaffleLapkin:🏳️‍⚧️sound, r=compiler-errorsbors-52/+15
Don't transmute `&List<GenericArg>` <-> `&List<Ty>` In #93505 we allowed safely transmuting between `&List<GenericArg<'_>>` and `&List<Ty<'_>>`. This was possible because `GenericArg` is a tagged pointer and the tag for types is `0b00`, such that a `GenericArg` with a type inside has the same layout as `Ty`. While this was meant as an optimization, it doesn't look like it was actually any perf or max-rss win (see https://github.com/rust-lang/rust/pull/94799#issuecomment-1064340003, https://github.com/rust-lang/rust/pull/94841, https://github.com/rust-lang/rust/pull/110496#issuecomment-1513799140). Additionally the way it was done is quite fragile — `unsafe` code was not properly documented or contained in a module, types were not marked as `repr(C)` (making the transmutes possibly unsound). All of this makes the code maintenance harder and blocks other possible optimizations (as an example I've found out about these `transmutes` when my change caused them to sigsegv compiler). Thus, I think we can safely (pun intended) remove those transmutes, making maintenance easier, optimizations possible, code less cursed, etc. r? `@compiler-errors`
2023-04-19Rollup merge of #110531 - lcnr:type-system-stuff, r=aliemjayMatthias Krüger-4/+4
small type system cleanup
2023-04-19Add `GenericArgKind::as_{type,const,region}`Maybe Waffle-23/+39
2023-04-19small type system cleanuplcnr-4/+4
2023-04-19Auto merge of #110407 - Nilstrieb:fluent-macro, r=davidtwcobors-1/+1
Add `rustc_fluent_macro` to decouple fluent from `rustc_macros` Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-19Rollup merge of #110498 - kylematsuda:earlybinder-rpitit-tys, r=compiler-errorsMatthias Krüger-9/+6
Switch to `EarlyBinder` for `collect_return_position_impl_trait_in_trait_tys` Part of the work to finish https://github.com/rust-lang/rust/issues/105779. This PR adds `EarlyBinder` to the return type of the `collect_return_position_impl_trait_in_trait_tys` query and removes `bound_return_position_impl_trait_in_trait_tys`. r? `@lcnr`
2023-04-19Remove find_map_relevant_implMichael Goulet-59/+40
2023-04-18add EarlyBinder to return type of ↵Kyle Matsuda-9/+6
collect_return_position_impl_trait_in_trait_tys query; remove bound_X version
2023-04-18Auto merge of #110083 - saethlin:encode-hashes-as-bytes, r=cjgillotbors-23/+19
Encode hashes as bytes, not varint In a few places, we store hashes as `u64` or `u128` and then apply `derive(Decodable, Encodable)` to the enclosing struct/enum. It is more efficient to encode hashes directly than try to apply some varint encoding. This PR adds two new types `Hash64` and `Hash128` which are produced by `StableHasher` and replace every use of storing a `u64` or `u128` that represents a hash. Distribution of the byte lengths of leb128 encodings, from `x build --stage 2` with `incremental = true` Before: ``` ( 1) 373418203 (53.7%, 53.7%): 1 ( 2) 196240113 (28.2%, 81.9%): 3 ( 3) 108157958 (15.6%, 97.5%): 2 ( 4) 17213120 ( 2.5%, 99.9%): 4 ( 5) 223614 ( 0.0%,100.0%): 9 ( 6) 216262 ( 0.0%,100.0%): 10 ( 7) 15447 ( 0.0%,100.0%): 5 ( 8) 3633 ( 0.0%,100.0%): 19 ( 9) 3030 ( 0.0%,100.0%): 8 ( 10) 1167 ( 0.0%,100.0%): 18 ( 11) 1032 ( 0.0%,100.0%): 7 ( 12) 1003 ( 0.0%,100.0%): 6 ( 13) 10 ( 0.0%,100.0%): 16 ( 14) 10 ( 0.0%,100.0%): 17 ( 15) 5 ( 0.0%,100.0%): 12 ( 16) 4 ( 0.0%,100.0%): 14 ``` After: ``` ( 1) 372939136 (53.7%, 53.7%): 1 ( 2) 196240140 (28.3%, 82.0%): 3 ( 3) 108014969 (15.6%, 97.5%): 2 ( 4) 17192375 ( 2.5%,100.0%): 4 ( 5) 435 ( 0.0%,100.0%): 5 ( 6) 83 ( 0.0%,100.0%): 18 ( 7) 79 ( 0.0%,100.0%): 10 ( 8) 50 ( 0.0%,100.0%): 9 ( 9) 6 ( 0.0%,100.0%): 19 ``` The remaining 9 or 10 and 18 or 19 are `u64` and `u128` respectively that have the high bits set. As far as I can tell these are coming primarily from `SwitchTargets`.
2023-04-18Auto merge of #109772 - petrochenkov:slimchild, r=cjgillotbors-3/+0
rustc_metadata: Remove `Span` from `ModChild` It can be decoded on demand from regular `def_span` tables. Partially mitigates perf regressions from https://github.com/rust-lang/rust/pull/109500.
2023-04-18Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`Nilstrieb-1/+1
Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-18Don't transmute `&List<GenericArg>` <-> `&List<Ty>`Maybe Waffle-51/+14
2023-04-18Remove `as_substs` usageMaybe Waffle-1/+1
2023-04-18Store hashes in special types so they aren't accidentally encoded as numbersBen Kimock-23/+19
2023-04-18rustc_metadata: Remove `Span` from `ModChild`Vadim Petrochenkov-3/+0
It can be decoded on demand from regular `def_span` tables. Partially mitigates perf regressions from #109500.
2023-04-18Rollup merge of #110417 - jsoref:spelling-compiler, r=NilstriebGuillaume Gomez-11/+11
Spelling compiler This is per https://github.com/rust-lang/rust/pull/110392#issuecomment-1510193656 I'm going to delay performing a squash because I really don't expect people to be perfectly happy w/ my changes, I really am a human and I really do make mistakes. r? Nilstrieb I'm going to be flying this evening, but I should be able to squash / respond to reviews w/in a day or two. I tried to be careful about dropping changes to `tests`, afaict only two files had changes that were likely related to the changes for a given commit (this is where not having eagerly squashed should have given me an advantage), but, that said, picking things apart can be error prone.
2023-04-18Rollup merge of #110465 - ↵Matthias Krüger-0/+8
WaffleLapkin:assure_everyone_that_has_type_flags_is_fast, r=oli-obk Assure everyone that `has_type_flags` is fast `number_of_people_who_tripped_on_this += 1` r? ``@oli-obk``
2023-04-17Auto merge of #110243 - WaffleLapkin:bless_tagged_pointers🙏, r=Nilstriebbors-18/+17
Tagged pointers, now with strict provenance! This is a big refactor of tagged pointers in rustc, with three main goals: 1. Porting the code to the strict provenance 2. Cleanup the code 3. Document the code (and safety invariants) better This PR has grown quite a bit (almost a complete rewrite at this point...), so I'm not sure what's the best way to review this, but reviewing commit-by-commit should be fine. r? `@Nilstrieb`
2023-04-17Spelling - compilerJosh Soref-11/+11
* account * achieved * advising * always * ambiguous * analysis * annotations * appropriate * build * candidates * cascading * category * character * clarification * compound * conceptually * constituent * consts * convenience * corresponds * debruijn * debug * debugable * debuggable * deterministic * discriminant * display * documentation * doesn't * ellipsis * erroneous * evaluability * evaluate * evaluation * explicitly * fallible * fulfill * getting * has * highlighting * illustrative * imported * incompatible * infringing * initialized * into * intrinsic * introduced * javascript * liveness * metadata * monomorphization * nonexistent * nontrivial * obligation * obligations * offset * opaque * opportunities * opt-in * outlive * overlapping * paragraph * parentheses * poisson * precisely * predecessors * predicates * preexisting * propagated * really * reentrant * referent * responsibility * rustonomicon * shortcircuit * simplifiable * simplifications * specify * stabilized * structurally * suggestibility * translatable * transmuting * two * unclosed * uninhabited * visibility * volatile * workaround Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-17Auto merge of #110343 - saethlin:encode-initmask, r=lqdbors-1/+31
Bypass the varint path when encoding InitMask The data in a `InitMask` is stored as `u64` but it is a large bitmask (not numbers) so varint encoding doesn't make sense.
2023-04-17Assure everyone that `has_type_flags` is fastMaybe Waffle-0/+8
2023-04-17Rollup merge of #110394 - scottmcm:less-idx-new, r=WaffleLapkinMatthias Krüger-0/+10
Various minor Idx-related tweaks Nothing particularly exciting here, but a couple of things I noticed as I was looking for more index conversions to simplify. cc https://github.com/rust-lang/compiler-team/issues/606 r? `@WaffleLapkin`
2023-04-17Rollup merge of #110386 - nnethercote:clean-up-traversal-macros, r=lcnrMatthias Krüger-41/+20
Clean up traversal macros The declarative macros relating to type folding and visiting can be simplified. r? ``@lcnr``
2023-04-17Bypass the varint path when encoding InitMaskBen Kimock-1/+31