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

Contexually dependent error message for E0424 when value is assigned to "self" #56572

Merged
merged 1 commit into from Dec 14, 2018

Conversation

Projects
None yet
6 participants
@kevgrasso
Contributor

kevgrasso commented Dec 6, 2018

This is an improvement for pull request #54495 referencing issue #54369. If the "self" keyword is assigned a value as though it were a valid identifier, it will now report:

let self = "self";
    ^^^^ `self` value is a keyword and may not be bound to variables or shadowed

instead of

let self = "self";
    ^^^^ `self` value is a keyword only available in methods with `self` parameter

If anyone has a better idea for what the error should be I'd be happy to modify it appropriately.

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Dec 6, 2018

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (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.

@estebank

Fix indentation of the new code.

It seems like you might have had some rebasing issues. Can you rebase your changes as a single commit against latest master?

After fixing that, r=me.

@estebank estebank assigned estebank and unassigned nikomatsakis Dec 7, 2018

@estebank

This comment has been minimized.

Contributor

estebank commented Dec 7, 2018

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Dec 9, 2018

The job x86_64-gnu-llvm-5.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:17d98bb9:start=1544317390948378159,finish=1544317445314993435,duration=54366615276
$ 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-5.0
---

[00:03:09] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:09] tidy error: /checkout/src/librustc_resolve/lib.rs:3199: trailing whitespace
[00:03:09] tidy error: /checkout/src/librustc_resolve/lib.rs:3205: trailing whitespace
[00:03:09] tidy error: /checkout/src/librustc_resolve/lib.rs:3206: line longer than 100 chars
[00:03:09] tidy error: /checkout/src/librustc_resolve/lib.rs:3207: line longer than 100 chars
[00:03:09] tidy error: /checkout/src/librustc_resolve/lib.rs:3208: line longer than 100 chars
[00:03:09] tidy error: /checkout/src/librustc_resolve/lib.rs:3209: line longer than 100 chars
[00:03:09] tidy error: /checkout/src/librustc_resolve/lib.rs:3210: trailing whitespace
[00:03:11] some tidy checks failed
[00:03:11] 
[00:03:11] 
[00:03:11] 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:11] 
[00:03:11] 
[00:03:11] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:11] Build completed unsuccessfully in 0:00:53
[00:03:11] Build completed unsuccessfully in 0:00:53
[00:03:11] make: *** [tidy] Error 1
[00:03:11] Makefile:79: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1035f456
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Sun Dec  9 01:07:25 UTC 2018
---
travis_time:end:181121f4:start=1544317645780872921,finish=1544317645785414302,duration=4541381
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1c873459
$ 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:178c3167
travis_time:start:178c3167
$ 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:00257db2
$ 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)

@estebank

This comment has been minimized.

Contributor

estebank commented Dec 10, 2018

Hi @kevgrasso! You still seem to have so clean up your commit history.

@kevgrasso kevgrasso force-pushed the kevgrasso:let_self_err_dev branch from 3544a32 to 64aafc1 Dec 10, 2018

@kevgrasso

This comment has been minimized.

Contributor

kevgrasso commented Dec 10, 2018

r= @estebank

I think I got it done. My teachers didn't know how do this so I had some trouble figuring it out.

@estebank

This comment has been minimized.

Contributor

estebank commented Dec 10, 2018

