about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2023-04-23allow array-style simd in inline asmEzra Shaw-13/+25
2023-04-22Add `intrinsics::transmute_unchecked`Scott McMurray-1/+1
This takes a whole 3 lines in `compiler/` since it lowers to `CastKind::Transmute` in MIR *exactly* the same as the existing `intrinsics::transmute` does, it just doesn't have the fancy checking in `hir_typeck`. Added to enable experimenting with the request in <https://github.com/rust-lang/rust/pull/106281#issuecomment-1496648190> and because the portable-simd folks might be interested for dependently-sized array-vector conversions. It also simplifies a couple places in `core`.
2023-04-22Don't infer fn return type to return itselfMichael Goulet-11/+20
2023-04-21Allow `LocalDefId` as the argument to `def_path_str`Oli Scherer-5/+5
2023-04-21Leave it to the query system to invoke the typeck query instead of invoking ↵Oli Scherer-2/+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-21Migrate `rustc_hir_analysis` to session diagnosticObei Sideg-84/+214
Part 4: Finishing `check/mod.rs` file
2023-04-21Auto merge of #96840 - cjgillot:query-feed, r=oli-obkbors-168/+97
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-21Rollup merge of #110555 - compiler-errors:subst-missing-trait-items, r=cjgillotMatthias Krüger-11/+32
Substitute missing trait items suggestion correctly Properly substitute missing item suggestions, so that when they reference generics from their parent trait they actually have the right time for the impl. Also, some other minor tweaks like using `/* Type */` to signify a GAT's type is actually missing, and fixing generic arg suggestions for GATs in general.
2023-04-20add subst_identity_iter and subst_identity_iter_copied methods on ↵Kyle Matsuda-11/+7
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-16/+15
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-11/+19
2023-04-20Remove opt_const_param_of.Camille GILLOT-159/+94
2023-04-20Remove WithOptconstParam.Camille GILLOT-1/+0
2023-04-20Feed type_of query instead of using WithOptconstParam.Camille GILLOT-8/+3
2023-04-19Format missing GATs correctlyMichael Goulet-1/+7
2023-04-19Make missing impl item suggestions more obvious that they're missingMichael Goulet-2/+2
2023-04-19Substitute missing item suggestion correctlyMichael Goulet-9/+24
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-4/+4
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-18add EarlyBinder to return type of ↵Kyle Matsuda-4/+4
collect_return_position_impl_trait_in_trait_tys query; remove bound_X version
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-18Rollup merge of #110417 - jsoref:spelling-compiler, r=NilstriebGuillaume Gomez-3/+3
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-17Spelling - compilerJosh Soref-3/+3
* 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-17Use `Item::expect_*` and `ImplItem::expect_*` moreMaybe Waffle-4/+3
2023-04-16Auto merge of #110405 - fee1-dead-contrib:rollup-9rkree6, r=fee1-deadbors-5/+2
Rollup of 4 pull requests Successful merges: - #110397 (Move some utils out of `rustc_const_eval`) - #110398 (use matches! macro in more places) - #110400 (more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_defau…) - #110402 (Remove the loop in `Align::from_bytes`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-16Rollup merge of #110400 - matthiaskrgr:style_mix, r=fee1-deadfee1-dead-1/+1
more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_defau… …lt, option_map_or_none} r? `@Nilstrieb`
2023-04-16Rollup merge of #110396 - Nilstrieb:speedy-bootstrap, r=jyn514fee1-dead-1/+1
Use lint via `lint_defs` instead of `lints` This gets rid of a blocking dependency edge from `rustc_lint->rustc_analysis->rustc_hir_typeck->rustc_interface` ![image](https://user-images.githubusercontent.com/48135649/232291152-fc61e6c5-9b1e-4db1-8101-dfaa3b7d30c6.png)
2023-04-16Rollup merge of #110345 - nnethercote:rm-Super-impls-for-Region, ↵fee1-dead-1/+1
r=compiler-errors Remove `TypeSuper{Foldable,Visitable}` impls for `Region`. These traits exist so that folders/visitors can recurse into types of interest: binders, types, regions, predicates, and consts. But `Region` is non-recursive and cannot contain other types of interest, so its methods in these traits are trivial. This commit inlines and removes those trivial methods. r? `@compiler-errors`
2023-04-16more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_default, ↵Matthias Krüger-1/+1
option_map_or_none}
2023-04-16use matches! macro in more placesMatthias Krüger-4/+1
2023-04-16Use lints via `lint_defs` instead of `lints`Nilstrieb-1/+1
This gets rid of a blocking dependency edge from `rustc_lint->rustc_analysis->rustc_hir_typeck->rustc_interface`
2023-04-16Remove `TypeSuper{Foldable,Visitable}` impls for `Region`.Nicholas Nethercote-1/+1
These traits exist so that folders/visitors can recurse into types of interest: binders, types, regions, predicates, and consts. But `Region` is non-recursive and cannot contain other types of interest, so its methods in these traits are trivial. This commit inlines and removes those trivial methods.
2023-04-15fix clippy::{clone_on_copy, useless_conversion}Matthias Krüger-3/+2
2023-04-13Rollup merge of #110220 - lcnr:regionzz, r=compiler-errorsMatthias Krüger-49/+18
cleanup our region error API - require `TypeErrCtxt` to always result in an error, closing #108810 - move `resolve_regions_and_report_errors` to the `ObligationCtxt` - call `process_registered_region_obligations` in `resolve_regions` - move `resolve_regions` into the `outlives` submodule - add `#[must_use]` to functions returning lists of errors r? types
2023-04-13Rollup merge of #110218 - nnethercote:rm-ToRegionVid, r=compiler-errorsMatthias Krüger-26/+1
Remove `ToRegionVid` r? ```@compiler-errors```
2023-04-13Rollup merge of #110195 - compiler-errors:issue-110052, r=aliemjayMatthias Krüger-14/+6
Erase lifetimes above `ty::INNERMOST` when probing ambiguous types Turns out that `TyCtxt::replace_escaping_bound_vars_uncached` only erases bound vars exactly at `ty::INNERMOST`, and not everything above. This regresses the suggestions for non-lifetime binders, but oh well, I don't really care about those. Fixes #110052
2023-04-13Remove some unused type folders.Nicholas Nethercote-26/+1
I'm surprised the compiler doesn't warn about these. It appears having an `impl` on a struct is enough to avoid a warning about it never being constructed.
2023-04-12Rollup merge of #110153 - DaniPopes:compiler-typos, r=NilstriebMatthias Krüger-1/+1
Fix typos in compiler I ran [`typos -w compiler`](https://github.com/crate-ci/typos) to fix typos in the `compiler` directory. Refs #110150
2023-04-12region error cleanuplcnr-49/+18
- require `TypeErrCtxt` to always result in an error - move `resolve_regions_and_report_errors` to the `ObligationCtxt` - merge `process_registered_region_obligations` into `resolve_regions`
2023-04-11Allow the elaborator to only filter to real supertraitsMichael Goulet-31/+37
2023-04-11Split implied and super predicate queriesMichael Goulet-35/+85
2023-04-11Split super_predicates_that_define_assoc_type query from super_predicates_ofMichael Goulet-4/+4
2023-04-11Erase lifetimes above ty::INNERMOST when probing ambiguous typesMichael Goulet-14/+6
2023-04-10Fix typos in compilerDaniPopes-1/+1
2023-04-10rustc_metadata: Filter encoded data more aggressively using `DefKind`Vadim Petrochenkov-1/+1
2023-04-10Rollup merge of #110124 - Nilstrieb:📎-told-me-so, r=compiler-errorsDylan DPC-1/+1
Some clippy fixes in the compiler Best reviewed commit-by-commit 📎.
2023-04-09Rollup merge of #110028 - obeis:hir-analysis-migrate-diagnostics-3, ↵Matthias Krüger-110/+179
r=compiler-errors Migrate `rustc_hir_analysis` to session diagnostic [Part 3] Part 3: Finishing `collect.rs` file r? ``@compiler-errors``
2023-04-09Small clippy::correctness fixesNilstrieb-1/+1
Nothing was really incorrect before, but it did get nicer.
2023-04-09Auto merge of #110031 - compiler-errors:generic-elaboration, r=b-naberbors-14/+12
Make elaboration generic over input Combines all the `elaborate_*` family of functions into just one, which is an iterator over the same type that you pass in (e.g. elaborating `Predicate` gives `Predicate`s, elaborating `Obligation`s gives `Obligation`s, etc.)
2023-04-08Migrate `rustc_hir_analysis` to session diagnosticObei Sideg-110/+179
Part 3: Finishing `collect.rs` file