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

Lint async identifiers in 2018 preparation mode #52375

Merged
merged 4 commits into from
Jul 18, 2018

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jul 14, 2018

r? @Manishearth

fixes #49716

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 14, 2018
@rust-highfive

This comment has been minimized.

@oli-obk oli-obk force-pushed the the_early_lint_pass_gets_the_worm branch from d2d85d5 to 6cd25b1 Compare July 14, 2018 15:38
@rust-highfive

This comment has been minimized.

@oli-obk oli-obk force-pushed the the_early_lint_pass_gets_the_worm branch from 6cd25b1 to 15a8a66 Compare July 14, 2018 18:44
@alexcrichton
Copy link
Member

Thanks for the PR @oli-obk! Since using async as an identifier can cause breakage in the 2018 edition should this also be part of the rust_2018_compatibility group instead of the idioms group?

Also, could the test be expanded to cover cases like:

trait async {}
struct async {}
let async: async = async {};
static async: u32 = 0;
const async: u32 = 0;
impl async for MyStruct {}
impl Foo { fn async() {} }

@rust-highfive
Copy link
Collaborator

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.
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/4a/98/035298bacd2d0041f0a1c919ebd81c8e7d5211c4282b9e5bf97bb9f5c416/awscli-1.15.60-py2.py3-none-any.whl (1.3MB)
    0% |▎                               | 10kB 9.5MB/s eta 0:00:01
    1% |▌                               | 20kB 1.8MB/s eta 0:00:01
    2% |▊                               | 30kB 2.1MB/s eta 0:00:01
    3% |█                               | 40kB 2.0MB/s eta 0:00:01
---
    100% |████████████████████████████████| 51kB 8.0MB/s 
Collecting botocore==1.10.59 (from awscli)
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/bf/77/26dab42032978b5f547869836523701279fc207d4affcad74b4b6d65f13f/botocore-1.10.59-py2.py3-none-any.whl (4.4MB)
    0% |                                | 10kB 46.1MB/s eta 0:00:01
    0% |▏                               | 20kB 36.6MB/s eta 0:00:01
    0% |▎                               | 30kB 43.1MB/s eta 0:00:01
    0% |▎                               | 40kB 14.7MB/s eta 0:00:01
---

[00:03:55] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:55] tidy error: /checkout/src/test/ui/rust-2018/async-ident.rs: missing trailing newline
[00:03:57] some tidy checks failed
[00:03:57] 
[00:03:57] 
[00:03:57] 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:57] 
[00:03:57] 
[00:03:57] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:57] Build completed unsuccessfully in 0:00:49
[00:03:57] Build completed unsuccessfully in 0:00:49
[00:03:57] Makefile:79: recipe for target 'tidy' failed
[00:03:57] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:00b1490e
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:04184e76:start=1531850589720065294,finish=1531850589727149922,duration=7084628
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:001a3931
$ 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 -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:234e4f36
travis_time:start:234e4f36
$ 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:079e8205
$ 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)


