Skip to content

Spurious "expected integer or floating pointer number after - (rust-analyzer macro-error)" (with reproduction) #19993

Open
@sourcefrog

Description

@sourcefrog

rust-analyzer version: rust-analyzer 1.89.0-nightly (573a015 2025-06-12)

rustc version: rustc 1.89.0-nightly (573a01569 2025-06-12)
binary: rustc
commit-hash: 573a01569000d395498a5f98f916d6e5305ac81a
commit-date: 2025-06-12
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5

editor or extension: Zed 0.190.5 901b05221cf3f1946638c44a81c93cffdaf1cdf5, also
reproducible on VS Code 1.100.3 258e40fedc6cb8edf399a463ce3a9d32e7e1f6f3

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): (eg. rust-analyzer) https://github.com/sourcefrog/rust-analyzer-repro (minimized from https://github.com/sourcefrog/cargo-mutants)

code snippet to reproduce:

use schemars::JsonSchema;
use serde::Deserialize;

#[derive(Default, Deserialize, JsonSchema)]
pub struct Config {
    /// Pass `--cap-lints` to rustc.
    pub cap_lints: bool,
    /// Skip calls to functions or methods with these names.
    ///
    /// This is combined with values from the --skip-calls argument.
    pub skip_calls: Vec<String>,
    /// Use built-in defaults for `skip_calls` in addition to any explicit values.
    pub skip_calls_defaults: Option<bool>,
}

errors:

; rust-analyzer diagnostics .
processing crate: rust_analyzer_repro, module: /home/mbp/src/rust-analyzer-repro/src/lib.rs
Error Ra("macro-error", Error) from LineCol { line: 5, col: 4 } to LineCol { line: 5, col: 36 }: expected integer or floating pointer number after '-'
Error Ra("macro-error", Error) from LineCol { line: 5, col: 4 } to LineCol { line: 5, col: 36 }: expected integer or floating pointer number after '-'
Error Ra("macro-error", Error) from LineCol { line: 7, col: 4 } to LineCol { line: 9, col: 68 }: expected integer or floating pointer number after '-'
Error Ra("macro-error", Error) from LineCol { line: 7, col: 4 } to LineCol { line: 9, col: 68 }: expected integer or floating pointer number after '-'
Error Ra("macro-error", Error) from LineCol { line: 11, col: 4 } to LineCol { line: 11, col: 82 }: expected integer or floating pointer number after '-'
Error Ra("macro-error", Error) from LineCol { line: 11, col: 4 } to LineCol { line: 11, col: 82 }: expected integer or floating pointer number after '-'

diagnostic scan complete

Error: diagnostic error detected

Stack backtrace:
   0: <anyhow::Error>::msg::<&str>
   1: std::sys::backtrace::__rust_begin_short_backtrace::<<stdx::thread::Builder>::spawn<<rust_analyzer::cli::flags::Diagnostics>::run::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#0}, core::result::Result<(), anyhow::Error>>
   2: <<std::thread::Builder>::spawn_unchecked_<<stdx::thread::Builder>::spawn<<rust_analyzer::cli::flags::Diagnostics>::run::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
   3: std::sys::pal::unix::thread::Thread::new::thread_start
   4: start_thread
             at ./nptl/pthread_create.c:442:8
   5: __GI___clone3
             at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0

cargo build doesn't error on this code.

Incidentally there's a typo "floating pointer" rather than "floating point".

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions