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

rustc_typeck: improve diagnostics for _ const/static declarations #62804

Merged
merged 4 commits into from
Jul 23, 2019

Conversation

lundibundi
Copy link
Contributor

This continues #62694 and adds type suggestions to const/static declarations with _ type.

r? @eddyb

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 19, 2019
@eddyb
Copy link
Member

eddyb commented Jul 19, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Jul 19, 2019

📌 Commit 469b7a9 has been approved by eddyb

@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 Jul 19, 2019
@lundibundi
Copy link
Contributor Author

@eddyb added a few tests that weren't covered by existing cases.

@eddyb
Copy link
Member

eddyb commented Jul 19, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Jul 19, 2019

📌 Commit c6735a6 has been approved by eddyb

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (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-07-19T16:11:38.4942769Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-07-19T16:11:38.5130400Z ##[command]git config gc.auto 0
2019-07-19T16:11:38.5205442Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-07-19T16:11:38.5256402Z ##[command]git config --get-all http.proxy
2019-07-19T16:11:38.5397313Z ##[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/62804/merge:refs/remotes/pull/62804/merge
---
2019-07-19T16:12:12.2343552Z do so (now or later) by using -b with the checkout command again. Example:
2019-07-19T16:12:12.2343584Z 
2019-07-19T16:12:12.2343789Z   git checkout -b <new-branch-name>
2019-07-19T16:12:12.2343819Z 
2019-07-19T16:12:12.2343887Z HEAD is now at 64504fc1c Merge c6735a624b45f8170299c0539856c7d3b5f29422 into 527dce7137f7a3c7bf47d9a503abf25f88ea22de
2019-07-19T16:12:12.2492591Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-07-19T16:12:12.2495349Z ==============================================================================
2019-07-19T16:12:12.2495398Z Task         : Bash
2019-07-19T16:12:12.2495466Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-07-19T17:09:44.3416350Z .................................................................................................... 200/5835
2019-07-19T17:09:48.7767284Z .................................................................................................... 300/5835
2019-07-19T17:09:52.1536042Z .................................................................................................... 400/5835
2019-07-19T17:09:55.5750946Z .................................................................................................... 500/5835
2019-07-19T17:09:59.0322440Z ........................................................................i........................... 600/5835
2019-07-19T17:10:07.3088327Z .................................................................................................... 800/5835
2019-07-19T17:10:12.4316344Z .................................................................................................... 900/5835
2019-07-19T17:10:17.0727664Z ...................................................................................................i 1000/5835
2019-07-19T17:10:17.0727664Z ...................................................................................................i 1000/5835
2019-07-19T17:10:23.0743726Z ...........i........................................................................................ 1100/5835
2019-07-19T17:10:26.9229956Z .............................iiiii.................................................................. 1200/5835
2019-07-19T17:10:32.3947655Z F................................................................................................... 1400/5835
2019-07-19T17:10:34.8879720Z .................................................................................................... 1500/5835
2019-07-19T17:10:38.3011707Z .................................................................................................... 1600/5835
2019-07-19T17:10:40.6205701Z .................................................................................................... 1700/5835
2019-07-19T17:10:40.6205701Z .................................................................................................... 1700/5835
2019-07-19T17:10:43.7222698Z ...................................................................i................................ 1800/5835
2019-07-19T17:10:51.6977986Z .................................................................................................... 2000/5835
2019-07-19T17:10:55.5467247Z .................................................................................................... 2100/5835
2019-07-19T17:10:59.0189522Z .................................................................................................... 2200/5835
2019-07-19T17:10:59.0189522Z .................................................................................................... 2200/5835
2019-07-19T17:11:02.5754268Z ..................................................i................................................. 2300/5835
2019-07-19T17:11:11.5003025Z .................................................................................................... 2500/5835
2019-07-19T17:11:15.2732568Z .................................................................................................... 2600/5835
2019-07-19T17:11:20.0702666Z .................................................................................................... 2700/5835
2019-07-19T17:11:23.7538635Z .................................................................................................... 2800/5835
2019-07-19T17:11:23.7538635Z .................................................................................................... 2800/5835
2019-07-19T17:11:27.7539196Z .................................................................................................... 2900/5835
2019-07-19T17:11:32.7784436Z .................................................................................................... 3000/5835
2019-07-19T17:11:37.1265242Z .................................................................................................... 3100/5835
2019-07-19T17:11:42.2473527Z .................................................................................................... 3200/5835
2019-07-19T17:11:45.5768416Z .................................................................................................... 3300/5835
2019-07-19T17:11:49.1553354Z .................................................................................................... 3400/5835
2019-07-19T17:11:54.0541233Z .................................................................................................... 3500/5835
2019-07-19T17:11:57.7407549Z ............i....................................................................................... 3600/5835
2019-07-19T17:12:01.6913273Z ......................................................................................ii...i..ii.... 3700/5835
2019-07-19T17:12:10.2576284Z .................................................................................................... 3900/5835
2019-07-19T17:12:13.9518726Z .................................................................................................... 4000/5835
2019-07-19T17:12:13.9518726Z .................................................................................................... 4000/5835
2019-07-19T17:12:17.3995116Z ii.................................................................................................. 4100/5835
2019-07-19T17:12:19.3946214Z .....................i.............................................................................. 4200/5835
2019-07-19T17:12:21.3524323Z .......................................................................................i............ 4300/5835
2019-07-19T17:12:29.5577123Z .................................................................................................... 4500/5835
2019-07-19T17:12:45.2684231Z .................................................................................................... 4600/5835
2019-07-19T17:12:48.5624866Z .................................................................................................... 4700/5835
2019-07-19T17:12:52.2297774Z .................................................................................................... 4800/5835
---
2019-07-19T17:13:24.7161803Z .................................................................................................... 5400/5835
2019-07-19T17:13:28.4817861Z .................................................................................................... 5500/5835
2019-07-19T17:13:32.4500440Z .................................................................................................... 5600/5835
2019-07-19T17:13:35.5169148Z .................................................................................................... 5700/5835
2019-07-19T17:13:38.3131176Z ...........................................................................i........................ 5800/5835
2019-07-19T17:13:39.5851372Z failures:
2019-07-19T17:13:39.5887566Z 
2019-07-19T17:13:39.5888057Z ---- [ui] ui/error-codes/E0121.rs stdout ----
2019-07-19T17:13:39.5888140Z diff of stderr:
2019-07-19T17:13:39.5888140Z diff of stderr:
2019-07-19T17:13:39.5888174Z 
2019-07-19T17:13:39.5888697Z 11   --> $DIR/E0121.rs:3:13
2019-07-19T17:13:39.5888752Z 12    |
2019-07-19T17:13:39.5888808Z 13 LL | static BAR: _ = "test";
2019-07-19T17:13:39.5888999Z -    |             ^ not allowed in type signatures
2019-07-19T17:13:39.5889092Z +    |             |
2019-07-19T17:13:39.5889132Z +    |             not allowed in type signatures
2019-07-19T17:13:39.5889132Z +    |             not allowed in type signatures
2019-07-19T17:13:39.5889337Z +    |             help: replace `_` with the correct type: `&'static str`
2019-07-19T17:13:39.5889444Z 16 error: aborting due to 2 previous errors
2019-07-19T17:13:39.5889482Z 17 
2019-07-19T17:13:39.5889517Z 
2019-07-19T17:13:39.5889555Z 
2019-07-19T17:13:39.5889555Z 
2019-07-19T17:13:39.5889798Z The actual stderr differed from the expected stderr.
2019-07-19T17:13:39.5890293Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0121/E0121.stderr
2019-07-19T17:13:39.5890524Z To update references, rerun the tests and pass the `--bless` flag
2019-07-19T17:13:39.5890752Z To only update this specific test, also pass `--test-args error-codes/E0121.rs`
2019-07-19T17:13:39.5890838Z error: 1 errors occurred comparing output.
2019-07-19T17:13:39.5890878Z status: exit code: 1
2019-07-19T17:13:39.5890878Z status: exit code: 1
2019-07-19T17:13:39.5891480Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/error-codes/E0121.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/error-codes/E0121" "-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/error-codes/E0121/auxiliary" "-A" "unused"
2019-07-19T17:13:39.5891775Z ------------------------------------------
2019-07-19T17:13:39.5891804Z 
2019-07-19T17:13:39.5891999Z ------------------------------------------
2019-07-19T17:13:39.5892037Z stderr:
2019-07-19T17:13:39.5892037Z stderr:
2019-07-19T17:13:39.5892361Z ------------------------------------------
2019-07-19T17:13:39.5892445Z error[E0121]: the type placeholder `_` is not allowed within types on item signatures
2019-07-19T17:13:39.5892728Z    |
2019-07-19T17:13:39.5892728Z    |
2019-07-19T17:13:39.5892929Z LL | fn foo() -> _ { 5 } //~ ERROR E0121
2019-07-19T17:13:39.5893007Z    |             |
2019-07-19T17:13:39.5893064Z    |             not allowed in type signatures
2019-07-19T17:13:39.5893064Z    |             not allowed in type signatures
2019-07-19T17:13:39.5893109Z    |             help: replace `_` with the correct return type: `i32`
2019-07-19T17:13:39.5893147Z 
2019-07-19T17:13:39.5893188Z error[E0121]: the type placeholder `_` is not allowed within types on item signatures
2019-07-19T17:13:39.5893445Z    |
2019-07-19T17:13:39.5893445Z    |
2019-07-19T17:13:39.5893484Z LL | static BAR: _ = "test"; //~ ERROR E0121
2019-07-19T17:13:39.5893583Z    |             |
2019-07-19T17:13:39.5893623Z    |             not allowed in type signatures
2019-07-19T17:13:39.5893623Z    |             not allowed in type signatures
2019-07-19T17:13:39.5893849Z    |             help: replace `_` with the correct type: `&'static str`
2019-07-19T17:13:39.5893921Z error: aborting due to 2 previous errors
2019-07-19T17:13:39.5893947Z 
2019-07-19T17:13:39.5894183Z For more information about this error, try `rustc --explain E0121`.
2019-07-19T17:13:39.5894213Z 
---
2019-07-19T17:13:39.5902089Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:535:22
2019-07-19T17:13:39.5902184Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-07-19T17:13:39.5914411Z 
2019-07-19T17:13:39.5914476Z 
2019-07-19T17:13:39.5916568Z 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-07-19T17:13:39.5916851Z 
2019-07-19T17:13:39.5916888Z 
2019-07-19T17:13:39.5930018Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-07-19T17:13:39.5930273Z Build completed unsuccessfully in 0:55:18
2019-07-19T17:13:39.5930273Z Build completed unsuccessfully in 0:55:18
2019-07-19T17:13:40.8560977Z ##[error]Bash exited with code '1'.
2019-07-19T17:13:40.8596820Z ##[section]Starting: Checkout
2019-07-19T17:13:40.8598755Z ==============================================================================
2019-07-19T17:13:40.8598820Z Task         : Get sources
2019-07-19T17:13:40.8598858Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (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-07-19T19:01:10.5365605Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-07-19T19:01:10.5567872Z ##[command]git config gc.auto 0
2019-07-19T19:01:10.5626105Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-07-19T19:01:10.5683708Z ##[command]git config --get-all http.proxy
2019-07-19T19:01:10.5835948Z ##[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/62804/merge:refs/remotes/pull/62804/merge
---
2019-07-19T19:01:46.7952026Z do so (now or later) by using -b with the checkout command again. Example:
2019-07-19T19:01:46.7952059Z 
2019-07-19T19:01:46.7952835Z   git checkout -b <new-branch-name>
2019-07-19T19:01:46.7953082Z 
2019-07-19T19:01:46.7953182Z HEAD is now at f31a8799b Merge b3618648f2d762c94bfbeee096562a799af38fe7 into 527dce7137f7a3c7bf47d9a503abf25f88ea22de
2019-07-19T19:01:46.8240731Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-07-19T19:01:46.8243743Z ==============================================================================
2019-07-19T19:01:46.8243814Z Task         : Bash
2019-07-19T19:01:46.8243860Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-07-19T20:01:06.2085652Z .................................................................................................... 200/5835
2019-07-19T20:01:10.4905318Z .................................................................................................... 300/5835
2019-07-19T20:01:14.2482284Z .................................................................................................... 400/5835
2019-07-19T20:01:18.0757894Z .................................................................................................... 500/5835
2019-07-19T20:01:21.9255950Z ........................................................................i........................... 600/5835
2019-07-19T20:01:30.9013695Z .................................................................................................... 800/5835
2019-07-19T20:01:36.5183140Z .................................................................................................... 900/5835
2019-07-19T20:01:41.4796159Z ...................................................................................................i 1000/5835
2019-07-19T20:01:41.4796159Z ...................................................................................................i 1000/5835
2019-07-19T20:01:47.0391345Z ...........i........................................................................................ 1100/5835
2019-07-19T20:01:51.0333676Z .............................iiiii.................................................................. 1200/5835
2019-07-19T20:01:57.1814380Z F................................................................................................... 1400/5835
2019-07-19T20:01:59.9325133Z .................................................................................................... 1500/5835
2019-07-19T20:02:03.7413789Z .................................................................................................... 1600/5835
2019-07-19T20:02:06.4150924Z .................................................................................................... 1700/5835
2019-07-19T20:02:06.4150924Z .................................................................................................... 1700/5835
2019-07-19T20:02:09.9152422Z ...................................................................i................................ 1800/5835
2019-07-19T20:02:18.4754915Z .................................................................................................... 2000/5835
2019-07-19T20:02:22.7715487Z .................................................................................................... 2100/5835
2019-07-19T20:02:26.6162445Z .................................................................................................... 2200/5835
2019-07-19T20:02:26.6162445Z .................................................................................................... 2200/5835
2019-07-19T20:02:30.4816297Z ..................................................i................................................. 2300/5835
2019-07-19T20:02:40.3956032Z .................................................................................................... 2500/5835
2019-07-19T20:02:44.5631759Z .................................................................................................... 2600/5835
2019-07-19T20:02:49.7058437Z .................................................................................................... 2700/5835
2019-07-19T20:02:53.7869167Z .................................................................................................... 2800/5835
2019-07-19T20:02:53.7869167Z .................................................................................................... 2800/5835
2019-07-19T20:02:58.1665328Z .................................................................................................... 2900/5835
2019-07-19T20:03:03.4609750Z .................................................................................................... 3000/5835
2019-07-19T20:03:07.9539692Z .................................................................................................... 3100/5835
2019-07-19T20:03:13.2461293Z .................................................................................................... 3200/5835
2019-07-19T20:03:16.7707518Z .................................................................................................... 3300/5835
2019-07-19T20:03:20.5248063Z .................................................................................................... 3400/5835
2019-07-19T20:03:25.6938396Z .................................................................................................... 3500/5835
2019-07-19T20:03:29.5858963Z ............i....................................................................................... 3600/5835
2019-07-19T20:03:33.7231432Z ......................................................................................ii...i..ii.... 3700/5835
2019-07-19T20:03:42.6967505Z .................................................................................................... 3900/5835
2019-07-19T20:03:46.6650633Z .................................................................................................... 4000/5835
2019-07-19T20:03:46.6650633Z .................................................................................................... 4000/5835
2019-07-19T20:03:50.2413942Z ii.................................................................................................. 4100/5835
2019-07-19T20:03:52.3771231Z .....................i.............................................................................. 4200/5835
2019-07-19T20:03:54.5077802Z .......................................................................................i............ 4300/5835
2019-07-19T20:04:03.0946681Z .................................................................................................... 4500/5835
2019-07-19T20:04:19.3101866Z .................................................................................................... 4600/5835
2019-07-19T20:04:22.8136289Z .................................................................................................... 4700/5835
2019-07-19T20:04:26.7456533Z .................................................................................................... 4800/5835
---
2019-07-19T20:05:00.3160510Z .................................................................................................... 5400/5835
2019-07-19T20:05:04.2223138Z .................................................................................................... 5500/5835
2019-07-19T20:05:08.3062805Z .................................................................................................... 5600/5835
2019-07-19T20:05:11.5117090Z .................................................................................................... 5700/5835
2019-07-19T20:05:14.4202758Z ...........................................................................i........................ 5800/5835
2019-07-19T20:05:15.7484779Z failures:
2019-07-19T20:05:15.7530869Z 
2019-07-19T20:05:15.7531786Z ---- [ui] ui/error-codes/E0121.rs stdout ----
2019-07-19T20:05:15.7532002Z diff of stderr:
2019-07-19T20:05:15.7532002Z diff of stderr:
2019-07-19T20:05:15.7532149Z 
2019-07-19T20:05:15.7532282Z 14    |             ^
2019-07-19T20:05:15.7532411Z 15    |             |
2019-07-19T20:05:15.7532608Z 16    |             not allowed in type signatures
2019-07-19T20:05:15.7533028Z -    |             help: replace `_` with the correct return type: `&'static str`
2019-07-19T20:05:15.7533469Z +    |             help: replace `_` with the correct type: `&'static str`
2019-07-19T20:05:15.7533800Z 19 error: aborting due to 2 previous errors
2019-07-19T20:05:15.7533944Z 20 
2019-07-19T20:05:15.7534173Z 
2019-07-19T20:05:15.7534883Z 
2019-07-19T20:05:15.7534883Z 
2019-07-19T20:05:15.7535058Z The actual stderr differed from the expected stderr.
2019-07-19T20:05:15.7535577Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0121/E0121.stderr
2019-07-19T20:05:15.7536040Z To update references, rerun the tests and pass the `--bless` flag
2019-07-19T20:05:15.7536499Z To only update this specific test, also pass `--test-args error-codes/E0121.rs`
2019-07-19T20:05:15.7536797Z error: 1 errors occurred comparing output.
2019-07-19T20:05:15.7536929Z status: exit code: 1
2019-07-19T20:05:15.7536929Z status: exit code: 1
2019-07-19T20:05:15.7538193Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/error-codes/E0121.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/error-codes/E0121" "-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/error-codes/E0121/auxiliary" "-A" "unused"
2019-07-19T20:05:15.7538897Z ------------------------------------------
2019-07-19T20:05:15.7539062Z 
2019-07-19T20:05:15.7539448Z ------------------------------------------
2019-07-19T20:05:15.7539623Z stderr:
2019-07-19T20:05:15.7539623Z stderr:
2019-07-19T20:05:15.7539968Z ------------------------------------------
2019-07-19T20:05:15.7540170Z error[E0121]: the type placeholder `_` is not allowed within types on item signatures
2019-07-19T20:05:15.7540768Z    |
2019-07-19T20:05:15.7540768Z    |
2019-07-19T20:05:15.7541135Z LL | fn foo() -> _ { 5 } //~ ERROR E0121
2019-07-19T20:05:15.7541464Z    |             |
2019-07-19T20:05:15.7541602Z    |             not allowed in type signatures
2019-07-19T20:05:15.7541602Z    |             not allowed in type signatures
2019-07-19T20:05:15.7541737Z    |             help: replace `_` with the correct return type: `i32`
2019-07-19T20:05:15.7541872Z 
2019-07-19T20:05:15.7542011Z error[E0121]: the type placeholder `_` is not allowed within types on item signatures
2019-07-19T20:05:15.7542574Z    |
2019-07-19T20:05:15.7542574Z    |
2019-07-19T20:05:15.7542715Z LL | static BAR: _ = "test"; //~ ERROR E0121
2019-07-19T20:05:15.7542990Z    |             |
2019-07-19T20:05:15.7543125Z    |             not allowed in type signatures
2019-07-19T20:05:15.7543125Z    |             not allowed in type signatures
2019-07-19T20:05:15.7545766Z    |             help: replace `_` with the correct type: `&'static str`
2019-07-19T20:05:15.7546658Z error: aborting due to 2 previous errors
2019-07-19T20:05:15.7546775Z 
2019-07-19T20:05:15.7547272Z For more information about this error, try `rustc --explain E0121`.
2019-07-19T20:05:15.7547450Z 
---
2019-07-19T20:05:15.7553257Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:535:22
2019-07-19T20:05:15.7553523Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-07-19T20:05:15.7558916Z 
2019-07-19T20:05:15.7559005Z 
2019-07-19T20:05:15.7569055Z 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-07-19T20:05:15.7569409Z 
2019-07-19T20:05:15.7569439Z 
2019-07-19T20:05:15.7573515Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-07-19T20:05:15.7573827Z Build completed unsuccessfully in 0:56:56
2019-07-19T20:05:15.7573827Z Build completed unsuccessfully in 0:56:56
2019-07-19T20:05:16.8086202Z ##[error]Bash exited with code '1'.
2019-07-19T20:05:16.8125478Z ##[section]Starting: Checkout
2019-07-19T20:05:16.8127137Z ==============================================================================
2019-07-19T20:05:16.8127212Z Task         : Get sources
2019-07-19T20:05:16.8127260Z 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)

@lundibundi
Copy link
Contributor Author

@bors r? @eddyb

@eddyb
Copy link
Member

eddyb commented Jul 20, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Jul 20, 2019

📌 Commit c6e027d has been approved by eddyb

Centril added a commit to Centril/rust that referenced this pull request Jul 21, 2019
… r=eddyb

rustc_typeck: improve diagnostics for _ const/static declarations

This continues rust-lang#62694 and adds type suggestions to const/static declarations with `_` type.

r? @eddyb
Centril added a commit to Centril/rust that referenced this pull request Jul 22, 2019
… r=eddyb

rustc_typeck: improve diagnostics for _ const/static declarations

This continues rust-lang#62694 and adds type suggestions to const/static declarations with `_` type.

r? @eddyb
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Jul 23, 2019
… r=eddyb

rustc_typeck: improve diagnostics for _ const/static declarations

This continues rust-lang#62694 and adds type suggestions to const/static declarations with `_` type.

r? @eddyb
bors added a commit that referenced this pull request Jul 23, 2019
Rollup of 14 pull requests

Successful merges:

 - #60951 (more specific errors in src/librustc/mir/interpret/error.rs)
 - #62523 (Delay bug to resolve HRTB ICE)
 - #62656 (explain how to search in slice without owned data)
 - #62791 (Handle more cases of typos misinterpreted as type ascription)
 - #62804 (rustc_typeck: improve diagnostics for _ const/static declarations)
 - #62808 (Revert "Disable stack probing for gnux32.")
 - #62817 (Tweak span for variant not found error)
 - #62842 (Add tests for issue-58887)
 - #62851 (move unescape module to rustc_lexer)
 - #62859 (Place::as_place_ref is now Place::as_ref)
 - #62869 (add rustc_private as a proper language feature gate)
 - #62880 (normalize use of backticks in compiler messages for librustc_allocator)
 - #62885 (Change "OSX" to "macOS")
 - #62889 (Update stage0.txt)

Failed merges:

r? @ghost
@bors bors merged commit c6e027d into rust-lang:master Jul 23, 2019
@lundibundi lundibundi deleted the help-infer-const-static branch July 24, 2019 08:46
Centril added a commit to Centril/rust that referenced this pull request Sep 24, 2019
…stebank

Recover on `const X = 42;` and infer type + Error Stash API

Here we:

1. Introduce a notion of the "error stash".

   This is a map in the `Handler` to which you can `err.stash(...)` away your diagnostics and then steal them in a later "phase" of the compiler (e.g. stash in parser, steal in typeck) to enrich them with more information that isn't available in the previous "phase".

    I believe I've covered all the bases to make sure these diagnostics are actually emitted eventually even under `#[cfg(FALSE)]` but please check my logic.

2. Recover when parsing `[const | static mut?] $ident = $expr;` which has a missing type.

    Use the "error stash" to stash away the error and later steal the error in typeck where we emit the error as `MachineApplicable` with the actual inferred type. This builds on rust-lang#62804.

cc rust-lang/rfcs#2545

r? @estebank
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants