about summary refs log tree commit diff
path: root/src/librustc/ty
AgeCommit message (Collapse)AuthorLines
2019-07-26Rollup merge of #62801 - bjorn3:remove_lower_128bit_ops, r=alexcrichtonMazdak Farrokhzad-35/+1
Remove support for -Zlower-128bit-ops It is broken and unused cc https://github.com/rust-lang/rust/issues/58969 blocked https://github.com/rust-lang-nursery/compiler-builtins/pull/302 (removes definitions of the lang items removed in this PR) r? @alexcrichton
2019-07-26Rollup merge of #62692 - eddyb:precompute-niches, r=oli-obkMazdak Farrokhzad-127/+100
rustc: precompute the largest Niche and store it in LayoutDetails. Since we only ever can use at most one niche, it makes sense to just store that in the layout, for the simplest caching (especially as it's almost trivial to compute). There might be a speedup from this, but even if it's marginal now, the caching would be a more significant benefit for future optimization attempts.
2019-07-26clarify and unify some type test namesRalf Jung-2/+2
2019-07-26Use sharded maps for queriesJohn Kåre Alsaker-26/+28
2019-07-25Rollup merge of #60066 - sfackler:type-name, r=CentrilMazdak Farrokhzad-5/+5
Stabilize the type_name intrinsic in core::any Stabilize `type_name` in `core::any`. Closes rust-lang/rfcs#1428 FCP completed over there. `RELEASES.md`: Prefer T-libs for categorization.
2019-07-24Stabilize the type_name intrinsic in core::anySteven Fackler-5/+5
Closes rust-lang/rfcs#1428
2019-07-23cleanup: Remove `extern crate serialize as rustc_serialize`sVadim Petrochenkov-17/+16
2019-07-23Auto merge of #61779 - Zoxc:sharded, r=oli-obkbors-18/+20
Use sharded maps for interning Cuts down runtime from 5.5s to 3.8s for non-incremental `syntex_syntax` check builds with 16 threads / 8 cores. r? @eddyb
2019-07-19Use sharded maps for interningJohn Kåre Alsaker-18/+20
2019-07-19Remove support for -Zlower-128bit-opsbjorn3-35/+1
It is broken and unused
2019-07-19hygiene: Tweak naming some moreVadim Petrochenkov-3/+3
2019-07-19Adjust other names after the `Mark` renamingVadim Petrochenkov-1/+1
2019-07-19libsyntax: Remove `Mark` into `ExpnId`Vadim Petrochenkov-6/+6
2019-07-15rustc: precompute the largest Niche and store it in LayoutDetails.Eduard-Mihai Burtescu-90/+100
2019-07-15rustc_target: move abi::Niche from rustc::ty::layout.Eduard-Mihai Burtescu-51/+0
2019-07-15rustc: compute `ty::layout::Niche`'s `available` on the fly.Eduard-Mihai Burtescu-29/+43
2019-07-13Rollup merge of #62585 - ↵Mazdak Farrokhzad-11/+97
pnkfelix:issue-60431-make-struct-tail-normalize-when-possible, r=eddyb Make struct_tail normalize when possible As noted in commit message: this replaces the existing methods to extract the struct tail(s) with new entry points that make the handling of normalization explicit. Most of the places that call `struct_tail` are during codegen, post type-checking, and therefore they can get away with using `tcx.normalize_erasing_regions` (this is the entry point `struct_tail_erasing_lifetimes`) For other cases that may arise, one can use the core method, which is parameterized over the normalization `Ty -> Ty` closure (`struct_tail_with_normalize`). Or one can use the trivial entry point that does not normalization (`struct_tail_without_normalization`) ---- I spent a little while trying to make a test that exposed the bug via `impl Trait` rather than a projection, but I failed to find something that tripped up the current nightly `rustc`. * I have *not* spent any time trying to make tests that trip up the other places where `struct_tail` was previously being called. While I do think the task of making such tests could be worthwhile, I am simply running out of time. (Its also possible that the layout code is always the first point called, and thus it may be pointless to try to come up with such tests.) I also spent a little time discussing with @eddyb where this code should live. They suggested moving `struct_tail` and its sibling `struct_lockstep_tails` to the `LayoutCx`. But in the interest of time, I have left that refactoring (which may be questionable at this point) to a follow-up task. ---- Fix #60431
2019-07-12Update docs to reflect review feedback.Felix S. Klock II-5/+10
2019-07-12Replace `struct_tail` and `struct_lockstep_tails` with variants handling ↵Felix S. Klock II-11/+92
normalization. The old struct tail functions did not deal with `<T as Trait>::A` and `impl Trait`, at least not explicitly. (We didn't notice this bug before because it is only exposed when the tail (post deep normalization) is not `Sized`, so it was a rare case to deal with.) For post type-checking (i.e. during codegen), there is now `struct_tail_erasing_lifetimes` and `struct_lockstep_tails_erasing_lifetimes`, which each take an additional `ParamEnv` argument to drive normalization. For pre type-checking cases where normalization is not needed, there is `struct_tail_without_normalization`. (Currently, the only instance of this is `Expectation::rvalue_hint`.) All of these new entrypoints work by calling out to common helper routines. The helpers are parameterized over a closure that handles the normalization.
2019-07-11Remove feature gate `dropck_parametricity` completelyLzu Tao-15/+0
Therefore we also remove `#[unsafe_destructor_blind_to_params]` attribute completly.
2019-07-11Auto merge of #62503 - pnkfelix:dont-recur-infiitely-from-print-def-path, ↵bors-1/+25
r=eddyb Dont recur infinitely from print_def_path Fix #61711
2019-07-11Fix failing testsVadim Petrochenkov-2/+3
2019-07-11hygiene: Introduce a helper method for creating new expansionsVadim Petrochenkov-23/+22
Creating a fresh expansion and immediately generating a span from it is the most common scenario. Also avoid allocating `allow_internal_unstable` lists for derive markers repeatedly. And rename `ExpnInfo::with_unstable` to `ExpnInfo::allow_unstable`, seems to be a better fitting name.
2019-07-08Avoid infinite looping in `print_def_path`.Felix S. Klock II-1/+25
2019-07-05Rollup merge of #62168 - ljedrz:the_culmination_of_hiridification, r=ZoxcMazdak Farrokhzad-10/+10
The (almost) culmination of HirIdification It's finally over. This PR removes old `FIXME`s and renames some functions so that the `HirId` variant has the shorter name. All that remains (and rightfully so) is stuff in `resolve`, `save_analysis` and (as far as I can tell) in a few places where we can't replace `NodeId` with `HirId`.
2019-07-05Rollup merge of #61545 - flip1995:internal_lints, r=oli-obkMazdak Farrokhzad-19/+27
Implement another internal lints cc #49509 This adds ~~two~~ one internal lint~~s~~: 1. LINT_PASS_IMPL_WITHOUT_MACRO: Make sure, that the `{declare,impl}_lint_pass` macro is used to implement lint passes. cc #59669 2. ~~USAGE_OF_TYCTXT_AND_SPAN_ARGS: item 2 on the list in #49509~~ ~~With 2. I wasn't sure, if this lint should be applied everywhere. That means a careful review of 0955835 would be great. Also 73fb9b4 allows this lint on some functions. Should I also apply this lint there?~~ TODO (not directly relevant for review): - [ ] https://github.com/rust-lang/rust/pull/59316#discussion_r280186517 (not sure yet, if this works or how to query for `rustc_private`, since it's not in [`Features`](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/feature_gate/struct.Features.html) :thinking: cc @eddyb) - [x] https://github.com/rust-lang/rust/pull/61735#discussion_r292389870 - [x] Check explicitly for the `{declare,impl}_lint_pass!` macros r? @oli-obk
2019-07-05Rollup merge of #62169 - Zoxc:store-query-results, r=eddybMazdak Farrokhzad-19/+13
Derive which queries to save using the proc macro Based on https://github.com/rust-lang/rust/pull/62166. r? @eddyb
2019-07-04Auto merge of #61392 - Zoxc:single-interner, r=eddybbors-136/+28
Use a single CtxtInterners Builds on https://github.com/rust-lang/rust/pull/57214 r? @eddyb
2019-07-04rename hir::map::local_def_id_from_hir_id to local_def_idljedrz-7/+7
2019-07-04rename hir::map::local_def_id to local_def_id_from_node_idljedrz-3/+3
2019-07-03Remove needless lifetimesJeremy Stucki-5/+5
2019-07-02implement `TypeFoldable` for `Arc`Niko Matsakis-0/+10
2019-07-02rename to "member constraints"Niko Matsakis-1/+1
2019-07-02implement Lift for ArcNiko Matsakis-0/+8
2019-07-02[WIP] fix `Lift` impl for `Rc`Niko Matsakis-1/+1
2019-07-02propagate the pick-constraints through queriesNiko Matsakis-0/+7
2019-07-02Derive which queries to save using the proc macroJohn Kåre Alsaker-19/+13
2019-07-02Use a single CtxtInternersJohn Kåre Alsaker-136/+28
2019-07-02Auto merge of #61871 - Zoxc:no-lift-branch, r=eddybbors-4/+15
Don't use lift to detect local types This overlaps with https://github.com/rust-lang/rust/pull/61392. r? @eddyb
2019-06-30Clean up query cache codeJohn Kåre Alsaker-116/+5
2019-06-29Rollup merge of #62104 - Zoxc:query-info, r=eddybMazdak Farrokhzad-14/+52
Inform the query system about properties of queries at compile time
2019-06-26Don't use lift to detect local typesJohn Kåre Alsaker-4/+15
2019-06-26Auto merge of #62072 - eddyb:generator-memory-index, r=tmandrybors-37/+78
rustc: correctly transform memory_index mappings for generators. Fixes #61793, closes #62011 (previous attempt at fixing #61793). During #60187, I made the mistake of suggesting that the (re-)computation of `memory_index` in `ty::layout`, after generator-specific logic split/recombined fields, be done off of the `offsets` of those fields (which needed to be computed anyway), as opposed to the `memory_index`. `memory_index` maps each field to its in-memory order index, which ranges over the same `0..n` values as the fields themselves, making it a bijective mapping, and more specifically a permutation (indeed, it's the permutation resulting from field reordering optimizations). Each field has an unique "memory index", meaning a sort based on them, even an unstable one, will not put them in the wrong order. But offsets don't have that property, because of ZSTs (which do not increase the offset), so sorting based on the offset of fields alone can (and did) result in wrong orders. Instead of going back to sorting based on (slices/subsets of) `memory_index`, or special-casing ZSTs to make sorting based on offsets produce the right results (presumably), as #62011 does, I opted to drop sorting altogether and focus on `O(n)` operations involving *permutations*: * a permutation is easily inverted (see the `invert_mapping` `fn`) * an `inverse_memory_index` was already employed in other parts of the `ty::layout` code (that is, a mapping from memory order to field indices) * inverting twice produces the original permutation, so you can invert, modify, and invert again, if it's easier to modify the inverse mapping than the direct one * you can modify/remove elements in a permutation, as long as the result remains dense (i.e. using every integer in `0..len`, without gaps) * for splitting a `0..n` permutation into disjoint `0..x` and `x..n` ranges, you can pick the elements based on a `i < x` / `i >= x` predicate, and for the latter, also subtract `x` to compact the range to `0..n-x` * in the general case, for taking an arbitrary subset of the permutation, you need a renumbering from that subset to a dense `0..subset.len()` - but notably, this is still `O(n)`! * you can merge permutations, as long as the result remains disjoint (i.e. each element is unique) * for concatenating two `0..n` and `0..m` permutations, you can renumber the elements in the latter to `n..n+m` * some of these operations can be combined, and an inverse mapping (be it a permutation or not) can still be used instead of a forward one by changing the "domain" of the loop performing the operation I wish I had a nicer / more mathematical description of the recombinations involved, but my focus was to fix the bug (in a way which preserves information more directly than sorting would), so I may have missed potential changes in the surrounding generator layout code, that would make this all more straight-forward. r? @tmandry
2019-06-25Rollup merge of #62091 - ljedrz:hiridification_almost_there, r=ZoxcMazdak Farrokhzad-5/+5
HirIdification: almost there I'm beginning to run out of stuff to HirIdify :wink:. This time I targeted mainly `hir::map::{find, get_parent_node}`, but a few other bits got changed too. r? @Zoxc
2019-06-25rustc: correctly transform memory_index mappings for generators.Eduard-Mihai Burtescu-37/+78
2019-06-25Fix an ICE with uninhabited constsvarkor-1/+1
2019-06-25Inform the query system about properties of queries at compile timeJohn Kåre Alsaker-14/+52
2019-06-24Allow usage_of_ty_tykind only in styflip1995-19/+27
and in some special cases
2019-06-24Turn internal lints into tool lintsflip1995-1/+1
2019-06-24HirIdification: miscellaneous bitsljedrz-2/+2