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

Function pointers as const generic arguments #64986

Merged
merged 10 commits into from
Oct 12, 2019

Conversation

BenLewis-Seequent
Copy link

Makes function pointers as const generic arguments usable.

Fixes #62395

r? @varkor

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 2, 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-10-02T07:53:12.2807135Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-02T07:53:12.2997583Z ##[command]git config gc.auto 0
2019-10-02T07:53:12.3065845Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-02T07:53:12.3116894Z ##[command]git config --get-all http.proxy
2019-10-02T07:53:12.3241086Z ##[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/64986/merge:refs/remotes/pull/64986/merge
---
2019-10-02T08:49:39.8296486Z .................................................................................................... 1400/9087
2019-10-02T08:49:45.6106205Z .................................................................................................... 1500/9087
2019-10-02T08:49:51.7395158Z .................................................................................................... 1600/9087
2019-10-02T08:50:00.5026918Z .................................................................................................... 1700/9087
2019-10-02T08:50:08.1156596Z .i...............i.................................................................................. 1800/9087
2019-10-02T08:50:14.4284878Z ............................................................................................iiiii... 1900/9087
2019-10-02T08:50:34.7212084Z .................................................................................................... 2100/9087
2019-10-02T08:50:36.8302919Z .................................................................................................... 2200/9087
2019-10-02T08:50:39.1698558Z .................................................................................................... 2300/9087
2019-10-02T08:50:45.0467615Z .................................................................................................... 2400/9087
---
2019-10-02T08:53:27.0056131Z ...............................................................................i...............i.... 4700/9087
2019-10-02T08:53:34.3228998Z .................................................................................................... 4800/9087
2019-10-02T08:53:43.5781202Z .................................................................................................... 4900/9087
2019-10-02T08:53:49.0548895Z .................................................................................................... 5000/9087
2019-10-02T08:53:59.2605201Z ......................................................................ii.ii......................... 5100/9087
2019-10-02T08:54:07.9827960Z .................................................................................................... 5300/9087
2019-10-02T08:54:16.5707901Z .................................................................................................... 5400/9087
2019-10-02T08:54:23.2971951Z ....................................i............................................................... 5500/9087
2019-10-02T08:54:29.0244896Z .................................................................................................... 5600/9087
2019-10-02T08:54:29.0244896Z .................................................................................................... 5600/9087
2019-10-02T08:54:39.7931025Z .................................................................................................... 5700/9087
2019-10-02T08:54:49.2142545Z ................................ii...i..ii...........i.............................................. 5800/9087
2019-10-02T08:55:09.3642324Z .................................................................................................... 6000/9087
2019-10-02T08:55:17.4345535Z .................................................................................................... 6100/9087
2019-10-02T08:55:17.4345535Z .................................................................................................... 6100/9087
2019-10-02T08:55:31.2896567Z ...................................i..ii............................................................ 6200/9087
2019-10-02T08:55:49.9639069Z ...............................................................................................i.... 6400/9087
2019-10-02T08:55:51.8959429Z .................................................................................................... 6500/9087
2019-10-02T08:55:53.9017115Z ...................................................................i................................ 6600/9087
2019-10-02T08:55:56.6090882Z .................................................................................................... 6700/9087
---
2019-10-02T09:00:00.4899596Z running 57 tests
2019-10-02T09:00:05.3794889Z ...........F.............................................
2019-10-02T09:00:05.3795881Z failures:
2019-10-02T09:00:05.3802166Z 
2019-10-02T09:00:05.3802963Z ---- [mir-opt] mir-opt/const_prop/reify_fn_ptr.rs stdout ----
2019-10-02T09:00:05.3805439Z thread '[mir-opt] mir-opt/const_prop/reify_fn_ptr.rs' panicked at 'Did not find expected line, error: ran out of mir dump to match against
2019-10-02T09:00:05.3806081Z Expected Line: "     _3 = const Scalar(AllocId(0).0x0) : fn();"
2019-10-02T09:00:05.3806322Z Test Name: rustc.main.ConstProp.after.mir
2019-10-02T09:00:05.3806722Z ... (elided)
2019-10-02T09:00:05.3806895Z  bb0: {
2019-10-02T09:00:05.3807068Z ... (elided)
2019-10-02T09:00:05.3807068Z ... (elided)
2019-10-02T09:00:05.3807292Z      _3 = const Scalar(AllocId(0).0x0) : fn();
2019-10-02T09:00:05.3807466Z      _2 = move _3 as usize (Misc);
2019-10-02T09:00:05.3808602Z ... (elided)
2019-10-02T09:00:05.3808900Z      _1 = move _2 as *const fn() (Misc);
2019-10-02T09:00:05.3809118Z ... (elided)
2019-10-02T09:00:05.3810073Z Actual:
2019-10-02T09:00:05.3810674Z fn  main() -> () {
2019-10-02T09:00:05.3810905Z     let mut _0: ();
2019-10-02T09:00:05.3810905Z     let mut _0: ();
2019-10-02T09:00:05.3811079Z     let mut _1: *const fn();
2019-10-02T09:00:05.3811382Z     let mut _2: usize;
2019-10-02T09:00:05.3811497Z     let mut _3: fn();
2019-10-02T09:00:05.3811786Z     scope 1 {
2019-10-02T09:00:05.3812000Z     bb0: {
2019-10-02T09:00:05.3812127Z         StorageLive(_1);
2019-10-02T09:00:05.3812238Z         StorageLive(_2);
2019-10-02T09:00:05.3812346Z         StorageLive(_3);
2019-10-02T09:00:05.3812346Z         StorageLive(_3);
2019-10-02T09:00:05.3812479Z         _3 = const main;
2019-10-02T09:00:05.3812591Z         _2 = move _3 as usize (Misc);
2019-10-02T09:00:05.3812715Z         StorageDead(_3);
2019-10-02T09:00:05.3812844Z         _1 = move _2 as *const fn() (Misc);
2019-10-02T09:00:05.3812952Z         StorageDead(_2);
2019-10-02T09:00:05.3813060Z         StorageDead(_1);
2019-10-02T09:00:05.3813184Z         _0 = ();
2019-10-02T09:00:05.3813407Z     }
2019-10-02T09:00:05.3813407Z     }
2019-10-02T09:00:05.3813532Z     bb1 (cleanup): {
2019-10-02T09:00:05.3813638Z         resume;
2019-10-02T09:00:05.3814080Z }', src/tools/compiletest/src/runtest.rs:3296:13
2019-10-02T09:00:05.3815506Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-02T09:00:05.3815676Z 
2019-10-02T09:00:05.3815797Z 
---
2019-10-02T09:00:05.3817346Z 
2019-10-02T09:00:05.3818767Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-10-02T09:00:05.3818985Z 
2019-10-02T09:00:05.3819116Z 
2019-10-02T09:00:05.3820983Z 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/mir-opt" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "mir-opt" "--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-10-02T09:00:05.3821838Z 
2019-10-02T09:00:05.3821955Z 
2019-10-02T09:00:05.3822067Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-10-02T09:00:05.3822183Z Build completed unsuccessfully in 1:00:02
2019-10-02T09:00:05.3822183Z Build completed unsuccessfully in 1:00:02
2019-10-02T09:00:05.3864762Z == clock drift check ==
2019-10-02T09:00:05.3879016Z   local time: Wed Oct  2 09:00:05 UTC 2019
2019-10-02T09:00:05.5388449Z   network time: Wed, 02 Oct 2019 09:00:05 GMT
2019-10-02T09:00:05.5391997Z == end clock drift check ==
2019-10-02T09:00:09.5190244Z ##[error]Bash exited with code '1'.
2019-10-02T09:00:09.5230741Z ##[section]Starting: Checkout
2019-10-02T09:00:09.5232750Z ==============================================================================
2019-10-02T09:00:09.5232811Z Task         : Get sources
2019-10-02T09:00:09.5232847Z 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)

@varkor
Copy link
Member

varkor commented Oct 2, 2019

It would definitely be good not to ICE, or emit a link error here. Let's put the ability to use pointers in const arguments behind const_compare_raw_pointers as @oli-obk suggested, so people can play around with it intentionally, but it will throw a proper feature gate error otherwise.

@oli-obk
Copy link
Contributor

oli-obk commented Oct 2, 2019

It would definitely be good not to ICE, or emit a link error here.

Oh I wasn't even worried about that, but UX is a good point, too. I worry about unsoundness because of differences between runtime and compile time for the same const evaluable code.

@BenLewis-Seequent
Copy link
Author

I gated the use of both raw pointers and function pointers behind the feature gate const_compare_raw_pointers.

Copy link
Member

@varkor varkor left a comment

Choose a reason for hiding this comment

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

Thanks, this looks great! Minor diagnostic suggestion, and then it looks good to go!

src/librustc_typeck/collect.rs Outdated Show resolved Hide resolved
@varkor
Copy link
Member

varkor commented Oct 7, 2019

(@Skinny121: you'll need to run x.py test src/test/ui --bless to update the stderr files afterwards.)

@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-10-07T18:56:30.4048938Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-07T18:56:31.2985241Z ##[command]git config gc.auto 0
2019-10-07T18:56:31.2988730Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-07T18:56:31.2990661Z ##[command]git config --get-all http.proxy
2019-10-07T18:56:31.2993066Z ##[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/64986/merge:refs/remotes/pull/64986/merge
---
2019-10-07T19:57:58.0118396Z .................................................................................................... 1600/9128
2019-10-07T19:58:05.1966443Z .................................................................................................... 1700/9128
2019-10-07T19:58:17.1078176Z ..................i...............i................................................................. 1800/9128
2019-10-07T19:58:24.3752931Z .................................................................................................... 1900/9128
2019-10-07T19:58:40.3513344Z .........iiiii...................................................................................... 2000/9128
2019-10-07T19:58:49.3546736Z .................................................................................................... 2200/9128
2019-10-07T19:58:51.9379713Z .................................................................................................... 2300/9128
2019-10-07T19:58:57.6647035Z .................................................................................................... 2400/9128
2019-10-07T19:59:03.7882461Z ........................................................................................F........... 2500/9128
---
2019-10-07T20:01:58.6028110Z ...................................................................................................i 4700/9128
2019-10-07T20:02:05.9035538Z ...............i.................................................................................... 4800/9128
2019-10-07T20:02:17.3935828Z .................................................................................................... 4900/9128
2019-10-07T20:02:22.9875060Z .................................................................................................... 5000/9128
2019-10-07T20:02:34.6755858Z .............................................................................................ii.ii.. 5100/9128
2019-10-07T20:02:44.9394513Z .................................................................................................... 5300/9128
2019-10-07T20:02:54.6744252Z .................................................................................................... 5400/9128
2019-10-07T20:03:01.5821907Z ...........................................................i........................................ 5500/9128
2019-10-07T20:03:08.7471320Z .................................................................................................... 5600/9128
2019-10-07T20:03:08.7471320Z .................................................................................................... 5600/9128
2019-10-07T20:03:16.6980746Z .................................................................................................... 5700/9128
2019-10-07T20:03:26.5971995Z ........................................................ii...i..ii...........i...................... 5800/9128
2019-10-07T20:03:52.8685261Z .................................................................................................... 6000/9128
2019-10-07T20:04:02.3069950Z .................................................................................................... 6100/9128
2019-10-07T20:04:02.3069950Z .................................................................................................... 6100/9128
2019-10-07T20:04:09.5178853Z ..............................................................i..ii................................. 6200/9128
2019-10-07T20:04:38.5466954Z .................................................................................................... 6400/9128
2019-10-07T20:04:40.6958864Z ......................i............................................................................. 6500/9128
2019-10-07T20:04:42.9191247Z ...............................................................................................i.... 6600/9128
2019-10-07T20:04:45.6572852Z .................................................................................................... 6700/9128
---
2019-10-07T20:08:57.2899327Z 
2019-10-07T20:08:57.2900296Z ---- [ui] ui/feature-gates/feature-gate-const_generics-ptr.rs stdout ----
2019-10-07T20:08:57.2900647Z diff of stderr:
2019-10-07T20:08:57.2901379Z 
2019-10-07T20:08:57.2902125Z 16    = note: for more information, see ***/issues/44580
2019-10-07T20:08:57.2902504Z 17    = help: add `#![feature(const_generics)]` to the crate attributes to enable
2019-10-07T20:08:57.2903301Z - error[E0658]: use of function pointers as const generic arguments are unstable
2019-10-07T20:08:57.2903649Z + error[E0658]: using function pointers as const generic parameters is unstable
2019-10-07T20:08:57.2904323Z 20   --> $DIR/feature-gate-const_generics-ptr.rs:1:25
2019-10-07T20:08:57.2904763Z 21    |
2019-10-07T20:08:57.2904763Z 21    |
2019-10-07T20:08:57.2905011Z 22 LL | struct ConstFn<const F: fn()>;
2019-10-07T20:08:57.2905199Z 
2019-10-07T20:08:57.2905762Z 25    = note: for more information, see ***/issues/53020
2019-10-07T20:08:57.2906076Z 26    = help: add `#![feature(const_compare_raw_pointers)]` to the crate attributes to enable
2019-10-07T20:08:57.2906788Z - error[E0658]: use of raw pointers as const generic arguments are unstable
2019-10-07T20:08:57.2907087Z + error[E0658]: using raw pointers as const generic parameters is unstable
2019-10-07T20:08:57.2907557Z 29   --> $DIR/feature-gate-const_generics-ptr.rs:5:26
2019-10-07T20:08:57.2907862Z 30    |
2019-10-07T20:08:57.2907862Z 30    |
2019-10-07T20:08:57.2908088Z 31 LL | struct ConstPtr<const P: *const u32>;
2019-10-07T20:08:57.2908482Z 
2019-10-07T20:08:57.2908698Z The actual stderr differed from the expected stderr.
2019-10-07T20:08:57.2908698Z The actual stderr differed from the expected stderr.
2019-10-07T20:08:57.2909237Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gates/feature-gate-const_generics-ptr/feature-gate-const_generics-ptr.stderr
2019-10-07T20:08:57.2909795Z To update references, rerun the tests and pass the `--bless` flag
2019-10-07T20:08:57.2910695Z To only update this specific test, also pass `--test-args feature-gates/feature-gate-const_generics-ptr.rs`
2019-10-07T20:08:57.2912179Z error: 1 errors occurred comparing output.
2019-10-07T20:08:57.2912421Z status: exit code: 1
2019-10-07T20:08:57.2912421Z status: exit code: 1
2019-10-07T20:08:57.2913527Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/feature-gates/feature-gate-const_generics-ptr.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/feature-gates/feature-gate-const_generics-ptr" "-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/feature-gates/feature-gate-const_generics-ptr/auxiliary" "-A" "unused"
2019-10-07T20:08:57.2914757Z ------------------------------------------
2019-10-07T20:08:57.2915228Z 
2019-10-07T20:08:57.2915689Z ------------------------------------------
2019-10-07T20:08:57.2915993Z stderr:
2019-10-07T20:08:57.2915993Z stderr:
2019-10-07T20:08:57.2916415Z ------------------------------------------
2019-10-07T20:08:57.2916689Z error[E0658]: const generics are unstable
2019-10-07T20:08:57.2917174Z   --> /checkout/src/test/ui/feature-gates/feature-gate-const_generics-ptr.rs:1:22
2019-10-07T20:08:57.2917462Z    |
2019-10-07T20:08:57.2917700Z LL | struct ConstFn<const F: fn()>;
2019-10-07T20:08:57.2918117Z    |
2019-10-07T20:08:57.2918117Z    |
2019-10-07T20:08:57.2918627Z    = note: for more information, see ***/issues/44580
2019-10-07T20:08:57.2918944Z    = help: add `#![feature(const_generics)]` to the crate attributes to enable
2019-10-07T20:08:57.2919380Z error[E0658]: const generics are unstable
2019-10-07T20:08:57.2919890Z   --> /checkout/src/test/ui/feature-gates/feature-gate-const_generics-ptr.rs:5:23
2019-10-07T20:08:57.2920188Z    |
2019-10-07T20:08:57.2920188Z    |
2019-10-07T20:08:57.2920433Z LL | struct ConstPtr<const P: *const u32>;
2019-10-07T20:08:57.2921301Z    |
2019-10-07T20:08:57.2921301Z    |
2019-10-07T20:08:57.2921913Z    = note: for more information, see ***/issues/44580
2019-10-07T20:08:57.2922256Z    = help: add `#![feature(const_generics)]` to the crate attributes to enable
2019-10-07T20:08:57.2922731Z error[E0658]: using function pointers as const generic parameters is unstable
2019-10-07T20:08:57.2923259Z   --> /checkout/src/test/ui/feature-gates/feature-gate-const_generics-ptr.rs:1:25
2019-10-07T20:08:57.2923613Z    |
2019-10-07T20:08:57.2923613Z    |
2019-10-07T20:08:57.2923856Z LL | struct ConstFn<const F: fn()>;
2019-10-07T20:08:57.2924342Z    |
2019-10-07T20:08:57.2924342Z    |
2019-10-07T20:08:57.2925241Z    = note: for more information, see ***/issues/53020
2019-10-07T20:08:57.2926081Z    = help: add `#![feature(const_compare_raw_pointers)]` to the crate attributes to enable
2019-10-07T20:08:57.2927063Z error[E0658]: using raw pointers as const generic parameters is unstable
2019-10-07T20:08:57.2927607Z   --> /checkout/src/test/ui/feature-gates/feature-gate-const_generics-ptr.rs:5:26
2019-10-07T20:08:57.2927968Z    |
2019-10-07T20:08:57.2927968Z    |
2019-10-07T20:08:57.2928125Z LL | struct ConstPtr<const P: *const u32>;
2019-10-07T20:08:57.2928391Z    |
2019-10-07T20:08:57.2928391Z    |
2019-10-07T20:08:57.2928803Z    = note: for more information, see ***/issues/53020
2019-10-07T20:08:57.2928994Z    = help: add `#![feature(const_compare_raw_pointers)]` to the crate attributes to enable
2019-10-07T20:08:57.2931525Z error: aborting due to 4 previous errors
2019-10-07T20:08:57.2931808Z 
2019-10-07T20:08:57.2932348Z For more information about this error, try `rustc --explain E0658`.
2019-10-07T20:08:57.2932567Z 
---
2019-10-07T20:08:57.2936379Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-10-07T20:08:57.2936727Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-07T20:08:57.2952525Z 
2019-10-07T20:08:57.2953084Z 
2019-10-07T20:08:57.2955425Z 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-10-07T20:08:57.2956068Z 
2019-10-07T20:08:57.2956188Z 
2019-10-07T20:08:57.3009161Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-10-07T20:08:57.3009271Z Build completed unsuccessfully in 1:05:18
2019-10-07T20:08:57.3009271Z Build completed unsuccessfully in 1:05:18
2019-10-07T20:08:57.3019320Z == clock drift check ==
2019-10-07T20:08:57.3041444Z   local time: Mon Oct  7 20:08:57 UTC 2019
2019-10-07T20:08:57.4005292Z   network time: Mon, 07 Oct 2019 20:08:57 GMT
2019-10-07T20:08:57.4010700Z == end clock drift check ==
2019-10-07T20:08:58.6875219Z ##[error]Bash exited with code '1'.
2019-10-07T20:08:58.6922132Z ##[section]Starting: Checkout
2019-10-07T20:08:58.6924074Z ==============================================================================
2019-10-07T20:08:58.6924137Z Task         : Get sources
2019-10-07T20:08:58.6924190Z 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)

@BenLewis-Seequent
Copy link
Author

I forgot that I would have to do that :). I also rebased so that the stderr files reflect the changes from #65154.

--> $DIR/raw-ptr-const-param.rs:7:38
|
LL | let _: Const<{15 as *const _}> = Const::<{10 as *const _}>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Scalar(0x000000000000000f) : *const u32`, found `Scalar(0x000000000000000a) : *const u32`
Copy link
Member

Choose a reason for hiding this comment

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

These diagnostics are not great, but we can file an issue for that.

@varkor
Copy link
Member

varkor commented Oct 8, 2019

Thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 8, 2019

📌 Commit 5986fe2 has been approved by varkor

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 8, 2019
Centril added a commit to Centril/rust that referenced this pull request Oct 9, 2019
…varkor

Function pointers as const generic arguments

Makes function pointers as const generic arguments usable.

Fixes rust-lang#62395

r? @varkor
bors added a commit that referenced this pull request Oct 9, 2019
Rollup of 6 pull requests

Successful merges:

 - #64656 (Implement (HashMap) Entry::insert as per #60142)
 - #64986 (Function pointers as const generic arguments)
 - #65037 (`#[track_caller]` feature gate (RFC 2091 1/N))
 - #65166 (Suggest to add `move` keyword for generator capture)
 - #65175 (add more info in debug traces for gcu merging)
 - #65220 (Update LLVM for Emscripten exception handling support)

Failed merges:

