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

Allow trait methods to be called on concrete types in a const context #68847

Merged
merged 16 commits into from Feb 20, 2020

Conversation

@ecstatic-morse
Copy link
Contributor

ecstatic-morse commented Feb 5, 2020

This partially implements RFC 2632 by const-checking methods inside an impl const block and allowing those methods to be called on concrete types. Calling trait methods on type parameters in a const context is not yet allowed. Implementing this will require much more work. Since we are only concerned with methods on concrete types, we are able to take advantage of the machinery in Instance::resolve, which is doing most of the work.

This also propagates #[rustc_const_unstable] from parent items to child items, making that attribute behave like #[stable] and #[unstable] do. This allows trait methods to be marked as unstably const.

cc #67792 #57563
cc @rust-lang/wg-const-eval
r? @oli-obk

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

rust-highfive commented Feb 5, 2020

The job x86_64-gnu-llvm-7 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.
2020-02-05T05:11:13.0928388Z ========================== Starting Command Output ===========================
2020-02-05T05:11:13.0943095Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/049cddd3-0d3e-4cbb-8770-2201514de04c.sh
2020-02-05T05:11:13.1153701Z 
2020-02-05T05:11:13.1206979Z ##[section]Finishing: Disable git automatic line ending conversion
2020-02-05T05:11:13.1213010Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/68847/merge to s
2020-02-05T05:11:13.1214661Z Task         : Get sources
2020-02-05T05:11:13.1214697Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-05T05:11:13.1214733Z Version      : 1.0.0
2020-02-05T05:11:13.1214809Z Author       : Microsoft
---
2020-02-05T05:11:14.5078835Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-02-05T05:11:14.5149068Z ##[command]git config gc.auto 0
2020-02-05T05:11:14.5226809Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-02-05T05:11:14.5270449Z ##[command]git config --get-all http.proxy
2020-02-05T05:11:14.5462494Z ##[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/68847/merge:refs/remotes/pull/68847/merge
---
2020-02-05T06:02:42.1678848Z .................................................................................................... 1700/9585
2020-02-05T06:02:47.0024423Z .................................................................................................... 1800/9585
2020-02-05T06:02:58.4114338Z ............................i....................................................................... 1900/9585
2020-02-05T06:03:05.3063357Z .................................................................................................... 2000/9585
2020-02-05T06:03:18.1497287Z ..................iiiii............................................................................. 2100/9585
2020-02-05T06:03:27.2537367Z .................................................................................................... 2300/9585
2020-02-05T06:03:29.4994671Z .................................................................................................... 2400/9585
2020-02-05T06:03:34.0170673Z .................................................................................................... 2500/9585
2020-02-05T06:03:52.6979321Z .................................................................................................... 2600/9585
---
2020-02-05T06:06:14.1491758Z .............................................................i...............i...................... 4900/9585
2020-02-05T06:06:21.1737439Z .................................................................................................... 5000/9585
2020-02-05T06:06:28.2664216Z .................................................................................................... 5100/9585
2020-02-05T06:06:32.4288865Z ....i............................................................................................... 5200/9585
2020-02-05T06:06:42.1591283Z ..............................................................................ii.ii........i...i.... 5300/9585
2020-02-05T06:06:49.7184622Z ................i................................................................................... 5500/9585
2020-02-05T06:06:57.9339295Z .................................................................................................... 5600/9585
2020-02-05T06:07:04.0031924Z .................................................................i.................................. 5700/9585
2020-02-05T06:07:10.5144881Z .................................................................................................... 5800/9585
2020-02-05T06:07:10.5144881Z .................................................................................................... 5800/9585
2020-02-05T06:07:17.4280330Z .................................................................................................... 5900/9585
2020-02-05T06:07:25.9109301Z ........................................................ii...i..ii...........i...................... 6000/9585
2020-02-05T06:07:45.2208745Z .................................................................................................... 6200/9585
2020-02-05T06:07:48.7283923Z .................................................................................................... 6300/9585
2020-02-05T06:07:48.7283923Z .................................................................................................... 6300/9585
2020-02-05T06:07:52.4950700Z ....................................................................................i..ii........... 6400/9585
2020-02-05T06:08:12.8237706Z .................................................................................................... 6600/9585
2020-02-05T06:08:21.2924569Z ......................................................................i............................. 6700/9585
2020-02-05T06:08:23.5188662Z .................................................................................................... 6800/9585
2020-02-05T06:08:25.8083456Z ........................................................................i........................... 6900/9585
---
2020-02-05T06:09:54.5185117Z .................................................................................................... 7500/9585
2020-02-05T06:09:59.3875992Z .................................................................................................... 7600/9585
2020-02-05T06:10:03.8540253Z .................................................................................................... 7700/9585
2020-02-05T06:10:10.3268147Z ..............................................................................................F..... 7800/9585
2020-02-05T06:10:18.2296211Z .....FF..F.......................................................................................... 7900/9585
2020-02-05T06:10:25.1748676Z ...................................iiiiiii.i........................................................ 8000/9585
2020-02-05T06:10:38.9589850Z .................................................................................................... 8200/9585
2020-02-05T06:10:46.6030923Z .................................................................................................... 8300/9585
2020-02-05T06:10:59.4915522Z .................................................................................................... 8400/9585
2020-02-05T06:11:06.4488483Z .................................................................................................... 8500/9585
---
2020-02-05T06:12:52.7696949Z -   --> $DIR/call-const-trait-method.rs:16:5
2020-02-05T06:12:52.7697147Z + error[E0601]: `main` function not found in crate `call_const_trait_method`
2020-02-05T06:12:52.7697482Z +   --> $DIR/call-const-trait-method.rs:1:1
2020-02-05T06:12:52.7697659Z 3    |
2020-02-05T06:12:52.7697983Z - LL |     a.add(b)
2020-02-05T06:12:52.7698304Z -    |     ^^^^^^^^
2020-02-05T06:12:52.7698471Z + LL | / #![allow(incomplete_features)]
2020-02-05T06:12:52.7698636Z + LL | | #![feature(const_trait_impl)]
2020-02-05T06:12:52.7698788Z + LL | | #![feature(const_fn)]
2020-02-05T06:12:52.7698935Z + LL | |
2020-02-05T06:12:52.7699102Z + ...  |
2020-02-05T06:12:52.7699249Z + LL | |
2020-02-05T06:12:52.7699394Z + LL | | }
2020-02-05T06:12:52.7699776Z +    | |_^ consider adding a `main` function to `$DIR/call-const-trait-method.rs`
2020-02-05T06:12:52.7700090Z 7 error: aborting due to previous error
2020-02-05T06:12:52.7700253Z 8 
2020-02-05T06:12:52.7700383Z 
2020-02-05T06:12:52.7700737Z - For more information about this error, try `rustc --explain E0015`.
2020-02-05T06:12:52.7700737Z - For more information about this error, try `rustc --explain E0015`.
2020-02-05T06:12:52.7701118Z + For more information about this error, try `rustc --explain E0601`.
2020-02-05T06:12:52.7701302Z 10 
2020-02-05T06:12:52.7701452Z 
2020-02-05T06:12:52.7701583Z 
2020-02-05T06:12:52.7701747Z The actual stderr differed from the expected stderr.
2020-02-05T06:12:52.7702193Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/call-const-trait-method/call-const-trait-method.stderr
2020-02-05T06:12:52.7702766Z To update references, rerun the tests and pass the `--bless` flag
2020-02-05T06:12:52.7703227Z To only update this specific test, also pass `--test-args rfc-2632-const-trait-impl/call-const-trait-method.rs`
2020-02-05T06:12:52.7703562Z error: 1 errors occurred comparing output.
2020-02-05T06:12:52.7703713Z status: exit code: 1
2020-02-05T06:12:52.7703713Z status: exit code: 1
2020-02-05T06:12:52.7704697Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/call-const-trait-method" "-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/rfc-2632-const-trait-impl/call-const-trait-method/auxiliary" "-A" "unused"
2020-02-05T06:12:52.7705393Z ------------------------------------------
2020-02-05T06:12:52.7705539Z 
2020-02-05T06:12:52.7705877Z ------------------------------------------
2020-02-05T06:12:52.7706041Z stderr:
2020-02-05T06:12:52.7706041Z stderr:
2020-02-05T06:12:52.7706363Z ------------------------------------------
2020-02-05T06:12:52.7706532Z error[E0601]: `main` function not found in crate `call_const_trait_method`
2020-02-05T06:12:52.7706915Z   --> /checkout/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method.rs:1:1
2020-02-05T06:12:52.7707117Z    |
2020-02-05T06:12:52.7707269Z LL | / #![allow(incomplete_features)]
2020-02-05T06:12:52.7707420Z LL | | #![feature(const_trait_impl)]
2020-02-05T06:12:52.7707595Z LL | | #![feature(const_fn)]
2020-02-05T06:12:52.7707889Z ...  |
2020-02-05T06:12:52.7707889Z ...  |
2020-02-05T06:12:52.7708035Z LL | |     //~^ ERROR
2020-02-05T06:12:52.7708196Z LL | | }
2020-02-05T06:12:52.7708613Z    | |_^ consider adding a `main` function to `/checkout/src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method.rs`
2020-02-05T06:12:52.7708936Z error: aborting due to previous error
2020-02-05T06:12:52.7709068Z 
2020-02-05T06:12:52.7709440Z For more information about this error, try `rustc --explain E0601`.
2020-02-05T06:12:52.7709588Z 
---
2020-02-05T06:12:52.7711560Z -   --> $DIR/feature-gate.rs:9:1
2020-02-05T06:12:52.7711727Z + error: fatal error triggered by #[rustc_error]
2020-02-05T06:12:52.7712062Z +   --> $DIR/feature-gate.rs:14:1
2020-02-05T06:12:52.7712223Z 3    |
2020-02-05T06:12:52.7712539Z - LL | impl const T for S {}
2020-02-05T06:12:52.7713071Z + LL | fn main() {}
2020-02-05T06:12:52.7713222Z +    | ^^^^^^^^^^^^
2020-02-05T06:12:52.7713367Z 6 
2020-02-05T06:12:52.7713516Z 7 error: aborting due to previous error
2020-02-05T06:12:52.7713516Z 7 error: aborting due to previous error
2020-02-05T06:12:52.7713660Z 8 
2020-02-05T06:12:52.7713807Z 
2020-02-05T06:12:52.7713936Z 
2020-02-05T06:12:52.7714103Z The actual stderr differed from the expected stderr.
2020-02-05T06:12:52.7714540Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/feature-gate.gated/feature-gate.gated.stderr
2020-02-05T06:12:52.7714913Z To update references, rerun the tests and pass the `--bless` flag
2020-02-05T06:12:52.7715326Z To only update this specific test, also pass `--test-args rfc-2632-const-trait-impl/feature-gate.rs`
2020-02-05T06:12:52.7715494Z 
2020-02-05T06:12:52.7715664Z error in revision `gated`: 1 errors occurred comparing output.
2020-02-05T06:12:52.7715816Z status: exit code: 1
2020-02-05T06:12:52.7716945Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2632-const-trait-impl/feature-gate.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "gated" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/feature-gate.gated" "-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/rfc-2632-const-trait-impl/feature-gate.gated/auxiliary" "-A" "unused"
2020-02-05T06:12:52.7717550Z ------------------------------------------
2020-02-05T06:12:52.7717698Z 
2020-02-05T06:12:52.7718037Z ------------------------------------------
2020-02-05T06:12:52.7718199Z stderr:
2020-02-05T06:12:52.7718199Z stderr:
2020-02-05T06:12:52.7718521Z ------------------------------------------
2020-02-05T06:12:52.7718725Z error: fatal error triggered by #[rustc_error]
2020-02-05T06:12:52.7719093Z   --> /checkout/src/test/ui/rfc-2632-const-trait-impl/feature-gate.rs:14:1
2020-02-05T06:12:52.7719264Z    |
2020-02-05T06:12:52.7719418Z LL | fn main() {} //[gated]~ ERROR fatal error triggered by #[rustc_error]
2020-02-05T06:12:52.7719719Z 
2020-02-05T06:12:52.7719869Z error: aborting due to previous error
2020-02-05T06:12:52.7720137Z 
2020-02-05T06:12:52.7720858Z 
---
2020-02-05T06:12:52.7722608Z 1 error[E0658]: const trait impls are experimental
2020-02-05T06:12:52.7722933Z -   --> $DIR/feature-gate.rs:9:6
2020-02-05T06:12:52.7723289Z +   --> $DIR/feature-gate.rs:10:6
2020-02-05T06:12:52.7723462Z 3    |
2020-02-05T06:12:52.7723612Z 4 LL | impl const T for S {}
2020-02-05T06:12:52.7723908Z 
2020-02-05T06:12:52.7723908Z 
2020-02-05T06:12:52.7724405Z 7    = note: for more information, see ***/issues/67792
2020-02-05T06:12:52.7724755Z 9 
2020-02-05T06:12:52.7725099Z - error: const trait impls are not yet implemented
2020-02-05T06:12:52.7725446Z -   --> $DIR/feature-gate.rs:9:1
2020-02-05T06:12:52.7725788Z -    |
2020-02-05T06:12:52.7725788Z -    |
2020-02-05T06:12:52.7726113Z - LL | impl const T for S {}
2020-02-05T06:12:52.7726748Z - 
2020-02-05T06:12:52.7727081Z - error: aborting due to 2 previous errors
2020-02-05T06:12:52.7727249Z + error: aborting due to previous error
2020-02-05T06:12:52.7727428Z 17 
2020-02-05T06:12:52.7727428Z 17 
2020-02-05T06:12:52.7727782Z 18 For more information about this error, try `rustc --explain E0658`.
2020-02-05T06:12:52.7728711Z 19 
2020-02-05T06:12:52.7728862Z 
2020-02-05T06:12:52.7728995Z 
2020-02-05T06:12:52.7729164Z The actual stderr differed from the expected stderr.
2020-02-05T06:12:52.7729606Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/feature-gate.stock/feature-gate.stock.stderr
2020-02-05T06:12:52.7729980Z To update references, rerun the tests and pass the `--bless` flag
2020-02-05T06:12:52.7730383Z To only update this specific test, also pass `--test-args rfc-2632-const-trait-impl/feature-gate.rs`
2020-02-05T06:12:52.7730569Z 
2020-02-05T06:12:52.7730722Z error in revision `stock`: 1 errors occurred comparing output.
2020-02-05T06:12:52.7730886Z status: exit code: 1
2020-02-05T06:12:52.7733336Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2632-const-trait-impl/feature-gate.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "stock" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/feature-gate.stock" "-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/rfc-2632-const-trait-impl/feature-gate.stock/auxiliary" "-A" "unused"
2020-02-05T06:12:52.7734041Z ------------------------------------------
2020-02-05T06:12:52.7734201Z 
2020-02-05T06:12:52.7734551Z ------------------------------------------
2020-02-05T06:12:52.7734731Z stderr:
2020-02-05T06:12:52.7734731Z stderr:
2020-02-05T06:12:52.7735198Z ------------------------------------------
2020-02-05T06:12:52.7735377Z error[E0658]: const trait impls are experimental
2020-02-05T06:12:52.7735784Z   --> /checkout/src/test/ui/rfc-2632-const-trait-impl/feature-gate.rs:10:6
2020-02-05T06:12:52.7735963Z    |
2020-02-05T06:12:52.7736122Z LL | impl const T for S {}
2020-02-05T06:12:52.7736469Z    |
2020-02-05T06:12:52.7736469Z    |
2020-02-05T06:12:52.7736919Z    = note: for more information, see ***/issues/67792
2020-02-05T06:12:52.7737299Z 
2020-02-05T06:12:52.7737463Z error: aborting due to previous error
2020-02-05T06:12:52.7737607Z 
2020-02-05T06:12:52.7737995Z For more information about this error, try `rustc --explain E0658`.
---
2020-02-05T06:12:52.7746551Z 
2020-02-05T06:12:52.7746680Z 
2020-02-05T06:12:52.7746848Z The actual stderr differed from the expected stderr.
2020-02-05T06:12:52.7747287Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/inherent-impl/inherent-impl.stderr
2020-02-05T06:12:52.7747736Z To update references, rerun the tests and pass the `--bless` flag
2020-02-05T06:12:52.7748416Z To only update this specific test, also pass `--test-args rfc-2632-const-trait-impl/inherent-impl.rs`
2020-02-05T06:12:52.7748670Z error: 1 errors occurred comparing output.
2020-02-05T06:12:52.7748820Z status: exit code: 1
2020-02-05T06:12:52.7748820Z status: exit code: 1
2020-02-05T06:12:52.7749851Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2632-const-trait-impl/inherent-impl.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/inherent-impl" "-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/rfc-2632-const-trait-impl/inherent-impl/auxiliary" "-A" "unused"
2020-02-05T06:12:52.7750418Z ------------------------------------------
2020-02-05T06:12:52.7750564Z 
2020-02-05T06:12:52.7750909Z ------------------------------------------
2020-02-05T06:12:52.7751074Z stderr:
---
2020-02-05T06:12:52.7759362Z test result: FAILED. 9529 passed; 4 failed; 52 ignored; 0 measured; 0 filtered out
2020-02-05T06:12:52.7759732Z 
2020-02-05T06:12:52.7759885Z 
2020-02-05T06:12:52.7760041Z 
2020-02-05T06:12:52.7761694Z 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-7/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" "7.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2020-02-05T06:12:52.7762670Z 
2020-02-05T06:12:52.7762991Z 
2020-02-05T06:12:52.7763347Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2020-02-05T06:12:52.7763518Z Build completed unsuccessfully in 0:55:39
2020-02-05T06:12:52.7763518Z Build completed unsuccessfully in 0:55:39
2020-02-05T06:12:52.7763698Z == clock drift check ==
2020-02-05T06:12:52.7763912Z   local time: Wed Feb  5 06:12:52 UTC 2020
2020-02-05T06:12:52.9309079Z   network time: Wed, 05 Feb 2020 06:12:52 GMT
2020-02-05T06:12:52.9314103Z == end clock drift check ==
2020-02-05T06:12:53.6225975Z 
2020-02-05T06:12:53.6321921Z ##[error]Bash exited with code '1'.
2020-02-05T06:12:53.6334816Z ##[section]Finishing: Run build
2020-02-05T06:12:53.6355957Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/68847/merge to s
2020-02-05T06:12:53.6357753Z Task         : Get sources
2020-02-05T06:12:53.6357800Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-05T06:12:53.6357847Z Version      : 1.0.0
2020-02-05T06:12:53.6358022Z Author       : Microsoft
2020-02-05T06:12:53.6358022Z Author       : Microsoft
2020-02-05T06:12:53.6358069Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-02-05T06:12:53.6358119Z ==============================================================================
2020-02-05T06:12:54.0306274Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-02-05T06:12:54.0344648Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/68847/merge to s
2020-02-05T06:12:54.0442519Z Cleaning up task key
2020-02-05T06:12:54.0443258Z Start cleaning up orphan processes.
2020-02-05T06:12:54.0539540Z Terminate orphan process: pid (4885) (python)
2020-02-05T06:12:54.0799460Z ##[section]Finishing: Finalize Job

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)

