rust-lang / rust-lang/rust-analyzer
`include!` macro silently gives empty string if destination file is outside of the crate
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: 0.3.1916-standalone (7a8374c16 2024-04-08)
rustc version: rustc 1.77.2 (25ef9e3d8 2024-04-09)
editor or extension: VSCode, rust-analyzer v0.3.1916
relevant settings: N/A?
repository link (if public, optional): https://github.com/saschanaz/rust-include-repro
code snippet to reproduce: (Please refer to the repo to see the exact file tree)
include!("in-src.rs");
include!("../in-crate.rs");
include!("../../in-workspace.rs");
fn main() {
in_src();
in_crate();
in_workspace();
}
The issue is threefold:
- The function name of
in_workspacedoes not autocomplete inmain() - Hovering over
in_workspace();shows nothing - Clicking "Inline macro" feature from light bulb menu for
include!("../../in-workspace.rs")just deletes the line
The build result works as expected, so this should be rust-analyzer specific.
See also: https://bugzilla.mozilla.org/show_bug.cgi?id=1890431
Contributor guide
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
Begin with the linked minimal reproduction and trace include!(...) handling for in-src.rs, ../in-crate.rs, and ../../in-workspace.rs. Compare autocomplete, hover, and Inline macro behavior; done means the workspace-outside destination is analyzed consistently without deleting the macro line.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100