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
{{ message }}
Repository navigation
warning: pub extern crate does not work as expected and should not be used #189
Ideally, I wouldn't want these public at all, rather just the renamed pub use num_traits as traits. But IIRC nightly then complains about a public export of something private. So we're left living with a warning on stable.
Are people supposed to use the new crates directly instead of using num? I did make a patch to modify ring to do that but it was quite cumbersome to use num_bigint since the traits I needed were split into two other crates, e.g.:
use num_bigint;use num_integer::IntegerasIntegral;use num_traits::{FromPrimitive,Num,One,Signed,ToPrimitive,Zero};
And then three crate references in Cargo.toml. Maybe I'm doing something silly, though?
In any case, if the warnings are intended to be ignored then maybe you can use #[allow] to suppress them?
error: an extern crate named `num_traits` has already been imported in this module
If I just drop the pub from the crate, leaving pub use num_traits as traits below, it says:
warning: extern crate `num_traits` is private, and cannot be reexported (error E0364), consider declaring with `pub`, #[warn(private_in_public)] on by default
warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
Both 1.8.0 and nightly say that right now, and they're perfectly happy when pub extern crate is used. Only 1.4 through 1.7 complain about pub extern crate, but seem to work AFAICT.
As for how to use all this, please feel free to continue using num as before. I don't plan to remove this supercrate any time soon. I'm fine with adding #[allow], although the message doesn't say what the lint name is.
Activity
cuviper commentedon Apr 29, 2016
Ideally, I wouldn't want these public at all, rather just the renamed
pub use num_traits as traits. But IIRC nightly then complains about a public export of something private. So we're left living with a warning on stable.briansmith commentedon Apr 29, 2016
Are people supposed to use the new crates directly instead of using
num? I did make a patch to modify ring to do that but it was quite cumbersome to usenum_bigintsince the traits I needed were split into two other crates, e.g.:And then three crate references in Cargo.toml. Maybe I'm doing something silly, though?
In any case, if the warnings are intended to be ignored then maybe you can use
#[allow]to suppress them?cuviper commentedon Apr 29, 2016
Your exact suggestion doesn't work:
If I just drop the pub from the crate, leaving
pub use num_traits as traitsbelow, it says:Both 1.8.0 and nightly say that right now, and they're perfectly happy when
pub extern crateis used. Only 1.4 through 1.7 complain aboutpub extern crate, but seem to work AFAICT.As for how to use all this, please feel free to continue using
numas before. I don't plan to remove this supercrate any time soon. I'm fine with adding#[allow], although the message doesn't say what the lint name is.bluss commentedon Apr 29, 2016
another reexporting technique that's sometimes used is:
but I actually don't know what caveats or bugs might apply to this form.
cuviper commentedon Apr 29, 2016
Hmm, I could have sworn I tried that, but it does appear to work.
num: remove `pub` from sub-crates
cuviper commentedon May 3, 2016
In case you missed it, I opened #190 removing
pub extern crate. Please let me know if you find any issues with this, or else I'll merge it soon.Auto merge of #190 - rust-num:private-crates, r=cuviper