@ecstatic-morse ecstatic-morse force-pushed the ecstatic-morse:const-impl branch from 862cb71 to a24aac4 Feb 5, 2020
fn plus(self, rhs: Self) -> Self;
}

impl const Plus for i32 {

This comment has been minimized.

Copy link
@oli-obk

oli-obk Feb 5, 2020

Contributor

Would this test work the same if the Add trait were used instead of Plus?

This comment has been minimized.

Copy link
@ecstatic-morse

ecstatic-morse Feb 5, 2020

Author Contributor

Yes. I'll add a type with a const impl of Add to this test. Obviously I can't do this directly on i32 outside the standard library without conflicting impls. Note that, with the current implementation, it's possible to have const unstable trait impls even though it's not possible to have unstable ones. This means we could have const unstable implementations of arithmetic traits for the primitive types. I will try to find an approach to trait solving that preserves this property.

This comment has been minimized.

Copy link
@oli-obk

oli-obk Feb 10, 2020

Contributor

Note that, with the current implementation, it's possible to have const unstable trait impls even though it's not possible to have unstable ones. This means we could have const unstable implementations of arithmetic traits for the primitive types. I will try to find an approach to trait solving that preserves this property.

Oh wow, that would be a neat feature

@ecstatic-morse ecstatic-morse force-pushed the ecstatic-morse:const-impl branch from 82a9302 to 475bd1c Feb 7, 2020
@ecstatic-morse ecstatic-morse changed the title [WIP] Allow trait methods to be called on concrete types in a const context Allow trait methods to be called on concrete types in a const context Feb 7, 2020
@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

rust-highfive commented Feb 7, 2020

The job x86_64-gnu-llvm-7 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.
2020-02-07T19:07:57.7962302Z ========================== Starting Command Output ===========================
2020-02-07T19:07:57.7964272Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/875bcc45-f426-42cf-b09d-8c4ae4aaa168.sh
2020-02-07T19:07:57.7964314Z 
2020-02-07T19:07:57.7966856Z ##[section]Finishing: Disable git automatic line ending conversion
2020-02-07T19:07:57.7973797Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/68847/merge to s
2020-02-07T19:07:57.7975355Z Task         : Get sources
2020-02-07T19:07:57.7975401Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-07T19:07:57.7975434Z Version      : 1.0.0
2020-02-07T19:07:57.7975466Z Author       : Microsoft
---
2020-02-07T19:07:58.7911728Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-02-07T19:07:58.7924267Z ##[command]git config gc.auto 0
2020-02-07T19:07:58.7927799Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-02-07T19:07:58.7930535Z ##[command]git config --get-all http.proxy
2020-02-07T19:07:58.7937870Z ##[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/68847/merge:refs/remotes/pull/68847/merge
---
2020-02-07T20:13:36.2459267Z .................................................................................................... 1700/9609
2020-02-07T20:13:41.3631122Z .................................................................................................... 1800/9609
2020-02-07T20:13:54.7444544Z .............................i...................................................................... 1900/9609
2020-02-07T20:14:02.2864264Z .................................................................................................... 2000/9609
2020-02-07T20:14:17.9273957Z ...................iiiii............................................................................ 2100/9609
2020-02-07T20:14:28.8739496Z .................................................................................................... 2300/9609
2020-02-07T20:14:31.0759270Z .................................................................................................... 2400/9609
2020-02-07T20:14:36.2420712Z .................................................................................................... 2500/9609
2020-02-07T20:14:59.5662772Z .................................................................................................... 2600/9609
---
2020-02-07T20:17:50.2406029Z .....................................................................i...............i.............. 4900/9609
2020-02-07T20:17:58.6719606Z .................................................................................................... 5000/9609
2020-02-07T20:18:07.4614301Z .................................................................................................... 5100/9609
2020-02-07T20:18:12.4493776Z ............i....................................................................................... 5200/9609
2020-02-07T20:18:24.2495490Z ......................................................................................ii.ii........i 5300/9609
2020-02-07T20:18:32.4445547Z ........................i........................................................................... 5500/9609
2020-02-07T20:18:41.3215543Z .................................................................................................... 5600/9609
2020-02-07T20:18:50.3763367Z ..........................................................................i......................... 5700/9609
2020-02-07T20:18:58.5024624Z .................................................................................................... 5800/9609
2020-02-07T20:18:58.5024624Z .................................................................................................... 5800/9609
2020-02-07T20:19:05.6889357Z .................................................................................................... 5900/9609
2020-02-07T20:19:16.9197704Z .................................................................ii...i..ii...........i............. 6000/9609
2020-02-07T20:19:39.9997671Z .................................................................................................... 6200/9609
2020-02-07T20:19:48.3925443Z .................................................................................................... 6300/9609
2020-02-07T20:19:48.3925443Z .................................................................................................... 6300/9609
2020-02-07T20:19:57.3163760Z .............................................................................................i..ii.. 6400/9609
2020-02-07T20:20:27.6456522Z .................................................................................................... 6600/9609
2020-02-07T20:20:38.6969361Z ................................................................................i................... 6700/9609
2020-02-07T20:20:40.9975008Z .................................................................................................... 6800/9609
2020-02-07T20:20:43.3793437Z .......................................................................................i............ 6900/9609
---
2020-02-07T20:22:34.0521030Z .................................................................................................... 7600/9609
2020-02-07T20:22:39.2488726Z .................................................................................................... 7700/9609
2020-02-07T20:22:45.6005323Z .................................................................................................... 7800/9609
2020-02-07T20:22:54.5340287Z .........i..................F....................................................................... 7900/9609
2020-02-07T20:23:04.3766653Z ........................................................iiiiiii.i................................... 8000/9609
2020-02-07T20:23:20.2675296Z ...i................................................................................................ 8200/9609
2020-02-07T20:23:25.7918193Z .................................................................................................... 8300/9609
2020-02-07T20:23:42.2921613Z .................................................................................................... 8400/9609
2020-02-07T20:23:51.2357985Z .................................................................................................... 8500/9609
---
2020-02-07T20:26:01.2408793Z 
2020-02-07T20:26:01.2410050Z ---- [ui] ui/rfc-2632-const-trait-impl/stability.rs stdout ----
2020-02-07T20:26:01.2410433Z diff of stderr:
2020-02-07T20:26:01.2410680Z 
2020-02-07T20:26:01.2411625Z - error[E0723]: can only call other `const fn` within a `const fn`, but `const <Int as std::ops::Add>::add` is not stable as `const fn`
2020-02-07T20:26:01.2412120Z -   --> $DIR/stability.rs:21:5
2020-02-07T20:26:01.2412678Z + error[E0545]: `issue` must be a non-zero numeric string or "none"
2020-02-07T20:26:01.2413158Z +   --> $DIR/stability.rs:9:47
2020-02-07T20:26:01.2413417Z 3    |
2020-02-07T20:26:01.2413991Z - LL |     Int(1i32) + Int(2i32)
2020-02-07T20:26:01.2414468Z -    |     ^^^^^^^^^^^^^^^^^^^^^
2020-02-07T20:26:01.2414730Z + LL | #[rustc_const_unstable(feature = "const_add", issue = "0")]
2020-02-07T20:26:01.2415739Z +    |                                                       |
2020-02-07T20:26:01.2415739Z +    |                                                       |
2020-02-07T20:26:01.2416064Z +    |                                                       `issue` must not be "0", use "none" instead
2020-02-07T20:26:01.2416280Z + 
2020-02-07T20:26:01.2416734Z + error[E0545]: `issue` must be a non-zero numeric string or "none"
2020-02-07T20:26:01.2417404Z +   --> $DIR/stability.rs:27:41
2020-02-07T20:26:01.2417884Z 6    |
2020-02-07T20:26:01.2418624Z -    = note: for more information, see issue ***/issues/57563
2020-02-07T20:26:01.2419193Z -    = help: add `#![feature(const_fn)]` to the crate attributes to enable
2020-02-07T20:26:01.2419496Z + LL | #[rustc_const_unstable(feature = "bar", issue = "0")]
2020-02-07T20:26:01.2420248Z +    |                                                 |
2020-02-07T20:26:01.2420248Z +    |                                                 |
2020-02-07T20:26:01.2420474Z +    |                                                 `issue` must not be "0", use "none" instead
2020-02-07T20:26:01.2421386Z - error: aborting due to previous error
2020-02-07T20:26:01.2421656Z + error: aborting due to 2 previous errors
2020-02-07T20:26:01.2421880Z 11 
2020-02-07T20:26:01.2422328Z - For more information about this error, try `rustc --explain E0723`.
2020-02-07T20:26:01.2422328Z - For more information about this error, try `rustc --explain E0723`.
2020-02-07T20:26:01.2422600Z 13 
2020-02-07T20:26:01.2422782Z 
2020-02-07T20:26:01.2422954Z 
2020-02-07T20:26:01.2423144Z The actual stderr differed from the expected stderr.
2020-02-07T20:26:01.2423679Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/stability/stability.stderr
2020-02-07T20:26:01.2424356Z To update references, rerun the tests and pass the `--bless` flag
2020-02-07T20:26:01.2426159Z To only update this specific test, also pass `--test-args rfc-2632-const-trait-impl/stability.rs`
2020-02-07T20:26:01.2426584Z error: 1 errors occurred comparing output.
2020-02-07T20:26:01.2426726Z status: exit code: 1
2020-02-07T20:26:01.2426726Z status: exit code: 1
2020-02-07T20:26:01.2428848Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2632-const-trait-impl/stability.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/stability" "-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/rfc-2632-const-trait-impl/stability/auxiliary" "-A" "unused"
2020-02-07T20:26:01.2430159Z ------------------------------------------
2020-02-07T20:26:01.2430956Z 
2020-02-07T20:26:01.2431863Z ------------------------------------------
2020-02-07T20:26:01.2432057Z stderr:
2020-02-07T20:26:01.2432057Z stderr:
2020-02-07T20:26:01.2432406Z ------------------------------------------
2020-02-07T20:26:01.2433839Z error[E0545]: `issue` must be a non-zero numeric string or "none"
2020-02-07T20:26:01.2434320Z   --> /checkout/src/test/ui/rfc-2632-const-trait-impl/stability.rs:9:47
2020-02-07T20:26:01.2435511Z    |
2020-02-07T20:26:01.2435693Z LL | #[rustc_const_unstable(feature = "const_add", issue = "0")]
2020-02-07T20:26:01.2436356Z    |                                                       |
2020-02-07T20:26:01.2436356Z    |                                                       |
2020-02-07T20:26:01.2436500Z    |                                                       `issue` must not be "0", use "none" instead
2020-02-07T20:26:01.2436852Z 
2020-02-07T20:26:01.2437580Z error[E0545]: `issue` must be a non-zero numeric string or "none"
2020-02-07T20:26:01.2438268Z   --> /checkout/src/test/ui/rfc-2632-const-trait-impl/stability.rs:27:41
2020-02-07T20:26:01.2438483Z    |
2020-02-07T20:26:01.2438653Z LL | #[rustc_const_unstable(feature = "bar", issue = "0")]
2020-02-07T20:26:01.2439910Z    |                                                 |
2020-02-07T20:26:01.2439910Z    |                                                 |
2020-02-07T20:26:01.2440085Z    |                                                 `issue` must not be "0", use "none" instead
2020-02-07T20:26:01.2440363Z error: aborting due to 2 previous errors
2020-02-07T20:26:01.2440480Z 
2020-02-07T20:26:01.2440594Z 
2020-02-07T20:26:01.2442516Z ------------------------------------------
---
2020-02-07T20:26:01.2444080Z test result: FAILED. 9555 passed; 1 failed; 53 ignored; 0 measured; 0 filtered out
2020-02-07T20:26:01.2444828Z 
2020-02-07T20:26:01.2450446Z 
2020-02-07T20:26:01.2450648Z 
2020-02-07T20:26:01.2452672Z 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-7/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" "7.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2020-02-07T20:26:01.2453441Z 
2020-02-07T20:26:01.2453562Z 
2020-02-07T20:26:01.2453720Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2020-02-07T20:26:01.2453864Z Build completed unsuccessfully in 1:11:12
2020-02-07T20:26:01.2453864Z Build completed unsuccessfully in 1:11:12
2020-02-07T20:26:01.2454502Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
2020-02-07T20:26:01.2454712Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2020-02-07T20:26:01.2505108Z == clock drift check ==
2020-02-07T20:26:01.2531260Z   local time: Fri Feb  7 20:26:01 UTC 2020
2020-02-07T20:26:01.8049500Z   network time: Fri, 07 Feb 2020 20:26:01 GMT
2020-02-07T20:26:01.8054878Z == end clock drift check ==
2020-02-07T20:26:02.2394681Z 
2020-02-07T20:26:02.2500532Z ##[error]Bash exited with code '1'.
2020-02-07T20:26:02.2515253Z ##[section]Finishing: Run build
2020-02-07T20:26:02.2536478Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/68847/merge to s
2020-02-07T20:26:02.2538721Z Task         : Get sources
2020-02-07T20:26:02.2538769Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-07T20:26:02.2538836Z Version      : 1.0.0
2020-02-07T20:26:02.2538879Z Author       : Microsoft
2020-02-07T20:26:02.2538879Z Author       : Microsoft
2020-02-07T20:26:02.2538926Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-02-07T20:26:02.2538995Z ==============================================================================
2020-02-07T20:26:02.7335652Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-02-07T20:26:02.7379126Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/68847/merge to s
2020-02-07T20:26:02.7507027Z Cleaning up task key
2020-02-07T20:26:02.7507774Z Start cleaning up orphan processes.
2020-02-07T20:26:02.7661798Z Terminate orphan process: pid (4062) (python)
2020-02-07T20:26:02.7936522Z ##[section]Finishing: Finalize Job

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)

