Skip to content

Format buffer fails due to running in 2015 #572

@nicrosengren

Description

@nicrosengren

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions