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

Improve reporting errors and suggestions for trait bounds #67665

Merged
merged 1 commit into from Feb 10, 2020

Conversation

@Patryk27
Copy link
Contributor

Patryk27 commented Dec 27, 2019

Fix #66802

  • When printing errors for unsized function parameter, properly point at the parameter instead of function's body.
  • Improve consider further restricting this bound (and related) messages by separating human-oriented hints from the machine-oriented ones.
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 27, 2019

r? @zackmdavis

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

@Patryk27

This comment has been minimized.

Copy link
Contributor Author

Patryk27 commented Dec 27, 2019

Hi,

I'd like to provide a bit of insight about the second part of my MR - it refers to the consider further restricting type parameter hint as seen in here:

fn foo2<T>(_: T) where T: ?Sized {
  //
}
error[E0277]: the size for values of type `T` cannot be known at compilation time
 --> src/lib.rs:5:18
  |
5 | fn foo2<T>(_: T) where T: ?Sized {
  |                  ^              - help: consider further restricting type parameter `T`: `, T: std::marker::Sized`
  |                  |
  |                  doesn't have a size known at compile-time

First of all, the hint points at an unrelated piece of code - it's been done this way, because (presumably) it was easier than creating two distinct messages: one for humans (pointing at the trait bounds) and the other one for rustfix (pointing at the end of where clause).

Second of all, the 'T': ', T: std::marker::Sized part looks barely legible for me - I'd like to suggest consider further restricting this bound with '+ std::marker::Sized' and a few other contextual variants, which you can see in the diff.

Third of all: current version is inconsistent when it comes to impl in argument position:

fn foo(x: impl ?Sized) {
  //
}

fn foo2<X: ?Sized>(x: X) {
  //
}
error[E0277]: the size for values of type `impl ?Sized` cannot be known at compilation time
 --> src/lib.rs:1:8
  |
1 | fn foo(x: impl ?Sized) {
  |        ^  ----------- help: consider further restricting this bound: `impl ?Sized + std::marker::Sized`
  |        |
  |        doesn't have a size known at compile-time

error[E0277]: the size for values of type `X` cannot be known at compilation time
 --> src/lib.rs:5:20
  |
5 | fn foo2<X: ?Sized>(x: X) {
  |         --         ^ doesn't have a size known at compile-time
  |         |
  |         help: consider further restricting this bound: `X: std::marker::Sized +`

Notice how the first error message underlines the entire type (impl ?Sized), whereas the other one points just at X:; once again: great for rustfix, not so great for humans.

Of course it's all just a suggestion and I'd like to hear what you think :-)

Thanks for reviewing,
Patryk.

Edit: also, I'd like to thank @VirrageS for pointing me in the right direction - his diff was higly helpful.

src/librustc/traits/error_reporting.rs Outdated Show resolved Hide resolved
src/librustc/traits/error_reporting.rs Outdated Show resolved Hide resolved
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 29, 2019

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-12-29T19:03:09.7597450Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-29T19:03:09.7829710Z ##[command]git config gc.auto 0
2019-12-29T19:03:09.7923056Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-29T19:03:09.7985419Z ##[command]git config --get-all http.proxy
2019-12-29T19:03:09.8136637Z ##[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/67665/merge:refs/remotes/pull/67665/merge
---
2019-12-29T20:01:42.4844849Z .................................................................................................... 1600/9463
2019-12-29T20:01:47.3426854Z .................................................................................................... 1700/9463
2019-12-29T20:01:56.5284734Z ..................................................................................................i. 1800/9463
2019-12-29T20:02:04.5151412Z .................................................................................................... 1900/9463
2019-12-29T20:02:11.5669035Z ....................................................................................iiiii........... 2000/9463
2019-12-29T20:02:32.4325169Z .................................................................................................... 2200/9463
2019-12-29T20:02:34.8195867Z .................................................................................................... 2300/9463
2019-12-29T20:02:37.2873814Z .................................................................................................... 2400/9463
2019-12-29T20:02:43.3946487Z .................................................................................................... 2500/9463
---
2019-12-29T20:05:40.9694181Z ...............i...............i.................................................................... 4900/9463
2019-12-29T20:05:50.7560204Z .................................................................................................... 5000/9463
2019-12-29T20:05:56.2098125Z ............................................................i....................................... 5100/9463
2019-12-29T20:06:04.2392500Z .................................................................................................... 5200/9463
2019-12-29T20:06:11.6029450Z ...........................ii.ii...........i........................................................ 5300/9463
2019-12-29T20:06:20.6924624Z .................................................................................................... 5500/9463
2019-12-29T20:06:31.6599451Z .................................................................................................... 5600/9463
2019-12-29T20:06:37.7502386Z .........i.......................................................................................... 5700/9463
2019-12-29T20:06:43.8105551Z .................................................................................................... 5800/9463
2019-12-29T20:06:43.8105551Z .................................................................................................... 5800/9463
2019-12-29T20:06:54.4175256Z .................................................................................................ii. 5900/9463
2019-12-29T20:07:06.2057619Z ..i..ii...........i................................................................................. 6000/9463
2019-12-29T20:07:23.9827418Z .................................................................................................... 6200/9463
2019-12-29T20:07:31.3240794Z .................................................................................................... 6300/9463
2019-12-29T20:07:31.3240794Z .................................................................................................... 6300/9463
2019-12-29T20:07:46.0364106Z ........................i..ii....................................................................... 6400/9463
2019-12-29T20:08:05.7994716Z .................................................................................................... 6600/9463
2019-12-29T20:08:07.9424852Z .i.................................................................................................. 6700/9463
2019-12-29T20:08:10.2240327Z .................................................................................................... 6800/9463
2019-12-29T20:08:12.8166651Z .i.................................................................................................. 6900/9463
---
2019-12-29T20:09:48.5514476Z .................................................................................................... 7500/9463
2019-12-29T20:09:53.4569024Z .................................................................................................... 7600/9463
2019-12-29T20:09:58.9337895Z .................................................................................................... 7700/9463
2019-12-29T20:10:08.7901350Z .................................................................................................... 7800/9463
2019-12-29T20:10:16.2126912Z ................................iiii................................................................ 7900/9463
2019-12-29T20:10:30.7064101Z .................................................................................................... 8100/9463
2019-12-29T20:10:39.4317928Z .................................................................................................... 8200/9463
2019-12-29T20:10:53.4322317Z .................................................................................................... 8300/9463
2019-12-29T20:11:00.8767318Z .................................................................................................... 8400/9463
---
2019-12-29T20:12:53.3659009Z 14 help: consider further restricting this bound with `+ std::marker::Sized`
2019-12-29T20:12:53.3659238Z -   --> $DIR/trait-suggest-where-clause.rs:6:26
2019-12-29T20:12:53.3659455Z +   --> $DIR/trait-suggest-where-clause.rs:9:26
2019-12-29T20:12:53.3659495Z 16    |
2019-12-29T20:12:53.3659534Z 17 LL | fn check<T: Iterator, U: ?Sized>() {
2019-12-29T20:12:53.3659618Z 
2019-12-29T20:12:53.3659618Z 
2019-12-29T20:12:53.3660057Z 31    = help: within `Misc<U>`, the trait `std::marker::Sized` is not implemented for `U`
2019-12-29T20:12:53.3660497Z 33 help: consider further restricting this bound with `+ std::marker::Sized`
2019-12-29T20:12:53.3660703Z -   --> $DIR/trait-suggest-where-clause.rs:6:26
2019-12-29T20:12:53.3661110Z +   --> $DIR/trait-suggest-where-clause.rs:9:26
2019-12-29T20:12:53.3661154Z 35    |
2019-12-29T20:12:53.3661154Z 35    |
2019-12-29T20:12:53.3661193Z 36 LL | fn check<T: Iterator, U: ?Sized>() {
2019-12-29T20:12:53.3661400Z 
2019-12-29T20:12:53.3661424Z 
2019-12-29T20:12:53.3661464Z The actual stderr differed from the expected stderr.
2019-12-29T20:12:53.3661995Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-suggest-where-clause/trait-suggest-where-clause.stderr
2019-12-29T20:12:53.3661995Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-suggest-where-clause/trait-suggest-where-clause.stderr
2019-12-29T20:12:53.3662262Z To update references, rerun the tests and pass the `--bless` flag
2019-12-29T20:12:53.3662673Z To only update this specific test, also pass `--test-args traits/trait-suggest-where-clause.rs`
2019-12-29T20:12:53.3662763Z error: 1 errors occurred comparing output.
2019-12-29T20:12:53.3662803Z status: exit code: 1
2019-12-29T20:12:53.3662803Z status: exit code: 1
2019-12-29T20:12:53.3663715Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/traits/trait-suggest-where-clause.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-suggest-where-clause" "-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/traits/trait-suggest-where-clause/auxiliary" "-A" "unused"
2019-12-29T20:12:53.3664018Z ------------------------------------------
2019-12-29T20:12:53.3664072Z 
2019-12-29T20:12:53.3664262Z ------------------------------------------
2019-12-29T20:12:53.3664301Z stderr:
---
2019-12-29T20:12:53.3665083Z    |                    ^ doesn't have a size known at compile-time
2019-12-29T20:12:53.3665141Z    | 
2019-12-29T20:12:53.3665181Z   ::: /checkout/src/libcore/mem/mod.rs:275:22
2019-12-29T20:12:53.3665217Z    |
2019-12-29T20:12:53.3665401Z LL | pub const fn size_of<T>() -> usize {
2019-12-29T20:12:53.3665684Z    |
2019-12-29T20:12:53.3665728Z    = help: the trait `std::marker::Sized` is not implemented for `U`
2019-12-29T20:12:53.3666023Z    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
2019-12-29T20:12:53.3666077Z help: consider further restricting this bound with `+ std::marker::Sized`
2019-12-29T20:12:53.3666077Z help: consider further restricting this bound with `+ std::marker::Sized`
2019-12-29T20:12:53.3666465Z   --> /checkout/src/test/ui/traits/trait-suggest-where-clause.rs:9:26
2019-12-29T20:12:53.3666527Z    |
2019-12-29T20:12:53.3666564Z LL | fn check<T: Iterator, U: ?Sized>() {
2019-12-29T20:12:53.3666655Z 
2019-12-29T20:12:53.3666698Z error[E0277]: the size for values of type `U` cannot be known at compilation time
2019-12-29T20:12:53.3666925Z   --> /checkout/src/test/ui/traits/trait-suggest-where-clause.rs:14:5
2019-12-29T20:12:53.3667070Z    |
2019-12-29T20:12:53.3667070Z    |
2019-12-29T20:12:53.3667116Z LL |     mem::size_of::<Misc<U>>();
2019-12-29T20:12:53.3667415Z    | 
2019-12-29T20:12:53.3667474Z   ::: /checkout/src/libcore/mem/mod.rs:275:22
2019-12-29T20:12:53.3667511Z    |
2019-12-29T20:12:53.3667511Z    |
2019-12-29T20:12:53.3667703Z LL | pub const fn size_of<T>() -> usize {
2019-12-29T20:12:53.3667986Z    |
2019-12-29T20:12:53.3667986Z    |
2019-12-29T20:12:53.3668029Z    = help: within `Misc<U>`, the trait `std::marker::Sized` is not implemented for `U`
2019-12-29T20:12:53.3668496Z help: consider further restricting this bound with `+ std::marker::Sized`
2019-12-29T20:12:53.3668718Z   --> /checkout/src/test/ui/traits/trait-suggest-where-clause.rs:9:26
2019-12-29T20:12:53.3668787Z    |
2019-12-29T20:12:53.3668787Z    |
2019-12-29T20:12:53.3668825Z LL | fn check<T: Iterator, U: ?Sized>() {
2019-12-29T20:12:53.3668927Z    = note: required because it appears within the type `Misc<U>`
2019-12-29T20:12:53.3668955Z 
2019-12-29T20:12:53.3668955Z 
2019-12-29T20:12:53.3668997Z error[E0277]: the trait bound `u64: std::convert::From<T>` is not satisfied
2019-12-29T20:12:53.3669282Z    |
2019-12-29T20:12:53.3669282Z    |
2019-12-29T20:12:53.3669319Z LL |     <u64 as From<T>>::from;
2019-12-29T20:12:53.3669366Z    |     ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<T>` is not implemented for `u64`
2019-12-29T20:12:53.3669472Z    = note: required by `std::convert::From::from`
2019-12-29T20:12:53.3669500Z 
2019-12-29T20:12:53.3669500Z 
2019-12-29T20:12:53.3669545Z error[E0277]: the trait bound `u64: std::convert::From<<T as std::iter::Iterator>::Item>` is not satisfied
2019-12-29T20:12:53.3669840Z    |
2019-12-29T20:12:53.3669840Z    |
2019-12-29T20:12:53.3669879Z LL |     <u64 as From<<T as Iterator>::Item>>::from;
2019-12-29T20:12:53.3669951Z    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<<T as std::iter::Iterator>::Item>` is not implemented for `u64`
2019-12-29T20:12:53.3670033Z    = note: required by `std::convert::From::from`
2019-12-29T20:12:53.3670076Z 
2019-12-29T20:12:53.3670076Z 
2019-12-29T20:12:53.3670121Z error[E0277]: the trait bound `Misc<_>: std::convert::From<T>` is not satisfied
2019-12-29T20:12:53.3670416Z    |
2019-12-29T20:12:53.3670416Z    |
2019-12-29T20:12:53.3670453Z LL |     <Misc<_> as From<T>>::from;
2019-12-29T20:12:53.3670500Z    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<T>` is not implemented for `Misc<_>`
2019-12-29T20:12:53.3670607Z    = note: required by `std::convert::From::from`
2019-12-29T20:12:53.3670633Z 
2019-12-29T20:12:53.3670675Z error[E0277]: the size for values of type `[T]` cannot be known at compilation time
2019-12-29T20:12:53.3670921Z   --> /checkout/src/test/ui/traits/trait-suggest-where-clause.rs:32:20
2019-12-29T20:12:53.3670921Z   --> /checkout/src/test/ui/traits/trait-suggest-where-clause.rs:32:20
2019-12-29T20:12:53.3670963Z    |
2019-12-29T20:12:53.3670999Z LL |     mem::size_of::<[T]>();
2019-12-29T20:12:53.3671275Z    | 
2019-12-29T20:12:53.3671314Z   ::: /checkout/src/libcore/mem/mod.rs:275:22
2019-12-29T20:12:53.3671350Z    |
2019-12-29T20:12:53.3671350Z    |
2019-12-29T20:12:53.3671556Z LL | pub const fn size_of<T>() -> usize {
2019-12-29T20:12:53.3671827Z    |
2019-12-29T20:12:53.3671886Z    = help: the trait `std::marker::Sized` is not implemented for `[T]`
2019-12-29T20:12:53.3672247Z    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
2019-12-29T20:12:53.3672290Z 
2019-12-29T20:12:53.3672290Z 
2019-12-29T20:12:53.3672352Z error[E0277]: the size for values of type `[&U]` cannot be known at compilation time
2019-12-29T20:12:53.3672647Z    |
2019-12-29T20:12:53.3672647Z    |
2019-12-29T20:12:53.3672685Z LL |     mem::size_of::<[&U]>();
2019-12-29T20:12:53.3672963Z    | 
2019-12-29T20:12:53.3673002Z   ::: /checkout/src/libcore/mem/mod.rs:275:22
2019-12-29T20:12:53.3673058Z    |
2019-12-29T20:12:53.3673058Z    |
2019-12-29T20:12:53.3673358Z LL | pub const fn size_of<T>() -> usize {
2019-12-29T20:12:53.3673639Z    |
2019-12-29T20:12:53.3673680Z    = help: the trait `std::marker::Sized` is not implemented for `[&U]`
2019-12-29T20:12:53.3674200Z    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
2019-12-29T20:12:53.3674255Z 
---
2019-12-29T20:12:53.3694277Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:385:22
2019-12-29T20:12:53.3694391Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-12-29T20:12:53.3712662Z 
2019-12-29T20:12:53.3712729Z 
2019-12-29T20:12:53.3715746Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-7/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "7.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-12-29T20:12:53.3716053Z 
2019-12-29T20:12:53.3716084Z 
2019-12-29T20:12:53.3722957Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-12-29T20:12:53.3723255Z Build completed unsuccessfully in 1:03:02
2019-12-29T20:12:53.3723255Z Build completed unsuccessfully in 1:03:02
2019-12-29T20:12:53.3775076Z == clock drift check ==
2019-12-29T20:12:53.3792466Z   local time: Sun Dec 29 20:12:53 UTC 2019
2019-12-29T20:12:53.6841297Z   network time: Sun, 29 Dec 2019 20:12:53 GMT
2019-12-29T20:12:53.6851280Z == end clock drift check ==
2019-12-29T20:12:54.8955446Z 
2019-12-29T20:12:54.9076787Z ##[error]Bash exited with code '1'.
2019-12-29T20:12:54.9118537Z ##[section]Starting: Checkout
2019-12-29T20:12:54.9120162Z ==============================================================================
2019-12-29T20:12:54.9120230Z Task         : Get sources
2019-12-29T20:12:54.9120273Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 30, 2019

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

@Patryk27 Patryk27 force-pushed the Patryk27:master branch from 3bfdf05 to 4a46c6d Dec 30, 2019
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 30, 2019

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-12-30T18:06:10.3713495Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-30T18:06:10.3940466Z ##[command]git config gc.auto 0
2019-12-30T18:06:10.4004563Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-30T18:06:10.4063107Z ##[command]git config --get-all http.proxy
2019-12-30T18:06:10.4187037Z ##[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/67665/merge:refs/remotes/pull/67665/merge
---
2019-12-30T19:01:51.2758733Z .................................................................................................... 1500/9465
2019-12-30T19:01:56.8470831Z .................................................................................................... 1600/9465
2019-12-30T19:02:01.5114910Z .................................................................................................... 1700/9465
2019-12-30T19:02:10.5186871Z .................................................................................................... 1800/9465
2019-12-30T19:02:18.2304001Z .i.................................................................................................. 1900/9465
2019-12-30T19:02:24.5221284Z .......................................................................................iiiii........ 2000/9465
2019-12-30T19:02:44.7679367Z .................................................................................................... 2200/9465
2019-12-30T19:02:46.8882285Z .................................................................................................... 2300/9465
2019-12-30T19:02:49.2728747Z .................................................................................................... 2400/9465
2019-12-30T19:02:55.0031592Z .................................................................................................... 2500/9465
---
2019-12-30T19:05:42.2072244Z ..................i...............i................................................................. 4900/9465
2019-12-30T19:05:51.3466795Z .................................................................................................... 5000/9465
2019-12-30T19:05:56.4360891Z ...............................................................i.................................... 5100/9465
2019-12-30T19:06:04.1515929Z .................................................................................................... 5200/9465
2019-12-30T19:06:11.0730256Z ..............................ii.ii...........i..................................................... 5300/9465
2019-12-30T19:06:19.8790521Z .................................................................................................... 5500/9465
2019-12-30T19:06:29.3015989Z .................................................................................................... 5600/9465
2019-12-30T19:06:35.9693184Z .............i...................................................................................... 5700/9465
2019-12-30T19:06:41.5785591Z .................................................................................................... 5800/9465
2019-12-30T19:06:41.5785591Z .................................................................................................... 5800/9465
2019-12-30T19:06:51.6447990Z .................................................................................................... 5900/9465
2019-12-30T19:07:02.7144615Z .ii...i..ii...........i............................................................................. 6000/9465
2019-12-30T19:07:19.1600623Z .................................................................................................... 6200/9465
2019-12-30T19:07:26.3281164Z .................................................................................................... 6300/9465
2019-12-30T19:07:26.3281164Z .................................................................................................... 6300/9465
2019-12-30T19:07:44.4906692Z ............................i..ii................................................................... 6400/9465
2019-12-30T19:08:03.5962641Z .................................................................................................... 6600/9465
2019-12-30T19:08:05.7654115Z ...i................................................................................................ 6700/9465
2019-12-30T19:08:08.0094047Z .................................................................................................... 6800/9465
2019-12-30T19:08:10.4364691Z ...i................................................................................................ 6900/9465
---
2019-12-30T19:09:43.7406473Z .................................................................................................... 7500/9465
2019-12-30T19:09:48.4927041Z .................................................................................................... 7600/9465
2019-12-30T19:09:53.8154390Z .................................................................................................... 7700/9465
2019-12-30T19:10:03.2935181Z .................................................................................................... 7800/9465
2019-12-30T19:10:10.4069749Z ..................................iiii.............................................................. 7900/9465
2019-12-30T19:10:24.5521203Z .................................................................................................... 8100/9465
2019-12-30T19:10:32.8365039Z .................................................................................................... 8200/9465
2019-12-30T19:10:46.7424839Z .................................................................................................... 8300/9465
2019-12-30T19:10:54.1577953Z .................................................................................................... 8400/9465
---
2019-12-30T19:12:43.4647723Z 14 help: consider further restricting this bound with `+ std::marker::Sized`
2019-12-30T19:12:43.4647915Z -   --> $DIR/trait-suggest-where-clause.rs:6:26
2019-12-30T19:12:43.4648114Z +   --> $DIR/trait-suggest-where-clause.rs:9:26
2019-12-30T19:12:43.4648166Z 16    |
2019-12-30T19:12:43.4648210Z 17 LL | fn check<T: Iterator, U: ?Sized>() {
2019-12-30T19:12:43.4648289Z 
2019-12-30T19:12:43.4648289Z 
2019-12-30T19:12:43.4648329Z 31    = help: within `Misc<U>`, the trait `std::marker::Sized` is not implemented for `U`
2019-12-30T19:12:43.4648667Z 33 help: consider further restricting this bound with `+ std::marker::Sized`
2019-12-30T19:12:43.4648853Z -   --> $DIR/trait-suggest-where-clause.rs:6:26
2019-12-30T19:12:43.4649031Z +   --> $DIR/trait-suggest-where-clause.rs:9:26
2019-12-30T19:12:43.4649086Z 35    |
2019-12-30T19:12:43.4649086Z 35    |
2019-12-30T19:12:43.4649121Z 36 LL | fn check<T: Iterator, U: ?Sized>() {
2019-12-30T19:12:43.4649199Z 
2019-12-30T19:12:43.4649220Z 
2019-12-30T19:12:43.4649435Z The actual stderr differed from the expected stderr.
2019-12-30T19:12:43.4649820Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-suggest-where-clause/trait-suggest-where-clause.stderr
2019-12-30T19:12:43.4649820Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-suggest-where-clause/trait-suggest-where-clause.stderr
2019-12-30T19:12:43.4650048Z To update references, rerun the tests and pass the `--bless` flag
2019-12-30T19:12:43.4650267Z To only update this specific test, also pass `--test-args traits/trait-suggest-where-clause.rs`
2019-12-30T19:12:43.4650348Z error: 1 errors occurred comparing output.
2019-12-30T19:12:43.4650384Z status: exit code: 1
2019-12-30T19:12:43.4650384Z status: exit code: 1
2019-12-30T19:12:43.4651098Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/traits/trait-suggest-where-clause.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-suggest-where-clause" "-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/traits/trait-suggest-where-clause/auxiliary" "-A" "unused"
2019-12-30T19:12:43.4651391Z ------------------------------------------
2019-12-30T19:12:43.4651434Z 
2019-12-30T19:12:43.4651609Z ------------------------------------------
2019-12-30T19:12:43.4651645Z stderr:
---
2019-12-30T19:12:43.4652372Z    |                    ^ doesn't have a size known at compile-time
2019-12-30T19:12:43.4652410Z    | 
2019-12-30T19:12:43.4652472Z   ::: /checkout/src/libcore/mem/mod.rs:275:22
2019-12-30T19:12:43.4652513Z    |
2019-12-30T19:12:43.4652689Z LL | pub const fn size_of<T>() -> usize {
2019-12-30T19:12:43.4652943Z    |
2019-12-30T19:12:43.4652981Z    = help: the trait `std::marker::Sized` is not implemented for `U`
2019-12-30T19:12:43.4653259Z    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
2019-12-30T19:12:43.4653311Z help: consider further restricting this bound with `+ std::marker::Sized`
2019-12-30T19:12:43.4653311Z help: consider further restricting this bound with `+ std::marker::Sized`
2019-12-30T19:12:43.4653514Z   --> /checkout/src/test/ui/traits/trait-suggest-where-clause.rs:9:26
2019-12-30T19:12:43.4653569Z    |
2019-12-30T19:12:43.4653603Z LL | fn check<T: Iterator, U: ?Sized>() {
2019-12-30T19:12:43.4653663Z 
2019-12-30T19:12:43.4653726Z error[E0277]: the size for values of type `U` cannot be known at compilation time
2019-12-30T19:12:43.4653936Z   --> /checkout/src/test/ui/traits/trait-suggest-where-clause.rs:14:5
2019-12-30T19:12:43.4653973Z    |
2019-12-30T19:12:43.4653973Z    |
2019-12-30T19:12:43.4654026Z LL |     mem::size_of::<Misc<U>>();
2019-12-30T19:12:43.4654264Z    | 
2019-12-30T19:12:43.4654319Z   ::: /checkout/src/libcore/mem/mod.rs:275:22
2019-12-30T19:12:43.4654353Z    |
2019-12-30T19:12:43.4654353Z    |
2019-12-30T19:12:43.4654527Z LL | pub const fn size_of<T>() -> usize {
2019-12-30T19:12:43.4654778Z    |
2019-12-30T19:12:43.4654778Z    |
2019-12-30T19:12:43.4654818Z    = help: within `Misc<U>`, the trait `std::marker::Sized` is not implemented for `U`
2019-12-30T19:12:43.4655215Z help: consider further restricting this bound with `+ std::marker::Sized`
2019-12-30T19:12:43.4655494Z   --> /checkout/src/test/ui/traits/trait-suggest-where-clause.rs:9:26
2019-12-30T19:12:43.4655550Z    |
2019-12-30T19:12:43.4655550Z    |
2019-12-30T19:12:43.4655585Z LL | fn check<T: Iterator, U: ?Sized>() {
2019-12-30T19:12:43.4655660Z    = note: required because it appears within the type `Misc<U>`
2019-12-30T19:12:43.4655706Z 
2019-12-30T19:12:43.4655706Z 
2019-12-30T19:12:43.4655746Z error[E0277]: the trait bound `u64: std::convert::From<T>` is not satisfied
2019-12-30T19:12:43.4656007Z    |
2019-12-30T19:12:43.4656007Z    |
2019-12-30T19:12:43.4656041Z LL |     <u64 as From<T>>::from;
2019-12-30T19:12:43.4656084Z    |     ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<T>` is not implemented for `u64`
2019-12-30T19:12:43.4656174Z    = note: required by `std::convert::From::from`
2019-12-30T19:12:43.4656206Z 
2019-12-30T19:12:43.4656206Z 
2019-12-30T19:12:43.4656252Z error[E0277]: the trait bound `u64: std::convert::From<<T as std::iter::Iterator>::Item>` is not satisfied
2019-12-30T19:12:43.4656514Z    |
2019-12-30T19:12:43.4656514Z    |
2019-12-30T19:12:43.4656550Z LL |     <u64 as From<<T as Iterator>::Item>>::from;
2019-12-30T19:12:43.4656615Z    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<<T as std::iter::Iterator>::Item>` is not implemented for `u64`
2019-12-30T19:12:43.4656690Z    = note: required by `std::convert::From::from`
2019-12-30T19:12:43.4656714Z 
2019-12-30T19:12:43.4656714Z 
2019-12-30T19:12:43.4656770Z error[E0277]: the trait bound `Misc<_>: std::convert::From<T>` is not satisfied
2019-12-30T19:12:43.4657010Z    |
2019-12-30T19:12:43.4657010Z    |
2019-12-30T19:12:43.4657062Z LL |     <Misc<_> as From<T>>::from;
2019-12-30T19:12:43.4657111Z    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<T>` is not implemented for `Misc<_>`
2019-12-30T19:12:43.4657206Z    = note: required by `std::convert::From::from`
2019-12-30T19:12:43.4657230Z 
2019-12-30T19:12:43.4657268Z error[E0277]: the size for values of type `[T]` cannot be known at compilation time
2019-12-30T19:12:43.4657493Z   --> /checkout/src/test/ui/traits/trait-suggest-where-clause.rs:32:20
2019-12-30T19:12:43.4657493Z   --> /checkout/src/test/ui/traits/trait-suggest-where-clause.rs:32:20
2019-12-30T19:12:43.4657531Z    |
2019-12-30T19:12:43.4657565Z LL |     mem::size_of::<[T]>();
2019-12-30T19:12:43.4657816Z    | 
2019-12-30T19:12:43.4657851Z   ::: /checkout/src/libcore/mem/mod.rs:275:22
2019-12-30T19:12:43.4657884Z    |
2019-12-30T19:12:43.4657884Z    |
2019-12-30T19:12:43.4658076Z LL | pub const fn size_of<T>() -> usize {
2019-12-30T19:12:43.4658312Z    |
2019-12-30T19:12:43.4658374Z    = help: the trait `std::marker::Sized` is not implemented for `[T]`
2019-12-30T19:12:43.4658638Z    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
2019-12-30T19:12:43.4658669Z 
2019-12-30T19:12:43.4658669Z 
2019-12-30T19:12:43.4658708Z error[E0277]: the size for values of type `[&U]` cannot be known at compilation time
2019-12-30T19:12:43.4658963Z    |
2019-12-30T19:12:43.4658963Z    |
2019-12-30T19:12:43.4658996Z LL |     mem::size_of::<[&U]>();
2019-12-30T19:12:43.4659246Z    | 
2019-12-30T19:12:43.4659281Z   ::: /checkout/src/libcore/mem/mod.rs:275:22
2019-12-30T19:12:43.4659332Z    |
2019-12-30T19:12:43.4659332Z    |
2019-12-30T19:12:43.4659507Z LL | pub const fn size_of<T>() -> usize {
2019-12-30T19:12:43.4659823Z    |
2019-12-30T19:12:43.4659906Z    = help: the trait `std::marker::Sized` is not implemented for `[&U]`
2019-12-30T19:12:43.4660191Z    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
2019-12-30T19:12:43.4660222Z 
---
2019-12-30T19:12:43.4664680Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:385:22
2019-12-30T19:12:43.4664733Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-12-30T19:12:43.4676507Z 
2019-12-30T19:12:43.4676599Z 
2019-12-30T19:12:43.4678030Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-7/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "7.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-12-30T19:12:43.4678464Z 
2019-12-30T19:12:43.4678488Z 
2019-12-30T19:12:43.4683159Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-12-30T19:12:43.4683490Z Build completed unsuccessfully in 1:00:03
2019-12-30T19:12:43.4683490Z Build completed unsuccessfully in 1:00:03
2019-12-30T19:12:43.4733404Z == clock drift check ==
2019-12-30T19:12:43.4747891Z   local time: Mon Dec 30 19:12:43 UTC 2019
2019-12-30T19:12:44.0011793Z   network time: Mon, 30 Dec 2019 19:12:43 GMT
2019-12-30T19:12:44.0011861Z == end clock drift check ==
2019-12-30T19:12:45.0857007Z 
2019-12-30T19:12:45.0996710Z ##[error]Bash exited with code '1'.
2019-12-30T19:12:45.1032724Z ##[section]Starting: Checkout
2019-12-30T19:12:45.1034262Z ==============================================================================
2019-12-30T19:12:45.1034331Z Task         : Get sources
2019-12-30T19:12:45.1034371Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 31, 2019

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

@Patryk27 Patryk27 force-pushed the Patryk27:master branch from 4a46c6d to 7c9e6f5 Jan 5, 2020
@Patryk27

This comment has been minimized.

Copy link
Contributor Author

Patryk27 commented Jan 5, 2020

According to @Centril's suggestion, I've split error_reporting.rs into a bunch of smaller files :-)

Taking the opportunity I've also modified the consider removing leading {} &-references hint to have a special case for when there's only one ampersand to drop (so it's consider removing the leading &-reference), just FYI.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 6, 2020

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

@Patryk27 Patryk27 force-pushed the Patryk27:master branch from d657de7 to 40a27bf Jan 6, 2020
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 6, 2020

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

@Patryk27 Patryk27 force-pushed the Patryk27:master branch 2 times, most recently from bd6b9ae to cb7ab46 Jan 7, 2020
@Patryk27

This comment has been minimized.

Copy link
Contributor Author

Patryk27 commented Jan 9, 2020

Hiya - since this branch is aging quite rapidly, maintaining it has become rather cumbersome; could someone please review it? :-) I'm not sure who to call, so @zackmdavis @Centril

Thanks,
Patryk.

@zackmdavis

This comment has been minimized.

Copy link
Member

zackmdavis commented Jan 9, 2020

@Patryk27 Thanks for your patience. Let me take a look tonight (I'm super behind on notifications and may need to resign from the reviewer queue 😰 😿 )

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 10, 2020

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

@zackmdavis

This comment has been minimized.

Copy link
Member

zackmdavis commented Jan 10, 2020

(ugh, or tomorrow night, need to sleep now 😰 )

@zackmdavis

This comment has been minimized.

Copy link
Member

zackmdavis commented Jan 13, 2020

okay, I at least managed to pull-request my resignation from the reviewer queue, and now I have to go to my dayjob, and then tonight I'll actually review this, and if I break my word this time then, like, hit me with a stick

@Patryk27

This comment has been minimized.

Copy link
Contributor Author

Patryk27 commented Jan 13, 2020

Don't worry, take your time; there are more important things that my PR - like a proper sleep! :-)

src/librustc/traits/error_reporting.rs Outdated Show resolved Hide resolved
@@ -5,7 +5,7 @@ LL | for (i, n) in &v.iter().enumerate() {
| -^^^^^^^^^^^^^^^^^^^^
| |
| `&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator
| help: consider removing 1 leading `&`-references
| help: consider removing the leading `&`-reference

This comment has been minimized.

Copy link
@zackmdavis
@zackmdavis

This comment has been minimized.

Copy link
Member

zackmdavis commented Jan 24, 2020

@bors delegate+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 24, 2020

✌️ @Patryk27 can now approve this pull request

@Patryk27 Patryk27 force-pushed the Patryk27:master branch from cb7ab46 to 3b7af1d Jan 24, 2020
@Patryk27

This comment has been minimized.

Copy link
Contributor Author

Patryk27 commented Jan 24, 2020

Hi - thanks for reviewing! :-)

While I've been rebasing this branch, I noticed that apparently three days ago someone already split this huge error_reporting.rs into a submodule... and since I'm kinda afraid my refactoring could end-up losing some parts of the new code, I've re-applied changes related solely to the original issue (and consider removing the leading &-reference), so the overall diff got relatively smaller :-P

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 26, 2020

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

@Patryk27 Patryk27 force-pushed the Patryk27:master branch from 3b7af1d to d2470eb Jan 27, 2020
@zackmdavis

This comment has been minimized.

Copy link
Member

zackmdavis commented Jan 28, 2020

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 28, 2020

📌 Commit d2470eb has been approved by zackmdavis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 28, 2020

⌛️ Testing commit d2470eb with merge 8b02e6c...

bors added a commit that referenced this pull request Jan 28, 2020
Improve reporting errors and suggestions for trait bounds

Fix #66802

- When printing errors for unsized function parameter, properly point at the parameter instead of function's body.
- Improve `consider further restricting this bound` (and related) messages by separating human-oriented hints from the machine-oriented ones.
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 29, 2020

The job x86_64-gnu-nopt of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-01-29T01:26:41.5190140Z 
2020-01-29T01:26:41.5190290Z 1 error[E0277]: `T` cannot be sent between threads safely
2020-01-29T01:26:41.5190733Z 2   --> $DIR/kindck-impl-type-params.rs:18:13
2020-01-29T01:26:41.5190934Z 3    |
2020-01-29T01:26:41.5191299Z - LL | fn f<T>(val: T) {
2020-01-29T01:26:41.5191929Z -    |      - help: consider restricting this bound: `T: std::marker::Send`
2020-01-29T01:26:41.5192483Z - LL |     let t: S<T> = S(marker::PhantomData);
2020-01-29T01:26:41.5192714Z 7 LL |     let a = &t as &dyn Gettable<T>;
2020-01-29T01:26:41.5192869Z 8    |             ^^ `T` cannot be sent between threads safely
2020-01-29T01:26:41.5193336Z 
2020-01-29T01:26:41.5193659Z 10    = help: the trait `std::marker::Send` is not implemented for `T`
2020-01-29T01:26:41.5193659Z 10    = help: the trait `std::marker::Send` is not implemented for `T`
2020-01-29T01:26:41.5193928Z + help: consider restricting this type parameter with `T: std::marker::Send`
2020-01-29T01:26:41.5194384Z +   --> $DIR/kindck-impl-type-params.rs:16:6
2020-01-29T01:26:41.5194594Z +    |
2020-01-29T01:26:41.5194724Z + LL | fn f<T>(val: T) {
2020-01-29T01:26:41.5194873Z +    |      ^
2020-01-29T01:26:41.5195036Z 11    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-01-29T01:26:41.5195200Z 12    = note: required for the cast to the object type `dyn Gettable<T>`
2020-01-29T01:26:41.5195463Z 
2020-01-29T01:26:41.5195630Z 14 error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
2020-01-29T01:26:41.5196001Z 15   --> $DIR/kindck-impl-type-params.rs:18:13
2020-01-29T01:26:41.5196201Z 16    |
2020-01-29T01:26:41.5196201Z 16    |
2020-01-29T01:26:41.5196510Z - LL | fn f<T>(val: T) {
2020-01-29T01:26:41.5196926Z -    |      - help: consider restricting this bound: `T: std::marker::Copy`
2020-01-29T01:26:41.5197342Z - LL |     let t: S<T> = S(marker::PhantomData);
2020-01-29T01:26:41.5197532Z 20 LL |     let a = &t as &dyn Gettable<T>;
2020-01-29T01:26:41.5197700Z 21    |             ^^ the trait `std::marker::Copy` is not implemented for `T`
2020-01-29T01:26:41.5197966Z 
2020-01-29T01:26:41.5197966Z 
2020-01-29T01:26:41.5198108Z + help: consider restricting this type parameter with `T: std::marker::Copy`
2020-01-29T01:26:41.5198469Z +   --> $DIR/kindck-impl-type-params.rs:16:6
2020-01-29T01:26:41.5198666Z +    |
2020-01-29T01:26:41.5198798Z + LL | fn f<T>(val: T) {
2020-01-29T01:26:41.5198945Z +    |      ^
2020-01-29T01:26:41.5199306Z 23    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-01-29T01:26:41.5199545Z 24    = note: required for the cast to the object type `dyn Gettable<T>`
2020-01-29T01:26:41.5199814Z 
2020-01-29T01:26:41.5199964Z 26 error[E0277]: `T` cannot be sent between threads safely
2020-01-29T01:26:41.5200365Z 27   --> $DIR/kindck-impl-type-params.rs:25:31
2020-01-29T01:26:41.5200570Z 28    |
2020-01-29T01:26:41.5200570Z 28    |
2020-01-29T01:26:41.5200876Z - LL | fn g<T>(val: T) {
2020-01-29T01:26:41.5201293Z -    |      - help: consider restricting this bound: `T: std::marker::Send`
2020-01-29T01:26:41.5201672Z - LL |     let t: S<T> = S(marker::PhantomData);
2020-01-29T01:26:41.5201876Z 32 LL |     let a: &dyn Gettable<T> = &t;
2020-01-29T01:26:41.5202046Z 33    |                               ^^ `T` cannot be sent between threads safely
2020-01-29T01:26:41.5202315Z 
2020-01-29T01:26:41.5202478Z 35    = help: the trait `std::marker::Send` is not implemented for `T`
2020-01-29T01:26:41.5202478Z 35    = help: the trait `std::marker::Send` is not implemented for `T`
2020-01-29T01:26:41.5202661Z + help: consider restricting this type parameter with `T: std::marker::Send`
2020-01-29T01:26:41.5203020Z +   --> $DIR/kindck-impl-type-params.rs:23:6
2020-01-29T01:26:41.5203485Z +    |
2020-01-29T01:26:41.5203654Z + LL | fn g<T>(val: T) {
2020-01-29T01:26:41.5203981Z +    |      ^
2020-01-29T01:26:41.5204150Z 36    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-01-29T01:26:41.5204310Z 37    = note: required for the cast to the object type `dyn Gettable<T>`
2020-01-29T01:26:41.5204571Z 
2020-01-29T01:26:41.5204727Z 39 error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
2020-01-29T01:26:41.5205123Z 40   --> $DIR/kindck-impl-type-params.rs:25:31
2020-01-29T01:26:41.5205337Z 41    |
2020-01-29T01:26:41.5205337Z 41    |
2020-01-29T01:26:41.5205662Z - LL | fn g<T>(val: T) {
2020-01-29T01:26:41.5206222Z -    |      - help: consider restricting this bound: `T: std::marker::Copy`
2020-01-29T01:26:41.5206866Z - LL |     let t: S<T> = S(marker::PhantomData);
2020-01-29T01:26:41.5207064Z 45 LL |     let a: &dyn Gettable<T> = &t;
2020-01-29T01:26:41.5207239Z 46    |                               ^^ the trait `std::marker::Copy` is not implemented for `T`
2020-01-29T01:26:41.5207525Z 
2020-01-29T01:26:41.5207525Z 
2020-01-29T01:26:41.5207681Z + help: consider restricting this type parameter with `T: std::marker::Copy`
2020-01-29T01:26:41.5208022Z +   --> $DIR/kindck-impl-type-params.rs:23:6
2020-01-29T01:26:41.5208220Z +    |
2020-01-29T01:26:41.5208346Z + LL | fn g<T>(val: T) {
2020-01-29T01:26:41.5208492Z +    |      ^
2020-01-29T01:26:41.5208654Z 48    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-01-29T01:26:41.5208807Z 49    = note: required for the cast to the object type `dyn Gettable<T>`
2020-01-29T01:26:41.5209058Z 
2020-01-29T01:26:41.5209159Z 
2020-01-29T01:26:41.5209309Z The actual stderr differed from the expected stderr.
2020-01-29T01:26:41.5209309Z The actual stderr differed from the expected stderr.
2020-01-29T01:26:41.5209772Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/kindck/kindck-impl-type-params.nll/kindck-impl-type-params.nll.stderr
2020-01-29T01:26:41.5210189Z To update references, rerun the tests and pass the `--bless` flag
2020-01-29T01:26:41.5211165Z To only update this specific test, also pass `--test-args kindck/kindck-impl-type-params.rs`
2020-01-29T01:26:41.5213146Z error: 1 errors occurred comparing output.
2020-01-29T01:26:41.5213367Z status: exit code: 1
2020-01-29T01:26:41.5213367Z status: exit code: 1
2020-01-29T01:26:41.5215873Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/kindck/kindck-impl-type-params.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/kindck/kindck-impl-type-params.nll" "-Zborrowck=mir" "-Crpath" "-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/kindck/kindck-impl-type-params.nll/auxiliary" "-A" "unused"
2020-01-29T01:26:41.5218613Z ------------------------------------------
2020-01-29T01:26:41.5218866Z 
2020-01-29T01:26:41.5219076Z ------------------------------------------
2020-01-29T01:26:41.5219190Z stderr:
2020-01-29T01:26:41.5219190Z stderr:
2020-01-29T01:26:41.5219387Z ------------------------------------------
2020-01-29T01:26:41.5219472Z error[E0277]: `T` cannot be sent between threads safely
2020-01-29T01:26:41.5219714Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:18:13
2020-01-29T01:26:41.5219800Z    |
2020-01-29T01:26:41.5219853Z LL |     let a = &t as &dyn Gettable<T>;
2020-01-29T01:26:41.5219941Z    |             ^^ `T` cannot be sent between threads safely
2020-01-29T01:26:41.5220082Z    = help: the trait `std::marker::Send` is not implemented for `T`
2020-01-29T01:26:41.5220182Z help: consider restricting this type parameter with `T: std::marker::Send`
2020-01-29T01:26:41.5220437Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:16:6
2020-01-29T01:26:41.5220706Z    |
2020-01-29T01:26:41.5220706Z    |
2020-01-29T01:26:41.5220755Z LL | fn f<T>(val: T) {
2020-01-29T01:26:41.5222324Z    |      ^
2020-01-29T01:26:41.5222390Z    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-01-29T01:26:41.5222488Z    = note: required for the cast to the object type `dyn Gettable<T>`
2020-01-29T01:26:41.5222608Z error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
2020-01-29T01:26:41.5222921Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:18:13
2020-01-29T01:26:41.5223003Z    |
2020-01-29T01:26:41.5223003Z    |
2020-01-29T01:26:41.5223072Z LL |     let a = &t as &dyn Gettable<T>;
2020-01-29T01:26:41.5223140Z    |             ^^ the trait `std::marker::Copy` is not implemented for `T`
2020-01-29T01:26:41.5223469Z help: consider restricting this type parameter with `T: std::marker::Copy`
2020-01-29T01:26:41.5224418Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:16:6
2020-01-29T01:26:41.5224495Z    |
2020-01-29T01:26:41.5224495Z    |
2020-01-29T01:26:41.5224780Z LL | fn f<T>(val: T) {
2020-01-29T01:26:41.5225010Z    |      ^
2020-01-29T01:26:41.5225100Z    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-01-29T01:26:41.5225185Z    = note: required for the cast to the object type `dyn Gettable<T>`
2020-01-29T01:26:41.5225822Z error[E0277]: `T` cannot be sent between threads safely
2020-01-29T01:26:41.5226345Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:25:31
2020-01-29T01:26:41.5226420Z    |
2020-01-29T01:26:41.5226420Z    |
2020-01-29T01:26:41.5226492Z LL |     let a: &dyn Gettable<T> = &t;
2020-01-29T01:26:41.5226569Z    |                               ^^ `T` cannot be sent between threads safely
2020-01-29T01:26:41.5226849Z    = help: the trait `std::marker::Send` is not implemented for `T`
2020-01-29T01:26:41.5226933Z help: consider restricting this type parameter with `T: std::marker::Send`
2020-01-29T01:26:41.5227220Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:23:6
2020-01-29T01:26:41.5227300Z    |
2020-01-29T01:26:41.5227300Z    |
2020-01-29T01:26:41.5227374Z LL | fn g<T>(val: T) {
2020-01-29T01:26:41.5227434Z    |      ^
2020-01-29T01:26:41.5227524Z    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-01-29T01:26:41.5227611Z    = note: required for the cast to the object type `dyn Gettable<T>`
2020-01-29T01:26:41.5227743Z error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
2020-01-29T01:26:41.5228223Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:25:31
2020-01-29T01:26:41.5228457Z    |
2020-01-29T01:26:41.5228457Z    |
2020-01-29T01:26:41.5228530Z LL |     let a: &dyn Gettable<T> = &t;
2020-01-29T01:26:41.5228612Z    |                               ^^ the trait `std::marker::Copy` is not implemented for `T`
2020-01-29T01:26:41.5229308Z help: consider restricting this type parameter with `T: std::marker::Copy`
2020-01-29T01:26:41.5230000Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:23:6
2020-01-29T01:26:41.5230555Z    |
2020-01-29T01:26:41.5230555Z    |
2020-01-29T01:26:41.5230608Z LL | fn g<T>(val: T) {
2020-01-29T01:26:41.5230684Z    |      ^
2020-01-29T01:26:41.5230752Z    = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
2020-01-29T01:26:41.5230860Z    = note: required for the cast to the object type `dyn Gettable<T>`
2020-01-29T01:26:41.5230990Z error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
2020-01-29T01:26:41.5231438Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:38:13
2020-01-29T01:26:41.5231793Z    |
2020-01-29T01:26:41.5231793Z    |
2020-01-29T01:26:41.5231848Z LL |     let a = t as Box<dyn Gettable<String>>;
2020-01-29T01:26:41.5231949Z    |             ^ the trait `std::marker::Copy` is not implemented for `std::string::String`
2020-01-29T01:26:41.5232016Z    |
2020-01-29T01:26:41.5232106Z    = note: required because of the requirements on the impl of `Gettable<std::string::String>` for `S<std::string::String>`
2020-01-29T01:26:41.5232301Z    = note: required for the cast to the object type `dyn Gettable<std::string::String>`
2020-01-29T01:26:41.5232352Z 
2020-01-29T01:26:41.5232443Z error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied
2020-01-29T01:26:41.5232708Z   --> /checkout/src/test/ui/kindck/kindck-impl-type-params.rs:46:37
2020-01-29T01:26:41.5232791Z    |
2020-01-29T01:26:41.5232842Z LL |     let a: Box<dyn Gettable<Foo>> = t;
2020-01-29T01:26:41.5232935Z    |                                     ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo`
2020-01-29T01:26:41.5233189Z    |
2020-01-29T01:26:41.5233376Z    = note: required because of the requirements on the impl of `Gettable<foo3::Foo>` for `S<foo3::Foo>`
2020-01-29T01:26:41.5233469Z    = note: required for the cast to the object type `dyn Gettable<foo3::Foo>`
2020-01-29T01:26:41.5233585Z error: aborting due to 6 previous errors
2020-01-29T01:26:41.5233641Z 
2020-01-29T01:26:41.5234215Z For more information about this error, try `rustc --explain E0277`.
2020-01-29T01:26:41.5234269Z 
---
2020-01-29T01:26:41.5236260Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
2020-01-29T01:26:41.5236356Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2020-01-29T01:26:41.5236435Z 
2020-01-29T01:26:41.5236469Z 
2020-01-29T01:26:41.5239368Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "/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" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--host-rustcflags" "-Crpath -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -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" "--llvm-version" "9.0.1-rust-1.42.0-nightly\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always" "--compare-mode" "nll"
2020-01-29T01:26:41.5240760Z 
2020-01-29T01:26:41.5240796Z 
2020-01-29T01:26:41.5241024Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2020-01-29T01:26:41.5241296Z Build completed unsuccessfully in 1:37:29
2020-01-29T01:26:41.5241296Z Build completed unsuccessfully in 1:37:29
2020-01-29T01:26:41.5242013Z == clock drift check ==
2020-01-29T01:26:41.5242780Z   local time: Wed Jan 29 01:26:40 UTC 2020
2020-01-29T01:26:41.5243046Z   network time: Wed, 29 Jan 2020 01:26:41 GMT
2020-01-29T01:26:41.5243117Z == end clock drift check ==
2020-01-29T01:26:41.9437582Z 
2020-01-29T01:26:41.9530885Z ##[error]Bash exited with code '1'.
2020-01-29T01:26:41.9579116Z ##[section]Starting: Checkout rust-lang/rust@auto to s
2020-01-29T01:26:41.9582186Z ==============================================================================
2020-01-29T01:26:41.9582269Z Task         : Get sources
2020-01-29T01:26:41.9582538Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 29, 2020

💔 Test failed - checks-azure

@Patryk27 Patryk27 force-pushed the Patryk27:master branch from d2470eb to 4348dbc Jan 29, 2020
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 4, 2020

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

@Patryk27 Patryk27 force-pushed the Patryk27:master branch from 4348dbc to 7473ccf Feb 9, 2020
@Patryk27 Patryk27 force-pushed the Patryk27:master branch from 7473ccf to a8d34c1 Feb 9, 2020
@Patryk27

This comment has been minimized.

Copy link
Contributor Author

Patryk27 commented Feb 9, 2020

Hi, I'm just reminding about this patch :-P

@zackmdavis

This comment has been minimized.

Copy link
Member

zackmdavis commented Feb 9, 2020

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 9, 2020

📌 Commit a8d34c1 has been approved by zackmdavis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 9, 2020

⌛️ Testing commit a8d34c1 with merge 840bdc3...

bors added a commit that referenced this pull request Feb 9, 2020
Improve reporting errors and suggestions for trait bounds

Fix #66802

- When printing errors for unsized function parameter, properly point at the parameter instead of function's body.
- Improve `consider further restricting this bound` (and related) messages by separating human-oriented hints from the machine-oriented ones.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 10, 2020

☀️ Test successful - checks-azure
Approved by: zackmdavis
Pushing 840bdc3 to master...

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

Successfully merging this pull request may close these issues.

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