1. 24 6月, 2020 1 次提交
    • B
      Auto merge of #73644 - ollie27:rustdoc_alias_filter, r=GuillaumeGomez · ff5b446d
      bors 提交于
      rustdoc: Fix doc aliases with crate filtering
      
      Fix a crash when searching for an alias contained in the currently selected filter crate.
      
      Also remove alias search results for crates that should be filtered out.
      
      The test suite needed to be fixed to actually take into account the crate filtering and check that there are no results when none are expected.
      
      Needs to be backported to beta to fix the `std` docs.
      
      Fixes #73620
      
      r? @GuillaumeGomez
      ff5b446d
  2. 23 6月, 2020 34 次提交
  3. 22 6月, 2020 5 次提交
    • N
      upcasting traits requires only that things become more general · 1e00e1b6
      Niko Matsakis 提交于
      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).
      1e00e1b6
    • N
      move leak-check to during coherence, candidate eval · 5a7a8507
      Niko Matsakis 提交于
      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 #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
      5a7a8507
    • N
      rewrite leak check to be based on universes · f2cf9944
      Niko Matsakis 提交于
      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.
      f2cf9944
    • N
      Revert "modify leak-check to track only outgoing edges from placeholders" · 4199b3ae
      Niko Matsakis 提交于
      This reverts commit 2e01db4b396a1e161f7a73933fff34bc9421dba0.
      4199b3ae
    • N
      modify leak-check to track only outgoing edges from placeholders · bcc0a9c8
      Niko Matsakis 提交于
      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`.
      bcc0a9c8