1. 17 11月, 2017 12 次提交
    • B
      Auto merge of #45996 - eddyb:even-mirer-1, r=arielb1 · aabfed5e
      bors 提交于
      MIR: hide .rodata constants vs by-ref ABI clash in trans.
      
      Back in #45380, constants were copied into locals during MIR creation to ensure that arguments ' memory can be used by the callee, if the constant is placed in `.rodata` and the ABI passes it by-ref.
      
      However, there are several drawbacks (see https://github.com/rust-lang/rust/pull/45380#discussion_r150447709), most importantly the complication of constant propagation (UB if a constant ends up in `Call` arguments) and inconveniencing analyses.
      
      Instead, I've modified the `rustc_trans` implementation of calls to copy an `Operand::Constant` argument locally if it's not immediate, and added a test that segfaults without the copy.
      
      cc @dotdash @arielb1
      aabfed5e
    • B
      Auto merge of #46004 - michaelwoerister:cached-mir-wip-3, r=nikomatsakis · 02eed2e9
      bors 提交于
      incr.comp.: Implement query result cache and use it to cache type checking tables.
      
      This is a spike implementation of caching more than LLVM IR and object files when doing incremental compilation. At the moment, only the `typeck_tables_of` query is cached but MIR and borrow-check will follow shortly. The feature is activated by running with `-Zincremental-queries` in addition to `-Zincremental`, it is not yet active by default.
      
      r? @nikomatsakis
      02eed2e9
    • B
      Auto merge of #45595 - scottmcm:iter-try-fold, r=dtolnay · b32267f2
      bors 提交于
      Short-circuiting internal iteration with Iterator::try_fold & try_rfold
      
      These are the core methods in terms of which the other methods (`fold`, `all`, `any`, `find`, `position`, `nth`, ...) can be implemented, allowing Iterator implementors to get the full goodness of internal iteration by only overriding one method (per direction).
      
      Based off the `Try` trait, so works with both `Result` and `Option` (🎉 https://github.com/rust-lang/rust/pull/42526).  The `try_fold` rustdoc examples use `Option` and the `try_rfold` ones use `Result`.
      
      AKA continuing in the vein of PRs https://github.com/rust-lang/rust/pull/44682 & https://github.com/rust-lang/rust/pull/44856 for more of `Iterator`.
      
      New bench following the pattern from the latter of those:
      ```
      test iter::bench_take_while_chain_ref_sum          ... bench:   1,130,843 ns/iter (+/- 25,110)
      test iter::bench_take_while_chain_sum              ... bench:     362,530 ns/iter (+/- 391)
      ```
      
      I also ran the benches without the `fold` & `rfold` overrides to test their new default impls, with basically no change.  I left them there, though, to take advantage of existing overrides and because `AlwaysOk` has some sub-optimality due to https://github.com/rust-lang/rust/issues/43278 (which 45225 should fix).
      
      If you're wondering why there are three type parameters, see issue https://github.com/rust-lang/rust/issues/45462
      
      Thanks for @bluss for the [original IRLO thread](https://internals.rust-lang.org/t/pre-rfc-fold-ok-is-composable-internal-iteration/4434) and the rfold PR and to @cuviper for adding so many folds, [encouraging me](https://github.com/rust-lang/rust/pull/45379#issuecomment-339424670) to make this PR, and finding a catastrophic bug in a pre-review.
      b32267f2
    • B
      Auto merge of #45991 - gnzlbg:fix_i586, r=alexcrichton · 3bcb00db
      bors 提交于
      fix linking error on i586
      
      Try to fix this linking error on i586 in cross:
      
      https://travis-ci.org/japaric/cross/builds/302095949#L8670
      
      The problem is that `std` is built in Ubuntu 16.04 and `cross` uses a linker from 12.04.
      
      Currently this fix solves the problem for `i686-musl`  making it "supercompatible", this PR applies the fix to `i586` as well.
      
      The cross PR is here: https://github.com/japaric/cross/pull/157
      3bcb00db
    • B
      Auto merge of #45980 - Keruspe:master, r=alexcrichton · 8fbb46c4
      bors 提交于
      rustbuild: Install rustfmt as part of extended build
      
      Now that we distribute it, this allows `./x.py install` to install it too
      8fbb46c4
    • E
      6db68938
    • B
      Auto merge of #45897 - tromey:trait-object-debug, r=michaelwoerister · d59f66d9
      bors 提交于
      Trait object debug
      
      This enables better debugging of trait objects.  See the individual commits for explanations.  This required an LLVM bump.
      d59f66d9
    • B
      Auto merge of #45825 - nikomatsakis:nll-factor-region-inference, r=arielb1 · d0f8e291
      bors 提交于
      integrate MIR type-checker with NLL inference
      
      This branch refactors NLL type inference so that it uses the MIR type-checker to gather constraints. Along the way, it also refactors how region constraints are gathered in the normal inference context mildly. The new setup is like this:
      
      - What used to be `region_inference` is split into two parts:
          - `region_constraints`, which just collects up sets of constraints
          - `lexical_region_resolve`, which does the iterative, lexical region resolution
      - When `resolve_regions_and_report_errors` is invoked, the inference engine converts the constraints into final values.
      - In the MIR type checker, however, we do not invoke this method, but instead periodically take the region constraints and package them up for the NLL solver to use later.
          - This allows us to track when and where those constraints were incurred.
          - We also remove the central fulfillment context from the MIR type checker, instead instantiating new fulfillment contexts at each point. This allows us to capture the set of obligations that occurred at a particular point, and also to ensure that if the same obligation arises at two points, we will enforce the region constraints at both locations.
      - The MIR type checker is also enhanced to instantiate late-bound-regions with fresh variables and handle a few other corner cases that arose.
      - I also extracted some of the 'outlives' logic from the regionck, which will be needed later (see future work) to handle the type-outlives relationships.
      
      One concern I have with this branch: since the MIR type checker is used even without the `-Znll` switch, I'm not sure if it will impact performance. One simple fix here would be to only enable the MIR type-checker if debug-assertions are enabled, since it just serves to validate the MIR. Longer term I hope to address this by improving the interface to the trait solver to be more query-based (ongoing work).
      
      There is plenty of future work left. Here are two things that leap to mind:
      
      - **Type-region outlives.** Currently, the NLL solver will ICE if it is required to handle a constraint like `T: 'a`. Fixing this will require a small amount of refactoring to extract the implied bounds code. I plan to follow a file-up bug on this (hopefully with mentoring instructions).
      - **Testing.** It's a good idea to enumerate some of the tricky scenarios that need testing, but I think it'd be nice to try and parallelize some of the actual test writing (and resulting bug fixing):
          - Same obligation occurring at two points.
          - Well-formedness and trait obligations of various kinds (which are not all processed by the current MIR type-checker).
          - More tests for how subtyping and region inferencing interact.
          - More suggestions welcome!
      
      r? @arielb1
      d0f8e291
    • B
      Auto merge of #46029 - GuillaumeGomez:rollup, r=GuillaumeGomez · 58d8761a
      bors 提交于
      Rollup of 6 pull requests
      
      - Successful merges: #45951, #45973, #45984, #45993, #46005, #46010
      - Failed merges:
      58d8761a
    • M
      Add doc comment for LocalDefId. · 0a1f6dd8
      Michael Woerister 提交于
      0a1f6dd8
    • M
      Fix some tidy errors in ty::codec. · 4c4f7a31
      Michael Woerister 提交于
      4c4f7a31
    • M
      incr.comp.: Remove default serialization implementations for things in... · cb1ff244
      Michael Woerister 提交于
      incr.comp.: Remove default serialization implementations for things in rustc::hir::def_id so that we get an ICE instead of silently doing the wrong thing.
      cb1ff244
  2. 16 11月, 2017 28 次提交