r? @ghost
@Centril
Copy link
Contributor

Centril commented Oct 9, 2019

Failed in #65227 (comment), @bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 9, 2019
@varkor
Copy link
Member

varkor commented Oct 9, 2019

Maybe we should normalise the printing of pointers to {pointer} or similar.

@BenLewis-Seequent
Copy link
Author

I changed the printing of point to {pointer}. This can probably be improved in future to be more detailed, as currently, it will produce potentially confusing diagnostics where found type looks the same as the expected type.

@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-10-09T19:12:21.9160434Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-09T19:12:21.9263200Z ##[command]git config gc.auto 0
2019-10-09T19:12:21.9338043Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-09T19:12:21.9398250Z ##[command]git config --get-all http.proxy
2019-10-09T19:12:21.9542438Z ##[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/64986/merge:refs/remotes/pull/64986/merge
---
2019-10-09T20:11:07.3827514Z .................................................................................................... 1600/9147
2019-10-09T20:11:14.0993343Z .................................................................................................... 1700/9147
2019-10-09T20:11:25.7455011Z .....................i...............i.............................................................. 1800/9147
2019-10-09T20:11:32.5911423Z .................................................................................................... 1900/9147
2019-10-09T20:11:48.1834552Z ............iiiii................................................................................... 2000/9147
2019-10-09T20:11:58.0052666Z .................................................................................................... 2200/9147
2019-10-09T20:12:00.5066240Z .................................................................................................... 2300/9147
2019-10-09T20:12:05.9048980Z .................................................................................................... 2400/9147
2019-10-09T20:12:12.0452412Z .................................................................................................... 2500/9147
---
2019-10-09T20:15:06.7053615Z ......i...............i............................................................................. 4800/9147
2019-10-09T20:15:17.7134463Z .................................................................................................... 4900/9147
2019-10-09T20:15:23.4073901Z .................................................................................................... 5000/9147
2019-10-09T20:15:34.7942107Z .................................................................................................... 5100/9147
2019-10-09T20:15:40.2099083Z ii.ii............................................................................................... 5200/9147
2019-10-09T20:15:54.2911222Z .................................................................................................... 5400/9147
2019-10-09T20:16:01.4346043Z ..................................................................i................................. 5500/9147
2019-10-09T20:16:08.6668090Z .................................................................................................... 5600/9147
2019-10-09T20:16:15.5153408Z .................................................................................................... 5700/9147
2019-10-09T20:16:15.5153408Z .................................................................................................... 5700/9147
2019-10-09T20:16:27.8408201Z ...............................................................ii...i..ii...........i............... 5800/9147
2019-10-09T20:16:53.8372569Z .................................................................................................... 6000/9147
2019-10-09T20:17:03.4972386Z .................................................................................................... 6100/9147
2019-10-09T20:17:03.4972386Z .................................................................................................... 6100/9147
2019-10-09T20:17:09.5357496Z .....................................................................i..ii.......................... 6200/9147
2019-10-09T20:17:39.9126689Z .................................................................................................... 6400/9147
2019-10-09T20:17:42.0498006Z .............................i...................................................................... 6500/9147
2019-10-09T20:17:44.3558724Z .................................................................................................... 6600/9147
2019-10-09T20:17:47.1402801Z ..i................................................................................................. 6700/9147
---
2019-10-09T20:22:28.7697390Z running 57 tests
2019-10-09T20:22:33.5544865Z .......F.................................................
2019-10-09T20:22:33.5546060Z failures:
2019-10-09T20:22:33.5548397Z 
2019-10-09T20:22:33.5549211Z ---- [mir-opt] mir-opt/const_prop/const_prop_fails_gracefully.rs stdout ----
2019-10-09T20:22:33.5549413Z [ERROR compiletest::runtest] None
2019-10-09T20:22:33.5549861Z thread '[mir-opt] mir-opt/const_prop/const_prop_fails_gracefully.rs' panicked at 'Did not find expected line, error: Mismatch in lines
2019-10-09T20:22:33.5550066Z Current block: None
2019-10-09T20:22:33.5550202Z Actual Line: "        _2 = const {pointer};"
2019-10-09T20:22:33.5550372Z Expected Line: "     _2 = const Scalar(AllocId(1).0x0) : *const i32;"
2019-10-09T20:22:33.5550518Z Test Name: rustc.main.ConstProp.after.mir
2019-10-09T20:22:33.5550802Z ... (elided)
2019-10-09T20:22:33.5550922Z  bb0: {
2019-10-09T20:22:33.5551045Z ... (elided)
2019-10-09T20:22:33.5551045Z ... (elided)
2019-10-09T20:22:33.5551190Z      _4 = const Scalar(AllocId(1).0x0) : &i32;
2019-10-09T20:22:33.5551316Z      _3 = const Scalar(AllocId(1).0x0) : &i32;
2019-10-09T20:22:33.5551443Z      _2 = const Scalar(AllocId(1).0x0) : *const i32;
2019-10-09T20:22:33.5551587Z ... (elided)
2019-10-09T20:22:33.5551711Z      _1 = move _2 as usize (Misc);
2019-10-09T20:22:33.5551848Z ... (elided)
2019-10-09T20:22:33.5551971Z      _6 = _1;
2019-10-09T20:22:33.5552307Z      _5 = const read(move _6) -> bb1;
2019-10-09T20:22:33.5552609Z Actual:
2019-10-09T20:22:33.5553686Z fn  main() -> () {
2019-10-09T20:22:33.5553920Z     let mut _0: ();
2019-10-09T20:22:33.5554063Z     let _1: usize;
2019-10-09T20:22:33.5554063Z     let _1: usize;
2019-10-09T20:22:33.5554400Z     let mut _2: *const i32;
2019-10-09T20:22:33.5554606Z     let mut _3: &i32;
2019-10-09T20:22:33.5554749Z     let mut _4: &i32;
2019-10-09T20:22:33.5554885Z     let _5: ();
2019-10-09T20:22:33.5555034Z     let mut _6: usize;
2019-10-09T20:22:33.5555171Z     scope 1 {
2019-10-09T20:22:33.5555453Z     bb0: {
2019-10-09T20:22:33.5555590Z         StorageLive(_1);
2019-10-09T20:22:33.5555725Z         StorageLive(_2);
2019-10-09T20:22:33.5555875Z         StorageLive(_3);
2019-10-09T20:22:33.5555875Z         StorageLive(_3);
2019-10-09T20:22:33.5556010Z         StorageLive(_4);
2019-10-09T20:22:33.5556149Z         _4 = const Scalar(AllocId(1).0x0) : &i32;
2019-10-09T20:22:33.5556311Z         _3 = const Scalar(AllocId(1).0x0) : &i32;
2019-10-09T20:22:33.5556607Z         _2 = const {pointer};
2019-10-09T20:22:33.5556874Z         StorageDead(_3);
2019-10-09T20:22:33.5557043Z         _1 = move _2 as usize (Misc);
2019-10-09T20:22:33.5557181Z         StorageDead(_2);
2019-10-09T20:22:33.5557311Z         StorageDead(_4);
2019-10-09T20:22:33.5557632Z         StorageLive(_5);
2019-10-09T20:22:33.5557761Z         StorageLive(_6);
2019-10-09T20:22:33.5557900Z         _6 = _1;
2019-10-09T20:22:33.5558288Z         _5 = const read(move _6) -> bb1;
2019-10-09T20:22:33.5558600Z     bb1: {
2019-10-09T20:22:33.5558728Z         StorageDead(_6);
2019-10-09T20:22:33.5558854Z         StorageDead(_5);
2019-10-09T20:22:33.5558993Z         _0 = ();
2019-10-09T20:22:33.5558993Z         _0 = ();
2019-10-09T20:22:33.5559119Z         StorageDead(_1);
2019-10-09T20:22:33.5559244Z         return;
2019-10-09T20:22:33.5559382Z     }
2019-10-09T20:22:33.5559508Z     bb2 (cleanup): {
2019-10-09T20:22:33.5559634Z         resume;
2019-10-09T20:22:33.5560114Z }', src/tools/compiletest/src/runtest.rs:3296:13
2019-10-09T20:22:33.5560284Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-09T20:22:33.5560422Z 
2019-10-09T20:22:33.5561759Z 
2019-10-09T20:22:33.5561759Z 
2019-10-09T20:22:33.5561961Z failures:
2019-10-09T20:22:33.5562416Z     [mir-opt] mir-opt/const_prop/const_prop_fails_gracefully.rs
2019-10-09T20:22:33.5562784Z 
2019-10-09T20:22:33.5563585Z test result: FAILED. 56 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
2019-10-09T20:22:33.5563820Z 
2019-10-09T20:22:33.5563965Z 
2019-10-09T20:22:33.5564086Z 
2019-10-09T20:22:33.5564561Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-10-09T20:22:33.5572234Z 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/mir-opt" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "mir-opt" "--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-10-09T20:22:33.5573084Z 
2019-10-09T20:22:33.5573239Z 
2019-10-09T20:22:33.5578380Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-10-09T20:22:33.5578772Z Build completed unsuccessfully in 1:03:54
2019-10-09T20:22:33.5578772Z Build completed unsuccessfully in 1:03:54
2019-10-09T20:22:33.5632447Z == clock drift check ==
2019-10-09T20:22:33.5651712Z   local time: Wed Oct  9 20:22:33 UTC 2019
2019-10-09T20:22:33.6528283Z   network time: Wed, 09 Oct 2019 20:22:33 GMT
2019-10-09T20:22:33.6530741Z == end clock drift check ==
2019-10-09T20:22:35.3163631Z ##[error]Bash exited with code '1'.
2019-10-09T20:22:35.3213904Z ##[section]Starting: Checkout
2019-10-09T20:22:35.3215834Z ==============================================================================
2019-10-09T20:22:35.3215911Z Task         : Get sources
2019-10-09T20:22:35.3215962Z 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)

@varkor
Copy link
Member

varkor commented Oct 10, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Oct 10, 2019

📌 Commit 8569dd1 has been approved by varkor

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 10, 2019
tmandry added a commit to tmandry/rust that referenced this pull request Oct 11, 2019
…varkor

Function pointers as const generic arguments

Makes function pointers as const generic arguments usable.

Fixes rust-lang#62395

r? @varkor
tmandry added a commit to tmandry/rust that referenced this pull request Oct 11, 2019
…varkor

Function pointers as const generic arguments

Makes function pointers as const generic arguments usable.

Fixes rust-lang#62395

r? @varkor
tmandry added a commit to tmandry/rust that referenced this pull request Oct 11, 2019
Rollup of 16 pull requests

Successful merges:

 - rust-lang#64337 (libstd: Fix typos in doc)
 - rust-lang#64986 (Function pointers as const generic arguments)
 - rust-lang#65048 (Added doc about behavior of extend on HashMap)
 - rust-lang#65191 (Add some regression tests)
 - rust-lang#65200 (Add ?Sized bound to a supertrait listing in E0038 error documentation)
 - rust-lang#65205 (Add long error explanation for E0568)
 - rust-lang#65240 (self-profiling: Add events for metadata loading (plus a small dep-tracking optimization))
 - rust-lang#65248 (Suggest `if let` on `let` refutable binding)
 - rust-lang#65252 (expand: Simplify expansion of derives)
 - rust-lang#65263 (Deduplicate is_{freeze,copy,sized}_raw)
 - rust-lang#65265 (Cleanup librustc mir err codes)
 - rust-lang#65266 (Mark Path::join as must_use)
 - rust-lang#65276 (Don't cc rust-lang/compiler for toolstate changes)
 - rust-lang#65277 (Query generator kind for error reporting)
 - rust-lang#65283 (stability: Do not use `buffer_lint` after lowering to HIR)
 - rust-lang#65289 (Fix suggested bound addition diagnostic)

Failed merges:

r? @ghost
Centril added a commit to Centril/rust that referenced this pull request Oct 11, 2019
Rollup of 16 pull requests

Successful merges:

 - rust-lang#64337 (libstd: Fix typos in doc)
 - rust-lang#64986 (Function pointers as const generic arguments)
 - rust-lang#65048 (Added doc about behavior of extend on HashMap)
 - rust-lang#65191 (Add some regression tests)
 - rust-lang#65200 (Add ?Sized bound to a supertrait listing in E0038 error documentation)
 - rust-lang#65205 (Add long error explanation for E0568)
 - rust-lang#65240 (self-profiling: Add events for metadata loading (plus a small dep-tracking optimization))
 - rust-lang#65248 (Suggest `if let` on `let` refutable binding)
 - rust-lang#65252 (expand: Simplify expansion of derives)
 - rust-lang#65263 (Deduplicate is_{freeze,copy,sized}_raw)
 - rust-lang#65265 (Cleanup librustc mir err codes)
 - rust-lang#65266 (Mark Path::join as must_use)
 - rust-lang#65276 (Don't cc rust-lang/compiler for toolstate changes)
 - rust-lang#65277 (Query generator kind for error reporting)
 - rust-lang#65283 (stability: Do not use `buffer_lint` after lowering to HIR)
 - rust-lang#65289 (Fix suggested bound addition diagnostic)

Failed merges:

r? @ghost
tmandry added a commit to tmandry/rust that referenced this pull request Oct 11, 2019
…varkor

Function pointers as const generic arguments

Makes function pointers as const generic arguments usable.

Fixes rust-lang#62395

r? @varkor
bors added a commit that referenced this pull request Oct 12, 2019
Rollup of 15 pull requests

Successful merges:

 - #64337 (libstd: Fix typos in doc)
 - #64986 (Function pointers as const generic arguments)
 - #65048 (Added doc about behavior of extend on HashMap)
 - #65191 (Add some regression tests)
 - #65200 (Add ?Sized bound to a supertrait listing in E0038 error documentation)
 - #65205 (Add long error explanation for E0568)
 - #65220 (Update LLVM for Emscripten exception handling support)
 - #65263 (Deduplicate is_{freeze,copy,sized}_raw)
 - #65266 (Mark Path::join as must_use)
 - #65276 (Don't cc rust-lang/compiler for toolstate changes)
 - #65277 (Query generator kind for error reporting)
 - #65283 (stability: Do not use `buffer_lint` after lowering to HIR)
 - #65289 (Fix suggested bound addition diagnostic)
 - #65310 (deriving: avoid dummy Span on an artificial `type_ident` path)
 - #65321 (Remove painful test that is not pulling its weight)

Failed merges:

r? @ghost
@bors bors merged commit 8569dd1 into rust-lang:master Oct 12, 2019
@eddyb
Copy link
Member

eddyb commented Oct 12, 2019

I changed the printing of point to {pointer}. This can probably be improved in future to be more detailed, as currently, it will produce potentially confusing diagnostics where found type looks the same as the expected type.

If there wasn't an issue opened for fixing this, there should be, so we won't forget about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-const_generics `#![feature(const_generics)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Const generics with function pointers produces linker error.
8 participants