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

Provide a span if main function is not present in crate #64290

Merged
merged 1 commit into from
Sep 15, 2019

Conversation

Mark-Simulacrum
Copy link
Member

@Mark-Simulacrum Mark-Simulacrum commented Sep 8, 2019

Unfortunately, the diagnostic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.

Tests are already updated for this change, so a dedicated test is not added.

Resolves #36561.

@rust-highfive
Copy link
Collaborator

r? @estebank

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 8, 2019
@ehuss
Copy link
Contributor

ehuss commented Sep 8, 2019

the diagnostic machinery does not cope well with an empty span

I'm curious what issues there are with this, can you say more?

(For context, I wrote this note, and at the time I noticed there are a few other diagnostics that don't have spans. I've also written editor integration where it has to handle these kinds of things, so I'm a bit surprised it causes issues. Tools still need to handle diagnostics without filenames.)

FWIW, this seems like a good improvement. At the time I didn't know it was possible to generate a span like this.

@estebank
Copy link
Contributor

estebank commented Sep 8, 2019

r=me once green

@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-09-08T17:28:18.9948195Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-08T17:28:19.9776615Z ##[command]git config gc.auto 0
2019-09-08T17:28:19.9782990Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-08T17:28:19.9787413Z ##[command]git config --get-all http.proxy
2019-09-08T17:28:19.9791419Z ##[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/64290/merge:refs/remotes/pull/64290/merge
---
2019-09-08T18:29:27.4303421Z .................................................................................................... 1500/9008
2019-09-08T18:29:33.6296543Z .................................................................................................... 1600/9008
2019-09-08T18:29:46.8057450Z ......................................................i...............i............................. 1700/9008
2019-09-08T18:29:54.9195143Z .................................................................................................... 1800/9008
2019-09-08T18:30:09.3275449Z .............................................iiiii.................................................. 1900/9008
2019-09-08T18:30:20.3638109Z .................................................................................................... 2100/9008
2019-09-08T18:30:22.8441710Z .................................................................................................... 2200/9008
2019-09-08T18:30:26.3520129Z .................................................................................................... 2300/9008
2019-09-08T18:30:34.6418396Z .................................................................................................... 2400/9008
---
2019-09-08T18:33:35.7754289Z ..................................i...............i................................................. 4700/9008
2019-09-08T18:33:47.5834212Z .................................................................................................... 4800/9008
2019-09-08T18:33:53.7616091Z .................................................................................................... 4900/9008
2019-09-08T18:34:04.3778187Z .................................................................................................... 5000/9008
2019-09-08T18:34:10.3616359Z ................ii.ii............................................................................... 5100/9008
2019-09-08T18:34:20.8849546Z .................................................................................................... 5300/9008
2019-09-08T18:34:30.9063846Z ...............................................................................i.................... 5400/9008
2019-09-08T18:34:38.6513929Z .................................................................................................... 5500/9008
2019-09-08T18:34:44.4441787Z .................................................................................................... 5600/9008
2019-09-08T18:34:44.4441787Z .................................................................................................... 5600/9008
2019-09-08T18:34:54.9274362Z .........................................................................ii...i..ii...........i..... 5700/9008
2019-09-08T18:35:20.5558887Z .................................................................................................... 5900/9008
2019-09-08T18:35:30.8882260Z .................................................................................................... 6000/9008
2019-09-08T18:35:30.8882260Z .................................................................................................... 6000/9008
2019-09-08T18:35:36.5472940Z ...........................................................................i..ii.................... 6100/9008
2019-09-08T18:36:06.5542966Z .................................................................................................... 6300/9008
2019-09-08T18:36:08.5785698Z ..................................i................................................................. 6400/9008
2019-09-08T18:36:10.7297451Z .................................................................................................... 6500/9008
2019-09-08T18:36:13.3227454Z ......i............................................................................................. 6600/9008
---
2019-09-08T18:40:23.4867579Z 1 error: incorrect close delimiter: `}`
2019-09-08T18:40:23.4867986Z -   --> $DIR/unclosed_delim_mod.rs:5:1
2019-09-08T18:40:23.4868611Z +   --> $DIR/unclosed_delim_mod.rs:7:1
2019-09-08T18:40:23.4868832Z 3    |
2019-09-08T18:40:23.4869502Z 4 LL | pub fn new() -> Result<Value, ()> {
2019-09-08T18:40:23.4869985Z 5    |                                   - close delimiter possibly meant for this
2019-09-08T18:40:23.4870247Z 
2019-09-08T18:40:23.4870403Z The actual stderr differed from the expected stderr.
2019-09-08T18:40:23.4870403Z The actual stderr differed from the expected stderr.
2019-09-08T18:40:23.4870879Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/unclosed-delimiter-in-dep/unclosed-delimiter-in-dep.stderr
2019-09-08T18:40:23.4871307Z To update references, rerun the tests and pass the `--bless` flag
2019-09-08T18:40:23.4871745Z To only update this specific test, also pass `--test-args parser/unclosed-delimiter-in-dep.rs`
2019-09-08T18:40:23.4872044Z error: 1 errors occurred comparing output.
2019-09-08T18:40:23.4872178Z status: exit code: 1
2019-09-08T18:40:23.4872178Z status: exit code: 1
2019-09-08T18:40:23.4873202Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/parser/unclosed-delimiter-in-dep.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/parser/unclosed-delimiter-in-dep" "-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/parser/unclosed-delimiter-in-dep/auxiliary" "-A" "unused"
2019-09-08T18:40:23.4874029Z ------------------------------------------
2019-09-08T18:40:23.4874178Z 
2019-09-08T18:40:23.4874517Z ------------------------------------------
2019-09-08T18:40:23.4874699Z stderr:
2019-09-08T18:40:23.4874699Z stderr:
2019-09-08T18:40:23.4875026Z ------------------------------------------
2019-09-08T18:40:23.4875185Z error: incorrect close delimiter: `}`
2019-09-08T18:40:23.4875548Z   --> /checkout/src/test/ui/parser/unclosed_delim_mod.rs:7:1
2019-09-08T18:40:23.4875710Z    |
2019-09-08T18:40:23.4876050Z LL | pub fn new() -> Result<Value, ()> {
2019-09-08T18:40:23.4876470Z    |                                   - close delimiter possibly meant for this
2019-09-08T18:40:23.4876891Z LL |     Ok(Value {
2019-09-08T18:40:23.4877713Z    |       - un-closed delimiter
2019-09-08T18:40:23.4878452Z LL | }
2019-09-08T18:40:23.4878513Z    | ^ incorrect close delimiter
2019-09-08T18:40:23.4878545Z 
2019-09-08T18:40:23.4878590Z error[E0308]: mismatched types
2019-09-08T18:40:23.4878590Z error[E0308]: mismatched types
2019-09-08T18:40:23.4878913Z   --> /checkout/src/test/ui/parser/unclosed-delimiter-in-dep.rs:4:20
2019-09-08T18:40:23.4878981Z    |
2019-09-08T18:40:23.4879225Z LL |     let _: usize = unclosed_delim_mod::new();
2019-09-08T18:40:23.4879287Z    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^ expected usize, found enum `std::result::Result`
2019-09-08T18:40:23.4879353Z    |
2019-09-08T18:40:23.4879397Z    = note: expected type `usize`
2019-09-08T18:40:23.4879460Z               found type `std::result::Result<unclosed_delim_mod::Value, ()>`
2019-09-08T18:40:23.4879558Z error: aborting due to 2 previous errors
2019-09-08T18:40:23.4879587Z 
2019-09-08T18:40:23.4879884Z For more information about this error, try `rustc --explain E0308`.
2019-09-08T18:40:23.4879921Z 
---
2019-09-08T18:40:23.4901196Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:536:22
2019-09-08T18:40:23.4901281Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-09-08T18:40:23.4920199Z 
2019-09-08T18:40:23.4920567Z 
2019-09-08T18:40:23.4922423Z 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-09-08T18:40:23.4923049Z 
2019-09-08T18:40:23.4923105Z 
2019-09-08T18:40:23.4927323Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-09-08T18:40:23.4927416Z Build completed unsuccessfully in 1:04:58
2019-09-08T18:40:23.4927416Z Build completed unsuccessfully in 1:04:58
2019-09-08T18:40:23.4982449Z == clock drift check ==
2019-09-08T18:40:23.5000681Z   local time: Sun Sep  8 18:40:23 UTC 2019
2019-09-08T18:40:23.5892168Z   network time: Sun, 08 Sep 2019 18:40:23 GMT
2019-09-08T18:40:23.5895632Z == end clock drift check ==
2019-09-08T18:40:24.2791447Z ##[error]Bash exited with code '1'.
2019-09-08T18:40:24.2832937Z ##[section]Starting: Checkout
2019-09-08T18:40:24.2835035Z ==============================================================================
2019-09-08T18:40:24.2835093Z Task         : Get sources
2019-09-08T18:40:24.2835163Z 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)

@Mark-Simulacrum
Copy link
Member Author

I'm curious what issues there are with this, can you say more?

It's not completely clear exactly where the problems arise, but I was able to trigger an ICE or two, particularly with --error-format=json; I suspect the problem lies in that we expect all files to have at least one line such that lines - 1 >= 0, but if this is not the case, at least in a debug-assertion enabled compiler we will panic when lines is 0. It's quite possible this can be fixed, but I don't think it's worth even filing an issue (it seems relatively unimportant that we can emit errors in completely empty files, as that is rare).

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

Ah, I also forgot to mention -- in some situations, I was unable to trigger an ICE with the normal machinery (though --error-format=json did, I believe); however, the span and associated label was still not emitted (as if they had not been set).

Centril
Centril previously requested changes Sep 8, 2019
src/librustc/middle/entry.rs Outdated Show resolved Hide resolved
src/librustc/middle/entry.rs Outdated Show resolved Hide resolved
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@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-09-09T14:55:02.0239868Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-09T14:55:02.0448998Z ##[command]git config gc.auto 0
2019-09-09T14:55:02.0562526Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-09T14:55:02.0632326Z ##[command]git config --get-all http.proxy
2019-09-09T14:55:02.0789905Z ##[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/64290/merge:refs/remotes/pull/64290/merge
---
2019-09-09T16:01:48.9732430Z .................................................................................................... 1500/9009
2019-09-09T16:01:55.4125984Z .................................................................................................... 1600/9009
2019-09-09T16:02:09.4512373Z ......................................................i...............i............................. 1700/9009
2019-09-09T16:02:18.2997712Z .................................................................................................... 1800/9009
2019-09-09T16:02:34.1394684Z .............................................iiiii.................................................. 1900/9009
2019-09-09T16:02:45.9759050Z .................................................................................................... 2100/9009
2019-09-09T16:02:48.6817607Z .................................................................................................... 2200/9009
2019-09-09T16:02:52.6093230Z .................................................................................................... 2300/9009
2019-09-09T16:03:01.3522884Z .................................................................................................... 2400/9009
---
2019-09-09T16:06:16.3323225Z ....................................i..............i................................................ 4700/9009
2019-09-09T16:06:28.8819593Z .................................................................................................... 4800/9009
2019-09-09T16:06:35.9414857Z .................................................................................................... 4900/9009
2019-09-09T16:06:47.5671707Z .................................................................................................... 5000/9009
2019-09-09T16:06:54.1672572Z .................ii.ii.............................................................................. 5100/9009
2019-09-09T16:07:05.6976051Z .................................................................................................... 5300/9009
2019-09-09T16:07:16.9225573Z ................................................................................i................... 5400/9009
2019-09-09T16:07:25.5806863Z .................................................................................................... 5500/9009
2019-09-09T16:07:32.1085236Z .................................................................................................... 5600/9009
2019-09-09T16:07:32.1085236Z .................................................................................................... 5600/9009
2019-09-09T16:07:43.7538465Z ..........................................................................ii...i..ii...........i.... 5700/9009
2019-09-09T16:08:11.0575361Z .................................................................................................... 5900/9009
2019-09-09T16:08:21.8894153Z .................................................................................................... 6000/9009
2019-09-09T16:08:21.8894153Z .................................................................................................... 6000/9009
2019-09-09T16:08:29.6571704Z ............................................................................i..ii................... 6100/9009
2019-09-09T16:09:02.2369850Z .................................................................................................... 6300/9009
2019-09-09T16:09:04.5827466Z ...................................i................................................................ 6400/9009
2019-09-09T16:09:06.9985380Z .................................................................................................... 6500/9009
2019-09-09T16:09:09.8460677Z .......i............................................................................................ 6600/9009
---
2019-09-09T16:14:19.6861184Z  finished in 20.814
2019-09-09T16:14:19.7068354Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-09T16:14:19.9266150Z 
2019-09-09T16:14:19.9268048Z running 150 tests
2019-09-09T16:14:23.6207824Z i....iii......iii..iiii....i.............................i..i..................i....i.........ii.i.i 100/150
2019-09-09T16:14:25.7807726Z ..iiii..............i.........iii.i.......ii......
2019-09-09T16:14:25.7810912Z 
2019-09-09T16:14:25.7815411Z  finished in 6.075
2019-09-09T16:14:25.8015734Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-09T16:14:25.9896709Z 
---
2019-09-09T16:14:28.2435253Z  finished in 2.442
2019-09-09T16:14:28.2640239Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-09T16:14:28.4428486Z 
2019-09-09T16:14:28.4430807Z running 9 tests
2019-09-09T16:14:28.4432266Z iiiiiiiii
2019-09-09T16:14:28.4438091Z 
2019-09-09T16:14:28.4438172Z  finished in 0.179
2019-09-09T16:14:28.4637348Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-09T16:14:28.6684999Z 
---
2019-09-09T16:14:48.2128680Z  finished in 19.749
2019-09-09T16:14:48.2371228Z Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-09T16:14:48.4456423Z 
2019-09-09T16:14:48.4456709Z running 123 tests
2019-09-09T16:15:14.1092543Z .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....ii..........iiii..........i...ii...i.......ii. 100/123
2019-09-09T16:15:19.0917067Z i.i.i......iii.i.....ii
2019-09-09T16:15:19.0919381Z 
2019-09-09T16:15:19.0926231Z  finished in 30.856
2019-09-09T16:15:19.0938941Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-09T16:15:19.0939714Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2019-09-09T16:16:26.4601979Z 
2019-09-09T16:16:26.4602250Z ---- [ui] ui-fulldeps/hash-stable-is-unstable.rs stdout ----
2019-09-09T16:16:26.4602320Z diff of stderr:
2019-09-09T16:16:26.4602352Z 
2019-09-09T16:16:26.4602837Z 43    = note: for more information, see ***/issues/27812
2019-09-09T16:16:26.4602921Z 44    = help: add `#![feature(rustc_private)]` to the crate attributes to enable
2019-09-09T16:16:26.4603217Z - error: aborting due to 6 previous errors
2019-09-09T16:16:26.4603283Z + error: aborting due to 5 previous errors
2019-09-09T16:16:26.4603325Z 47 
2019-09-09T16:16:26.4603547Z - Some errors have detailed explanations: E0601, E0658.
2019-09-09T16:16:26.4603547Z - Some errors have detailed explanations: E0601, E0658.
2019-09-09T16:16:26.4603790Z - For more information about an error, try `rustc --explain E0601`.
2019-09-09T16:16:26.4604245Z + For more information about this error, try `rustc --explain E0658`.
2019-09-09T16:16:26.4604310Z 50 
2019-09-09T16:16:26.4604336Z 
2019-09-09T16:16:26.4604360Z 
2019-09-09T16:16:26.4604442Z The actual stderr differed from the expected stderr.
2019-09-09T16:16:26.4604784Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/hash-stable-is-unstable/hash-stable-is-unstable.stderr
2019-09-09T16:16:26.4605101Z To update references, rerun the tests and pass the `--bless` flag
2019-09-09T16:16:26.4605948Z To only update this specific test, also pass `--test-args hash-stable-is-unstable.rs`
2019-09-09T16:16:26.4606036Z error: 1 errors occurred comparing output.
2019-09-09T16:16:26.4606102Z status: exit code: 1
2019-09-09T16:16:26.4606102Z status: exit code: 1
2019-09-09T16:16:26.4606874Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui-fulldeps/hash-stable-is-unstable.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-fulldeps/hash-stable-is-unstable" "-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-fulldeps/hash-stable-is-unstable/auxiliary" "-A" "unused"
2019-09-09T16:16:26.4607228Z ------------------------------------------
2019-09-09T16:16:26.4607263Z 
2019-09-09T16:16:26.4607505Z ------------------------------------------
2019-09-09T16:16:26.4607551Z stderr:
2019-09-09T16:16:26.4607551Z stderr:
2019-09-09T16:16:26.4607763Z ------------------------------------------
2019-09-09T16:16:26.4608157Z error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
2019-09-09T16:16:26.4608859Z    |
2019-09-09T16:16:26.4608924Z LL | extern crate rustc_data_structures;
2019-09-09T16:16:26.4608970Z    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2019-09-09T16:16:26.4609011Z    |
2019-09-09T16:16:26.4609011Z    |
2019-09-09T16:16:26.4609510Z    = note: for more information, see ***/issues/27812
2019-09-09T16:16:26.4609573Z    = help: add `#![feature(rustc_private)]` to the crate attributes to enable
2019-09-09T16:16:26.4609608Z 
2019-09-09T16:16:26.4610466Z error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
2019-09-09T16:16:26.4610802Z    |
2019-09-09T16:16:26.4610864Z LL | extern crate rustc;
2019-09-09T16:16:26.4610925Z    | ^^^^^^^^^^^^^^^^^^^
2019-09-09T16:16:26.4610966Z    |
2019-09-09T16:16:26.4610966Z    |
2019-09-09T16:16:26.4611306Z    = note: for more information, see ***/issues/27812
2019-09-09T16:16:26.4611365Z    = help: add `#![feature(rustc_private)]` to the crate attributes to enable
2019-09-09T16:16:26.4611400Z 
2019-09-09T16:16:26.4611812Z error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
2019-09-09T16:16:26.4612120Z    |
2019-09-09T16:16:26.4612181Z LL | extern crate rustc_macros;
2019-09-09T16:16:26.4612227Z    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
2019-09-09T16:16:26.4612269Z    |
2019-09-09T16:16:26.4612269Z    |
2019-09-09T16:16:26.4612567Z    = note: for more information, see ***/issues/27812
2019-09-09T16:16:26.4612631Z    = help: add `#![feature(rustc_private)]` to the crate attributes to enable
2019-09-09T16:16:26.4612677Z 
2019-09-09T16:16:26.4613403Z error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
2019-09-09T16:16:26.4613768Z    |
2019-09-09T16:16:26.4613811Z LL | use rustc_macros::HashStable;
2019-09-09T16:16:26.4613875Z    |     ^^^^^^^^^^^^^^^^^^^^^^^^
2019-09-09T16:16:26.4613916Z    |
2019-09-09T16:16:26.4613916Z    |
2019-09-09T16:16:26.4614196Z    = note: for more information, see ***/issues/27812
2019-09-09T16:16:26.4614275Z    = help: add `#![feature(rustc_private)]` to the crate attributes to enable
2019-09-09T16:16:26.4614310Z 
2019-09-09T16:16:26.4614700Z error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
2019-09-09T16:16:26.4615635Z    |
2019-09-09T16:16:26.4615692Z LL | #[derive(HashStable)]
2019-09-09T16:16:26.4615759Z    |          ^^^^^^^^^^
2019-09-09T16:16:26.4615801Z    |
2019-09-09T16:16:26.4615801Z    |
2019-09-09T16:16:26.4616153Z    = note: for more information, see ***/issues/27812
2019-09-09T16:16:26.4616232Z    = help: add `#![feature(rustc_private)]` to the crate attributes to enable
2019-09-09T16:16:26.4616310Z error: aborting due to 5 previous errors
2019-09-09T16:16:26.4616339Z 
2019-09-09T16:16:26.4616614Z For more information about this error, try `rustc --explain E0658`.
2019-09-09T16:16:26.4616648Z 
---
2019-09-09T16:16:26.4617550Z test result: FAILED. 68 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
2019-09-09T16:16:26.4617724Z 
2019-09-09T16:16:26.4622350Z 
2019-09-09T16:16:26.4622424Z 
2019-09-09T16:16:26.4624000Z 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-fulldeps" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps" "--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-09-09T16:16:26.4624254Z 
2019-09-09T16:16:26.4624301Z 
2019-09-09T16:16:26.4624344Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-09-09T16:16:26.4624395Z Build completed unsuccessfully in 1:13:53
2019-09-09T16:16:26.4624395Z Build completed unsuccessfully in 1:13:53
2019-09-09T16:16:26.4628572Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:536:22
2019-09-09T16:16:26.4628656Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-09-09T16:16:26.4674534Z == clock drift check ==
2019-09-09T16:16:26.4697261Z   local time: Mon Sep  9 16:16:26 UTC 2019
2019-09-09T16:16:26.5072056Z   network time: Mon, 09 Sep 2019 16:16:26 GMT
2019-09-09T16:16:26.5076214Z == end clock drift check ==
2019-09-09T16:16:27.1247800Z ##[error]Bash exited with code '1'.
2019-09-09T16:16:27.1286519Z ##[section]Starting: Checkout
2019-09-09T16:16:27.1288440Z ==============================================================================
2019-09-09T16:16:27.1288515Z Task         : Get sources
2019-09-09T16:16:27.1288564Z 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)

err.note("the main function must be defined at the crate level \
but you have one or more functions named 'main' that are not \
defined at the crate level. Either move the definition or \
attach the `#[main]` attribute to override this behavior.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should have a span pointing at where the main function should be, like we're doing below?

None
if tcx.sess.teach(&err.get_code().unwrap()) {
err.note("If you don't know the basics of Rust, you can go look to the Rust Book \
to get started: https://doc.rust-lang.org/book/");
Copy link
Contributor

Choose a reason for hiding this comment

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

The indentation on both strings is off by two chars :)

Centril added a commit to Centril/rust that referenced this pull request Sep 14, 2019
…ebank

Provide a span if main function is not present in crate

Unfortunately, the diagnostic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.

Tests are already updated for this change, so a dedicated test is not added.

Resolves rust-lang#36561.
@Centril
Copy link
Contributor

Centril commented Sep 14, 2019

@bors retry rolled up.

@Centril
Copy link
Contributor

Centril commented Sep 14, 2019

Failed in #64452, @bors r-

You need to --bless --compare-mode=nll.

@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 Sep 14, 2019
Unfortunately, the diagnotic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.
@Mark-Simulacrum
Copy link
Member Author

@bors r=estebank

Ran with compare-mode=nll; can't wait until we can remove it.

@bors
Copy link
Contributor

bors commented Sep 14, 2019

📌 Commit b7f20d0 has been approved by estebank

@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 Sep 14, 2019
@bors
Copy link
Contributor

bors commented Sep 14, 2019

⌛ Testing commit b7f20d0 with merge 5453909254f2181a201c47c471a64ddc0f652b10...

Centril added a commit to Centril/rust that referenced this pull request Sep 14, 2019
…ebank

Provide a span if main function is not present in crate

Unfortunately, the diagnostic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.

Tests are already updated for this change, so a dedicated test is not added.

Resolves rust-lang#36561.
@Centril
Copy link
Contributor

Centril commented Sep 14, 2019

@bors retry rolled up.

@bors
Copy link
Contributor

bors commented Sep 14, 2019

⌛ Testing commit b7f20d0 with merge 97ec3ff09407d4f17fedac2262e61fb69cc61351...

Centril added a commit to Centril/rust that referenced this pull request Sep 14, 2019
…ebank

Provide a span if main function is not present in crate

Unfortunately, the diagnostic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.

Tests are already updated for this change, so a dedicated test is not added.

Resolves rust-lang#36561.
@Centril
Copy link
Contributor

Centril commented Sep 14, 2019

@bors retry rolled up.

bors added a commit that referenced this pull request Sep 14, 2019
Rollup of 4 pull requests

Successful merges:

 - #61797 (Stabilise weak_ptr_eq)
 - #64290 (Provide a span if main function is not present in crate)
 - #64406 (Ban non-extern rust intrinsics)
 - #64462 (feature_gate: Remove dead code from attribute checking)

Failed merges:

r? @ghost
@bors bors merged commit b7f20d0 into rust-lang:master Sep 15, 2019
mati865 added a commit to mati865/rust-phf that referenced this pull request Oct 15, 2019
rust-lang/rust#64290 changed that lint output causing test error, however there is no point in keeping this lint stderr
mati865 added a commit to mati865/rust-phf that referenced this pull request Oct 15, 2019
rust-lang/rust#64290 changed that lint output causing test error, however there is no point in keeping this lint stderr
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.

Error without location
6 participants