about summary refs log tree commit diff
path: root/src/librustc/ty
AgeCommit message (Collapse)AuthorLines
2019-06-24HIR: rename find_by_hir_id to findljedrz-1/+1
2019-06-24HIR: rename get_parent_node_by_hir_id to get_parent_nodeljedrz-2/+2
2019-06-22Deny explicit_outlives_requirements in the compilerMatthew Jasper-5/+5
2019-06-22Rollup merge of #62019 - jeremystucki:refactoring, r=estebankMazdak Farrokhzad-25/+25
Remove needless lifetimes
2019-06-22Rollup merge of #61984 - ljedrz:more_node_id_pruning, r=ZoxcMazdak Farrokhzad-21/+7
More NodeId pruning Just another round of the `HirId`ification initiative. r? @Zoxc
2019-06-21Remove needless lifetimesJeremy Stucki-25/+25
2019-06-20rename hir::map::get_by_hir_id to getljedrz-4/+4
2019-06-20rename hir::map::name_by_hir_id to ::nameljedrz-3/+3
2019-06-20remove TyCtx::expr_span (unused)ljedrz-14/+0
2019-06-19Change `ByRef` to a struct variant to clarify its fields via namesOliver Scherer-4/+5
2019-06-19Remove the `AllocId` from `ByRef` valuesOliver Scherer-1/+1
`ByRef` const values have no identity beyond their value, we should not treat them as having identity. The `AllocId` often differed between equal constants, because of the way that the miri-engine evaluates constants.
2019-06-19Auto merge of #58351 - oli-obk:double_check_const_eval, r=RalfJungbors-1/+1
Refactor interning to properly mark memory as mutable or immutable r? @RalfJung This implementation is incomplete out of multiple reasons * [ ] add `-Zunleash_the_miri_inside_of_you` tests * [ ] report an error if there's an `UnsafeCell` behind a reference in a constant * [ ] make validity checks actually test whether the mutability of their allocations match what they see in the type
2019-06-19Weave the alignment through `ByRef`Oliver Scherer-1/+1
2019-06-19Auto merge of #61945 - Centril:rollup-xdqo2mn, r=Centrilbors-11/+11
Rollup of 11 pull requests Successful merges: - #61505 (Only show methods that appear in `impl` blocks in the Implementors sections of trait doc pages) - #61701 (move stray run-pass const tests into const/ folder) - #61748 (Tweak transparent enums and unions diagnostic spans) - #61802 (Make MaybeUninit #[repr(transparent)]) - #61839 (ci: Add a script for generating CPU usage graphs) - #61842 (Remove unnecessary lift calls) - #61843 (Turn down the myriad-closures test) - #61896 (rustc_typeck: correctly compute `Substs` for `Res::SelfCtor`.) - #61898 (syntax: Factor out common fields from `SyntaxExtension` variants) - #61938 (create an issue for miri even in status test-fail) - #61941 (Preserve generator and yield source for error messages) Failed merges: r? @ghost
2019-06-19Rollup merge of #61842 - Zoxc:trim-lift, r=eddybMazdak Farrokhzad-11/+11
Remove unnecessary lift calls Note that some of these might be useful for sanity checking that there's no infer types or regions. r? @eddyb
2019-06-18Auto merge of #59625 - immunant:copy_variadics_typealias, r=eddybbors-2/+2
Refactor C FFI variadics to more closely match their C counterparts, and add Clone implementation We had to make some changes to expose `va_copy` and `va_end` directly to users (mainly for C2Rust, but not exclusively): - redefine the Rust variadic structures to more closely correspond to C: `VaList` now matches `va_list`, and `VaListImpl` matches `__va_list_tag` - add `Clone` for `VaListImpl` - add explicit `as_va_list()` conversion function from `VaListImpl` to `VaList` - add deref coercion from `VaList` to `VaListImpl` - add support for the `asmjs` target All these changes were needed for use cases like: ```Rust let mut ap2 = va_copy(ap); vprintf(fmt, ap2); va_end(&mut ap2); ```
2019-06-18Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-6/+5
2019-06-18rustc: remove unused lifetimes.Eduard-Mihai Burtescu-1/+1
2019-06-18rustc: remove leftover lifetimes with no bounds from where clauses.Eduard-Mihai Burtescu-1/+0
2019-06-18rustc: remove 'x: 'y bounds (except from comments/strings).Eduard-Mihai Burtescu-4/+4
2019-06-17Expose `VaListImpl` as the Rust equivalent of `__va_list_tag` and implement ↵Andrei Homescu-2/+2
Clone for it.
2019-06-17renamve hir_to_string to node_to_stringljedrz-2/+2
2019-06-17remove _by_hir_id if there is no NodeId counterpartljedrz-9/+9
2019-06-17replace some uses of NodeId with HirIdljedrz-3/+1
2019-06-14Remove unnecessary lift callsJohn Kåre Alsaker-11/+11
2019-06-14Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-210/+108
2019-06-14Unify all uses of 'gcx and 'tcx.Eduard-Mihai Burtescu-852/+665
2019-06-12Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-643/+771
2019-06-12rustc: remove some unnecessary lifetimes in -> TyCtxt methods.Eduard-Mihai Burtescu-29/+16
2019-06-12rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`.Eduard-Mihai Burtescu-345/+345
2019-06-12Fix fallout from `deny(unused_lifetimes)`.Eduard-Mihai Burtescu-147/+147
2019-06-12rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`.Eduard-Mihai Burtescu-426/+419
2019-06-12Rollup merge of #61688 - RalfJung:is-floating-point, r=cramertjMazdak Farrokhzad-8/+31
is_fp and is_floating_point do the same thing, remove the former also consistently mark all these `is_*` methods for inlining
2019-06-12Rollup merge of #60187 - tmandry:generator-optimization, r=eddybMazdak Farrokhzad-280/+487
Generator optimization: Overlap locals that never have storage live at the same time The specific goal of this optimization is to optimize async fns which use `await!`. Notably, `await!` has an enclosing scope around the futures it awaits ([definition](https://github.com/rust-lang/rust/blob/08bfe16129b0621bc90184f8704523d4929695ef/src/libstd/macros.rs#L365-L381)), which we rely on to implement the optimization. More generally, the optimization allows overlapping the storage of some locals which are never storage-live at the same time. **We care about storage-liveness when computing the layout, because knowing a field is `StorageDead` is the only way to prove it will not be accessed, either directly or through a reference.** To determine whether we can overlap two locals in the generator layout, we look at whether they might *both* be `StorageLive` at any point in the MIR. We use the `MaybeStorageLive` dataflow analysis for this. We iterate over every location in the MIR, and build a bitset for each local of the locals it might potentially conflict with. Next, we assign every saved local to one or more variants. The variants correspond to suspension points, and we include the set of locals live across a given suspension point in the variant. (Note that we use liveness instead of storage-liveness here; this ensures that the local has actually been initialized in each variant it has been included in. If the local is not live across a suspension point, then it doesn't need to be included in that variant.). It's important to note that the variants are a "view" into our layout. For the layout computation, we use a simplified approach. 1. Start with the set of locals assigned to only one variant. The rest are disqualified. 2. For each pair of locals which may conflict *and are not assigned to the same variant*, we pick one local to disqualify from overlapping. Disqualified locals go into a non-overlapping "prefix" at the beginning of our layout. This means they always have space reserved for them. All the locals that are allowed to overlap in each variant are then laid out after this prefix, in the "overlap zone". So, if A and B were disqualified, and X, Y, and Z were all eligible for overlap, our generator might look something like this: You can think of a generator as an enum, where some fields are shared between variants. e.g. ```rust enum Generator { Unresumed, Poisoned, Returned, Suspend0(A, B, X), Suspend1(B), Suspend2(A, Y, Z), } ``` where every mention of `A` and `B` refer to the same field, which does not move when changing variants. Note that `A` and `B` would automatically be sent to the prefix in this example. Assuming that `X` is never `StorageLive` at the same time as either `Y` or `Z`, it would be allowed to overlap with them. Note that if two locals (`Y` and `Z` in this case) are assigned to the same variant in our generator, their memory would never overlap in the layout. Thus they can both be eligible for the overlapping section, even if they are storage-live at the same time. --- Depends on: - [x] #59897 Multi-variant layouts for generators - [x] #60840 Preserve local scopes in generator MIR - [x] #61373 Emit StorageDead along unwind paths for generators Before merging: - [x] ~Wrap the types of all generator fields in `MaybeUninitialized` in layout::ty::field~ (opened #60889) - [x] Make PR description more complete (e.g. explain why storage liveness is important and why we have to check every location) - [x] Clean up TODO - [x] Fix the layout code to enforce that the same field never moves around in the generator - [x] Add tests for async/await - [x] ~Reduce # bits we store by half, since the conflict relation is symmetric~ (note: decided not to do this, for simplicity) - [x] Store liveness information for each yield point in our `GeneratorLayout`, that way we can emit more useful debuginfo AND tell miri which fields are definitely initialized for a given variant (see discussion at https://github.com/rust-lang/rust/pull/59897#issuecomment-489468627)
2019-06-11More review fixesTyler Mandry-29/+13
2019-06-11Auto merge of #61735 - eddyb:must-use-life, r=oli-obkbors-16/+22
Add deny(unused_lifetimes) to all the crates that have deny(internal). @Zoxc brought up, regarding #61722, that we don't force the removal of unused lifetimes. Turns out that it's not that bad to enable for compiler crates (I wonder why it's not `warn` by default?). I would've liked to enable `single_use_lifetimes` as well, but https://github.com/rust-lang/rust/issues/53738 makes it unusable for now. For the `rustfmt` commit, I used https://github.com/rust-lang/rustfmt/issues/1324#issuecomment-482109952, and manually filtered out some noise. r? @oli-obk cc @rust-lang/compiler
2019-06-11is_fp and is_floating_point do the same thing, remove the formerRalf Jung-8/+31
also consistently mark all these is_* methods for inlining
2019-06-11Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-10/+12
2019-06-11rustc: deny(unused_lifetimes).Eduard-Mihai Burtescu-7/+11
2019-06-11Auto merge of #60463 - mjbshaw:transparent, r=varkor,rkruppebors-1/+1
Implement RFC 2645 (transparent enums and unions) Tracking issue: #60405
2019-06-10Implement RFC 2645 (transparent enums and unions)Michael Bradshaw-1/+1
Tracking issue: #60405
2019-06-10Extract generator_layout as a methodTyler Mandry-254/+271
2019-06-10Extract univariant_uninterned as methodTyler Mandry-224/+234
2019-06-10Use BitMatrix for storage conflictsTyler Mandry-4/+5
2019-06-10Small review fixesTyler Mandry-36/+43
2019-06-10Overlap locals that never have storage live at the same timeTyler Mandry-13/+201
...and are only included in a single variant.
2019-06-09make floating point casts nicer with genericsRalf Jung-0/+8
2019-06-06Make constructors actually be const functionsMatthew Jasper-13/+19
2019-06-06Auto merge of #61373 - tmandry:emit-storagedead-along-unwind, r=eddybbors-1/+1
Emit StorageDead along unwind paths for generators Completion of the work done in #60840. That PR made a change to implicitly consider a local `StorageDead` after Drop, but that was incorrect for DropAndReplace (see also #61060 which tried to fix this in a different way). This finally enables the optimization implemented in #60187. r? @eddyb cc @Zoxc @cramertj @RalfJung
2019-06-05Aggregation of drive-by cosmetic changes.Alexander Regueiro-32/+30