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

Extend E0106, E0261 #57310

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
5 participants
@purple-ice
Copy link

purple-ice commented Jan 3, 2019

Added an example that points out hardly obvious mistake one could make when writing impl for a new type.

Extend E0106, E0261
Added an example that points out hardly obvious mistake one could make when writing impl for a new type.
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 3, 2019

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@@ -772,6 +776,24 @@ struct Foo<'a> {
x: &'a str,
}
```
Implementations need their own lifetime declarations:

This comment has been minimized.

@QuietMisdreavus

QuietMisdreavus Jan 3, 2019

Member

Doc suggestion:

Impl blocks declare lifetime parameters separately. You need to add lifetime parameters to an impl block if you're implementing a type that has a lifetime parameter of its own. For example:

Implementations need their own lifetime declarations:
```

This comment has been minimized.

@QuietMisdreavus

QuietMisdreavus Jan 3, 2019

Member

Since these code blocks stand on their own, can you make sure to tag them with compile_fail,E0261 like the other failing sample in this excerpt? You'll also need to include the struct definition again.

Which are declared like this:
```
// correct

This comment has been minimized.

@QuietMisdreavus

QuietMisdreavus Jan 3, 2019

Member

These code samples are tested, so please include the struct definition in this sample to make sure it properly compiles.

@QuietMisdreavus

This comment has been minimized.

Copy link
Member

QuietMisdreavus commented Jan 3, 2019

r? @QuietMisdreavus

cc @rust-lang/docs in case someone else wants to take a look.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 3, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (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.
travis_time:end:0209a86a:start=1546542387154158626,finish=1546542389779984410,duration=2625825784
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---

[00:02:51] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:02:52] tidy error: /checkout/src/librustc/diagnostics.rs:781: trailing whitespace
[00:02:53] some tidy checks failed
[00:02:53] 
[00:02:53] 
[00:02:53] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:02:53] 
[00:02:53] 
[00:02:53] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:02:53] Build completed unsuccessfully in 0:00:45
[00:02:53] Build completed unsuccessfully in 0:00:45
[00:02:53] make: *** [tidy] Error 1
[00:02:53] Makefile:69: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:226af279
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Thu Jan  3 19:09:31 UTC 2019
---
travis_time:end:295838a4:start=1546542572317541423,finish=1546542572322685247,duration=5143824
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:186c5700
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:15841fb0
travis_time:start:15841fb0
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:066f2f65
$ dmesg | grep -i kill

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)

Fix changes for E0106, E0261
Replaced impl block dock with suggested one and made sure that blocks compile.
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 4, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (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.
travis_time:end:05f416f8:start=1546599712754305907,finish=1546599796088086845,duration=83333780938
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---

[00:03:31] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:31] tidy error: /checkout/src/librustc/diagnostics.rs:784: trailing whitespace
[00:03:31] tidy error: /checkout/src/librustc/diagnostics.rs:790: trailing whitespace
[00:03:31] tidy error: /checkout/src/librustc/diagnostics.rs:803: trailing whitespace
[00:03:32] some tidy checks failed
[00:03:32] 
[00:03:32] 
[00:03:32] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:03:32] 
[00:03:32] 
[00:03:32] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:32] Build completed unsuccessfully in 0:00:49
[00:03:32] Build completed unsuccessfully in 0:00:49
[00:03:32] make: *** [tidy] Error 1
[00:03:32] Makefile:69: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:03575dd4
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Fri Jan  4 11:07:03 UTC 2019
---
travis_time:end:132a5b00:start=1546600023621749462,finish=1546600023626870517,duration=5121055
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:08ee9cd8
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:17606787
travis_time:start:17606787
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:2947b0cf
$ dmesg | grep -i kill

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)

@QuietMisdreavus

This comment has been minimized.

Copy link
Member

QuietMisdreavus commented Jan 4, 2019

[00:03:31] tidy error: /checkout/src/librustc/diagnostics.rs:784: trailing whitespace
[00:03:31] tidy error: /checkout/src/librustc/diagnostics.rs:790: trailing whitespace
[00:03:31] tidy error: /checkout/src/librustc/diagnostics.rs:803: trailing whitespace
[00:03:32] some tidy checks failed

We have a linter that checks for trailing whitespace in files. Can you check out these lines and trim off the trailing whitespace there?

@Dylan-DPC

This comment has been minimized.

Copy link
Member

Dylan-DPC commented Jan 21, 2019

ping from triage @purple-ice any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment