about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2020-02-13Print flow state in debug messages for `find_dead_unwinds`Dylan MacKenzie-3/+9
2020-02-13Use more descriptive name to get `InitializationData` stateDylan MacKenzie-5/+5
2020-02-13Use `seek_before` instead of `seek_after`Dylan MacKenzie-7/+7
2020-02-13Use `ResultsCursor` for `elaborate_drops`Dylan MacKenzie-81/+33
The old code hard-coded the transfer function for the initialized places analyses.
2020-02-12Auto merge of #68241 - ecstatic-morse:unified-dataflow-impls, r=pnkfelixbors-516/+788
Migrate borrowck dataflow impls to new framework This uses #65672 to implement the dataflow analyses needed by borrowck. These include all the `InitializedPlaces` analyses as well as `Borrows`. Additionally, this PR contains several independent changes around the dataflow API which improve performance and make it more ergonomic. * An optimization that inhibits the caching of block transfer functions for acyclic MIR (~0.3% I-CNT savings). * A `ResultsVisitor` for dataflow results that is more efficient than `ResultsCursor` when we have to visit every statement unconditionally (~0.3% I-CNT savings). * An `into_engine` method on `Analysis` that selects the appropriate `Engine` constructor. * A `contains` method for `ResultsCursor` as a shorthand for `.get().contains()`. * A `find_descendants` helper on `MovePath` that replaces `has_any_child_of` on the old `FlowsAtLocation` These changes made porting the dataflow analyses much easier. Finally, this PR removes some now-unused code in `dataflow/at_location.rs` and elsewhere. You can view the perf results for the final version of this PR [here](https://perf.rust-lang.org/compare.html?start=29b854fb741809c29764e33fc17c32ba9c6523ba&end=6e516c1410c18cfe4eb6d030a39fdb73c8d8a4fe). Here's an example of the graphviz diagrams that are generated for the `MaybeInitializedPlaces` analysis. ![image](https://user-images.githubusercontent.com/29463364/72846117-c3e97d80-3c54-11ea-8171-3d48981c9ddd.png)
2020-02-12Auto merge of #69088 - JohnTitor:rollup-x7bk7h7, r=JohnTitorbors-1022/+1198
Rollup of 11 pull requests Successful merges: - #67695 (Added dyn and true keyword docs) - #68487 ([experiment] Support linking from a .rlink file) - #68554 (Split lang_items to crates `rustc_hir` and `rustc_passes`.) - #68937 (Test failure of unchecked arithmetic intrinsics in const eval) - #68947 (Python script PEP8 style guide space formatting and minor Python source cleanup) - #68999 (remove dependency on itertools) - #69026 (Remove common usage pattern from `AllocRef`) - #69027 (Add missing `_zeroed` varants to `AllocRef`) - #69058 (Preparation for allocator aware `Box`) - #69070 (Add self to .mailmap) - #69077 (Fix outdated doc comment.) Failed merges: r? @ghost
2020-02-12Rollup merge of #69077 - jumbatm:fix-comment, r=Dylan-DPCYuki Okushi-4/+3
Fix outdated doc comment. r? @RalfJung
2020-02-12Rollup merge of #69058 - TimDiekmann:box, r=AmanieuYuki Okushi-21/+28
Preparation for allocator aware `Box` This cleans up the `Box` code a bit, and uses `Box::from_raw(ptr)` instead of `Box(ptr)`. Additionally, `box_free` and `exchange_malloc` now uses the `AllocRef` trait and a comment was added on how `box_free` is tied to `Box`. This a preparation for an upcoming PR, which makes `Box` aware of an allocator. r? @Amanieu
2020-02-12Rollup merge of #69027 - TimDiekmann:zeroed-alloc, r=AmanieuYuki Okushi-0/+137
Add missing `_zeroed` varants to `AllocRef` The majority of the allocator wg has decided to add the missing `_zeroed` variants to `AllocRef`: > these should be added since they can be efficiently implemented with the `mremap` system call on Linux. `mremap` allows you to move/grow/shrink a memory mapping, and any new pages added for growth are guaranteed to be zeroed. > > If `AllocRef` does not have these methods then the user will have to manually write zeroes to the added memory since the API makes no guarantees on their contents. For the full discussion please see https://github.com/rust-lang/wg-allocators/issues/14. This PR provides default implementations for `realloc_zeroed`, `alloc_excess_zeroed`, `realloc_excess_zeroed`, and `grow_in_place_zeroed`. r? @Amanieu
2020-02-12Rollup merge of #69026 - TimDiekmann:common-usage, r=AmanieuYuki Okushi-223/+9
Remove common usage pattern from `AllocRef` This removes the common usage patterns from `AllocRef`: - `alloc_one` - `dealloc_one` - `alloc_array` - `realloc_array` - `dealloc_array` Actually, they add nothing to `AllocRef` except a [convenience wrapper around `Layout` and other methods in this trait](https://doc.rust-lang.org/1.41.0/src/core/alloc.rs.html#1076-1240) but have a major flaw: The documentation of `AllocRefs` notes, that > some higher-level allocation methods (`alloc_one`, `alloc_array`) are well-defined on zero-sized types and can optionally support them: it is left up to the implementor whether to return `Err`, or to return `Ok` with some pointer. With the current API, `GlobalAlloc` does not have those methods, so they cannot be overridden for `liballoc::Global`, which means that even if the global allocator would support zero-sized allocations, `alloc_one`, `alloc_array`, and `realloc_array` for `liballoc::Global` will error, while calling `alloc` with a zeroed-size `Layout` could succeed. Even worse: allocating with `alloc` and deallocating with `dealloc_{one,array}` could end up with not calling `dealloc` at all! For the full discussion please see https://github.com/rust-lang/wg-allocators/issues/18 r? @Amanieu
2020-02-12Rollup merge of #68999 - andjo403:itertools, r=CentrilYuki Okushi-7/+1
remove dependency on itertools r? @Centril
2020-02-12Rollup merge of #68947 - chrissimpkins:python-fmt, r=alexcrichtonYuki Okushi-85/+114
Python script PEP8 style guide space formatting and minor Python source cleanup This PR includes the following changes in the Python sources based on a flake8 3.7.9 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.7.6 on Darwin lint: - PEP8 style guide spacing updates *without* line length changes - removal of unused local variable assignments in context managers and exception handling - removal of unused Python import statements - removal of unnecessary semicolons
2020-02-12Rollup merge of #68937 - ecstatic-morse:unchecked-intrinsics-test, r=RalfJungYuki Okushi-41/+119
Test failure of unchecked arithmetic intrinsics in const eval Test that the unchecked arithmetic intrinsics that were made unstably const in #68809 emit an error during const-eval if given invalid input. Addresses [this comment](https://github.com/rust-lang/rust/pull/68809#discussion_r375753066). r? @RalfJung
2020-02-12Rollup merge of #68554 - cjgillot:lang_items, r=ZoxcYuki Okushi-628/+687
Split lang_items to crates `rustc_hir` and `rustc_passes`. As discussed in comment https://github.com/rust-lang/rust/pull/67688#discussion_r368289946
2020-02-12Rollup merge of #68487 - 0dvictor:nolink, r=tmandryYuki Okushi-8/+56
[experiment] Support linking from a .rlink file Flag `-Z no-link` was previously introduced, which allows creating an `.rlink` file to perform compilation without linking. This change enables linking from an `.rlink` file. Part of Issue #64191
2020-02-12Rollup merge of #67695 - gilescope:truth, r=centrilYuki Okushi-5/+44
Added dyn and true keyword docs r? @Centril
2020-02-12Auto merge of #68998 - lzutao:clippyup, r=Manishearthbors-7/+9
Update clippy Closes #68901
2020-02-12Auto merge of #68823 - matthiaskrgr:submodule_upd, r=ehussbors-0/+1
submodules: update cargo
2020-02-12Update clippyLzu Tao-7/+9
2020-02-12Fix outdated doc comment.jumbatm-4/+3
2020-02-11Test failure of unchecked arithmetic intrinsics in const evalDylan MacKenzie-41/+119
2020-02-11Review comments.Camille GILLOT-75/+76
2020-02-11Merge rustc::middle::*lang_items.Camille GILLOT-42/+30
2020-02-11Move it all into rustc_hir.Camille GILLOT-79/+19
2020-02-11Nits.Camille GILLOT-1/+1
2020-02-11Move weak_lang_items checking to librustc_passes.Camille GILLOT-33/+40
2020-02-11Move weak_lang_items.rs to librustc_passes.Camille GILLOT-0/+0
2020-02-11Move weak lang items to librustc_lang_items.Camille GILLOT-68/+80
2020-02-11Move get_lang_items query in librustc_passes.Camille GILLOT-172/+176
2020-02-11Move lang_items definitions to librustc_lang_items.Camille GILLOT-288/+372
2020-02-11Move hir::check_attr::Target to librustc_lang_items.Camille GILLOT-3/+25
2020-02-11Move macro enum_from_u32 to rustc_data_structures.Camille GILLOT-37/+38
2020-02-11Auto merge of #68491 - pnkfelix:hide-niches-under-unsafe-cell, r=olibors-24/+521
Hide niches under UnsafeCell Hide any niche of T from type-construction context of `UnsafeCell<T>`. Fix #68303 Fix #68206
2020-02-11Keyword docsGiles Cope-5/+44
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com> Co-Authored-By: Tim Robinson <tim.g.robinson@gmail.com> Co-Authored-By: Peter Todd <pete@petertodd.org> Co-Authored-By: Dylan DPC <dylan.dpc@gmail.com>
2020-02-11Clarify why you shouldn't override `Analysis::into_engine`Dylan MacKenzie-3/+11
2020-02-11Use exhaustive matchingDylan MacKenzie-1/+10
2020-02-11Add note about `elaborate_drops::InitializationData`Dylan MacKenzie-0/+3
2020-02-11Skip caching block transfer functions for acyclic MIRDylan MacKenzie-10/+14
2020-02-11Use new dataflow framework for `rustc_peek` testsDylan MacKenzie-42/+30
2020-02-11Use new dataflow framework for drop elaboration and borrow checkingDylan MacKenzie-312/+166
2020-02-11remove some dependencies on itertoolsAndreas Jonson-7/+1
2020-02-11Auto merge of #69062 - Dylan-DPC:rollup-7wpjpqu, r=Dylan-DPCbors-375/+528
Rollup of 8 pull requests Successful merges: - #66498 (Remove unused feature gates) - #68816 (Tweak borrow error on `FnMut` when `Fn` is expected) - #68824 (Enable Control Flow Guard in rustbuild) - #69022 (traits: preallocate 2 Vecs of known initial size) - #69031 (Use `dyn Trait` more in tests) - #69044 (Don't run coherence twice for future-compat lints) - #69047 (Don't rustfmt check the vendor directory.) - #69055 (Clean up E0307 explanation) Failed merges: r? @ghost
2020-02-11Rollup merge of #69055 - GuillaumeGomez:clean-up-e0307, r=Dylan-DPCDylan DPC-3/+17
Clean up E0307 explanation r? @Dylan-DPC
2020-02-11Rollup merge of #69044 - jonas-schievink:dont-run-coherence-twice, r=davidtwcoDylan DPC-30/+43
Don't run coherence twice for future-compat lints This fixes the regression introduced by https://github.com/rust-lang/rust/pull/65232 (which I mentioned in https://github.com/rust-lang/rust/pull/65232#issuecomment-583739037). Old algorithm: * Run coherence with all future-incompatible checks off, reporting errors on any overlap. * If there's no overlap (common case), run it *again*, with the future-incompatible checks on. Report warnings for any overlap found. New algorithm: * Run coherence with all additional future-incompatible checks *on*, which means that we'll find *all* potentially overlapping impls immediately. * If this found overlap, run coherence again, with the future-incompatible checks off. If that *still* gives an error, we report it. If not, it ought to be a warning. This reduces time spent in coherence checking for the nrf52810-pac by roughly 50% relative to current master.
2020-02-11Rollup merge of #69031 - Centril:dyntest, r=eddybDylan DPC-30/+30
Use `dyn Trait` more in tests Here are some tests using the old trait object type syntax which are not testing the syntax itself. This has been extracted from https://github.com/rust-lang/rust/pull/66364.
2020-02-11Rollup merge of #69022 - ljedrz:traits_tweak_vecs, r=petrochenkovDylan DPC-4/+5
traits: preallocate 2 Vecs of known initial size The 2 preallocations are pretty obvious; both vectors will be as big as or larger than the collections they are created from. In `WfPredicates::normalize` the change from a functional style improves readability and should be perf-friendly, too.
2020-02-11Rollup merge of #68824 - ajpaverd:cfguard-rustbuild, r=Mark-SimulacrumDylan DPC-0/+52
Enable Control Flow Guard in rustbuild Now that Rust supports Control Flow Guard (#68180), add a config.toml option to build the standard library with CFG enabled. r? @nagisa
2020-02-11Rollup merge of #68816 - estebank:fn-mut-closure, r=varkorDylan DPC-238/+367
Tweak borrow error on `FnMut` when `Fn` is expected Fix #31701, fix #66097.
2020-02-11Rollup merge of #66498 - bjorn3:less_feature_flags, r=Dylan-DPCDylan DPC-70/+14
Remove unused feature gates I think many of the remaining unstable things can be easily be replaced with stable things. I have kept the `#![feature(nll)]` even though it is only necessary in `libstd`, to make regressions of it harder.
2020-02-11Auto merge of #68725 - jumbatm:invert-control-in-struct_lint_level, r=Centrilbors-1611/+1795
Invert control in struct_lint_level. Closes #67927 Changes the `struct_lint*` methods to take a `decorate` function instead of a message string. This decorate function is also responsible for eventually stashing, emitting or cancelling the diagnostic. If the lint was allowed after all, the decorate function is not run at all, saving us from spending time formatting messages (and potentially other expensive work) for lints that don't end up being emitted. r? @Centril