You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[macro_use]externcrate lazy_static;mod a {pubmod b {use std::collections::HashMap;lazy_static!{pub(in a)static ref HASHMAP:HashMap<u32,&'staticstr> = {letmut m = HashMap::new();
m.insert(0,"baz");
m
};}}useself::b::HASHMAP;pubfnfoo(){println!("{}",HASHMAP[&0]);}}fnmain(){
a::foo();}
It works as intended, but if we switch pub(in a) to pub(crate) (both of which are valid visibility restrictions as of Rust v.1.18 and higher) we get an error:
I would submit a patch, but unfortunately my macro-foo is not high enough to take on this issue alone (although if someone is willing to mentor I can try to fix this).
The text was updated successfully, but these errors were encountered:
Yeh it looks like we're hard-coding the in $path part here... My macro-foo is also weak, but @dtolnayposted a snippet in another crate that supports pub(crate) and pub(in path). Maybe we should have a look at that?
Consider this example:
It works as intended, but if we switch
pub(in a)
topub(crate)
(both of which are valid visibility restrictions as of Rust v.1.18 and higher) we get an error:I would submit a patch, but unfortunately my macro-foo is not high enough to take on this issue alone (although if someone is willing to mentor I can try to fix this).
The text was updated successfully, but these errors were encountered: