Handle prelude
Open
Nobody has claimed this yet.
bug
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 231
- Avg merge
- 19h 55m
- Merged PRs (30d)
- 67
Description
I tried this code (minimized from core):
/* rustc requires these, gccrs doesn't currently
#![feature(no_core)]
#![feature(prelude_import)]
#![no_core]
*/
#[prelude_import]
pub use crate::prelude::*;
mod a {
// Exports as `crate::assert`.
#[macro_export]
macro_rules! assert {
() => {}
}
}
mod prelude {
pub use crate::assert;
}
mod other {
assert!();
}
I expected to see this happen: Compiles
Instead, this happened:
<source>:101:5: error: unknown macro: [assert]
101 | assert!();
| ^~~~~~
For macros, this requires #1076 and #1576. Types/traits in the prelude also don't work, but don't appear to have any immediate blockers.
Meta
- What version of Rust GCC were you using, git sha if possible.
gccrs (Compiler-Explorer-Build-gcc-c7b7e297ea4b688ef9fb51a8aee2a8b2af39ac1c-binutils-2.40) 13.0.1 20230417 (experimental)
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 with the minimized Rust reproduction in the issue and inspect how gccrs handles #[prelude_import], macro exports, and macro lookup. Review the related blockers #1076 and #1576 before changing scope. Done means the reproduction compiles with the prelude macro available, while checking whether type and trait prelude cases also need coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100