Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #73643

Merged
merged 39 commits into from
Jun 23, 2020
Merged

Rollup of 9 pull requests #73643

merged 39 commits into from
Jun 23, 2020

Commits on Jun 18, 2020

  1. Configuration menu
    Copy the full SHA
    1d08b1b View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2020

  1. Remove the const_raw_ptr_comparison feature gate.

    We can never supply a meaningful implementation of this.
    Instead, the follow up commits will create two intrinsics
    that approximate comparisons:
    
    * `ptr_maybe_eq`
    * `ptr_maybe_ne`
    
    The fact that `ptr_maybe_eq(a, b)` is not necessarily the same
    value as `!ptr_maybe_ne(a, b)` is a symptom of this entire
    problem.
    oli-obk committed Jun 19, 2020
    Configuration menu
    Copy the full SHA
    9245ba8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e09b620 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    84f1d73 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e75fbae View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    562f496 View commit details
    Browse the repository at this point in the history

Commits on Jun 20, 2020

  1. Squashed all commits

    rakshith-ravi committed Jun 20, 2020
    Configuration menu
    Copy the full SHA
    0624a5a View commit details
    Browse the repository at this point in the history
  2. Refer just to the issue in the raw ptr cmp diagnostic instead of expl…

    …aining everything in the diagnostic
    oli-obk committed Jun 20, 2020
    Configuration menu
    Copy the full SHA
    9e88b48 View commit details
    Browse the repository at this point in the history
  3. Satisfy tidy

    oli-obk committed Jun 20, 2020
    Configuration menu
    Copy the full SHA
    53686b9 View commit details
    Browse the repository at this point in the history
  4. Address review comments

    oli-obk committed Jun 20, 2020
    Configuration menu
    Copy the full SHA
    98e97a4 View commit details
    Browse the repository at this point in the history
  5. update tests

    Christian Poveda committed Jun 20, 2020
    Configuration menu
    Copy the full SHA
    9355168 View commit details
    Browse the repository at this point in the history

Commits on Jun 21, 2020

  1. Clarify --extern documentation.

    Fixes rust-lang#64731, rust-lang#73531.
    
    See also rust-lang#64402#issuecomment-530852886
    adetaylor committed Jun 21, 2020
    Configuration menu
    Copy the full SHA
    a63eb3c View commit details
    Browse the repository at this point in the history
  2. Fix typos in doc comments

    This commit fixes typos in the doc comments of 'librustc_mir/monomorphize/collector.rs'
    JOE1994 authored Jun 21, 2020
    Configuration menu
    Copy the full SHA
    6374054 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e465b22 View commit details
    Browse the repository at this point in the history
  4. Update src/librustc_mir/monomorphize/collector.rs

    typo fix
    
    Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
    JOE1994 and jonas-schievink authored Jun 21, 2020
    Configuration menu
    Copy the full SHA
    893077c View commit details
    Browse the repository at this point in the history

Commits on Jun 22, 2020

  1. bootstrap: no config.toml exists regression

    This commit fixes a regression introduced in rust-lang#73317 where an oversight
    meant that `config.toml` was assumed to exist.
    
    Signed-off-by: David Wood <david@davidtw.co>
    davidtwco committed Jun 22, 2020
    Configuration menu
    Copy the full SHA
    b60ec47 View commit details
    Browse the repository at this point in the history
  2. modify leak-check to track only outgoing edges from placeholders

    Also, update the affected tests. This seems strictly better but it is
    actually more permissive than I initially intended. In particular it
    accepts this
    
    ```
    forall<'a, 'b> {
      exists<'intersection> {
        'a: 'intersection,
        'b: 'intersection,
      }
    }
    ```
    
    and I'm not sure I want to accept that. It implies that we have a
    `'empty` in the new universe intoduced by the `forall`.
    nikomatsakis committed Jun 22, 2020
    Configuration menu
    Copy the full SHA
    bcc0a9c View commit details
    Browse the repository at this point in the history
  3. Revert "modify leak-check to track only outgoing edges from placehold…

    …ers"
    
    This reverts commit 2e01db4b396a1e161f7a73933fff34bc9421dba0.
    nikomatsakis committed Jun 22, 2020
    Configuration menu
    Copy the full SHA
    4199b3a View commit details
    Browse the repository at this point in the history
  4. rewrite leak check to be based on universes

    In the new leak check, instead of getting a list of placeholders to
    track, we look for any placeholder that is part of a universe which
    was created during the snapshot.
    
    We are looking for the following error patterns:
    
    * P1: P2, where P1 != P2
    * P1: R, where R is in some universe that cannot name P1
    
    This new leak check is more precise than before, in that it accepts
    this patterns:
    
    * R: P1, even if R cannot name P1, because R = 'static is a valid
    sol'n
    * R: P1, R: P2, as above
    
    Note that this leak check, when running during subtyping, is less
    efficient than before in some sense because it is going to check and
    re-check all the universes created since the snapshot. We're going to
    move when the leak check runs to try and correct that.
    nikomatsakis committed Jun 22, 2020
    Configuration menu
    Copy the full SHA
    f2cf994 View commit details
    Browse the repository at this point in the history
  5. move leak-check to during coherence, candidate eval

    In particular, it no longer occurs during the subtyping check. This is
    important for enabling lazy normalization, because the subtyping check
    will be producing sub-obligations that could affect its results.
    
    Consider an example like
    
        for<'a> fn(<&'a as Mirror>::Item) =
          fn(&'b u8)
    
    where `<T as Mirror>::Item = T` for all `T`. We will wish to produce a
    new subobligation like
    
        <'!1 as Mirror>::Item = &'b u8
    
    This will, after being solved, ultimately yield a constraint that `'!1
    = 'b` which will fail. But with the leak-check being performed on
    subtyping, there is no opportunity to normalize `<'!1 as
    Mirror>::Item` (unless we invoke that normalization directly from
    within subtyping, and I would prefer that subtyping and unification
    are distinct operations rather than part of the trait solving stack).
    
    The reason to keep the leak check during coherence and trait
    evaluation is partly for backwards compatibility. The coherence change
    permits impls for `fn(T)` and `fn(&T)` to co-exist, and the trait
    evaluation change means that we can distinguish those two cases
    without ambiguity errors. It also avoids recreating rust-lang#57639, where we
    were incorrectly choosing a where clause that would have failed the
    leak check over the impl which succeeds.
    
    The other reason to keep the leak check in those places is that I
    think it is actually close to the model we want. To the point, I think
    the trait solver ought to have the job of "breaking down"
    higher-ranked region obligation like ``!1: '2` into into region
    obligations that operate on things in the root universe, at which
    point they should be handed off to polonius. The leak check isn't
    *really* doing that -- these obligations are still handed to the
    region solver to process -- but if/when we do adopt that model, the
    decision to pass/fail would be happening in roughly this part of the
    code.
    
    This change had somewhat more side-effects than I anticipated. It
    seems like there are cases where the leak-check was not being enforced
    during method proving and trait selection. I haven't quite tracked
    this down but I think it ought to be documented, so that we know what
    precisely we are committing to.
    
    One surprising test was `issue-30786.rs`. The behavior there seems a
    bit "fishy" to me, but the problem is not related to the leak check
    change as far as I can tell, but more to do with the closure signature
    inference code and perhaps the associated type projection, which
    together seem to be conspiring to produce an unexpected
    signature. Nonetheless, it is an example of where changing the
    leak-check can have some unexpected consequences: we're now failing to
    resolve a method earlier than we were, which suggests we might change
    some method resolutions that would have been ambiguous to be
    successful.
    
    TODO:
    
    * figure out remainig test failures
    * add new coherence tests for the patterns we ARE disallowing
    nikomatsakis committed Jun 22, 2020
    Configuration menu
    Copy the full SHA
    5a7a850 View commit details
    Browse the repository at this point in the history
  6. upcasting traits requires only that things become more general

    Revert the code that states that upcasting traits requires full
    equality and change to require that the source type is a subtype of
    the target type, as one would expect. As the comment states, this was
    an old bug that we didn't want to fix yet as it interacted poorly with
    the old leak-check. This fixes the old-lub-glb-object test, which was
    previously reporting too many errors (i.e., in the previous commit).
    nikomatsakis committed Jun 22, 2020
    Configuration menu
    Copy the full SHA
    1e00e1b View commit details
    Browse the repository at this point in the history
  7. remove snapshot calls from "match" operations during select

    Motivation:
    
    - we want to use leak-check sparingly, first off
    - these calls were essentially the same as doing the check during subtyping
    nikomatsakis committed Jun 22, 2020
    Configuration menu
    Copy the full SHA
    70cf33f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    6873a76 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    3a68d56 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    be0d10f View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    93e2982 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    c88a76e View commit details
    Browse the repository at this point in the history
  13. fix subtle bug in NLL type checker

    The bug was revealed by the behavior of the old-lub-glb-hr-noteq1.rs
    test. The old-lub-glb-hr-noteq2 test shows the current 'order dependent'
    behavior of coercions around higher-ranked functions, at least when
    running with `-Zborrowck=mir`.
    
    Also, run compare-mode=nll.
    nikomatsakis committed Jun 22, 2020
    Configuration menu
    Copy the full SHA
    6929013 View commit details
    Browse the repository at this point in the history
  14. cite issue 73154

    nikomatsakis committed Jun 22, 2020
    Configuration menu
    Copy the full SHA
    d57689f View commit details
    Browse the repository at this point in the history
  15. review comments

    estebank committed Jun 22, 2020
    Configuration menu
    Copy the full SHA
    3eb8eb9 View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2020

  1. Rollup merge of rust-lang#72271 - rakshith-ravi:master, r=varkor

    Improve compiler error message for wrong generic parameter order
    
    - Added optional "help" parameter that shows a help message on the compiler error if required.
    - Added a simple ordered parameter as a sample help.
    
    @varkor will make more changes as required. Let me know if I'm heading in the right direction.
    
    Fixes rust-lang#68437
    
    r? @varkor
    Manishearth authored Jun 23, 2020
    Configuration menu
    Copy the full SHA
    59e87c0 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#72493 - nikomatsakis:move-leak-check, r=mat…

    …thewjasper
    
     move leak-check to during coherence, candidate eval
    
    Implementation of MCP rust-lang/compiler-team#295.
    
    I'd like to do a crater run on this.
    
    Note to @rust-lang/lang: This PR is a breaking change (bugfix). It causes tests like the following to go from a future-compatibility warning rust-lang#56105 to a hard error:
    
    ```rust
    trait Trait {}
    impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {}
    impl Trait for for<'c> fn(&'c u32, &'c u32) {} // now rejected, used to warn
    ```
    
    I am not aware of any instances of this code in the wild, but that is why we are doing a crater run. The reason for this change is that those two types are, in fact, the same type, and hence the two impls are overlapping.
    
    There will still be impls that trigger rust-lang#56105 after this lands, however -- I hope that we will eventually just accept those impls without warning, for the most part. One example of such an impl is this pattern, which is used by wasm-bindgen and other crates as well:
    
    ```rust
    trait Trait {}
    impl<T> Trait for fn(&T) { }
    impl<T> Trait for fn(T) { } // still accepted, but warns
    ```
    Manishearth authored Jun 23, 2020
    Configuration menu
    Copy the full SHA
    903823c View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#73398 - oli-obk:const_raw_ptr_cmp, r=varkor…

    …,RalfJung,nagisa
    
    A way forward for pointer equality in const eval
    
    r? @varkor on the first commit and @RalfJung on the second commit
    
    cc rust-lang#53020
    Manishearth authored Jun 23, 2020
    Configuration menu
    Copy the full SHA
    ae38698 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#73472 - GuillaumeGomez:cleanup-e0689, r=Dyl…

    …an-DPC
    
    Clean up E0689 explanation
    
    r? @Dylan-DPC
    Manishearth authored Jun 23, 2020
    Configuration menu
    Copy the full SHA
    98aa34c View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#73496 - estebank:opaque-missing-lts-in-fn-3…

    …, r=nikomatsakis
    
    Account for multiple impl/dyn Trait in return type when suggesting `'_`
    
    Make `impl` and `dyn` Trait lifetime suggestions a bit more resilient.
    
    Follow up to rust-lang#72804.
    
    r? @nikomatsakis
    Manishearth authored Jun 23, 2020
    Configuration menu
    Copy the full SHA
    cd18ac1 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#73515 - christianpoveda:livedrop-diagnostic…

    …s, r=oli-obk
    
    Add second message for LiveDrop errors
    
    This is an attempt to fix rust-lang#72907 by adding a second message to the `LiveDrop` diagnostics. Changing from this
    ```
    error[E0493]: destructors cannot be evaluated at compile-time
     --> src/lib.rs:7:9
      |
    7 |     let mut always_returned = None;
      |         ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors
    
    error: aborting due to previous error
    ```
    to this
    ```
    error[E0493]: destructors cannot be evaluated at compile-time
      --> foo.rs:6:9
       |
    6  |     let mut always_returned = None;
       |         ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors
    ...
    10 |         always_returned = never_returned;
       |         --------------- value is dropped here
    
    error: aborting due to previous error
    ```
    r? @RalfJung @ecstatic-morse
    Manishearth authored Jun 23, 2020
    Configuration menu
    Copy the full SHA
    0f9a6ed View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    0560151 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#73572 - JOE1994:patch-4, r=jonas-schievink

    Fix typos in doc comments
    
    Hello 🦀 ,
    
    This commit fixes typos in the doc comments of 'librustc_mir/monomorphize/collector.rs'
    
    Thank you for reviewing this PR 👍
    Manishearth authored Jun 23, 2020
    Configuration menu
    Copy the full SHA
    84bd1e7 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#73590 - davidtwco:bootstrap-fix-config-env-…

    …var, r=Mark-Simulacrum
    
    bootstrap: no `config.toml` exists regression
    
    Fixes rust-lang#73574.
    
    This PR fixes a regression introduced in rust-lang#73317 where an oversight meant that `config.toml` was assumed to exist.
    Manishearth authored Jun 23, 2020
    Configuration menu
    Copy the full SHA
    44900f8 View commit details
    Browse the repository at this point in the history