@ecstatic-morse ecstatic-morse force-pushed the ecstatic-morse:const-impl branch from 475bd1c to a28e2f1 Feb 7, 2020
@ecstatic-morse

This comment has been minimized.

Copy link
Contributor Author

ecstatic-morse commented Feb 8, 2020

@oli-obk, I'm conflicted about this PR. On the one hand, it allows a lot of useful operations within const initializers on nightly. Notably, you can use the various arithmetic operators on custom types. On the other, it's a hack that can't reason about generic types at all. For now, associated type bounds within const impls are not required to be const, violating the RFC, although actually trying to call methods on associated types will always fail in a const context. Perhaps this is okay since this feature gate is marked experimental.

The next step is to teach the trait solver and method resolution about the constness of impls. This will require a lot of small changes to performance-sensitive code, so it will take a while.

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Feb 10, 2020

For now, associated type bounds within const impls are not required to be const, violating the RFC, although actually trying to call methods on associated types will always fail in a const context. Perhaps this is okay since this feature gate is marked experimental.

Yea that's ok. You can mark the feature as partially implemented to make sure users get a warning.

I'm conflicted about this PR. On the one hand, it allows a lot of useful operations within const initializers on nightly. Notably, you can use the various arithmetic operators on custom types. On the other, it's a hack that can't reason about generic types at all.