declare_lint! {
pub ASYNC_IDENTS,
Deny,
Copy link
Member

Choose a reason for hiding this comment

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

Just to confirm, but the Deny here was for tests?

For the other 2018 lints at least they're all set to Allow by default and they're only active with the lint group turned on (which rustfix does automatically)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just followed what another 2018 incompat lint did, and that was deny

Copy link
Contributor Author

Choose a reason for hiding this comment

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

E.g.

pub DUPLICATE_MACRO_EXPORTS,

Copy link
Member

Choose a reason for hiding this comment

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

Aha, that's not a 2018 lint I think because that's changing for the 2015 edition, I was thinking of lints like this one --

declare_lint! {
pub ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
Allow,
"fully qualified paths that start with a module name \
instead of `crate`, `self`, or an extern crate name"
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then this is wrong:

FutureIncompatibleInfo {
id: LintId::of(DUPLICATE_MACRO_EXPORTS),
reference: "issue #35896 <https://github.com/rust-lang/rust/issues/35896>",
edition: Some(Edition::Edition2018),

Copy link
Member

Choose a reason for hiding this comment

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

Ah I believe so! Want to file an issue for that?

Copy link
Member

Choose a reason for hiding this comment

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

edition lints can be any level they wish to be, that one probably makes more sense as deny, but this one should be allow

@rust-highfive
Copy link
Collaborator

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.
    100% |████████████████████████████████| 51kB 9.5MB/s 
Collecting botocore==1.10.59 (from awscli)
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/bf/77/26dab42032978b5f547869836523701279fc207d4affcad74b4b6d65f13f/botocore-1.10.59-py2.py3-none-any.whl (4.4MB)
    0% |                                | 10kB 26.6MB/s eta 0:00:01
    0% |▏                               | 20kB 32.2MB/s eta 0:00:01
    0% |▎                               | 30kB 37.6MB/s eta 0:00:01
    0% |▎                               | 40kB 32.9MB/s eta 0:00:01
---
[00:46:35] ....................................................................................................
[00:46:39] ............................................................................................i.......
[00:46:42] ..................................................................................i.................
[00:46:46] ....................................................................................................
[00:46:49] ....................................F...............................................................
[00:46:53] ....................................................................................................
start":1207,"byte_end":1212,"line_start":46,"line_end":46,"column_start":12,"column_end":17,"is_primary":true,"text":[{"text":"    static async: u32 = 0;","highlight_start":12,"highlight_end":17}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!","code":null,"level":"warning","spans":[],"children":[],"rendered":null},{"message":"for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"you can use a raw identifier to stay compatible","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/rust-2018/async-ident.rs","byte_start":1207,"byte_end":1212,"line_start":46,"line_end":46,"column_start":12,"column_end":17,"is_primary":true,"text":[{"text":"    static async: u32 = 0;","highlight_start":12,"highlight_end":17}],"label":null,"suggested_replacement":"r#async","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: `async` is a keyword in the 2018 edition\n  --> /checkout/src/test/ui/rust-2018/async-ident.rs:46:12\n   |\nLL |     static async: u32 = 0;\n   |            ^^^^^ help: you can use a raw identifier to stay compatible: `r#async`\n   |\n   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!\n   = note: for more information, see issue #49716 <https://github.com/rust-lang/ruync`\n   |\n   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!\n   = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>\n\n"}
[00:46:58] {"message":"`async` is a keyword in the 2018 edition","code":{"code":"async_idents","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/rust-2018/async-ident.rs","byte_start":1431,"byte_end":1436,"line_start":58,"line_end":58,"column_start":15,"column_end":20,"is_primary":true,"text":[{"text":"impl Foo { fn async() {} }","highlight_start":15,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!","code":null,"level":"warning","spans":[],"children":[],"rendered":null},{"message":"for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"you can use a raw identifier to stay compatible","code":null,"level":"help","spans":[{"file_name":"/checkout/src/test/ui/rust-2018/async-ident.rs","byte_start":1431,"byte_end":1436,"line_start":58,"line_end":58,"column_start":15,"column_end":20,"is_primary":true,"text":[{"text":"impl Foo { fn async() {} }","highlight_start":15,"highlight_end":20}],"label":null,"suggested_replacement":"r#async","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered"3680124 .
2330976 ./obj/build
1737756 ./obj/build/x86_64-unknown-linux-gnu
785056 ./src
563544 ./.git
---
143656 ./obj/build/x86_64-unknown-linux-gnu/stage1-std
132888 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu
132884 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release
130516 ./obj/build/bootstrap/debug/incremental/bootstrap-3kaq1kqcanyi4
130512 ./obj/build/bootstrap/debug/incremental/bootstrap-3kaq1kqcanyi4/s-f2zvzkilgl-14ilwz3-xx3ruytk6cjw
129516 ./obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-nknown-linux-gnu/stage0-rustc
53136 ./obj/build/x86_64-unknown-linux-gnu/stage0/bin
52532 ./obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu
52528 ./obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release

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)

Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

r=me with deny replaced with allow

Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

r=me with deny replacd with allow

@oli-obk oli-obk force-pushed the the_early_lint_pass_gets_the_worm branch from d9280b2 to 3fb907f Compare July 18, 2018 08:57
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 18, 2018

@bors r=Manishearth

@bors
Copy link
Contributor

bors commented Jul 18, 2018

📌 Commit 3fb907f49d3d6864b0d138870b86b5c5116354c9 has been approved by Manishearth

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 18, 2018
@rust-highfive

This comment has been minimized.

@oli-obk oli-obk force-pushed the the_early_lint_pass_gets_the_worm branch from 3fb907f to 68c93e7 Compare July 18, 2018 09:45
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 18, 2018

@bors r=Manishearth

@bors
Copy link
Contributor

bors commented Jul 18, 2018

📌 Commit 68c93e7 has been approved by Manishearth

@kennytm
Copy link
Member

kennytm commented Jul 18, 2018

@bors p=332

@bors
Copy link
Contributor

bors commented Jul 18, 2018

⌛ Testing commit 68c93e7 with merge 12ed235...

bors added a commit that referenced this pull request Jul 18, 2018
…anishearth

Lint `async` identifiers in 2018 preparation mode

r? @Manishearth

fixes #49716
@bors
Copy link
Contributor

bors commented Jul 18, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: Manishearth
Pushing 12ed235 to master...

@bors bors merged commit 68c93e7 into rust-lang:master Jul 18, 2018
@oli-obk oli-obk deleted the the_early_lint_pass_gets_the_worm branch June 15, 2020 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write lint for usage of edition-gated keywords
6 participants