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

async fn + rustfmt don't "just work" inside of RLS #61072

Open
nikomatsakis opened this issue May 23, 2019 · 6 comments

Comments

Projects
None yet
4 participants
@nikomatsakis
Copy link
Contributor

commented May 23, 2019

If you create a new rust project in the RLS and try to use async fn:

async fn foo() { }
fn main() { }

you will get errors from rustfmt that async fn is not supported in the 2015 Edition when you attempt to format. This is true even if your project is in Rust 2018. Presumably the RLS is not supplying the correct version information. I view this as a fairly large "user experience" problem.

Note: Probably this should be filed on the RLS repository, but I wanted to file a bug here so that we could track it more easily as a potential blocker for stabilization (I would consider it to be one). I think in the future we should be tracking said bugs through repository-wise searches to avoid this sort of dilemma, but anyway.

cc @Xanewok -- any thoughts?

@Xanewok

This comment has been minimized.

Copy link
Member

commented May 23, 2019

This is one of the cases where RLS is overzealous when it comes to making sure we've picked up a right edition, to the point where it refuses to do any work if it's not 100% sure (and it doesn't pick up the correct edition, which is another case).

To provide some more context on why's that, it's technically possible for a file to fall under multiple editions - an edge case where we have separate crates with different editions in Cargo.toml which pull in the same module. Since we issue format request for a given file, we do not disambiguate now and thus we first run analysis compilation, detect which files were part of a given crate and only then allow to format a file with a detected edition.

It seems that the edition detection has regressed recently so that's probably the case why it continues to not work in the 2018 edition - will look into it.

@cramertj

This comment has been minimized.

Copy link
Member

commented May 23, 2019

Hey @Centril you're tagging all of this issues as async/await blocking -- can you explain why that is? IMO bugs in editors and things shouldn't block stabilization of async/await.

@Centril

This comment has been minimized.

Copy link
Member

commented May 23, 2019

Hey @Centril you're tagging all of this issues as async/await blocking -- can you explain why that is? IMO bugs in editors and things shouldn't block stabilization of async/await.

Per Niko's note:

Note: Probably this should be filed on the RLS repository, but I wanted to file a bug here so that we could track it more easily as a potential blocker for stabilization (I would consider it to be one).

@cramertj

This comment has been minimized.

Copy link
Member

commented Jun 4, 2019

@Xanewok have you had a chance to investigate this further?

@Xanewok

This comment has been minimized.

Copy link
Member

commented Jun 10, 2019

@cramertj sorry, not yet. I'll work on this this week.

@cramertj

This comment has been minimized.

Copy link
Member

commented Jun 14, 2019

@Xanewok Were you able to look into this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.