Can you elaborate on the

can't reason about generic types at all.

part? Do you mean const fn foo<T: Add>(arg: SomeStruct<T>) { arg + arg; } won't work even if there's an Add impl for SomeStruct<T: Arg>?

@ecstatic-morse

This comment has been minimized.

Copy link
Contributor Author

ecstatic-morse commented Feb 10, 2020

Do you mean const fn foo<T: Add>(arg: SomeStruct) { arg + arg; } won't work even if there's an Add impl for SomeStruct<T: Arg>?

I thought that Instance::resolve only worked when the types were fully monomorphized, but apparently that's not quite right. Clearly I need more tests. I added a passing one for calling <Struct<T> as ops::Add>::add. Calling a trait method directly on T doesn't work, however.

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Feb 11, 2020

r=me with a stability test for the above worry

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2020

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

@ecstatic-morse

This comment has been minimized.

Copy link
Contributor Author

ecstatic-morse commented Feb 15, 2020

#69036 will change the effects of this, so I'll hold off until that is merged. cc @eddyb who will probably not be happy with Instance::resolve being used in this way.

@eddyb

This comment has been minimized.

Copy link
Member

eddyb commented Feb 16, 2020

This seems straight-forward and the use of Instance::resolve looks correct.
However, I think you should make sure that the ParamEnv is UserFacing, not RevealAll, because you want maximally conservative behavior around specialization - similar to associated types in typeck.

