rust-lang / rust-lang/rust-analyzer
Using css-modules crate results in macro-error but compiles and works.
Open
Nobody has claimed this yet.
A-macro
S-actionable
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Example
src/app.css
.something {
background: red
}
src/main.rs
use css_modules::include_css_module;
fn main() {
let css = include_css_module!("app.css");
println!("{}", css["something"]);
}
./build.rs :
use css_modules::CssModules;
fn main() {
let mut css_modules = CssModules::default();
// Include all CSS files in the src dir:
css_modules.add_modules("src/**/*.css").unwrap();
// Compile all modules and export CSS into one file:
css_modules.compile("./app.css");
}
./Cargo.toml
# ...
[dependencies]
css-modules = "0.5"
[build-dependencies]
css-modules = "0.5"
Error
message: called `Result::unwrap()` on an `Err` value: StripPrefixError(())
Maybe Rust-analyzer does not find the file that Rust does.
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
Reproduce the macro error using the provided src/app.css, src/main.rs, build.rs, and Cargo.toml example, comparing rust-analyzer's result with the successful Rust build. Start by tracing how the include_css_module! call resolves app.css and handles the build-script output. Done means the example no longer reports a macro error while retaining its existing compiled behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100