Skip to content

Async functions in sub-crate break formatting #13790

Closed
@fmeef

Description

@fmeef

rust-analyzer version: 21e61be 2022-12-10

rustc version: rustc 1.66.0 (69f9c33d7 2022-12-12)

relevant settings: helix editor with default settings

When working with a project composed of multiple local crates added via lib = { path = "./lib" } in cargo.toml formatting seems to fail if an async function or an async block is present in the current file. This seems to affect the entire file where async code is present. Running formatting on the topmost crate even when multiple crates are in cargo.toml causes formatting to run correctly. Running cargo fmt always works even when rust-analyzer fails to format

I created a minimal reproduction here https://github.com/fmeef/rust-analyzer-format-fail/, attempting to format the lib.rs file in the lib crate results in nothing actually happening.

Metadata

Metadata

Labels

A-formattingformatting of r-a output/formatting on saveC-bugCategory: bugS-actionableSomeone could pick this issue up and work on it right now

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions