Skip to content

Conversation

@feniljain
Copy link
Contributor

Fixing #10333

@Veykril
Copy link
Member

Veykril commented Oct 3, 2021

This seems to be the wrong way to fix this, as extracting this

fn foo() -> i64 {
    loop {
        let n = 1;$0
        let k = async { 1 }.await;
        if k == 42 {
            break 3;
        }
        let m = k + 1;$0
        let h = 1 + m;
    }
}

also produces incorrect await order which wouldn't be fixed by this.

The proper fix I believe would be to add the .async expression to the call expression that is passed to let expr = handler.make_call_expr(call_expr).indent(indent); a few lines above instead. That should just fix these ordering issues.

@feniljain
Copy link
Contributor Author

This seems good?

@Veykril
Copy link
Member

Veykril commented Oct 3, 2021

Yep that looks right 👍
bors r+

@bors
Copy link
Contributor

bors bot commented Oct 3, 2021

@bors bors bot merged commit 0618a6f into rust-lang:master Oct 3, 2021
@feniljain feniljain deleted the fix-await_insert branch October 3, 2021 10:17
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 this pull request may close these issues.

2 participants