cc @nikomatsakis

// See if this is a trait method for a concrete type whose impl of that trait is
// `const`.
if self.tcx.features().const_trait_impl {
let instance = Instance::resolve(self.tcx, self.param_env, def_id, substs);

This comment has been minimized.

Copy link
@eddyb

eddyb Feb 16, 2020

Member

As long as self.param_env is tcx.param_env(some_def_id) without calling .with_reveal_all() or w/e, it should be fine.

@ecstatic-morse ecstatic-morse force-pushed the ecstatic-morse:const-impl branch from f0cc77e to cede204 Feb 18, 2020
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Feb 18, 2020

The job mingw-check 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.
2020-02-18T23:48:37.4540883Z ========================== Starting Command Output ===========================
2020-02-18T23:48:37.4542718Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/e4b4bba3-5650-4953-b8aa-89b99984d0f5.sh
2020-02-18T23:48:37.4542760Z 
2020-02-18T23:48:37.4546093Z ##[section]Finishing: Disable git automatic line ending conversion
2020-02-18T23:48:37.4555315Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/68847/merge to s
2020-02-18T23:48:37.4557377Z Task         : Get sources
2020-02-18T23:48:37.4557414Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-18T23:48:37.4557450Z Version      : 1.0.0
2020-02-18T23:48:37.4557546Z Author       : Microsoft
---
2020-02-18T23:48:38.4294324Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-02-18T23:48:38.4305883Z ##[command]git config gc.auto 0
2020-02-18T23:48:38.4308826Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-02-18T23:48:38.4311006Z ##[command]git config --get-all http.proxy
2020-02-18T23:48:38.4317879Z ##[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/68847/merge:refs/remotes/pull/68847/merge
---
2020-02-18T23:52:51.3785679Z extracting /checkout/obj/build/cache/2020-01-31/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.gz
2020-02-18T23:52:51.4510270Z error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
2020-02-18T23:52:51.4510424Z 
2020-02-18T23:52:51.4510518Z Caused by:
2020-02-18T23:52:51.4510977Z   patch for `rustfmt-nightly` in `https://github.com/rust-lang/crates.io-index` did not resolve to any crates. If this is unexpected, you may wish to consult: https://github.com/rust-lang/cargo/issues/4678
2020-02-18T23:52:51.4521301Z Build completed unsuccessfully in 0:00:23
2020-02-18T23:52:51.4563651Z == clock drift check ==
2020-02-18T23:52:51.4570851Z   local time: Tue Feb 18 23:52:51 UTC 2020
2020-02-18T23:52:51.7443716Z   network time: Tue, 18 Feb 2020 23:52:51 GMT
2020-02-18T23:52:51.7443716Z   network time: Tue, 18 Feb 2020 23:52:51 GMT
2020-02-18T23:52:51.7448434Z == end clock drift check ==
2020-02-18T23:52:59.2789069Z 
2020-02-18T23:52:59.2904004Z ##[error]Bash exited with code '1'.
2020-02-18T23:52:59.2919995Z ##[section]Finishing: Run build
2020-02-18T23:52:59.2937350Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/68847/merge to s
2020-02-18T23:52:59.2939638Z Task         : Get sources
2020-02-18T23:52:59.2939744Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-18T23:52:59.2939801Z Version      : 1.0.0
2020-02-18T23:52:59.2939847Z Author       : Microsoft
2020-02-18T23:52:59.2939847Z Author       : Microsoft
2020-02-18T23:52:59.2939935Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-02-18T23:52:59.2939992Z ==============================================================================
2020-02-18T23:52:59.6898863Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-02-18T23:52:59.6936762Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/68847/merge to s
2020-02-18T23:52:59.7040852Z Cleaning up task key
2020-02-18T23:52:59.7041643Z Start cleaning up orphan processes.
2020-02-18T23:52:59.7153561Z Terminate orphan process: pid (3682) (python)
2020-02-18T23:52:59.7348342Z ##[section]Finishing: Finalize Job

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)

