rust-lang / rust-lang/rust-analyzer

The formatcp! macro does not work when the project root does not have Cargo.toml.

Open
#10,969 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: 7d6fcbc0b 2021-12-06 stable

rustc version: rustc 1.58.0-nightly (b426445c6 2021-11-24)

It looks like the formatcp! macro from the const-format crate combined with another macro cannot work if the project root is not a rust project in VSCode. But it works fine if I open the rust project as project root. It also works fine when it is used outside of our component! macro. So there are multiple things needed for the bug.

Our project structure:

web-frontend (has Cargo.toml)
   ...
   frontend-svg-react (does not have Cargo.toml)
      ...
      relate_wasm (has Cargo.toml)
         component_macro (has Cargo.toml)
         ...

image

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 reported formatcp! and component! macro combination using the nested web-frontend, frontend-svg-react, relate_wasm, and component_macro project layout. Compare behavior when web-frontend versus relate_wasm is opened as the project root; done means the macro works correctly in both layouts.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.