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

Make "await" a pseudo-edition keyword #54411

Merged
merged 1 commit into from Sep 25, 2018

Conversation

cramertj
Copy link
Member

This change makes "await" ident an error in 2018 edition without async_await
feature and adds "await" to the 2018 edition keyword lint group that
suggest migration on the 2015 edition.

cc #53834

r? @nikomatsakis

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

This comment has been minimized.

#![allow(non_camel_case_types)]
#![deny(keyword_idents)]

mod outer_mod {
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be good to make this a "rustfix" test, just to be sure. Just add // run-rustfix and then re-run with --bless. This will make a .fixed file to sure the effect of the suggestions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

// a custom error if `await` is used as an identifier on the
// 2018 edition or later and the `async_await` feature isn't
// enabled.
if ident.name == "await"
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a vague fear that this may not work for some uses, because it runs post-expansion.

For example, what if I have (in a Rust 2018 crate):

macro_rules! r#await {
    () => { println!("Hello, world!") }
}

fn main() { await!(); }

Does that error?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is why I was considering saying that we should adapt the keyword warning lint we use for migrating to give a hard error in this case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Originally I made the code in the lint issue an error, but then I discovered that issuing an error (by setting diagnostic.level = Level::Error) from the context of a lint won't give you any error output if the compilation fails unless the lint is enabled-- it will just print out "error: ". You're right, though, that that example might not work, so I'll try it out and see if I can hack around the diagnostic builder in the lint code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Heh, actually, your example does error-- but not where it should:

error[E0721]: `await` is a keyword in the 2018 edition                                                                                              
  --> $DIR/async_keyword_again.rs:3:14                                                                                                              
   |                                                                                                                                                
LL | macro_rules! r#await {                                                                                                                         
   |              ^^^^^^^ help: you can use a raw identifier to stay compatible: `r#await`                                                          
   |                                                                                                                                                
   = help: if you were trying to use async/await!, add #![feature(async_await)] to the crate attributes to enable                                                                                                                                                                                       
error: aborting due to previous error                                                                                                               
                                                                                                                                                    
For more information about this error, try `rustc --explain E0721`.  

I'll look into changing the lint.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@bors
Copy link
Contributor

bors commented Sep 22, 2018

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

This change makes "await" ident an error in 2018 edition without async_await
feature and adds "await" to the 2018 edition keyword lint group that
suggest migration on the 2015 edition.
@nikomatsakis
Copy link
Contributor

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Sep 24, 2018

📌 Commit fb14662 has been approved by nikomatsakis

@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 Sep 24, 2018
@nikomatsakis
Copy link
Contributor

Tagging as p=1 b/c this is an Edition feature

@bors
Copy link
Contributor

bors commented Sep 24, 2018

⌛ Testing commit fb14662 with merge f4d0894c9192326fa9e1c11721364fc4bdd745a7...

@bors
Copy link
Contributor

bors commented Sep 25, 2018

💔 Test failed - status-travis

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

The job dist-i686-apple 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.
[00:04:16]       Memory: 8 GB
[00:04:16]       Boot ROM Version: VMW71.00V.0.B64.1704110547
[00:04:16]       Apple ROM Info: [MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]Welcome to the Virtual Machine
[00:04:16]       SMC Version (system): 2.8f0
[00:04:16]       Serial Number (system): VMv0BrzobDxL
[00:04:16] 
[00:04:17] hw.ncpu: 4
[00:04:17] hw.byteorder: 1234
[00:04:17] hw.memsize: 8589934592
---
uploading "f4d0894c9192326fa9e1c11721364fc4bdd745a7/clippy-nightly-i686-apple-darwin.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}
uploading "f4d0894c9192326fa9e1c11721364fc4bdd745a7/clippy-nightly-i686-apple-darwin.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}
uploading "f4d0894c9192326fa9e1c11721364fc4bdd745a7/cargo-nightly-i686-apple-darwin.tar.xz" with {:content_type=>"application/x-xz", :acl=>"public-read"}
uploading "f4d0894c9192326fa9e1c11721364fc4bdd745a7/cargo-nightly-i686-apple-darwin.tar.gz" with {:content_type=>"application/gzip", :acl=>"public-read"}
/Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.136/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb:81:in `abort_upload': multipart upload failed: Encountered a `SocketError` while attempting to connect to: (Aws::S3::MultipartUploadError)
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds/f4d0894c9192326fa9e1c11721364fc4bdd745a7/rust-std-nightly-i686-apple-darwin.tar.gz?partNumber=2&uploadId=aLajxpm86vLlAEHjaQNOCr7L9XOnyzD4A_ttHmq.SsVIjlpqzRcFYcmbhJDBiGDsY8VLCoDYlTeLskd1mhBMmvzsTG_a3GtWn7_fxkCGNG3fRO0nagGgKQGyoCWGc1Eb
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
cn-north-1
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds/f4d0894c9192326fa9e1c11721364fc4bdd745a7/rust-std-nightly-i686-apple-darwin.tar.gz?partNumber=3&uploadId=aLajxpm86vLlAEHjaQNOCr7L9XOnyzD4A_ttHmq.SsVIjlpqzRcFYcmbhJDBiGDsY8VLCoDYlTeLskd1mhBMmvzsTG_a3GtWn7_fxkCGNG3fRO0nagGgKQGyoCWGc1Eb
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
cn-north-1
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds/f4d0894c9192326fa9e1c11721364fc4bdd745a7/rust-std-nightly-i686-apple-darwin.tar.gz?partNumber=5&uploadId=aLajxpm86vLlAEHjaQNOCr7L9XOnyzD4A_ttHmq.SsVIjlpqzRcFYcmbhJDBiGDsY8VLCoDYlTeLskd1mhBMmvzsTG_a3GtWn7_fxkCGNG3fRO0nagGgKQGyoCWGc1Eb
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
cn-north-1
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds/f4d0894c9192326fa9e1c11721364fc4bdd745a7/rust-std-nightly-i686-apple-darwin.tar.gz?partNumber=6&uploadId=aLajxpm86vLlAEHjaQNOCr7L9XOnyzD4A_ttHmq.SsVIjlpqzRcFYcmbhJDBiGDsY8VLCoDYlTeLskd1mhBMmvzsTG_a3GtWn7_fxkCGNG3fRO0nagGgKQGyoCWGc1Eb
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
cn-north-1
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds/f4d0894c9192326fa9e1c11721364fc4bdd745a7/rust-std-nightly-i686-apple-darwin.tar.gz?partNumber=7&uploadId=aLajxpm86vLlAEHjaQNOCr7L9XOnyzD4A_ttHmq.SsVIjlpqzRcFYcmbhJDBiGDsY8VLCoDYlTeLskd1mhBMmvzsTG_a3GtWn7_fxkCGNG3fRO0nagGgKQGyoCWGc1Eb
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
cn-north-1
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds/f4d0894c9192326fa9e1c11721364fc4bdd745a7/rust-std-nightly-i686-apple-darwin.tar.gz?partNumber=8&uploadId=aLajxpm86vLlAEHjaQNOCr7L9XOnyzD4A_ttHmq.SsVIjlpqzRcFYcmbhJDBiGDsY8VLCoDYlTeLskd1mhBMmvzsTG_a3GtWn7_fxkCGNG3fRO0nagGgKQGyoCWGc1Eb
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
cn-north-1
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds/f4d0894c9192326fa9e1c11721364fc4bdd745a7/rust-std-nightly-i686-apple-darwin.tar.gz?partNumber=9&uploadId=aLajxpm86vLlAEHjaQNOCr7L9XOnyzD4A_ttHmq.SsVIjlpqzRcFYcmbhJDBiGDsY8VLCoDYlTeLskd1mhBMmvzsTG_a3GtWn7_fxkCGNG3fRO0nagGgKQGyoCWGc1Eb
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
cn-north-1
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds/f4d0894c9192326fa9e1c11721364fc4bdd745a7/rust-std-nightly-i686-apple-darwin.tar.gz?partNumber=10&uploadId=aLajxpm86vLlAEHjaQNOCr7L9XOnyzD4A_ttHmq.SsVIjlpqzRcFYcmbhJDBiGDsY8VLCoDYlTeLskd1mhBMmvzsTG_a3GtWn7_fxkCGNG3fRO0nagGgKQGyoCWGc1Eb
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
cn-north-1
cn-north-1
cn-northwest-1
us-gov-west-1
; Encountered a `SocketError` while attempting to connect to:
  https://rust-lang-ci2.s3.us-west-1.amazonaws.com/rustc-builds/f4d0894c9192326fa9e1c11721364fc4bdd745a7/rust-std-nightly-i686-apple-darwin.tar.gz?partNumber=1&uploadId=aLajxpm86vLlAEHjaQNOCr7L9XOnyzD4A_ttHmq.SsVIjlpqzRcFYcmbhJDBiGDsY8VLCoDYlTeLskd1mhBMmvzsTG_a3GtWn7_fxkCGNG3fRO0nagGgKQGyoCWGc1Eb
This is typically the result of an invalid `:region` option or a
poorly formatted `:endpoint` option.
* Avoid configuring the `:endpoint` option directly. Endpoints are constructed
  from the `:region`. The `:endpoint` option is reserved for connecting to
  non-standard test endpoints.
* Not every service is available in every region.
* Never suffix region names with availability zones.
  Use "us-east-1", not "us-east-1a"
Known AWS regions include (not specific to this service):
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-west-2
cn-north-1
cn-north-1
cn-northwest-1
us-gov-west-1
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.136/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb:70:in `upload_parts'
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.136/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb:44:in `upload'
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.136/lib/aws-sdk-resources/services/s3/file_uploader.rb:32:in `upload'
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/aws-sdk-resources-2.11.136/lib/aws-sdk-resources/services/s3/object.rb:252:in `upload_file'
 from /Users/travis/.rvm/gems/ruby-2.4.2/gems/dpl-s3-1.10.1/lib/dpl/provider/s3.rb:106:in `block (2 levels) in upload_multithreaded'
failed to deploy
failed to deploy
No output has been received in the last 30m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated

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)

@cramertj
Copy link
Member Author

@bors retry

Looks flakey

@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 Sep 25, 2018
@bors
Copy link
Contributor

bors commented Sep 25, 2018

⌛ Testing commit fb14662 with merge 31789a6...

bors added a commit that referenced this pull request Sep 25, 2018
Make "await" a pseudo-edition keyword

This change makes "await" ident an error in 2018 edition without async_await
feature and adds "await" to the 2018 edition keyword lint group that
suggest migration on the 2015 edition.

cc #53834

r? @nikomatsakis
@bors
Copy link
Contributor

bors commented Sep 25, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 31789a6 to master...

@bors bors merged commit fb14662 into rust-lang:master Sep 25, 2018
@cramertj cramertj deleted the await-keyword-error branch September 25, 2018 18:47
yvt added a commit to yvt/ngspades that referenced this pull request Apr 25, 2020
Tested with: rustc 1.31.0-nightly (8c4ad4e9e 2018-10-04)

The changes are mainly about the Rust 2018 transition:

- Stopped using `await` as an identifier since it's been reserved as a
  placeholder for a potential keyword and causes a hard error
  (rust-lang/rust#54411).
- Removed redundant lifetime bounds.
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.

None yet

4 participants