PistonDevelopers / gfx_graphics

A Gfx 2D back-end for the Piston game engine
MIT License
55 stars 31 forks source link

Compile error: error[E0432]: unresolved import `` #315

Closed Johnson-A closed 7 years ago

Johnson-A commented 7 years ago

piston2d-gfx_graphics v0.33.1 fails to compile with rustc 1.15.0-nightly (ba872f270 2016-11-17) giving the following error message compiler_error.txt

There are two additional warnings: $crate may not be imported on each error. Is this a problem with the way the crate has been implemented? I say this because there was a compile error on the previous version that seemed very similar #308

lucklove commented 7 years ago

It seems that newest rust nightly don't support use $crate in macros, but unfortunately, gfx v0.12.0, which piston2d-gfx_graphics v0.33.1 depends on, do so. In src/macros/pso.rs:

205 #[macro_export]
206 macro_rules! gfx_pipeline_base {
207     ($module:ident {
208         $( $field:ident: $ty:ty, )*
209     }) => {
210         pub mod $module {
211             use $crate;
212             #[allow(unused_imports)]
213             use super::*;
214             gfx_pipeline_inner!{ $(
215                 $field: $ty,
216             )*}
217         }
218     }
219 }

To workaround, simply delete the line use $crate in. Of course, we should fix it permanently, but the difficulty is, the newest gfx's structure is never like 0.12.x at all, it doesn't even expose these macros now(these macros is now at a sub directory of gfx as a sub crate). We should work out a better way to get out of it.

lucklove commented 7 years ago

Thanks for this issue, going to close this in favour of tracking at PistonDevelopers/gfx_graphics#313.