-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hi,
If I use lazy_static_include_str in a module, and try to use the result somewhere, I get a compile error with private struct, even though I used pub.
More clearly:
- This works:
/// main.rs
use lazy_static_include::lazy_static_include_str;
mod some_mod;
lazy_static_include_str! {
pub TEST1 => "plain/test1.txt",
}
fn main() {
some_mod::some_func();
}/// some_mod.rs
pub(crate) fn some_func() {
println!("{}", crate::TEST1);
}- But this, unexpectedly, does not:
/// main.rs
mod some_mod;
use some_mod::TEST2;
fn main() {
println!("{}", TEST2);
}/// some_mod.rs
use lazy_static_include::lazy_static_include_str;
lazy_static_include_str! {
pub TEST2 => "plain/test2.txt",
}On the second case, the full output of the compiler is :
error[E0603]: struct `TEST2` is private
--> src/main.rs:2:15
|
2 | use some_mod::TEST2;
| ^^^^^ private struct
|
note: the struct `TEST2` is defined here
--> src/some_mod.rs:3:1
|
3 | / lazy_static_include_str! {
4 | | pub TEST2 => "plain/test2.txt",
5 | | }
| |_^
= note: this error originates in the macro `__lazy_static_internal` which comes from the expansion of the macro `lazy_static_include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0603`.
error: could not compile `test-lsi-bug` (bin "test-lsi-bug") due to previous error
Tested on nightly (1.71.0-nightly (b628260df 2023-04-22))
Metadata
Metadata
Assignees
Labels
No labels