rust-lang / rust-lang/rust-mode
Format buffer fails due to running in 2015
Nobody has claimed this yet.
- Dominant language
- Emacs Lisp
- Stars
- 1.3k
- Forks
- 198
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I recently updated rust-mode and looking through the recent changes i see rustfmt is now invoked without the --edition flag.
I'm not getting errors when running rust-format-buffer.
I created a new project with edition = 2024 in Cargo.toml using $ cargo new proj.
Added an async function and ran rust-format-buffer and received the error:
error[E0670]: `async fn` is not permitted in Rust 2015
--> main.rs:6:1
|
6 | async fn give() -> String {
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: pass `--edition 2024` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
All configuration I have for rustmode is:
(use-package rust-mode
:ensure t
:init
(setq rust-format-on-save t)
:hook (rust-mode . eglot-ensure))
Is this the intended behavior?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the rust-format-buffer entry point and the rustfmt invocation, then reproduce the failure with an async function in a project whose Cargo.toml declares edition 2024. Done means rust-format-buffer formats that buffer without interpreting it as Rust 2015.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- emacs-lisp, rust
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100