summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
2020-12-25Rollup merge of #80342 - pierwill:patch-1, r=lcnrDylan DPC-1/+1
Fix typo
2020-12-25Rollup merge of #80327 - PankajChaudhary5:PankajChaudhary, r=GuillaumeGomezDylan DPC-4/+1
Updated the match with the matches macro r?````@GuillaumeGomez````
2020-12-25Rollup merge of #80274 - pierwill:lintlevelsource, r=petrochenkovDylan DPC-2/+2
Rename rustc_middle::lint::LintSource Rename [`rustc_middle::lint::LintSource`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/lint/enum.LintSource.html) to `rustc_middle::lint::LintLevelSource`. This enum represents the source of a *lint level*, not a lint. This should improve code readability. Update: Also documents `rustc_middle::lint::LevelSource` to clarify.
2020-12-23Fix typopierwill-1/+1
2020-12-23Updated the match with the matches macroPankajChaudhary5-4/+1
2020-12-23Rollup merge of #80298 - PankajChaudhary5:PankajChaudhary, r=GuillaumeGomezGuillaume Gomez-8/+2
Improve the code quality by using matches macro Improved the code quality by using matches macro r? `@GuillaumeGomez`
2020-12-23Rollup merge of #80241 - pierwill:patch-12, r=lcnrGuillaume Gomez-1/+1
Fix typo Fix typo in rustc_middle::ty::inhabitedness::DefIdForest docs.
2020-12-23Rollup merge of #80225 - pierwill:patch-11, r=lcnrGuillaume Gomez-0/+11
Add module-level docs to rustc_middle::ty I thought it would be nice to point out `Ty` and `TyCtxt` on the module page, and link out to the [rustc-dev-guide chapter](https://rustc-dev-guide.rust-lang.org/ty.html).
2020-12-23Rollup merge of #80204 - pierwill:pierwill-rustcmiddle-ondisk, r=varkorGuillaume Gomez-2/+2
docs: Edit rustc_middle::ty::query::on_disk_cache Expand abbreviations for "incremental compliation". Also added the word "to" to the description of CacheEncoder.
2020-12-22Auto merge of #80177 - tgnottingham:foreign_defpathhash_registration, ↵bors-10/+28
r=Aaron1011 rustc_query_system: explicitly register reused dep nodes Register nodes that we've reused from the previous session explicitly with `OnDiskCache`. Previously, we relied on this happening as a side effect of accessing the nodes in the `PreviousDepGraph`. For the sake of performance and avoiding unintended side effects, register explictily.
2020-12-22Improve the code quality by using matches macroPankajChaudhary5-8/+2
2020-12-21Rename rustc_middle::lint::LintSourcepierwill-2/+2
Rename rustc_middle::lint::LintSource to rustc_middle::lint::LintLevelSource.
2020-12-20Fix typopierwill-1/+1
Fix typo in rustc_middle::ty::inhabitedness::DefIdForest docs.
2020-12-20Edit rustc_middle::ty::TyKind docspierwill-3/+5
- Add a definition for this enum. - Fix typo and missing punctuation. - Spell out "algebraic data type".
2020-12-20Add module-level docs to rustc_middle::typierwill-0/+11
2020-12-20Auto merge of #80163 - jackh726:binder-refactor-part-3, r=lcnrbors-70/+71
Make BoundRegion have a kind of BoungRegionKind Split from #76814 Also includes making `replace_escaping_bound_vars` only return `T` Going to r? `@lcnr` Feel free to reassign
2020-12-20Auto merge of #79635 - lcnr:const-eval-idk, r=oli-obkbors-1/+10
const_evaluatable_checked: fix occurs check fixes #79615 this is kind of a hack because we use `TypeRelation` for both the `Generalizer` and the `ConstInferUnifier` but i am not sure if there is a useful way to disentangle this without unnecessarily duplicating some code. The error in the added test is kind of unavoidable until we erase the unused substs of `ConstKind::Unevaluated`. We talked a bit about this in the cg lazy norm meeting (https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/lazy_normalization_consts)
2020-12-19docs: Edit rustc_middle::ty::query::on_disk_cachepierwill-2/+2
Expand abbreviations for "incremental compliation". Also added the word "to" to the description of CacheEncoder.
2020-12-19More rebindsJack Huey-8/+15
2020-12-18OnDiskCache: avoid storing local def id hashes in foreign def id collectionTyson Nottingham-2/+4
2020-12-18rustc_query_system: explicitly register reused dep nodesTyson Nottingham-9/+25
Register nodes that we've reused from the previous session explicitly with `OnDiskCache`. Previously, we relied on this happening as a side effect of accessing the nodes in the `PreviousDepGraph`. For the sake of performance and avoiding unintended side effects, register explictily.
2020-12-18Change potentially_qualified to be defined on Binder<PredicateAtom>Jack Huey-10/+14
2020-12-18Make BoundRegion have a kind of BoungRegionKindJack Huey-70/+71
2020-12-17Auto merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakisbors-137/+173
Move binder for dyn to each list item This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`. This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `@rust-lang/wg-traits.` r? `@nikomatsakis`
2020-12-17Rollup merge of #80039 - LeSeulArtichaut:rm-tyencoder-tcx, r=matthewjasperYuki Okushi-4/+0
Remove unused `TyEncoder::tcx` required method Unsure if this is helpful or not... r? ``@ghost`` cc ``@matthewjasper`` ``@jackh726``
2020-12-15Auto merge of #79922 - tmiasko:lower-discriminant, r=nagisabors-4/+35
Lower `discriminant_value` intrinsic This allows const propagation to evaluate comparisons involving field-less enums using derived implementations of `PartialEq` (after inlining `eq`).
2020-12-14Remove unused `TyEncoder::tcx` required methodLeSeulArtichaut-4/+0
2020-12-14Add explanation for skip_binder in relateJack Huey-0/+1
2020-12-12Auto merge of #79169 - LeSeulArtichaut:ty-lib, r=nikomatsakisbors-194/+4
Create `rustc_type_ir` Decided to start small 😄 This PR creates a `rustc_type_ir` crate as part of the WG-Traits plan to create a shared type library. ~~There already exists a `rustc_ty` crate, so I named the new crate `rustc_ty_library`. However I think it would make sense to rename the current `rustc_ty` to something else (e.g. `rustc_ty_passes`) to free the name for this new crate.~~ r? `@jackh726`
2020-12-12Auto merge of #79553 - sexxi-goose:mir_min_cap_writeback, r=nikomatsakisbors-7/+40
Capture precise paths in THIR and MIR This PR allows THIR and MIR to use the result of the new capture analysis to actually capture precise paths To achieve we: - Writeback min capture results to TypeckResults - Move handling upvars to PlaceBuilder in mir_build - Lower precise paths in THIR build by reading min_captures - Search for ancestors in min_capture when trying to build a MIR place which starts off of an upvar Closes: https://github.com/rust-lang/project-rfc-2229/issues/10 Partly implements: rust-lang/project-rfc-2229#18 Work that remains (not in this PR): - [ ] [Known bugs when feature gate is enabled](https://github.com/rust-lang/project-rfc-2229/projects/1?card_filter_query=label%3Abug) - [ ] Use min_capure_map for - [ ] Liveness analysis - [ ] rustc_mir/interpret/validity.rs - [ ] regionck - [ ] rust-lang/project-rfc-2229#8 - [ ] remove closure_captures and upvar_capture_map r? `@ghost`
2020-12-11Move binder for dyn to each list itemJack Huey-137/+172
2020-12-11Lower `discriminant_value` intrinsicTomasz Miąsko-4/+35
This allows const propagation to evaluate comparisons involving field-less enums using derived implementations of `PartialEq` (after inlining `eq`).
2020-12-10Use `def_path_hash_to_def_id` when re-using a `RawDefId`Aaron Hill-3/+21
Fixes #79890 Previously, we just copied a `RawDefId` from the 'old' map to the 'new' map. However, the `RawDefId` for a given `DefPathHash` may be different in the current compilation session. Using `def_path_hash_to_def_id` ensures that the `RawDefId` we use is valid in the current session.
2020-12-09Use Places for captures in MIRAman Arora-0/+9
- Use closure_min_capture maps to capture precise paths - PlaceBuilder now searches for ancestors in min_capture list - Add API to `Ty` to allow access to the n-th element in a tuple in O(1) time. Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2020-12-09Auto merge of #79721 - Aaron1011:fix/reuse-def-path-hash, r=wesleywiserbors-1/+1
Properly re-use def path hash in incremental mode Fixes #79661 In incremental compilation mode, we update a `DefPathHash -> DefId` mapping every time we create a `DepNode` for a foreign `DefId`. This mapping is written out to the on-disk incremental cache, and is read by the next compilation session to allow us to lazily decode `DefId`s. When we decode a `DepNode` from the current incremental cache, we need to ensure that any previously-recorded `DefPathHash -> DefId` mapping gets recorded in the new mapping that we write out. However, PR #74967 didn't do this in all cases, leading to us being unable to decode a `DefPathHash` in certain circumstances. This PR refactors some of the code around `DepNode` deserialization to prevent this kind of mistake from happening again.
2020-12-06Use min_captures for creating UpvarSusbts::tupled_upvar_tysAman Arora-0/+13
- final_upvar_tys now reads types from places instead of using `node_ty` Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2020-12-06Writeback min_capture map to TypeckResultsAman Arora-7/+18
- Derive TypeFoldable on `hir::place::Place` and associated structs, to them to be written into typeck results. Co-authored-by: Jennifer Wills <wills.jenniferg@gmail.com> Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-12-06Auto merge of #78609 - lcnr:rustdoc-const-eval, r=matthewjasperbors-13/+38
extend `WithOptConstParam` docs, move rustdoc test This should hopefully make things a bit clearer, feel free to comment on anything which can still be improved. cc `@ecstatic-morse` `@nikomatsakis` `@RalfJung`
2020-12-06Auto merge of #79729 - matthiaskrgr:clones_, r=jyn514bors-1/+1
remove redundant clones
2020-12-05Auto merge of #79445 - SNCPlay42:struct-tail-recursion-limit, r=oli-obkbors-2/+8
check the recursion limit when finding a struct's tail fixes #79437 This does a `delay_span_bug` (via `ty_error_with_message`) rather than emit a new error message, under the assumption that there will be an error elsewhere (even if the type isn't infinitely recursive, just deeper than the recursion limit, this appears to be the case).
2020-12-05remove redundant clonesMatthias Krüger-1/+1
2020-12-04Properly re-use def path hash in incremental modeAaron Hill-1/+1
Fixes #79661 In incremental compilation mode, we update a `DefPathHash -> DefId` mapping every time we create a `DepNode` for a foreign `DefId`. This mapping is written out to the on-disk incremental cache, and is read by the next compilation session to allow us to lazily decode `DefId`s. When we decode a `DepNode` from the current incremental cache, we need to ensure that any previously-recorded `DefPathHash -> DefId` mapping gets recorded in the new mapping that we write out. However, PR #74967 didn't do this in all cases, leading to us being unable to decode a `DefPathHash` in certain circumstances. This PR refactors some of the code around `DepNode` deserialization to prevent this kind of mistake from happening again.
2020-12-04check the recursion limit when finding struct tailSNCPlay42-2/+8
2020-12-03Combination of commitsRich Kadel-2/+4
Fixes multiple issue with counters, with simplification Includes a change to the implicit else span in ast_lowering, so coverage of the implicit else no longer spans the `then` block. Adds coverage for unused closures and async function bodies. Fixes: #78542 Adding unreachable regions for known MIR missing from coverage map Cleaned up PR commits, and removed link-dead-code requirement and tests Coverage no longer depends on Issue #76038 (`-C link-dead-code` is no longer needed or enforced, so MSVC can use the same tests as Linux and MacOS now) Restrict adding unreachable regions to covered files Improved the code that adds coverage for uncalled functions (with MIR but not-codegenned) to avoid generating coverage in files not already included in the files with covered functions. Resolved last known issue requiring --emit llvm-ir workaround Fixed bugs in how unreachable code spans were added.
2020-12-03extend the docs for `WithOptConstParam`Bastian Kauschke-13/+38
2020-12-03Auto merge of #79637 - spastorino:revert-trait-inheritance-self, ↵bors-60/+2
r=Mark-Simulacrum Revert "Auto merge of #79209 r? `@nikomatsakis` This has caused some issues (#79560) so better to revert and try to come up with a proper fix without rush.
2020-12-02Create `rustc_ty_library`LeSeulArtichaut-194/+4
2020-12-02add comment to `visit_ct_substs`Bastian Kauschke-0/+5
2020-12-02Revert "Auto merge of #79209 - spastorino:trait-inheritance-self, ↵Santiago Pastorino-60/+2
r=nikomatsakis" This reverts commit 349b3b324dade7ca638091db93ba08bbc443c63d, reversing changes made to b776d1c3e3db8befabb123ebb1e46c3531eaed46.
2020-12-02Auto merge of #79547 - erikdesjardins:byval, r=nagisabors-6/+6
Pass arguments up to 2*usize by value In https://github.com/rust-lang/rust/pull/77434#discussion_r498719533, `@eddyb` said: > I wonder if it makes sense to limit this to returns [...] Let's do a perf run and find out. It seems the `extern "C"` ABI will pass arguments up to 2*usize in registers: https://godbolt.org/z/n8E6zc. (modified from https://github.com/rust-lang/rust/issues/26494#issuecomment-619506345) r? `@nagisa`