`include_str` does not output an error when the file is missing
Open
Nobody has claimed this yet.
bug
good-first-pr
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 231
- Avg merge
- 19h 55m
- Merged PRs (30d)
- 67
Description
I tried this code:
#![feature(rustc_attrs)]
#[rustc_builtin_macro]
macro_rules! include_str {
() => {{}};
}
macro_rules! file1 {
() => {
"missing_file.in"
};
}
fn main() {
include_str!(file1!(),);
}
(note the trailing comma in the include_str macro invocation)
I expected to see this happen: Gccrs output an error message such like rustc.
error: couldn't read missing_file.in: No such file or directory (os error 2)
Instead, this happened: explanation
No error, simply expand the macro to an empty fragment.
Meta
- fb1259001c2
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
Start by running the supplied Rust reproduction with gccrs and compare its behavior with rustc. Trace the include_str builtin macro expansion, especially the trailing-comma case and missing-file handling; done means gccrs emits a diagnostic for missing_file.in rather than expanding to an empty fragment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100