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

cargo fix prepare-for 2018 errors after due to 'async' identifier #5783

Closed
seanmonstar opened this issue Jul 24, 2018 · 5 comments
Closed

cargo fix prepare-for 2018 errors after due to 'async' identifier #5783

seanmonstar opened this issue Jul 24, 2018 · 5 comments

Comments

@seanmonstar
Copy link

I tried out cargo fix --prepare-for 2018 on hyper, and after it ran, it showed an error and claimed it was a bug in cargo or rustc, and to report it here. There is an identifier currently named async in a file, here: https://github.com/hyperium/hyper/blob/069a32b1acc5ece35643c26cf5d9972dace5481c/src/body/body.rs#L268

In this specific case, it would have been fine to just renamed that binding to async_, or perhaps r#async. I'm not sure if trying to do that automatically would accidentally name async blocks or functions wrongly, though.

@Nemo157
Copy link
Member

Nemo157 commented Jul 24, 2018

Just hit this right now with websocket::async as well. It seems doing an unconditional replacement to r#async should work, the lint should only be triggered on identifiers so won't affect async fn, and async blocks don't exist in 2015.

EDIT: Except raw identifiers are still an unstable feature, should they be ungated in 2018 even though they're still unstable since they are essential for transitioning in some cases?

@alexcrichton
Copy link
Member

Thanks for the report @seanmonstar and @Nemo157!

It looks like this may be a bug in the lint and/or compiler. To confirm, if you place #![feature(raw_identifiers)] at the top of the crate, does the migration succeed?

If so, I'll fix this in rustc. If not, there's more digging to do!

@Nemo157
Copy link
Member

Nemo157 commented Jul 26, 2018

@alexcrichton #![feature(raw_identifiers)] worked, it updated the import to r#async and cargo fix didn't report any errors.

@alexcrichton
Copy link
Member

Ok great, thanks for checking @Nemo157!

alexcrichton added a commit to alexcrichton/rust that referenced this issue Jul 26, 2018
* Enable the `raw_identifiers` feature automatically in the 2018 preview
* Only emit lint warnings if the `raw_identifiers` feature is activated

cc rust-lang/cargo#5783
bors added a commit to rust-lang/rust that referenced this issue Jul 30, 2018
Tweak the raw_identifiers lints in 2018

* Enable the `raw_identifiers` feature automatically in the 2018 preview
* Only emit lint warnings if the `raw_identifiers` feature is activated

cc rust-lang/cargo#5783
@alexcrichton
Copy link
Member

Ok the fixes are now in nightly and with @Nemo157's confirmation it worked I'm gonna close, we can always reopen if this comes up again though!

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

No branches or pull requests

3 participants