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

Extend E0106, E0261 #57310

Closed
wants to merge 2 commits into from
Closed

Extend E0106, E0261 #57310

wants to merge 2 commits into from

Conversation

purple-ice
Copy link
Contributor

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

Added an example that points out hardly obvious mistake one could make when writing impl for a new type.
@rust-highfive
Copy link
Collaborator

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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 3, 2019
@@ -772,6 +776,24 @@ struct Foo<'a> {
x: &'a str,
}
```

Implementations need their own lifetime declarations:
Copy link
Member

Choose a reason for hiding this comment

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

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:

```
Copy link
Member

Choose a reason for hiding this comment

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

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
Copy link
Member

Choose a reason for hiding this comment

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

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

@QuietMisdreavus
Copy link
Member

r? @QuietMisdreavus

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

@rust-highfive
Copy link
Collaborator

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)

Replaced impl block dock with suggested one and made sure that blocks compile.
@rust-highfive
Copy link
Collaborator

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
Copy link
Member

[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-zz Dylan-DPC-zz 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 Jan 21, 2019
@Dylan-DPC-zz
Copy link

ping from triage @purple-ice any updates?

@QuietMisdreavus
Copy link
Member

Since the author has deleted their fork, i've checked out their changes, applied fixes to review comments, and reopened it as #57950. I'll close this PR since the new one includes all the changes from this one.

Centril added a commit to Centril/rust that referenced this pull request Jan 28, 2019
…r=estebank

Extend E0106, E0261

This is a reopening of rust-lang#57310 with review comments addressed because the original author has since deleted their fork.

From the author (@purple-ice):

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

r? @rust-lang/docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants