summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2019-08-04Use Set1<Region> instead of Option<Region>Taiki Endo-5/+6
2019-08-04Make is_self_ty a method on SelfVisitorTaiki Endo-32/+35
2019-08-04Remove query for `.pin_type()`Taiki Endo-34/+32
2019-08-04Allow lifetime elision in `Pin<&(mut) Self>`Taiki Endo-1/+28
2019-07-22Rollup merge of #62793 - wesleywiser:pgo_error_backport, r=zackmdavisPietro Albini-2/+5
2019-07-22Raise the default recursion limit to 128Simonas Kazlauskas-1/+1
2019-07-18Only error about MSVC + PGO + unwind if we're generating codeWesley Wiser-2/+5
When `rustc` is invoked with the `--print` argument, we don't actually generate any code (unless it's the `native-static-libs` option). So we don't need to error our in this case since there's no risk of generating either LLVM assertions or corrupted binaries.
2019-07-03Auto merge of #61775 - ↵bors-316/+788
nikomatsakis:issue-56238-multiple-lifetimes-async-fn-region-solver, r=MatthewJasper generalize impl trait to permit multiple lifetime bounds Generalizes the region solver to support "pick constraints". These have the form: ``` pick R0 from [R1..Rn] ``` where `R1..Rn` are called the "option regions". The idea is that `R0` must be equal to *some* region in the set `R1..Rn`. These constraints are then used to handle cases like this: ```rust fn foo<'a, 'b>(...) -> impl Trait<'a, 'b> { .. } ``` The problem here is that every region R in the hidden type must be equal to *either* `'a` *or* `'b` (or `'static`) -- in the past, the only kinds of constraints we had were outlives constraints, and since `'a` and `'b` are unrelated, there was no outlives constraint we could issue that would enforce that (`R: 'a` and `R: 'b` are both too strict, for example). But now we can issue a pick constraint: `pick R from ['a, 'b]`. In general, solving pick constraints is tricky. We integrate them into the solver as follows. In general, during the propagation phase, we are monotonically growing a set of inference regions. To handle a case like `pick R from [O...]`, where `O...` represents the option regions, we do the following: - Look for all the *lower bounds* of the region R -- that is, every region LB such that `R: LB` must hold. - Look for all the *upper bounds* of the region R -- that is, every region UB such that `UB: R` must hold. - Let the *viable options* be each option region O such that `UB: O` and `O: LB` for each UB, LB bound. - Find the *minimal viable option* M, where `O: M` holds for every option region O. If there is such a *minimal viable option*, then we make `R: M`. (This may in turn influence other bits of inference.) If there is no minimal viable option, either because all options were eliminated or because none of the remaining options are minimal, we do nothing. Ultimately, if the pick constraint is not satisfied, an error is reported. For this logic, we currently require that the option regions O are always lifetime parameters. To determine the bounds, we walk the various outlives edges that were otherwise introduced. r? @matthewjasper cc @cramertj Fixes #56238 TODO: - [ ] Error messages include region variable info sometimes, how to fix? - [ ] Tests for bare `existential type` and other impl Trait usage
2019-07-02Auto merge of #61268 - michaelwoerister:stabilize-pgo, r=alexcrichtonbors-18/+17
Stabilize support for Profile-guided Optimization This PR makes profile-guided optimization available via the `-C profile-generate` / `-C profile-use` pair of commandline flags and adds end-user documentation for the feature to the [rustc book](https://doc.rust-lang.org/rustc/). The PR thus ticks the last two remaining checkboxes of the [stabilization tracking issue](https://github.com/rust-lang/rust/issues/59913). From the tracking issue: > Profile-guided optimization (PGO) is a common optimization technique for ahead-of-time compilers. It works by collecting data about a program's typical execution (e.g. probability of branches taken, typical runtime values of variables, etc) and then uses this information during program optimization for things like inlining decisions, machine code layout, or indirect call promotion. If you are curious about how this can be used, there is a rendered version of the documentation this PR adds available [here]( https://github.com/michaelwoerister/rust/blob/stabilize-pgo/src/doc/rustc/src/profile-guided-optimization.md). r? @alexcrichton cc @rust-lang/compiler
2019-07-02fix ICE with delay-span-bugNiko Matsakis-3/+6
2019-07-02region_constraints: nitsNiko Matsakis-5/+5
2019-07-02opaque_types: more nitsNiko Matsakis-6/+6
2019-07-02s/abstract_type_generics/opaque_type_generics/Niko Matsakis-5/+5
2019-07-02opaque_types: various nitsNiko Matsakis-10/+10
2019-07-02cleanup formatting of comment and add attributionNiko Matsakis-22/+23
2019-07-02rewrite `dup_vec` to use `IndexVec` instead of `u32`Niko Matsakis-7/+6
2019-07-02various centril nitsNiko Matsakis-10/+11
2019-07-02explain why the code is the way it isNiko Matsakis-0/+2
2019-07-02Update src/librustc/infer/lexical_region_resolve/mod.rsNiko Matsakis-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-02feature-gate member constraints outside of async-awaitNiko Matsakis-0/+72
Minimizes risk.
2019-07-02implement `TypeFoldable` for `Arc`Niko Matsakis-0/+10
2019-07-02rename to "member constraints"Niko Matsakis-91/+96
2019-07-02implement Lift for ArcNiko Matsakis-0/+8
2019-07-02switch to LrcNiko Matsakis-11/+11
2019-07-02address nits by mattewjasperNiko Matsakis-29/+12
2019-07-02account for the pick-constraint edges when reporting errorsNiko Matsakis-3/+38
Also, thread through better span info to improve the error message to something tolerable.
2019-07-02pacify the mercilous tidyNiko Matsakis-2/+6
long lines, trailing newlines
2019-07-02preliminary integration of "pick constraints" into nll solverNiko Matsakis-7/+8
2019-07-02[WIP] fix `Lift` impl for `Rc`Niko Matsakis-1/+1
2019-07-02propagate the pick-constraints through queriesNiko Matsakis-9/+35
2019-07-02pass a `&mut QueryRegionConstraints` not just outlives constraintsNiko Matsakis-10/+12
2019-07-02introduce `QueryRegionConstraints` structNiko Matsakis-22/+28
2019-07-02introduce `QueryRegionConstraints` struct (no-op)Niko Matsakis-7/+27
2019-07-02rename `QueryRegionConstraint` to `QueryOutlivesConstraint`Niko Matsakis-23/+23
2019-07-02enforce and report pick-constraint errorsNiko Matsakis-52/+169
The error message here is not great.
2019-07-02integrate pick constraints into lexical solver more completelyNiko Matsakis-17/+56
2019-07-02rename from "in constraint" to "pick constraint"Niko Matsakis-39/+44
2019-07-02add some tests, currently ICE-ingNiko Matsakis-25/+119
2019-07-02make `dup_vec` optionalNiko Matsakis-13/+20
2019-07-02lexical_region_resolve: rustfmtNiko Matsakis-86/+68
2019-07-02introduce an "in" constraint instead of errorNiko Matsakis-49/+133
2019-07-02introduce `constrain_regions` helperNiko Matsakis-20/+25
2019-07-02opaque_types/mod.rs: rustfmtNiko Matsakis-90/+51
2019-07-02Auto merge of #61871 - Zoxc:no-lift-branch, r=eddybbors-73/+113
Don't use lift to detect local types This overlaps with https://github.com/rust-lang/rust/pull/61392. r? @eddyb
2019-06-30Keep caching for non-promoted queriesJohn Kåre Alsaker-0/+2
2019-06-30Clean up query cache codeJohn Kåre Alsaker-164/+57
2019-06-29Rollup merge of #62104 - Zoxc:query-info, r=eddybMazdak Farrokhzad-18/+52
Inform the query system about properties of queries at compile time
2019-06-27Rollup merge of #62160 - ia0:question_mark_macro_sep, r=petrochenkovMazdak Farrokhzad-9/+1
Remove outdated question_mark_macro_sep lint
2019-06-27Rollup merge of #62152 - doctorn:async_let_ice, r=cramertjMazdak Farrokhzad-2/+1
Don't ICE on item in `.await` expression The code for lowering a `.await` expression missed that item IDs may already have been assigned for items inside of an `async` block, or for closures. This change means we no longer exit early after finding a `.await` in a block that isn't `async` and instead just emit the error. This avoids an ICE generated due to item IDs not being densely generated. (The `YieldSource` of the generated `yield` expression is used to avoid errors generated about having `yield` expressions outside of generator literals.) r? @cramertj Resolves #62009 and resolves #61685
2019-06-27Add suggestion for missing `.await` keywordNathan Corbyn-0/+1