@ecstatic-morse ecstatic-morse force-pushed the ecstatic-morse:const-impl branch from cede204 to a06734d Feb 19, 2020
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Feb 19, 2020

The job x86_64-gnu-llvm-7 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.
2020-02-19T05:04:24.5104204Z ========================== Starting Command Output ===========================
2020-02-19T05:04:24.5106760Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/ff622616-d5c4-4e72-ba7a-ca54359cbd47.sh
2020-02-19T05:04:24.5106795Z 
2020-02-19T05:04:24.5109436Z ##[section]Finishing: Disable git automatic line ending conversion
2020-02-19T05:04:24.5114526Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/68847/merge to s
2020-02-19T05:04:24.5116166Z Task         : Get sources
2020-02-19T05:04:24.5116195Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-19T05:04:24.5116239Z Version      : 1.0.0
2020-02-19T05:04:24.5116267Z Author       : Microsoft
---
2020-02-19T05:04:25.5540912Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-02-19T05:04:25.5637773Z ##[command]git config gc.auto 0
2020-02-19T05:04:25.5718557Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-02-19T05:04:25.5774648Z ##[command]git config --get-all http.proxy
2020-02-19T05:04:25.5930823Z ##[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/68847/merge:refs/remotes/pull/68847/merge
---
2020-02-19T05:55:47.9771038Z .................................................................................................... 1700/9682
2020-02-19T05:55:51.9412071Z .................................................................................................... 1800/9682
2020-02-19T05:56:01.6632080Z ...................................i................................................................ 1900/9682
2020-02-19T05:56:07.9710408Z .................................................................................................... 2000/9682
2020-02-19T05:56:20.2059150Z .........................iiiii...................................................................... 2100/9682
2020-02-19T05:56:28.2312242Z .................................................................................................... 2300/9682
2020-02-19T05:56:30.1761019Z .................................................................................................... 2400/9682
2020-02-19T05:56:33.8329018Z .................................................................................................... 2500/9682
2020-02-19T05:56:50.9151424Z .................................................................................................... 2600/9682
---
2020-02-19T05:59:06.3588911Z i................................................................................................... 5000/9682
2020-02-19T05:59:13.9320900Z .................................................................................................... 5100/9682
2020-02-19T05:59:18.0567493Z ...........................i........................................................................ 5200/9682
2020-02-19T05:59:27.1425914Z .................................................................................................... 5300/9682
2020-02-19T05:59:31.8599767Z ..ii.ii........i...i................................................................................ 5400/9682
2020-02-19T05:59:40.6506275Z .................................................................................................... 5600/9682
2020-02-19T05:59:49.3488807Z ............................................................................................i....... 5700/9682
2020-02-19T05:59:55.9943993Z .................................................................................................... 5800/9682
2020-02-19T06:00:00.1982038Z ..........................................................................................i......... 5900/9682
2020-02-19T06:00:00.1982038Z ..........................................................................................i......... 5900/9682
2020-02-19T06:00:08.8344233Z ...................................................................................ii...i..ii....... 6000/9682
2020-02-19T06:00:28.4158523Z .................................................................................................... 6200/9682
2020-02-19T06:00:34.6539817Z .................................................................................................... 6300/9682
2020-02-19T06:00:40.9875123Z .................................................................................................... 6400/9682
2020-02-19T06:00:40.9875123Z .................................................................................................... 6400/9682
2020-02-19T06:00:54.3179584Z ...........i..ii.................................................................................... 6500/9682
2020-02-19T06:01:10.5670791Z .................................................................................................... 6700/9682
2020-02-19T06:01:12.4287633Z ...i................................................................................................ 6800/9682
2020-02-19T06:01:14.3352193Z .................................................................................................... 6900/9682
2020-02-19T06:01:16.3085913Z .........................i.......................................................................... 7000/9682
---
2020-02-19T06:02:44.3719424Z .................................................................................................... 7700/9682
2020-02-19T06:02:49.1536277Z .................................................................................................... 7800/9682
2020-02-19T06:02:54.2924616Z .....................................................................i...F.......................... 7900/9682
2020-02-19T06:03:02.8919610Z .................................................................................................... 8000/9682
2020-02-19T06:03:07.9561742Z ..................iiiiiii.i......................................................................... 8100/9682
2020-02-19T06:03:20.0950465Z .................................................................................................... 8300/9682
2020-02-19T06:03:28.0997186Z .................................................................................................... 8400/9682
2020-02-19T06:03:40.3943821Z .................................................................................................... 8500/9682
2020-02-19T06:03:46.5597018Z .................................................................................................... 8600/9682
---
2020-02-19T06:05:28.2027549Z 4 LL |     fn foo() { non_const() }
2020-02-19T06:05:28.2027903Z -    |     ^^^^^^^^^^^^^^^^^^^^^^^^
2020-02-19T06:05:28.2028063Z +    |                ^^^^^^^^^^^
2020-02-19T06:05:28.2028190Z 6    |
2020-02-19T06:05:28.2028708Z 7    = note: see issue #57563 <***/issues/57563> for more information
2020-02-19T06:05:28.2028897Z 8    = help: add `#![feature(const_fn)]` to the crate attributes to enable
2020-02-19T06:05:28.2029144Z 
2020-02-19T06:05:28.2029271Z The actual stderr differed from the expected stderr.
2020-02-19T06:05:28.2029744Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl/const-check-fns-in-const-impl.stderr
2020-02-19T06:05:28.2029744Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl/const-check-fns-in-const-impl.stderr
2020-02-19T06:05:28.2030118Z To update references, rerun the tests and pass the `--bless` flag
2020-02-19T06:05:28.2030548Z To only update this specific test, also pass `--test-args rfc-2632-const-trait-impl/const-check-fns-in-const-impl.rs`
2020-02-19T06:05:28.2030831Z error: 1 errors occurred comparing output.
2020-02-19T06:05:28.2031183Z status: exit code: 1
2020-02-19T06:05:28.2031183Z status: exit code: 1
2020-02-19T06:05:28.2032291Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-A" "unused" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl/auxiliary"
2020-02-19T06:05:28.2033223Z ------------------------------------------
2020-02-19T06:05:28.2033392Z 
2020-02-19T06:05:28.2033712Z ------------------------------------------
2020-02-19T06:05:28.2033884Z stderr:
2020-02-19T06:05:28.2033884Z stderr:
2020-02-19T06:05:28.2034215Z ------------------------------------------
2020-02-19T06:05:28.2034395Z error[E0723]: can only call other `const fn` within a `const fn`, but `const non_const` is not stable as `const fn`
2020-02-19T06:05:28.2034772Z   --> /checkout/src/test/ui/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.rs:12:16
2020-02-19T06:05:28.2034963Z    |
2020-02-19T06:05:28.2035092Z LL |     fn foo() { non_const() }
2020-02-19T06:05:28.2035233Z    |                ^^^^^^^^^^^
2020-02-19T06:05:28.2035360Z    |
2020-02-19T06:05:28.2035941Z    = note: see issue #57563 <***/issues/57563> for more information
2020-02-19T06:05:28.2036139Z    = help: add `#![feature(const_fn)]` to the crate attributes to enable
2020-02-19T06:05:28.2036390Z error: aborting due to previous error
2020-02-19T06:05:28.2036677Z 
2020-02-19T06:05:28.2037024Z For more information about this error, try `rustc --explain E0723`.
2020-02-19T06:05:28.2037170Z 
---
2020-02-19T06:05:28.2042168Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
2020-02-19T06:05:28.2042418Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2020-02-19T06:05:28.2052519Z 
2020-02-19T06:05:28.2052742Z 
2020-02-19T06:05:28.2057951Z 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-7/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" "7.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2020-02-19T06:05:28.2059280Z 
2020-02-19T06:05:28.2059309Z 
2020-02-19T06:05:28.2090894Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2020-02-19T06:05:28.2091004Z Build completed unsuccessfully in 0:55:29
2020-02-19T06:05:28.2091004Z Build completed unsuccessfully in 0:55:29
2020-02-19T06:05:28.2124900Z == clock drift check ==
2020-02-19T06:05:28.2152430Z   local time: Wed Feb 19 06:05:28 UTC 2020
2020-02-19T06:05:28.5111936Z   network time: Wed, 19 Feb 2020 06:05:28 GMT
2020-02-19T06:05:28.5112035Z == end clock drift check ==
2020-02-19T06:05:28.9678273Z 
2020-02-19T06:05:28.9768522Z ##[error]Bash exited with code '1'.
2020-02-19T06:05:28.9780643Z ##[section]Finishing: Run build
2020-02-19T06:05:28.9800359Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/68847/merge to s
2020-02-19T06:05:28.9802098Z Task         : Get sources
2020-02-19T06:05:28.9802135Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-02-19T06:05:28.9802204Z Version      : 1.0.0
2020-02-19T06:05:28.9802237Z Author       : Microsoft
2020-02-19T06:05:28.9802237Z Author       : Microsoft
2020-02-19T06:05:28.9802273Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-02-19T06:05:28.9802330Z ==============================================================================
2020-02-19T06:05:29.3585942Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-02-19T06:05:29.3622562Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/68847/merge to s
2020-02-19T06:05:29.3716802Z Cleaning up task key
2020-02-19T06:05:29.3717427Z Start cleaning up orphan processes.
2020-02-19T06:05:29.3806818Z Terminate orphan process: pid (3582) (python)
2020-02-19T06:05:29.3993593Z ##[section]Finishing: Finalize Job

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)

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Feb 19, 2020

r=me with tests blessed

@ecstatic-morse ecstatic-morse force-pushed the ecstatic-morse:const-impl branch from a06734d to 19801b1 Feb 19, 2020
@ecstatic-morse

This comment has been minimized.

Copy link
Contributor Author

ecstatic-morse commented Feb 19, 2020

@bors r=oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 19, 2020

📌 Commit 19801b1 has been approved by oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 20, 2020

⌛️ Testing commit 19801b1 with merge 6af388b...

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 20, 2020

☀️ Test successful - checks-azure
Approved by: oli-obk
Pushing 6af388b to master...

@bors bors added the merged-by-bors label Feb 20, 2020
@bors bors merged commit 6af388b into rust-lang:master Feb 20, 2020
5 checks passed
5 checks passed
homu Test successful
Details
pr Build #20200219.35 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.