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

[WIP] rustc: avoid checking Trait's predicates for WF(<T as Trait>::X). #66020

Closed
wants to merge 1 commit into from

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Nov 1, 2019

Fixes #65510 - specifically, this is the WF disabling patch mentioned in #65510 (comment).

This is marked WIP to avoid merging it without serious scrutiny, since there's a chance this is unsound.

In case this doesn't work out, we can probably try caching proving WF obligations (perhaps when no type/const inference variables are involved? in general we could try to use queries more).

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 1, 2019
@eddyb eddyb changed the title rustc: avoid checking Trait's predicates for WF(<T as Trait>::X). [WIP] rustc: avoid checking Trait's predicates for WF(<T as Trait>::X). Nov 1, 2019
@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-01T17:22:04.3148461Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-11-01T17:22:04.3339721Z ##[command]git config gc.auto 0
2019-11-01T17:22:04.3434588Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-11-01T17:22:04.3481486Z ##[command]git config --get-all http.proxy
2019-11-01T17:22:04.3620578Z ##[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/66020/merge:refs/remotes/pull/66020/merge
---
2019-11-01T18:20:54.3610397Z .................................................................................................... 1600/9262
2019-11-01T18:21:00.0816222Z .................................................................................................... 1700/9262
2019-11-01T18:21:12.3335664Z ..........................................................i...............i......................... 1800/9262
2019-11-01T18:21:20.2337088Z .................................................................................................... 1900/9262
2019-11-01T18:21:34.6202034Z ................................................iiiii............................................... 2000/9262
2019-11-01T18:21:45.1421778Z .................................................................................................... 2200/9262
2019-11-01T18:21:47.6654783Z .................................................................................................... 2300/9262
2019-11-01T18:21:51.3375889Z .................................................................................................... 2400/9262
2019-11-01T18:22:14.2370388Z .................................................................................................... 2500/9262
---
2019-11-01T18:25:01.8775522Z ................................................i...............i................................... 4800/9262
2019-11-01T18:25:10.4736570Z .................................................................................................... 4900/9262
2019-11-01T18:25:18.9190352Z .................................................................................................... 5000/9262
2019-11-01T18:25:25.3119139Z .................................................................................................... 5100/9262
2019-11-01T18:25:35.1257568Z .................................................ii.ii...........i.................................. 5200/9262
2019-11-01T18:25:44.9536362Z .................................................................................................... 5400/9262
2019-11-01T18:25:54.8174269Z .................................................................................................... 5500/9262
2019-11-01T18:26:02.2097556Z ......................i............................................................................. 5600/9262
2019-11-01T18:26:08.6335854Z .................................................................................................... 5700/9262
2019-11-01T18:26:08.6335854Z .................................................................................................... 5700/9262
2019-11-01T18:26:20.3016906Z .................................................................................................... 5800/9262
2019-11-01T18:26:32.1932685Z .......ii...i..ii...........i....................................................................... 5900/9262
2019-11-01T18:26:53.5033212Z .................................................................................................... 6100/9262
2019-11-01T18:27:00.2319176Z .................................................................................................... 6200/9262
2019-11-01T18:27:00.2319176Z .................................................................................................... 6200/9262
2019-11-01T18:27:13.8633628Z ..........................i..ii..................................................................... 6300/9262
2019-11-01T18:27:33.7038350Z ............................................................................................i....... 6500/9262
2019-11-01T18:27:35.9582786Z .................................................................................................... 6600/9262
2019-11-01T18:27:38.1936894Z ...................................................................i................................ 6700/9262
2019-11-01T18:27:41.0867405Z .................................................................................................... 6800/9262
---
2019-11-01T18:32:25.4774100Z error: /checkout/src/test/ui/associated-types/associated-types-overridden-binding.rs:7: expected error not found: type annotations needed
2019-11-01T18:32:25.4774323Z 
2019-11-01T18:32:25.4774494Z error: 0 unexpected errors found, 1 expected errors not found
2019-11-01T18:32:25.4774670Z status: exit code: 1
2019-11-01T18:32:25.4776007Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/associated-types/associated-types-overridden-binding.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-types/associated-types-overridden-binding" "-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/associated-types/associated-types-overridden-binding/auxiliary" "-A" "unused"
2019-11-01T18:32:25.4776374Z not found errors (from test file): [
2019-11-01T18:32:25.4776712Z         line_num: 7,
2019-11-01T18:32:25.4776865Z         kind: Some(
2019-11-01T18:32:25.4777011Z             Error,
2019-11-01T18:32:25.4777173Z         ),
2019-11-01T18:32:25.4777173Z         ),
2019-11-01T18:32:25.4777326Z         msg: "type annotations needed",
2019-11-01T18:32:25.4777631Z ]
2019-11-01T18:32:25.4777760Z 
2019-11-01T18:32:25.4778340Z thread '[ui] ui/associated-types/associated-types-overridden-binding.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:1520:13
2019-11-01T18:32:25.4778775Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-11-01T18:32:25.4778775Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-11-01T18:32:25.4778926Z 
2019-11-01T18:32:25.4779375Z ---- [ui] ui/issues/issue-20831-debruijn.rs stdout ----
2019-11-01T18:32:25.4779588Z 
2019-11-01T18:32:25.4780065Z error: /checkout/src/test/ui/issues/issue-20831-debruijn.rs:28: expected error not found: mismatched types
2019-11-01T18:32:25.4780247Z 
2019-11-01T18:32:25.4780729Z error: /checkout/src/test/ui/issues/issue-20831-debruijn.rs:28: expected error not found: mismatched types
2019-11-01T18:32:25.4781078Z error: 0 unexpected errors found, 2 expected errors not found
2019-11-01T18:32:25.4781254Z status: exit code: 1
2019-11-01T18:32:25.4781254Z status: exit code: 1
2019-11-01T18:32:25.4782243Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-20831-debruijn.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-20831-debruijn" "-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/issues/issue-20831-debruijn/auxiliary" "-A" "unused"
2019-11-01T18:32:25.4782535Z not found errors (from test file): [
2019-11-01T18:32:25.4782862Z         line_num: 28,
2019-11-01T18:32:25.4783012Z         kind: Some(
2019-11-01T18:32:25.4783160Z             Error,
2019-11-01T18:32:25.4783322Z         ),
2019-11-01T18:32:25.4783322Z         ),
2019-11-01T18:32:25.4783472Z         msg: "mismatched types",
2019-11-01T18:32:25.4783781Z     Error {
2019-11-01T18:32:25.4783949Z         line_num: 28,
2019-11-01T18:32:25.4784097Z         kind: Some(
2019-11-01T18:32:25.4784272Z             Error,
2019-11-01T18:32:25.4784272Z             Error,
2019-11-01T18:32:25.4784421Z         ),
2019-11-01T18:32:25.4784569Z         msg: "mismatched types",
2019-11-01T18:32:25.4785358Z ]
2019-11-01T18:32:25.4785489Z 
2019-11-01T18:32:25.4786061Z thread '[ui] ui/issues/issue-20831-debruijn.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:1520:13
2019-11-01T18:32:25.4786262Z 
2019-11-01T18:32:25.4786262Z 
2019-11-01T18:32:25.4786705Z ---- [ui] ui/suggestions/missing-assoc-type-bound-restriction.rs stdout ----
2019-11-01T18:32:25.4786933Z diff of stderr:
2019-11-01T18:32:25.4787065Z 
2019-11-01T18:32:25.4787209Z 32    |
2019-11-01T18:32:25.4787388Z 33    = note: required because of the requirements on the impl of `Child<A>` for `ChildWrapper<<T as Parent>::Assoc>`
2019-11-01T18:32:25.4787547Z 34 
2019-11-01T18:32:25.4787989Z - error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
2019-11-01T18:32:25.4789023Z -    |
2019-11-01T18:32:25.4789023Z -    |
2019-11-01T18:32:25.4789513Z - LL | trait Parent {
2019-11-01T18:32:25.4790556Z -    | ------------ required by `Parent`
2019-11-01T18:32:25.4791917Z - ...
2019-11-01T18:32:25.4792217Z - LL | impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T> {
2019-11-01T18:32:25.4792591Z -    |                                                       - help: consider further restricting the associated type: `where <T as Parent>::Assoc: Child<A>`
2019-11-01T18:32:25.4792809Z - ...
2019-11-01T18:32:25.4793076Z - LL |     type Assoc = ChildWrapper<T::Assoc>;
2019-11-01T18:32:25.4793400Z -    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Child<A>` is not implemented for `<T as Parent>::Assoc`
2019-11-01T18:32:25.4793863Z - error: aborting due to 3 previous errors
2019-11-01T18:32:25.4793919Z + error: aborting due to 2 previous errors
2019-11-01T18:32:25.4793966Z 48 
2019-11-01T18:32:25.4794252Z 49 For more information about this error, try `rustc --explain E0277`.
2019-11-01T18:32:25.4794252Z 49 For more information about this error, try `rustc --explain E0277`.
2019-11-01T18:32:25.4794317Z 50 
2019-11-01T18:32:25.4794349Z 
2019-11-01T18:32:25.4794378Z 
2019-11-01T18:32:25.4794447Z The actual stderr differed from the expected stderr.
2019-11-01T18:32:25.4795016Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/missing-assoc-type-bound-restriction/missing-assoc-type-bound-restriction.stderr
2019-11-01T18:32:25.4795344Z To update references, rerun the tests and pass the `--bless` flag
2019-11-01T18:32:25.4795738Z To only update this specific test, also pass `--test-args suggestions/missing-assoc-type-bound-restriction.rs`
2019-11-01T18:32:25.4795836Z error: 1 errors occurred comparing output.
2019-11-01T18:32:25.4795890Z status: exit code: 1
2019-11-01T18:32:25.4795890Z status: exit code: 1
2019-11-01T18:32:25.4796821Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/suggestions/missing-assoc-type-bound-restriction.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/missing-assoc-type-bound-restriction" "-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/suggestions/missing-assoc-type-bound-restriction/auxiliary" "-A" "unused"
2019-11-01T18:32:25.4797229Z ------------------------------------------
2019-11-01T18:32:25.4797269Z 
2019-11-01T18:32:25.4797532Z ------------------------------------------
2019-11-01T18:32:25.4797605Z stderr:
2019-11-01T18:32:25.4797605Z stderr:
2019-11-01T18:32:25.4797864Z ------------------------------------------
2019-11-01T18:32:25.4797926Z error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
2019-11-01T18:32:25.4798323Z    |
2019-11-01T18:32:25.4798381Z LL |   trait Parent {
2019-11-01T18:32:25.4798659Z    |   ------------ required by `Parent`
2019-11-01T18:32:25.4798711Z ...
2019-11-01T18:32:25.4798711Z ...
2019-11-01T18:32:25.4798767Z LL |   impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T> {
2019-11-01T18:32:25.4799185Z    |   ^                                                     - help: consider further restricting the associated type: `where <T as Parent>::Assoc: Child<A>`
2019-11-01T18:32:25.4799253Z    |  _|
2019-11-01T18:32:25.4799302Z    | |
2019-11-01T18:32:25.4799379Z LL | |     //~^ ERROR the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
2019-11-01T18:32:25.4799437Z LL | |     type Ty = A;
2019-11-01T18:32:25.4799490Z LL | |     type Assoc = ChildWrapper<T::Assoc>;
2019-11-01T18:32:25.4799569Z LL | |     //~^ ERROR the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
2019-11-01T18:32:25.4799634Z LL | |     //~| ERROR the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
2019-11-01T18:32:25.4799688Z LL | | }
2019-11-01T18:32:25.4799863Z    | |_^ the trait `Child<A>` is not implemented for `<T as Parent>::Assoc`
2019-11-01T18:32:25.4799910Z 
2019-11-01T18:32:25.4799966Z error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
2019-11-01T18:32:25.4800401Z    |
2019-11-01T18:32:25.4800401Z    |
2019-11-01T18:32:25.4800452Z LL |     type Assoc: Child<Self::Ty>;
2019-11-01T18:32:25.4800728Z    |          ----- associated type defined here
2019-11-01T18:32:25.4800797Z ...
2019-11-01T18:32:25.4800852Z LL | impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T> {
2019-11-01T18:32:25.4803076Z    | ------------------------------------------------------- help: consider further restricting the associated type: `where <T as Parent>::Assoc: Child<A>`
2019-11-01T18:32:25.4803540Z    | in this `impl` item
2019-11-01T18:32:25.4803587Z ...
2019-11-01T18:32:25.4803587Z ...
2019-11-01T18:32:25.4803656Z LL |     type Assoc = ChildWrapper<T::Assoc>;
2019-11-01T18:32:25.4803736Z    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Child<A>` is not implemented for `<T as Parent>::Assoc`
2019-11-01T18:32:25.4803950Z    |
2019-11-01T18:32:25.4804012Z    = note: required because of the requirements on the impl of `Child<A>` for `ChildWrapper<<T as Parent>::Assoc>`
2019-11-01T18:32:25.4804125Z error: aborting due to 2 previous errors
2019-11-01T18:32:25.4804161Z 
2019-11-01T18:32:25.4804600Z For more information about this error, try `rustc --explain E0277`.
2019-11-01T18:32:25.4804662Z 
---
2019-11-01T18:32:25.4806365Z 
2019-11-01T18:32:25.4809994Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-11-01T18:32:25.4825864Z 
2019-11-01T18:32:25.4825965Z 
2019-11-01T18:32:25.4827690Z 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-01T18:32:25.4827941Z 
2019-11-01T18:32:25.4827987Z 
2019-11-01T18:32:25.4830807Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-11-01T18:32:25.4830882Z Build completed unsuccessfully in 1:03:45
2019-11-01T18:32:25.4830882Z Build completed unsuccessfully in 1:03:45
2019-11-01T18:32:25.4881141Z == clock drift check ==
2019-11-01T18:32:25.4906293Z   local time: Fri Nov  1 18:32:25 UTC 2019
2019-11-01T18:32:25.5804130Z   network time: Fri, 01 Nov 2019 18:32:25 GMT
2019-11-01T18:32:25.5804881Z == end clock drift check ==
2019-11-01T18:32:26.5462738Z 
2019-11-01T18:32:26.5607922Z ##[error]Bash exited with code '1'.
2019-11-01T18:32:26.5641185Z ##[section]Starting: Checkout
2019-11-01T18:32:26.5643218Z ==============================================================================
2019-11-01T18:32:26.5643302Z Task         : Get sources
2019-11-01T18:32:26.5643355Z 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)

@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 9, 2019
@JohnCSimon
Copy link
Member

Ping from triage:
@eddyb - there's a build failure, can you please address this or post status?

cc: @nikomatsakis

Thanks!

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

eddyb commented Nov 9, 2019

Sorry, this is waiting for a review, I should've mentioned I didn't fully address the test failures because it's not clear what the correct outcome is.

@JohnCSimon
Copy link
Member

Ping from triage, it's been a week since this was last touched.
Can anyone provide an answer to @eddyb ?
cc: @nikomatsakis @petrochenkov @estebank

Thanks!

@nikomatsakis
Copy link
Contributor

My take is this:

This may well be sound but it's not obviously so. I would prefer to look at steps to avoid merging the where clauses from associated types into the trait listing -- I believe that would have a similar effect to this PR and just be generally less work overall (and a closer match to what chalk does).

However, such a change might have some subtle effects on very strange code. Notably, I imagine that if a user wrote this:

trait Foo where Self::Bar: Display {
    type Bar;
}

that is today probably equivalent to

trait Foo {
    type Bar: Display;
}

but under the most straightforward version of the code I am imagining, it would no longer be (although, now that I think about it, I think that implied bounds in chalk might ultimately judge them to be equivalent regardless).

@eddyb
Copy link
Member Author

eddyb commented Nov 26, 2019

While I don't expect this to land, I am curious how perf would measure the impact.
(NB: do not run perf before rust-lang/rustc-perf#566, the relevant benchmark, is merged)

@bors try

@bors
Copy link
Contributor

bors commented Nov 26, 2019

⌛ Trying commit 7a82867 with merge fad7de5f0bbacf986f3cf2baa8006b977b6e2107...

@eddyb
Copy link
Member Author

eddyb commented Nov 26, 2019

@rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@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-26T20:11:20.4421751Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-11-26T20:11:20.4625838Z ##[command]git config gc.auto 0
2019-11-26T20:11:20.4692893Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-11-26T20:11:21.2759980Z ##[command]git config --get-all http.proxy
2019-11-26T20:11:21.2773014Z ##[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/66020/merge:refs/remotes/pull/66020/merge
---
2019-11-26T21:10:07.2822846Z .................................................................................................... 1600/9295
2019-11-26T21:10:12.1513065Z .................................................................................................... 1700/9295
2019-11-26T21:10:25.1693475Z ................................i................................................................... 1800/9295
2019-11-26T21:10:32.5180085Z .................................................................................................... 1900/9295
2019-11-26T21:10:46.3036549Z .................iiiii.............................................................................. 2000/9295
2019-11-26T21:10:56.4023748Z .................................................................................................... 2200/9295
2019-11-26T21:10:59.3094636Z .................................................................................................... 2300/9295
2019-11-26T21:11:04.1658737Z .................................................................................................... 2400/9295
2019-11-26T21:11:25.6784098Z .................................................................................................... 2500/9295
---
2019-11-26T21:14:08.4996944Z ..................i...............i................................................................. 4800/9295
2019-11-26T21:14:19.0162214Z .................................................................................................... 4900/9295
2019-11-26T21:14:24.8773347Z .................................................................................................... 5000/9295
2019-11-26T21:14:34.5404673Z .................................................................................................... 5100/9295
2019-11-26T21:14:41.0061495Z .......................ii.ii...........i............................................................ 5200/9295
2019-11-26T21:14:50.2665803Z .................................................................................................... 5400/9295
2019-11-26T21:15:01.1677057Z .................................................................................................... 5500/9295
2019-11-26T21:15:08.0803787Z .....i.............................................................................................. 5600/9295
2019-11-26T21:15:14.5565882Z .................................................................................................... 5700/9295
2019-11-26T21:15:14.5565882Z .................................................................................................... 5700/9295
2019-11-26T21:15:25.0742817Z ...........................................................................................ii...i... 5800/9295
2019-11-26T21:15:37.6419327Z ii..........i....................................................................................... 5900/9295
2019-11-26T21:15:47.4597532Z .................................................................................................... 6000/9295
2019-11-26T21:15:56.0004255Z .................................................................................................... 6100/9295
2019-11-26T21:16:02.4634668Z .................................................................................................... 6200/9295
2019-11-26T21:16:16.9079137Z ..............i..ii................................................................................. 6300/9295
2019-11-26T21:16:36.5581967Z ..................................................................................i................. 6500/9295
2019-11-26T21:16:38.8654268Z .................................................................................................... 6600/9295
2019-11-26T21:16:41.1840010Z .........................................................................i.......................... 6700/9295
2019-11-26T21:16:44.0219213Z .................................................................................................... 6800/9295
---
2019-11-26T21:21:32.7519563Z error: /checkout/src/test/ui/associated-types/associated-types-overridden-binding.rs:7: expected error not found: type annotations needed
2019-11-26T21:21:32.7519728Z 
2019-11-26T21:21:32.7519871Z error: 0 unexpected errors found, 1 expected errors not found
2019-11-26T21:21:32.7520024Z status: exit code: 1
2019-11-26T21:21:32.7520988Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/associated-types/associated-types-overridden-binding.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-types/associated-types-overridden-binding" "-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/associated-types/associated-types-overridden-binding/auxiliary" "-A" "unused"
2019-11-26T21:21:32.7521680Z not found errors (from test file): [
2019-11-26T21:21:32.7521995Z         line_num: 7,
2019-11-26T21:21:32.7522132Z         kind: Some(
2019-11-26T21:21:32.7522269Z             Error,
2019-11-26T21:21:32.7522426Z         ),
---
2019-11-26T21:21:32.7523713Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-11-26T21:21:32.7523855Z 
2019-11-26T21:21:32.7524241Z ---- [ui] ui/issues/issue-20831-debruijn.rs stdout ----
2019-11-26T21:21:32.7524415Z 
2019-11-26T21:21:32.7525000Z error: /checkout/src/test/ui/issues/issue-20831-debruijn.rs:28: expected error not found: mismatched types
2019-11-26T21:21:32.7525152Z 
2019-11-26T21:21:32.7525564Z error: /checkout/src/test/ui/issues/issue-20831-debruijn.rs:28: expected error not found: mismatched types
2019-11-26T21:21:32.7525870Z error: 0 unexpected errors found, 2 expected errors not found
2019-11-26T21:21:32.7526019Z status: exit code: 1
2019-11-26T21:21:32.7526019Z status: exit code: 1
2019-11-26T21:21:32.7526886Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-20831-debruijn.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-20831-debruijn" "-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/issues/issue-20831-debruijn/auxiliary" "-A" "unused"
2019-11-26T21:21:32.7527126Z not found errors (from test file): [
2019-11-26T21:21:32.7527407Z         line_num: 28,
2019-11-26T21:21:32.7527538Z         kind: Some(
2019-11-26T21:21:32.7527664Z             Error,
2019-11-26T21:21:32.7527804Z         ),
---
2019-11-26T21:21:32.7530542Z ---- [ui] ui/suggestions/missing-assoc-type-bound-restriction.rs stdout ----
2019-11-26T21:21:32.7530729Z diff of stderr:
2019-11-26T21:21:32.7530841Z 
2019-11-26T21:21:32.7530966Z 32    |
2019-11-26T21:21:32.7531598Z 33    = note: required because of the requirements on the impl of `Child<A>` for `ChildWrapper<<T as Parent>::Assoc>`
2019-11-26T21:21:32.7531788Z 34 
2019-11-26T21:21:32.7532217Z - error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
2019-11-26T21:21:32.7532998Z -    |
2019-11-26T21:21:32.7532998Z -    |
2019-11-26T21:21:32.7533356Z - LL | trait Parent {
2019-11-26T21:21:32.7533758Z -    | ------------ required by `Parent`
2019-11-26T21:21:32.7534102Z - ...
2019-11-26T21:21:32.7534512Z - LL | impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T> {
2019-11-26T21:21:32.7535199Z -    |                                                       - help: consider further restricting the associated type: `where <T as Parent>::Assoc: Child<A>`
2019-11-26T21:21:32.7535539Z - ...
2019-11-26T21:21:32.7535932Z - LL |     type Assoc = ChildWrapper<T::Assoc>;
2019-11-26T21:21:32.7536360Z -    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Child<A>` is not implemented for `<T as Parent>::Assoc`
2019-11-26T21:21:32.7537066Z - error: aborting due to 3 previous errors
2019-11-26T21:21:32.7537229Z + error: aborting due to 2 previous errors
2019-11-26T21:21:32.7537396Z 48 
2019-11-26T21:21:32.7537755Z 49 For more information about this error, try `rustc --explain E0277`.
2019-11-26T21:21:32.7537755Z 49 For more information about this error, try `rustc --explain E0277`.
2019-11-26T21:21:32.7537918Z 50 
2019-11-26T21:21:32.7538030Z 
2019-11-26T21:21:32.7538157Z 
2019-11-26T21:21:32.7538287Z The actual stderr differed from the expected stderr.
2019-11-26T21:21:32.7538756Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/missing-assoc-type-bound-restriction/missing-assoc-type-bound-restriction.stderr
2019-11-26T21:21:32.7540061Z To update references, rerun the tests and pass the `--bless` flag
2019-11-26T21:21:32.7540351Z To only update this specific test, also pass `--test-args suggestions/missing-assoc-type-bound-restriction.rs`
2019-11-26T21:21:32.7540450Z error: 1 errors occurred comparing output.
2019-11-26T21:21:32.7540493Z status: exit code: 1
2019-11-26T21:21:32.7540493Z status: exit code: 1
2019-11-26T21:21:32.7541693Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/suggestions/missing-assoc-type-bound-restriction.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/missing-assoc-type-bound-restriction" "-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/suggestions/missing-assoc-type-bound-restriction/auxiliary" "-A" "unused"
2019-11-26T21:21:32.7542079Z ------------------------------------------
2019-11-26T21:21:32.7542114Z 
2019-11-26T21:21:32.7542337Z ------------------------------------------
2019-11-26T21:21:32.7542383Z stderr:
2019-11-26T21:21:32.7542383Z stderr:
2019-11-26T21:21:32.7542616Z ------------------------------------------
2019-11-26T21:21:32.7542671Z error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
2019-11-26T21:21:32.7543016Z    |
2019-11-26T21:21:32.7543057Z LL |   trait Parent {
2019-11-26T21:21:32.7543278Z    |   ------------ required by `Parent`
2019-11-26T21:21:32.7543340Z ...
2019-11-26T21:21:32.7543340Z ...
2019-11-26T21:21:32.7543388Z LL |   impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T> {
2019-11-26T21:21:32.7544002Z    |   ^                                                     - help: consider further restricting the associated type: `where <T as Parent>::Assoc: Child<A>`
2019-11-26T21:21:32.7544090Z    |  _|
2019-11-26T21:21:32.7544133Z    | |
2019-11-26T21:21:32.7544183Z LL | |     //~^ ERROR the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
2019-11-26T21:21:32.7544248Z LL | |     type Ty = A;
2019-11-26T21:21:32.7544294Z LL | |     type Assoc = ChildWrapper<T::Assoc>;
2019-11-26T21:21:32.7544346Z LL | |     //~^ ERROR the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
2019-11-26T21:21:32.7544420Z LL | |     //~| ERROR the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
2019-11-26T21:21:32.7544466Z LL | | }
2019-11-26T21:21:32.7544514Z    | |_^ the trait `Child<A>` is not implemented for `<T as Parent>::Assoc`
2019-11-26T21:21:32.7544565Z 
2019-11-26T21:21:32.7544613Z error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
2019-11-26T21:21:32.7545175Z    |
2019-11-26T21:21:32.7545175Z    |
2019-11-26T21:21:32.7545234Z LL |     type Assoc: Child<Self::Ty>;
2019-11-26T21:21:32.7545449Z    |          ----- associated type defined here
2019-11-26T21:21:32.7545493Z ...
2019-11-26T21:21:32.7545552Z LL | impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T> {
2019-11-26T21:21:32.7547094Z    | ------------------------------------------------------- help: consider further restricting the associated type: `where <T as Parent>::Assoc: Child<A>`
2019-11-26T21:21:32.7547211Z    | in this `impl` item
2019-11-26T21:21:32.7547248Z ...
2019-11-26T21:21:32.7547248Z ...
2019-11-26T21:21:32.7547288Z LL |     type Assoc = ChildWrapper<T::Assoc>;
2019-11-26T21:21:32.7547354Z    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Child<A>` is not implemented for `<T as Parent>::Assoc`
2019-11-26T21:21:32.7547398Z    |
2019-11-26T21:21:32.7547456Z    = note: required because of the requirements on the impl of `Child<A>` for `ChildWrapper<<T as Parent>::Assoc>`
2019-11-26T21:21:32.7547553Z error: aborting due to 2 previous errors
2019-11-26T21:21:32.7547580Z 
2019-11-26T21:21:32.7547862Z For more information about this error, try `rustc --explain E0277`.
2019-11-26T21:21:32.7547894Z 
---
2019-11-26T21:21:32.7549212Z 
2019-11-26T21:21:32.7553499Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-11-26T21:21:32.7565246Z 
2019-11-26T21:21:32.7565328Z 
2019-11-26T21:21:32.7567150Z 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-26T21:21:32.7567454Z 
2019-11-26T21:21:32.7567481Z 
2019-11-26T21:21:32.7573211Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-11-26T21:21:32.7573284Z Build completed unsuccessfully in 1:04:02
2019-11-26T21:21:32.7573284Z Build completed unsuccessfully in 1:04:02
2019-11-26T21:21:32.7628279Z == clock drift check ==
2019-11-26T21:21:32.7645086Z   local time: Tue Nov 26 21:21:32 UTC 2019
2019-11-26T21:21:32.9176473Z   network time: Tue, 26 Nov 2019 21:21:32 GMT
2019-11-26T21:21:32.9179247Z == end clock drift check ==
2019-11-26T21:21:33.7326173Z 
2019-11-26T21:21:33.7417445Z ##[error]Bash exited with code '1'.
2019-11-26T21:21:33.7484403Z ##[section]Starting: Checkout
2019-11-26T21:21:33.7486268Z ==============================================================================
2019-11-26T21:21:33.7486335Z Task         : Get sources
2019-11-26T21:21:33.7486377Z 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)

@bors
Copy link
Contributor

bors commented Nov 26, 2019

☀️ Try build successful - checks-azure
Build commit: fad7de5f0bbacf986f3cf2baa8006b977b6e2107 (fad7de5f0bbacf986f3cf2baa8006b977b6e2107)

@rust-timer
Copy link
Collaborator

Queued fad7de5f0bbacf986f3cf2baa8006b977b6e2107 with parent 797fd92, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit fad7de5f0bbacf986f3cf2baa8006b977b6e2107, comparison URL.

@eddyb
Copy link
Member Author

eddyb commented Nov 27, 2019

I would prefer to look at steps to avoid merging the where clauses from associated types into the trait listing -- I believe that would have a similar effect to this PR and just be generally less work overall (and a closer match to what chalk does).

At a first glance, that might be so, but consider that now every place, which used tcx.predicates_of (and friends) on traits, requires a decision on whether to include, or not, associated type predicates, in order to preserve soundness (as implicit dependencies may have accrued over time).

One of those places is the very one modified by this PR!

So moving associated type bounds off of the trait where clauses is strictly more concerning, soundness-wise, than this PR (or rather a version of this PR where only the associated type bounds are ignored and trait-level bounds are still included, which wouldn't be that hard to write).

bors added a commit that referenced this pull request Nov 28, 2019
[WIP] [DO NOT MERGE] combine #66020 and #66821.

That is, the two fixes for #65510, and only for perf testing purposes.
The fact that they both work to a comparable extent, while touching different parts of the trait system, made me curious if there would be any gains from having both.

r? @nikomatsakis
@nikomatsakis
Copy link
Contributor

@eddyb

At a first glance, that might be so, but consider that now every place, which used tcx.predicates_of (and friends) on traits, requires a decision on whether to include, or not, associated type predicates, in order to preserve soundness (as implicit dependencies may have accrued over time).

Yes, I agree that this would be a larger change, though it wouldn't concern me for soundness per se. I might be concerned about bits of code that used to compile no longer doing so.

@hdhoang
Copy link
Contributor

hdhoang commented Dec 12, 2019

ping from triage, @eddyb any update after niko's comment? Should we try a crater run or so?

@eddyb
Copy link
Member Author

eddyb commented Dec 12, 2019

@hdhoang Crater runs would probably show nothing, as people wouldn't write code unless it compiles.

We're not worried about breaking code that compiles today, but silently allowing wrong code.

Anyway, now that #66821 is landed, this is less urgent.

@eddyb eddyb closed this Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quadratic slowdown for lookup of bounds on associated types.
7 participants