I think you still might have to remove three commits (adbf5dc, 51fd050 and 209e625). You can do that by doing git rebase -I HEAD^^^^ (interactive rebase 4 commits back) and then on the editor that will open remove those three and only leave yours (it should be the last one). After doing that you can (but don't need to) do git checkout master && git pull (get the latest changes from rust in your master branch) git checkout let_self_err_dev (get back on your branch) and finally git rebase master (replay the changes in your local branch on top of master).

Also, https://git-scm.com/book/en/v2/Git-Branching-Rebasing and https://sethrobertson.github.io/GitFixUm/fixup.html are good resources (even though a bit more convoluted than I'd like).

Also, thank you for your patience, git wrangling can be very difficult at times.

@kevgrasso kevgrasso force-pushed the kevgrasso:let_self_err_dev branch 2 times, most recently from c3d8922 to 5586c04 Dec 10, 2018

@kevgrasso

This comment has been minimized.

Contributor

kevgrasso commented Dec 10, 2018

r= @estebank
Okay I'm pretty sure this is good now. Thank you for the help.

@estebank

This comment has been minimized.

Contributor

estebank commented Dec 11, 2018

@bors r+ rollup

@bors

This comment has been minimized.

Contributor

bors commented Dec 11, 2018

📌 Commit 5586c04 has been approved by estebank

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Dec 11, 2018

Rollup merge of rust-lang#56572 - kevgrasso:let_self_err_dev, r=estebank
Contexually dependent error message for E0424 when value is assigned to "self"

This is an improvement for pull request rust-lang#54495 referencing issue rust-lang#54369. If the "self" keyword is assigned a value as though it were a valid identifier, it will now report:
```
let self = "self";
    ^^^^ `self` value is a keyword and may not be bound to variables or shadowed
```
instead of
```
let self = "self";
    ^^^^ `self` value is a keyword only available in methods with `self` parameter
```
If anyone has a better idea for what the error should be I'd be happy to modify it appropriately.

bors added a commit that referenced this pull request Dec 11, 2018

Auto merge of #56728 - pietroalbini:rollup, r=pietroalbini
Rollup of 13 pull requests

Successful merges:

 - #56203 (Add lint for items deprecated in future)
 - #56343 (Remove not used mod)
 - #56439 (Clearer error message for dead assign)
 - #56507 (polonius tweaks)
 - #56572 (Contexually dependent error message for E0424 when value is assigned to "self")
 - #56609 (Unconditionally emit the target-cpu LLVM attribute.)
 - #56637 (rustdoc: Fix local reexports of proc macros)
 - #56679 (overhaul external doc attribute diagnostics)
 - #56682 (Update the stdsimd submodule)
 - #56691 (fix install broken link)
 - #56702 ([self-profiler] Add column for percent of total time)
 - #56708 (Remove some unnecessary feature gates)
 - #56710 (Always set the RDRAND and RDSEED features on SGX)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Dec 11, 2018

Auto merge of #56728 - pietroalbini:rollup, r=pietroalbini
Rollup of 13 pull requests

Successful merges:

 - #56203 (Add lint for items deprecated in future)
 - #56343 (Remove not used mod)
 - #56439 (Clearer error message for dead assign)
 - #56507 (polonius tweaks)
 - #56572 (Contexually dependent error message for E0424 when value is assigned to "self")
 - #56609 (Unconditionally emit the target-cpu LLVM attribute.)
 - #56637 (rustdoc: Fix local reexports of proc macros)
 - #56679 (overhaul external doc attribute diagnostics)
 - #56682 (Update the stdsimd submodule)
 - #56691 (fix install broken link)
 - #56702 ([self-profiler] Add column for percent of total time)
 - #56708 (Remove some unnecessary feature gates)
 - #56710 (Always set the RDRAND and RDSEED features on SGX)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Dec 12, 2018

Auto merge of #56728 - pietroalbini:rollup, r=pietroalbini
Rollup of 13 pull requests

Successful merges:

 - #56203 (Add lint for items deprecated in future)
 - #56343 (Remove not used mod)
 - #56439 (Clearer error message for dead assign)
 - #56507 (polonius tweaks)
 - #56572 (Contexually dependent error message for E0424 when value is assigned to "self")
 - #56609 (Unconditionally emit the target-cpu LLVM attribute.)
 - #56637 (rustdoc: Fix local reexports of proc macros)
 - #56679 (overhaul external doc attribute diagnostics)
 - #56682 (Update the stdsimd submodule)
 - #56691 (fix install broken link)
 - #56702 ([self-profiler] Add column for percent of total time)
 - #56708 (Remove some unnecessary feature gates)
 - #56710 (Always set the RDRAND and RDSEED features on SGX)

Failed merges:

r? @ghost

kennytm added a commit to kennytm/rust that referenced this pull request Dec 12, 2018

Rollup merge of rust-lang#56572 - kevgrasso:let_self_err_dev, r=estebank
Contexually dependent error message for E0424 when value is assigned to "self"

This is an improvement for pull request rust-lang#54495 referencing issue rust-lang#54369. If the "self" keyword is assigned a value as though it were a valid identifier, it will now report:
```
let self = "self";
    ^^^^ `self` value is a keyword and may not be bound to variables or shadowed
```
instead of
```
let self = "self";
    ^^^^ `self` value is a keyword only available in methods with `self` parameter
```
If anyone has a better idea for what the error should be I'd be happy to modify it appropriately.

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Dec 12, 2018

Rollup merge of rust-lang#56572 - kevgrasso:let_self_err_dev, r=estebank
Contexually dependent error message for E0424 when value is assigned to "self"

This is an improvement for pull request rust-lang#54495 referencing issue rust-lang#54369. If the "self" keyword is assigned a value as though it were a valid identifier, it will now report:
```
let self = "self";
    ^^^^ `self` value is a keyword and may not be bound to variables or shadowed
```
instead of
```
let self = "self";
    ^^^^ `self` value is a keyword only available in methods with `self` parameter
```
If anyone has a better idea for what the error should be I'd be happy to modify it appropriately.

bors added a commit that referenced this pull request Dec 12, 2018

Auto merge of #56757 - pietroalbini:rollup, r=pietroalbini
Rollup of 17 pull requests

Successful merges:

 - #56203 (Add lint for items deprecated in future)
 - #56343 (Remove not used mod)
 - #56439 (Clearer error message for dead assign)
 - #56507 (polonius tweaks)
 - #56572 (Contexually dependent error message for E0424 when value is assigned to "self")
 - #56672 (Document time of back operations of a Linked List)
 - #56677 (#[must_use] on traits in stdlib)
 - #56679 (overhaul external doc attribute diagnostics)
 - #56682 (Update the stdsimd submodule)
 - #56691 (fix install broken link)
 - #56710 (Always set the RDRAND and RDSEED features on SGX)
 - #56713 (Test capacity of ZST vector)
 - #56718 (Use libbacktrace pretty-printing)
 - #56725 (fix rust-lang/rust issue #50583)
 - #56731 (Add missing urls in ffi module docs)
 - #56738 (Fix private_no_mangle_fns message grammar)
 - #56746 (Add test of current behavior (infer free region within closure body))

Failed merges:

r? @ghost
@pietroalbini

This comment has been minimized.

Member

pietroalbini commented Dec 13, 2018

@bors r-

Please remove the clippy submodule update.

@pietroalbini

This comment has been minimized.

Member

pietroalbini commented Dec 13, 2018

@bors rollup-

@kevgrasso kevgrasso force-pushed the kevgrasso:let_self_err_dev branch from 5586c04 to 9de6bee Dec 14, 2018

@kevgrasso

This comment has been minimized.

Contributor

kevgrasso commented Dec 14, 2018

Whoops, sorry about that. I dunno how that got in there. I think that's fixed now.

@estebank

This comment has been minimized.

Contributor

estebank commented Dec 14, 2018

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented Dec 14, 2018

📌 Commit 9de6bee has been approved by estebank

kennytm added a commit to kennytm/rust that referenced this pull request Dec 14, 2018

Rollup merge of rust-lang#56572 - kevgrasso:let_self_err_dev, r=estebank
Contexually dependent error message for E0424 when value is assigned to "self"

This is an improvement for pull request rust-lang#54495 referencing issue rust-lang#54369. If the "self" keyword is assigned a value as though it were a valid identifier, it will now report:
```
let self = "self";
    ^^^^ `self` value is a keyword and may not be bound to variables or shadowed
```
instead of
```
let self = "self";
    ^^^^ `self` value is a keyword only available in methods with `self` parameter
```
If anyone has a better idea for what the error should be I'd be happy to modify it appropriately.

bors added a commit that referenced this pull request Dec 14, 2018

Auto merge of #56817 - kennytm:rollup, r=kennytm
Rollup of 27 pull requests (second batch)

Successful merges:

 - #53506 (Documentation for impl From for AtomicBool and other Atomic types)
 - #56203 (Add lint for items deprecated in future)
 - #56343 (Remove not used mod)
 - #56439 (Clearer error message for dead assign)
 - #56507 (polonius tweaks)
 - #56572 (Contexually dependent error message for E0424 when value is assigned to "self")
 - #56600 (bootstrap: fix edition)
 - #56672 (Document time of back operations of a Linked List)
 - #56677 (#[must_use] on traits in stdlib)
 - #56679 (overhaul external doc attribute diagnostics)
 - #56682 (Update the stdsimd submodule)
 - #56691 (fix install broken link)
 - #56710 (Always set the RDRAND and RDSEED features on SGX)
 - #56713 (Test capacity of ZST vector)
 - #56718 (Use libbacktrace pretty-printing)
 - #56725 (fix rust-lang/rust issue #50583)
 - #56731 (Add missing urls in ffi module docs)
 - #56738 (Fix private_no_mangle_fns message grammar)
 - #56746 (Add test of current behavior (infer free region within closure body))
 - #56747 (target: remove Box returned by get_targets)
 - #56751 (Allow ptr::hash to accept fat pointers)
 - #56755 (Account for `impl Trait` when suggesting lifetime)
 - #56758 (Add short emoji status to toolstate updates)
 - #56760 (Deduplicate unsatisfied trait bounds)
 - #56769 (Add x86_64-unknown-uefi target)
 - #56772 (fix issue 54153 by not testing issue-18804 on Windows nor OS X.)
 - #56808 (Fixes broken links)

Failed merges:

r? @ghost
@bors

This comment has been minimized.

Contributor

bors commented Dec 14, 2018

⌛️ Testing commit 9de6bee with merge 96d1334...

bors added a commit that referenced this pull request Dec 14, 2018

Auto merge of #56572 - kevgrasso:let_self_err_dev, r=estebank
Contexually dependent error message for E0424 when value is assigned to "self"

This is an improvement for pull request #54495 referencing issue #54369. If the "self" keyword is assigned a value as though it were a valid identifier, it will now report:
```
let self = "self";
    ^^^^ `self` value is a keyword and may not be bound to variables or shadowed
```
instead of
```
let self = "self";
    ^^^^ `self` value is a keyword only available in methods with `self` parameter
```
If anyone has a better idea for what the error should be I'd be happy to modify it appropriately.
@bors

This comment has been minimized.

Contributor

bors commented Dec 14, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: estebank
Pushing 96d1334 to master...

@bors bors merged commit 9de6bee into rust-lang:master Dec 14, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment