`format!` in a `proptest!` test: "macro `format!` is not supported yet" when a local module `alloc` is in scope
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 58/100
Research direction
Start by running the linked minimal reproducer from the issue and reading the proptest! macro expansion path in the Relax Rust JIT repository. Compare how format! is resolved inside and outside the generated test, with a local alloc module in scope. Done means the reproducer passes under relax test while preserving the shadowing module.
Written by the indexing model from the issue text.
Description
format! inside a proptest! test fails to expand when a local module named alloc is in scope:
mod gpu {
pub mod alloc {
pub fn bytes(n: usize) -> Vec<u8> { vec![0; n] }
}
}
use gpu::alloc;
#[cfg(test)]
mod tests {
use super::*;
use proptest::prelude::*;
proptest! {
#[test]
fn formats(n in 0usize..100) {
let s = format!("{n}");
prop_assert!(!s.is_empty());
}
}
}
cargo test: test result: ok. 1 passed
relax test: src/lib.rs:19:5: internal: macro `format!` is not supported yet
It looks like the local alloc shadows the alloc crate that format! comes from. Each of these makes it pass:
- deleting
use gpu::alloc; - calling
format!from an ordinary function in a child module with the sameuse super::*;, with noproptest!.
Minimal reproducer (proptest only), checked on 193e0b6c.
- Dominant language
- Rust
- Stars
- 601
- Forks
- 34
- Avg merge
- 1h 58m
- Merged PRs (30d)
- 45
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from makepad/relax
-
std: `SliceIndex<str>` missing for `std::ops` ranges, so generic `R: SliceIndex<str>` bounds failOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 18/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 18/100
Maintainers usually reply within 1 day
Similar issues
-
CI/CD ignore-for-release
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
eclipse-ankaios/ankaios#844 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
symposium-dev/symposium#530 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
topgrade-rs/topgrade#2540 ·
Maintainers usually reply within 1 day