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

replace the leak check with universes, take 2 #65232

Merged
merged 10 commits into from
Feb 8, 2020

Conversation

nikomatsakis
Copy link
Contributor

@nikomatsakis nikomatsakis commented Oct 9, 2019

This PR is an attempt to revive the "universe-based region check", which is an important step towards lazy normalization. Unlike before, we also modify the definition of 'empty so that it is indexed by a universe. This sidesteps some of the surprising effects we saw before -- at the core, we no longer think that exists<'a> { forall<'b> { 'b: 'a } } is solveable. The new region lattice looks like this:

static ----------+-----...------+       (greatest)
|                |              |
early-bound and  |              |
free regions     |              |
|                |              |
scope regions    |              |
|                |              |
empty(root)   placeholder(U1)   |
|            /                  |
|           /         placeholder(Un)
empty(U1) --         /
|                   /
...                /
|                 /
empty(Un) --------                      (smallest)

This PR has three effects:

  • It changes a fair number of error messages, I think for the better.
  • It fixes a number of bugs. The old algorithm was too conservative and caused us to reject legal subtypings.
  • It also causes two regressions (things that used to compile, but now do not).

Both of the regressions stem from the same underlying property: without the leak check, the instantaneous "subtype" check is not able to tell whether higher-ranked subtyping will succeed or not. In both cases, we might be able to fix the problem by doing a 'leak-check like change' at some later point (e.g., as part of coherence).

This is a draft PR because:

  • I didn't finish ripping out the leak-check completely.
  • We might want to consider a crater run before landing this.
  • We might want some kind of design meeting to cover the overall strategy.
  • I just remembered I never finished 100% integrating this into the canonicalization code.
  • I should also review what happens in NLL region checking -- it probably still has a notion of bottom (empty set).

r? @matthewjasper

@jonas-schievink jonas-schievink added A-lazy-normalization Area: lazy normalization (tracking issue: #60471) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 9, 2019
Copy link
Contributor

@Centril Centril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a series of nits that can be batch-applied.

src/librustc/infer/lexical_region_resolve/mod.rs Outdated Show resolved Hide resolved
src/librustc/infer/lexical_region_resolve/mod.rs Outdated Show resolved Hide resolved
src/librustc/infer/lexical_region_resolve/mod.rs Outdated Show resolved Hide resolved
src/librustc/infer/lexical_region_resolve/mod.rs Outdated Show resolved Hide resolved
src/librustc/infer/lexical_region_resolve/mod.rs Outdated Show resolved Hide resolved
src/librustc/ty/context.rs Outdated Show resolved Hide resolved
src/librustc/ty/context.rs Outdated Show resolved Hide resolved
src/librustc/ty/sty.rs Outdated Show resolved Hide resolved
src/librustc/ty/sty.rs Outdated Show resolved Hide resolved
src/librustc/ty/sty.rs Outdated Show resolved Hide resolved
@lqd
Copy link
Member

lqd commented Oct 9, 2019

When this PR is complete (particularly the "I didn't finish ripping out the leak-check completely." bullet point), it will also fix #59490.

@matthewjasper
Copy link
Contributor

  • I should also review what happens in NLL region checking -- it probably still has a notion of bottom (empty set).

It definitely considers regions that are not live anywhere and don't outlive any universal regions as 'empty:

let error_element = match {
self.scc_values.elements_contained_in(longer_fr_scc).find(|element| match element {
RegionElement::Location(_) => true,
RegionElement::RootUniversalRegion(_) => true,
RegionElement::PlaceholderRegion(placeholder1) => placeholder != *placeholder1,
})
} {
Some(v) => v,
None => return,
};

@nikomatsakis
Copy link
Contributor Author

@nikomatsakis
Copy link
Contributor Author

It occurs to me that updating NLL to match is not (presently) a strict requirement, but it would be something we have to do before we disable the AST-based regionck.

@matthewjasper
Copy link
Contributor

Can you bless the NLL compare mode output and check how this handles #57936 as well?

@nikomatsakis
Copy link
Contributor Author

nikomatsakis commented Oct 9, 2019

@matthewjasper I will bless compare-mode output, yes. As far as #57936, I get two errors: one in the call_indirect function and one in the direct function. The call_indirect error appears to be new? It is as follows:

error[E0308]: mismatched types
  --> /home/nmatsakis/tmp/issue-57936.rs:19:5
   |
19 |     indirect::<fn(&())>(); // OK
   |     ^^^^^^^^^^^^^^^^^^^ one type is more general than the other
   |
   = note: expected type `X`
              found type `X`

This error is very bad -- I think we have an open issue on it, actually? I should fix that. The problem here is that the real cause has to do with the full trait ref, but for some reason we're not printing all the details.

@nikomatsakis
Copy link
Contributor Author

(I had not noticed #57936 at the time, or else I forgot about it, I'm not sure. :)

@nikomatsakis
Copy link
Contributor Author

Commit just pushed. Message:

--bless --compare-mode=nll -- but note that we get two errors

failures:
    [ui (nll)] ui/hrtb/hrtb-exists-forall-trait-contravariant.rs
    [ui (nll)] ui/hrtb/issue-46989.rs

Both are related to the NLL region checker not handling the empty(ui) correctly.

@lqd
Copy link
Member

lqd commented Oct 9, 2019

...
   = note: expected type `X`
              found type `X`

This error is very bad -- I think we have an open issue on it, actually?

We used to have #57362 for example, but it was fixed.

At the time we mentioned there might still be some cases missing from try_report_placeholder_conflict's big match but didn't have cases exercising these possibly missing arms, maybe that is such a case ?

(Or, In particular, some cases needed to be written "twice", where the subtype was once with the sub and once with the sup, here in this PR RegionResolutionError::UpperBoundUniverseConflict is handled for one of these 2 sides, and maybe it needs to be handled symmetrically for both ?)

@bors
Copy link
Contributor

bors commented Oct 10, 2019

☔ The latest upstream changes (presumably #64939) made this pull request unmergeable. Please resolve the merge conflicts.

@nikomatsakis
Copy link
Contributor Author

@lqd

We used to have #57362 for example, but it was fixed.

OK, well, I guess I broke it again. Thanks for the cite.

src/test/ui/issues/issue-57362-2.stderr Outdated Show resolved Hide resolved
src/test/ui/hr-subtype/hr-subtype.rs Outdated Show resolved Hide resolved
= help: the following implementations were found:
<&'static u32 as Bar>
= note: `Bar` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
= note: ...but `Bar` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice for this to use 'static instead of '1.

| |
| expected signature of `fn(&(u32, u32)) -> _`

error: aborting due to 3 previous errors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other two errors are missing here because typeck errors stop compilation before borrow checking, right?

= help: the following implementations were found:
<SomeStruct as Foo<(&'a isize, &'a isize)>>
= note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
= note: ...but `SomeStruct` actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wording is a little odd.

= note: expected type `&isize`
found type `&usize`

error: aborting due to 2 previous errors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typeck errors are hiding borrowck errors

| |
| expected signature of `fn(for<'r> fn(&'r u32), &i32) -> _`
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
| ^ requires that `'x` must outlive `'static`
Copy link
Contributor

@matthewjasper matthewjasper Oct 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does replacing 'x with 'static make this compile?
edit: it doesn't. It would be nice for the error messages here to be better.

...
LL | foo((), drop)
| ^^^ expected bound lifetime parameter 'a, found concrete lifetime
| expected signature of `fn(<() as Trait<'a>>::Item) -> _`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be compiling but isn't because we don't normalize types with escaping bound regions, right?

@nikomatsakis nikomatsakis marked this pull request as ready for review October 22, 2019 21:20
@nikomatsakis nikomatsakis changed the title replace the leak check with universes, take 2 [WIP] replace the leak check with universes, take 2 Oct 22, 2019
@lqd
Copy link
Member

lqd commented Oct 24, 2019

I looked a bit at the region errors managing to avoid the nice_region_errors mechanism, and left a couple notes in this Zulip thread.

@JohnCSimon JohnCSimon added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 2, 2019
@JohnCSimon
Copy link
Member

Ping from triage.
@nikomatsakis can you please address the merge conflicts?
Thank you!

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-11-11T14:13:15.1576502Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-11-11T14:13:15.1768153Z ##[command]git config gc.auto 0
2019-11-11T14:13:15.1822857Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-11-11T14:13:15.1855333Z ##[command]git config --get-all http.proxy
2019-11-11T14:13:15.2012362Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/65232/merge:refs/remotes/pull/65232/merge
---
2019-11-11T15:07:40.8233505Z .................................................................................................... 1400/9225
2019-11-11T15:07:46.5733984Z .................................................................................................... 1500/9225
2019-11-11T15:07:52.1154842Z .................................................................................................... 1600/9225
2019-11-11T15:08:00.7540114Z .................................................................................................... 1700/9225
2019-11-11T15:08:08.6262271Z ..i................................................................................................. 1800/9225
2019-11-11T15:08:14.8139133Z ......................................................................................iiiii......... 1900/9225
2019-11-11T15:08:34.3191944Z .................................................................................................... 2100/9225
2019-11-11T15:08:36.4470163Z .................................................................................................... 2200/9225
2019-11-11T15:08:38.7134379Z .................................................................................................... 2300/9225
2019-11-11T15:08:47.4838379Z .................................................................................................... 2400/9225
---
2019-11-11T15:11:27.5864845Z ...............................................................................i...............i.... 4700/9225
2019-11-11T15:11:34.3487281Z .................................................................................................... 4800/9225
2019-11-11T15:11:42.5444706Z .................................................................................................... 4900/9225
2019-11-11T15:11:47.1862820Z .................................................................................................... 5000/9225
2019-11-11T15:11:57.6723122Z ..................................................................................ii.ii...........i. 5100/9225
2019-11-11T15:12:05.7303677Z .................i.................................................................................. 5300/9225
2019-11-11T15:12:14.6746396Z .................................................................................................... 5400/9225
2019-11-11T15:12:21.0122275Z ................................................................i................................... 5500/9225
2019-11-11T15:12:27.6395903Z .................................................................................................... 5600/9225
2019-11-11T15:12:27.6395903Z .................................................................................................... 5600/9225
2019-11-11T15:12:35.8454811Z .................................................................................................... 5700/9225
2019-11-11T15:12:43.0986403Z .................................................ii...i..ii...........i............................. 5800/9225
2019-11-11T15:13:04.2365706Z .................................................................................................... 6000/9225
2019-11-11T15:13:11.8766614Z .................................................................................................... 6100/9225
2019-11-11T15:13:11.8766614Z .................................................................................................... 6100/9225
2019-11-11T15:13:16.7273441Z ....................................................................i..ii........................... 6200/9225
2019-11-11T15:13:43.2487225Z .................................................................................................... 6400/9225
2019-11-11T15:13:45.0658864Z ....................................i............................................................... 6500/9225
2019-11-11T15:13:47.0691202Z .................................................................................................... 6600/9225
2019-11-11T15:13:49.2123423Z ....................i............................................................................... 6700/9225
---
2019-11-11T15:18:13.0656749Z 
2019-11-11T15:18:13.0657390Z ---- [ui] ui/coherence/coherence-subtyping.rs#old stdout ----
2019-11-11T15:18:13.0657704Z diff of stderr:
2019-11-11T15:18:13.0657893Z 
2019-11-11T15:18:13.0658426Z 1 error[E0119]: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
2019-11-11T15:18:13.0658934Z -   --> $DIR/coherence-subtyping.rs:18:1
2019-11-11T15:18:13.0659917Z +   --> $DIR/coherence-subtyping.rs:16:1
2019-11-11T15:18:13.0660230Z 3    |
2019-11-11T15:18:13.0660739Z 4 LL | impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
2019-11-11T15:18:13.0661278Z 5    | --------------------------------------------------------- first implementation here
2019-11-11T15:18:13.0661737Z 
2019-11-11T15:18:13.0661956Z The actual stderr differed from the expected stderr.
2019-11-11T15:18:13.0661956Z The actual stderr differed from the expected stderr.
2019-11-11T15:18:13.0662494Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coherence/coherence-subtyping.old/coherence-subtyping.old.stderr
2019-11-11T15:18:13.0663407Z To update references, rerun the tests and pass the `--bless` flag
2019-11-11T15:18:13.0663881Z To only update this specific test, also pass `--test-args coherence/coherence-subtyping.rs`
2019-11-11T15:18:13.0664092Z 
2019-11-11T15:18:13.0664295Z error in revision `old`: 1 errors occurred comparing output.
2019-11-11T15:18:13.0664473Z status: exit code: 1
2019-11-11T15:18:13.0665356Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/coherence/coherence-subtyping.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "old" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coherence/coherence-subtyping.old" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coherence/coherence-subtyping.old/auxiliary" "-A" "unused"
2019-11-11T15:18:13.0666105Z ------------------------------------------
2019-11-11T15:18:13.0666325Z 
2019-11-11T15:18:13.0666710Z ------------------------------------------
2019-11-11T15:18:13.0666953Z stderr:
2019-11-11T15:18:13.0666953Z stderr:
2019-11-11T15:18:13.0667313Z ------------------------------------------
2019-11-11T15:18:13.0667777Z error[E0119]: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
2019-11-11T15:18:13.0668458Z    |
2019-11-11T15:18:13.0668458Z    |
2019-11-11T15:18:13.0668833Z LL | impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
2019-11-11T15:18:13.0670565Z    | --------------------------------------------------------- first implementation here
2019-11-11T15:18:13.0670904Z ...
2019-11-11T15:18:13.0671417Z LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
2019-11-11T15:18:13.0672007Z    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
2019-11-11T15:18:13.0672287Z    |
2019-11-11T15:18:13.0672943Z    = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
2019-11-11T15:18:13.0673692Z error: aborting due to previous error
2019-11-11T15:18:13.0673859Z 
2019-11-11T15:18:13.0674248Z For more information about this error, try `rustc --explain E0119`.
2019-11-11T15:18:13.0674449Z 
2019-11-11T15:18:13.0674449Z 
2019-11-11T15:18:13.0674807Z ------------------------------------------
2019-11-11T15:18:13.0675027Z 
2019-11-11T15:18:13.0675175Z 
2019-11-11T15:18:13.0675564Z ---- [ui] ui/coherence/coherence-subtyping.rs#re stdout ----
2019-11-11T15:18:13.0675806Z diff of stderr:
2019-11-11T15:18:13.0675970Z 
2019-11-11T15:18:13.0676397Z 1 error[E0119]: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
2019-11-11T15:18:13.0676824Z -   --> $DIR/coherence-subtyping.rs:18:1
2019-11-11T15:18:13.0677377Z +   --> $DIR/coherence-subtyping.rs:16:1
2019-11-11T15:18:13.0677598Z 3    |
2019-11-11T15:18:13.0677999Z 4 LL | impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
2019-11-11T15:18:13.0678445Z 5    | --------------------------------------------------------- first implementation here
2019-11-11T15:18:13.0678826Z 
2019-11-11T15:18:13.0679347Z The actual stderr differed from the expected stderr.
2019-11-11T15:18:13.0679347Z The actual stderr differed from the expected stderr.
2019-11-11T15:18:13.0680060Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coherence/coherence-subtyping.re/coherence-subtyping.re.stderr
2019-11-11T15:18:13.0681278Z To update references, rerun the tests and pass the `--bless` flag
2019-11-11T15:18:13.0682016Z To only update this specific test, also pass `--test-args coherence/coherence-subtyping.rs`
2019-11-11T15:18:13.0682205Z 
2019-11-11T15:18:13.0682374Z error in revision `re`: 1 errors occurred comparing output.
2019-11-11T15:18:13.0682543Z status: exit code: 1
2019-11-11T15:18:13.0683550Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/coherence/coherence-subtyping.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "re" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coherence/coherence-subtyping.re" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coherence/coherence-subtyping.re/auxiliary" "-A" "unused"
2019-11-11T15:18:13.0684070Z ------------------------------------------
2019-11-11T15:18:13.0684223Z 
2019-11-11T15:18:13.0684527Z ------------------------------------------
2019-11-11T15:18:13.0684674Z stderr:
2019-11-11T15:18:13.0684674Z stderr:
2019-11-11T15:18:13.0684979Z ------------------------------------------
2019-11-11T15:18:13.0685448Z error[E0119]: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
2019-11-11T15:18:13.0685991Z    |
2019-11-11T15:18:13.0685991Z    |
2019-11-11T15:18:13.0686299Z LL | impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
2019-11-11T15:18:13.0686676Z    | --------------------------------------------------------- first implementation here
2019-11-11T15:18:13.0686821Z ...
2019-11-11T15:18:13.0687129Z LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
2019-11-11T15:18:13.0688951Z    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
2019-11-11T15:18:13.0689883Z    |
2019-11-11T15:18:13.0690527Z    = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
2019-11-11T15:18:13.0690898Z error: aborting due to previous error
2019-11-11T15:18:13.0691021Z 
2019-11-11T15:18:13.0691452Z For more information about this error, try `rustc --explain E0119`.
2019-11-11T15:18:13.0691624Z 
---
2019-11-11T15:18:13.0703972Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-11-11T15:18:13.0704213Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-11-11T15:18:13.0707297Z 
2019-11-11T15:18:13.0707354Z 
2019-11-11T15:18:13.0715697Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-11-11T15:18:13.0751514Z 
2019-11-11T15:18:13.0751897Z 
2019-11-11T15:18:13.0752216Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-11-11T15:18:13.0752479Z Build completed unsuccessfully in 0:58:56
2019-11-11T15:18:13.0752479Z Build completed unsuccessfully in 0:58:56
2019-11-11T15:18:13.0768789Z == clock drift check ==
2019-11-11T15:18:13.0780266Z   local time: Mon Nov 11 15:18:13 UTC 2019
2019-11-11T15:18:13.3551207Z   network time: Mon, 11 Nov 2019 15:18:13 GMT
2019-11-11T15:18:13.3551391Z == end clock drift check ==
2019-11-11T15:18:14.2136442Z 
2019-11-11T15:18:14.2251436Z ##[error]Bash exited with code '1'.
2019-11-11T15:18:14.2286196Z ##[section]Starting: Checkout
2019-11-11T15:18:14.2287789Z ==============================================================================
2019-11-11T15:18:14.2287851Z Task         : Get sources
2019-11-11T15:18:14.2287893Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-11-11T22:02:27.2063660Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-11-11T22:02:27.2238856Z ##[command]git config gc.auto 0
2019-11-11T22:02:27.2316300Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-11-11T22:02:27.2368903Z ##[command]git config --get-all http.proxy
2019-11-11T22:02:27.2496935Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/65232/merge:refs/remotes/pull/65232/merge
---
2019-11-11T22:56:51.7647391Z .................................................................................................... 1400/9228
2019-11-11T22:56:57.6557540Z .................................................................................................... 1500/9228
2019-11-11T22:57:03.5510691Z .................................................................................................... 1600/9228
2019-11-11T22:57:12.4182452Z .................................................................................................... 1700/9228
2019-11-11T22:57:20.8519757Z ..i................................................................................................. 1800/9228
2019-11-11T22:57:27.3664908Z ......................................................................................iiiii......... 1900/9228
2019-11-11T22:57:47.6022956Z .................................................................................................... 2100/9228
2019-11-11T22:57:50.0103305Z .................................................................................................... 2200/9228
2019-11-11T22:57:52.4679351Z .................................................................................................... 2300/9228
2019-11-11T22:58:02.3423869Z .................................................................................................... 2400/9228
---
2019-11-11T23:00:56.2664681Z ..................................................................................i...............i. 4700/9228
2019-11-11T23:01:03.2843761Z .................................................................................................... 4800/9228
2019-11-11T23:01:12.3901829Z .................................................................................................... 4900/9228
2019-11-11T23:01:17.7407805Z .................................................................................................... 5000/9228
2019-11-11T23:01:29.2102733Z .....................................................................................ii.ii.......... 5100/9228
2019-11-11T23:01:33.0580251Z .i.................................................................................................. 5200/9228
2019-11-11T23:01:47.6396253Z .................................................................................................... 5400/9228
2019-11-11T23:01:54.6297852Z ...................................................................i................................ 5500/9228
2019-11-11T23:02:02.0087804Z .................................................................................................... 5600/9228
2019-11-11T23:02:09.9690698Z .................................................................................................... 5700/9228
2019-11-11T23:02:09.9690698Z .................................................................................................... 5700/9228
2019-11-11T23:02:19.0329938Z ....................................................ii...i..ii...........i.......................... 5800/9228
2019-11-11T23:02:41.6383994Z .................................................................................................... 6000/9228
2019-11-11T23:02:50.0969625Z .................................................................................................... 6100/9228
2019-11-11T23:02:50.0969625Z .................................................................................................... 6100/9228
2019-11-11T23:02:55.4023674Z .......................................................................i..ii........................ 6200/9228
2019-11-11T23:03:24.6834541Z .................................................................................................... 6400/9228
2019-11-11T23:03:26.7767033Z .......................................i............................................................ 6500/9228
2019-11-11T23:03:28.9522987Z .................................................................................................... 6600/9228
2019-11-11T23:03:31.2108286Z .......................i............................................................................ 6700/9228
---
2019-11-11T23:08:18.6817240Z 
2019-11-11T23:08:18.6818373Z ---- [ui] ui/coherence/coherence-subtyping.rs#old stdout ----
2019-11-11T23:08:18.6818600Z diff of stderr:
2019-11-11T23:08:18.6818730Z 
2019-11-11T23:08:18.6819194Z 1 error[E0119]: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
2019-11-11T23:08:18.6819571Z -   --> $DIR/coherence-subtyping.rs:18:1
2019-11-11T23:08:18.6819962Z +   --> $DIR/coherence-subtyping.rs:16:1
2019-11-11T23:08:18.6820155Z 3    |
2019-11-11T23:08:18.6820659Z 4 LL | impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
2019-11-11T23:08:18.6821041Z 5    | --------------------------------------------------------- first implementation here
2019-11-11T23:08:18.6821319Z 
2019-11-11T23:08:18.6821450Z The actual stderr differed from the expected stderr.
2019-11-11T23:08:18.6821450Z The actual stderr differed from the expected stderr.
2019-11-11T23:08:18.6821893Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coherence/coherence-subtyping.old/coherence-subtyping.old.stderr
2019-11-11T23:08:18.6822277Z To update references, rerun the tests and pass the `--bless` flag
2019-11-11T23:08:18.6822709Z To only update this specific test, also pass `--test-args coherence/coherence-subtyping.rs`
2019-11-11T23:08:18.6822889Z 
2019-11-11T23:08:18.6823030Z error in revision `old`: 1 errors occurred comparing output.
2019-11-11T23:08:18.6823163Z status: exit code: 1
2019-11-11T23:08:18.6824253Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/coherence/coherence-subtyping.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "old" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coherence/coherence-subtyping.old" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coherence/coherence-subtyping.old/auxiliary" "-A" "unused"
2019-11-11T23:08:18.6825233Z ------------------------------------------
2019-11-11T23:08:18.6825807Z 
2019-11-11T23:08:18.6826598Z ------------------------------------------
2019-11-11T23:08:18.6826820Z stderr:
2019-11-11T23:08:18.6826820Z stderr:
2019-11-11T23:08:18.6827197Z ------------------------------------------
2019-11-11T23:08:18.6827697Z error[E0119]: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
2019-11-11T23:08:18.6828683Z    |
2019-11-11T23:08:18.6828683Z    |
2019-11-11T23:08:18.6829371Z LL | impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
2019-11-11T23:08:18.6829771Z    | --------------------------------------------------------- first implementation here
2019-11-11T23:08:18.6829958Z ...
2019-11-11T23:08:18.6830318Z LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
2019-11-11T23:08:18.6830774Z    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
2019-11-11T23:08:18.6830970Z    |
2019-11-11T23:08:18.6831519Z    = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
2019-11-11T23:08:18.6831824Z error: aborting due to previous error
2019-11-11T23:08:18.6831937Z 
2019-11-11T23:08:18.6833457Z For more information about this error, try `rustc --explain E0119`.
2019-11-11T23:08:18.6833654Z 
2019-11-11T23:08:18.6833654Z 
2019-11-11T23:08:18.6833977Z ------------------------------------------
2019-11-11T23:08:18.6834116Z 
2019-11-11T23:08:18.6834225Z 
2019-11-11T23:08:18.6835166Z ---- [ui] ui/coherence/coherence-subtyping.rs#re stdout ----
2019-11-11T23:08:18.6835393Z diff of stderr:
2019-11-11T23:08:18.6835523Z 
2019-11-11T23:08:18.6836001Z 1 error[E0119]: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
2019-11-11T23:08:18.6836401Z -   --> $DIR/coherence-subtyping.rs:18:1
2019-11-11T23:08:18.6836784Z +   --> $DIR/coherence-subtyping.rs:16:1
2019-11-11T23:08:18.6837190Z 3    |
2019-11-11T23:08:18.6837640Z 4 LL | impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
2019-11-11T23:08:18.6838107Z 5    | --------------------------------------------------------- first implementation here
2019-11-11T23:08:18.6838533Z 
2019-11-11T23:08:18.6838681Z The actual stderr differed from the expected stderr.
2019-11-11T23:08:18.6838681Z The actual stderr differed from the expected stderr.
2019-11-11T23:08:18.6839118Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coherence/coherence-subtyping.re/coherence-subtyping.re.stderr
2019-11-11T23:08:18.6839489Z To update references, rerun the tests and pass the `--bless` flag
2019-11-11T23:08:18.6840164Z To only update this specific test, also pass `--test-args coherence/coherence-subtyping.rs`
2019-11-11T23:08:18.6840492Z 
2019-11-11T23:08:18.6840643Z error in revision `re`: 1 errors occurred comparing output.
2019-11-11T23:08:18.6840810Z status: exit code: 1
2019-11-11T23:08:18.6841722Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/coherence/coherence-subtyping.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "re" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coherence/coherence-subtyping.re" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coherence/coherence-subtyping.re/auxiliary" "-A" "unused"
2019-11-11T23:08:18.6842478Z ------------------------------------------
2019-11-11T23:08:18.6843135Z 
2019-11-11T23:08:18.6843767Z ------------------------------------------
2019-11-11T23:08:18.6845074Z stderr:
2019-11-11T23:08:18.6845074Z stderr:
2019-11-11T23:08:18.6845646Z ------------------------------------------
2019-11-11T23:08:18.6846138Z error[E0119]: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
2019-11-11T23:08:18.6846520Z    |
2019-11-11T23:08:18.6846520Z    |
2019-11-11T23:08:18.6846766Z LL | impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
2019-11-11T23:08:18.6847033Z    | --------------------------------------------------------- first implementation here
2019-11-11T23:08:18.6847094Z ...
2019-11-11T23:08:18.6847355Z LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
2019-11-11T23:08:18.6847669Z    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
2019-11-11T23:08:18.6847722Z    |
2019-11-11T23:08:18.6848022Z    = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
2019-11-11T23:08:18.6848276Z error: aborting due to previous error
2019-11-11T23:08:18.6848302Z 
2019-11-11T23:08:18.6848541Z For more information about this error, try `rustc --explain E0119`.
2019-11-11T23:08:18.6848572Z 
---
2019-11-11T23:08:18.6857779Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-11-11T23:08:18.6857861Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-11-11T23:08:18.6875997Z 
2019-11-11T23:08:18.6876125Z 
2019-11-11T23:08:18.6877963Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-11-11T23:08:18.6878396Z 
2019-11-11T23:08:18.6878425Z 
2019-11-11T23:08:18.6917714Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-11-11T23:08:18.6917811Z Build completed unsuccessfully in 0:59:36
2019-11-11T23:08:18.6917811Z Build completed unsuccessfully in 0:59:36
2019-11-11T23:08:18.6937667Z == clock drift check ==
2019-11-11T23:08:18.6953391Z   local time: Mon Nov 11 23:08:18 UTC 2019
2019-11-11T23:08:18.8458366Z   network time: Mon, 11 Nov 2019 23:08:18 GMT
2019-11-11T23:08:18.8462861Z == end clock drift check ==
2019-11-11T23:08:19.5991515Z 
2019-11-11T23:08:19.6102299Z ##[error]Bash exited with code '1'.
2019-11-11T23:08:19.6142956Z ##[section]Starting: Checkout
2019-11-11T23:08:19.6145278Z ==============================================================================
2019-11-11T23:08:19.6145336Z Task         : Get sources
2019-11-11T23:08:19.6145403Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@matthewjasper
Copy link
Contributor

  • I just remembered I never finished 100% integrating this into the canonicalization code.

If this is referring to this, I guess this can be done in a follow up issue
https://github.com/rust-lang/rust/blob/94fe66d3df05a5f6329bae64e02dfe5ba09eb71a/src/librustc/infer/canonical/canonicalizer.rs#L202-L204

I think that this should be good to go with follow up issues raised and a crater run.

@JohnCSimon
Copy link
Member

Ping from triage:
@nikomatsakis Can you please address the failing build?
cc: @matthewjasper @Centril
Thanks.

@matthewjasper
Copy link
Contributor

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 7, 2020
@bors
Copy link
Contributor

bors commented Feb 7, 2020

⌛ Testing commit 4b3c66d with merge 92e5173d86cfea6987c917c74cb611fd330f959d...

@rust-highfive
Copy link
Collaborator

Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Feb 7, 2020

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 7, 2020
@lqd
Copy link
Member

lqd commented Feb 7, 2020

The install of msys2 was NOT successful.

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 7, 2020
@bors
Copy link
Contributor

bors commented Feb 7, 2020

⌛ Testing commit 4b3c66d with merge 8498c5f...

bors added a commit that referenced this pull request Feb 7, 2020
…tthewjasper

replace the leak check with universes, take 2

This PR is an attempt to revive the "universe-based region check", which is an important step towards lazy normalization. Unlike before, we also modify the definition of `'empty` so that it is indexed by a universe. This sidesteps some of the surprising effects we saw before -- at the core, we no longer think that `exists<'a> { forall<'b> { 'b: 'a } }` is solveable. The new region lattice looks like this:

```
static ----------+-----...------+       (greatest)
|                |              |
early-bound and  |              |
free regions     |              |
|                |              |
scope regions    |              |
|                |              |
empty(root)   placeholder(U1)   |
|            /                  |
|           /         placeholder(Un)
empty(U1) --         /
|                   /
...                /
|                 /
empty(Un) --------                      (smallest)
```
This PR has three effects:

* It changes a fair number of error messages, I think for the better.
* It fixes a number of bugs. The old algorithm was too conservative and caused us to reject legal subtypings.
* It also causes two regressions (things that used to compile, but now do not).
    * `coherence-subtyping.rs` gets an additional error. This is expected.
    * `issue-57639.rs` regresses as before, for the reasons covered in #57639.

Both of the regressions stem from the same underlying property: without the leak check, the instantaneous "subtype" check is not able to tell whether higher-ranked subtyping will succeed or not. In both cases, we might be able to fix the problem by doing a 'leak-check like change' at some later point (e.g., as part of coherence).

This is a draft PR because:

* I didn't finish ripping out the leak-check completely.
* We might want to consider a crater run before landing this.
* We might want some kind of design meeting to cover the overall strategy.
* I just remembered I never finished 100% integrating this into the canonicalization code.
* I should also review what happens in NLL region checking -- it probably still has a notion of bottom (empty set).

r? @matthewjasper
@bors
Copy link
Contributor

bors commented Feb 8, 2020

☀️ Test successful - checks-azure
Approved by: matthewjasper
Pushing 8498c5f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 8, 2020
@bors bors merged commit 4b3c66d into rust-lang:master Feb 8, 2020
@jonas-schievink
Copy link
Contributor

jonas-schievink commented Feb 8, 2020

This regressed the packed-simd benchmark by ~5%, presumably due to the extra call to traits::overlapping_impls.

EDIT: All svd2rust generated crates are similarly affected (they have similar structure and compiler load to packed-simd) – I've measured a 4% increase on stm32f0(x2).

bors added a commit to rust-lang/rust-clippy that referenced this pull request Feb 9, 2020
Rustup "index ReEmpty by universe"

cc rust-lang/rust#65232

changelog: none
@jonas-schievink
Copy link
Contributor

I have opened a fix at #69044

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Feb 11, 2020
…twice, r=davidtwco

Don't run coherence twice for future-compat lints

This fixes the regression introduced by rust-lang#65232 (which I mentioned in rust-lang#65232 (comment)).

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lazy-normalization Area: lazy normalization (tracking issue: #60471) merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet