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
The glyph_packer module publicly re-exports a Buffer2d trait from the buffer2d module, which is then used by rasterize/mod.rs.
However, when I attempt to implement the Buffer2d trait, I get this error:
$ rustc -V
rustc 1.8.0-nightly (3623797eb 2016-02-07)
$ cargo build
Compiling font-atlas v0.1.2 (file:///C:/Users/Ty/workspace/rust/font-atlas)
src\rasterize/mod.rs:59:29: 59:41 error: source trait is inaccessible
src\rasterize/mod.rs:59 self.bytes.get((x + self.width() * y) as usize).cloned()
^~~~~~~~~~~~
src\rasterize/mod.rs:59:29: 59:41 note: module `buffer2d` is private
src\rasterize/mod.rs:59 self.bytes.get((x + self.width() * y) as usize).cloned()
^~~~~~~~~~~~
src\rasterize/mod.rs:63:17: 63:29 error: source trait is inaccessible
src\rasterize/mod.rs:63 let w = self.width();
^~~~~~~~~~~~
src\rasterize/mod.rs:63:17: 63:29 note: module `buffer2d` is private
src\rasterize/mod.rs:63 let w = self.width();
^~~~~~~~~~~~
src\rasterize/mod.rs:73:17: 73:29 error: source trait is inaccessible
src\rasterize/mod.rs:73 assert!(self.width() <= width && self.height() <= height,
^~~~~~~~~~~~
src\rasterize/mod.rs:73:9: 74:55 note: in this expansion of assert! (defined in <std macros>)
src\rasterize/mod.rs:73:17: 73:29 note: module `buffer2d` is private
src\rasterize/mod.rs:73 assert!(self.width() <= width && self.height() <= height,
^~~~~~~~~~~~
src\rasterize/mod.rs:73:9: 74:55 note: in this expansion of assert! (defined in <std macros>)
src\rasterize/mod.rs:73:42: 73:55 error: source trait is inaccessible
src\rasterize/mod.rs:73 assert!(self.width() <= width && self.height() <= height,
^~~~~~~~~~~~~
src\rasterize/mod.rs:73:9: 74:55 note: in this expansion of assert! (defined in <std macros>)
src\rasterize/mod.rs:73:42: 73:55 note: module `buffer2d` is private
src\rasterize/mod.rs:73 assert!(self.width() <= width && self.height() <= height,
^~~~~~~~~~~~~
src\rasterize/mod.rs:73:9: 74:55 note: in this expansion of assert! (defined in <std macros>)
src\rasterize/mod.rs:76:9: 76:32 error: source trait is inaccessible
src\rasterize/mod.rs:76 o_new.patch(0, 0, self);
^~~~~~~~~~~~~~~~~~~~~~~
src\rasterize/mod.rs:76:9: 76:32 note: module `buffer2d` is private
src\rasterize/mod.rs:76 o_new.patch(0, 0, self);
^~~~~~~~~~~~~~~~~~~~~~~
src\rasterize/mod.rs:96:13: 96:45 error: source trait is inaccessible
src\rasterize/mod.rs:96 out.set(x, y, (v * 255.0) as u8);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src\rasterize/mod.rs:96:13: 96:45 note: module `buffer2d` is private
src\rasterize/mod.rs:96 out.set(x, y, (v * 255.0) as u8);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src\rasterize/mod.rs:104:9: 104:34 error: source trait is inaccessible
src\rasterize/mod.rs:104 packer.set_margin(margin);
^~~~~~~~~~~~~~~~~~~~~~~~~
src\rasterize/mod.rs:104:9: 104:34 note: module `packer` is private
src\rasterize/mod.rs:104 packer.set_margin(margin);
^~~~~~~~~~~~~~~~~~~~~~~~~
src\rasterize/mod.rs:106:13: 106:64 error: source trait is inaccessible
src\rasterize/mod.rs:106 packer.pack_resize(&c, |(ow, oh)| (ow * 2, oh * 2));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src\rasterize/mod.rs:106:13: 106:64 note: module `packer` is private
src\rasterize/mod.rs:106 packer.pack_resize(&c, |(ow, oh)| (ow * 2, oh * 2));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src\rasterize/mod.rs:108:9: 108:26 error: source trait is inaccessible
src\rasterize/mod.rs:108 packer.into_buf()
^~~~~~~~~~~~~~~~~
src\rasterize/mod.rs:108:9: 108:26 note: module `packer` is private
src\rasterize/mod.rs:108 packer.into_buf()
^~~~~~~~~~~~~~~~~
error: aborting due to 9 previous errors
Could not compile `font-atlas`.
By making the glyph_packer module pub mod buffer2d; pub use buffer2d::Buffer2d; instead of just mod buffer2d; pub use buffer2d::Buffer2d; the error goes away.
The text was updated successfully, but these errors were encountered:
TyOverby
changed the title
Rustc fails to compile code with "source trait is inaccessible", when the source trait is public.
Rustc fails to compile code with "source trait is inaccessible", when the source trait is re-exported to be public.
Mar 9, 2016
I have a module structure that looks like this:
The
glyph_packer
module publicly re-exports aBuffer2d
trait from thebuffer2d
module, which is then used byrasterize/mod.rs
.However, when I attempt to implement the
Buffer2d
trait, I get this error:By making the
glyph_packer
modulepub mod buffer2d; pub use buffer2d::Buffer2d;
instead of justmod buffer2d; pub use buffer2d::Buffer2d;
the error goes away.The text was updated successfully, but these errors were encountered: