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

Unable to parse unsafe async fn #3025

Closed
LucioFranco opened this issue Feb 5, 2020 · 3 comments · Fixed by #3047
Closed

Unable to parse unsafe async fn #3025

LucioFranco opened this issue Feb 5, 2020 · 3 comments · Fixed by #3047

Comments

@LucioFranco
Copy link
Member

LucioFranco commented Feb 5, 2020

I am running into a reproducible bug with ra that says Syntax Error: expected existential, fn, trait or impl right in between the async and unsafe. Running the check manually via cargo seems to report no errors.

struct Foo;

impl Foo {
	pub async unsafe fn bar() {}
}

should reproduce it.

Reference sha d92a15c1637860a669970142abe37d1daf5f2c73

@kiljacken
Copy link
Contributor

If I recall, this is expected, no? The correct syntax is pub async unsafe fn (async before unsafe), see rust-lang/rust#61319

@LucioFranco
Copy link
Member Author

pub async unsafe fn push You're right, i keep mixing up the order. Ill update the main comment but the bug still exists.

bors bot added a commit that referenced this issue Feb 7, 2020
3047: Update async unsafe fn ordering in parser r=matklad a=kiljacken

As of rust-lang/rust#61319 the correct order for functions that are both unsafe and async is: `async unsafe fn` and not `unsafe async fn`.

This commit updates the parser tests to reflect this, and corrects parsing behavior to accept the correct ordering.

Fixes #3025

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
@bors bors bot closed this as completed in 73ec2ab Feb 7, 2020
@LucioFranco
Copy link
Member Author

Thanks for the quick fix!

cjhopman pushed a commit to cjhopman/rust-analyzer that referenced this issue Apr 10, 2020
As of rust-lang/rust#61319 the correct order for functions that are both
unsafe and async is: `async unsafe fn` and not `unsafe async fn`.

This commit updates the parser tests to reflect this, and corrects
parsing behavior to accept the correct ordering.

Fixes rust-lang#3025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants