rust-lang / rust-lang/rust-analyzer

Cargo.toml file if mains to ".rs" rust analyzer doesn't work, changine main file to "_.rs" solves it.

Open
#19,181 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: rust-analyzer version: 0.4.2309-standalone

rustc version: rustc 1.86.0-nightly (ef148cd7e 2025-02-12)

editor or extension: VSCode

relevant settings: none

repository link (if public, optional): (eg. rust-analyzer)

code snippet to reproduce:

// any code of rust doesn't show editor token colors or hints if the Cargo.toml file has a lib which mains to ".rs" file, if I use "_.rs" as main file it works, next code if the Cargo.toml file I used.
[lib]
path = ".rs"
doctest = false

[package]
name = "en"
version = "1.1.1"
edition = "2024"
license = "MIT OR Apache-2.0"

[dependencies]
libc = "0.2.169"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in the provided Cargo.toml, focusing on the [lib] path set to ".rs" and comparing it with "_.rs" in VSCode using rust-analyzer 0.4.2309-standalone. Trace how rust-analyzer loads this Cargo target and verify whether editor token colors and hints work for both paths. Done means the valid ".rs" configuration receives the same editor features without requiring a renamed file.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.