Gfx: GFX is broken on nightly

Created on 24 Oct 2016  路  12Comments  路  Source: gfx-rs/gfx

https://travis-ci.org/ozkriff/zoc/jobs/169961437

...
cargo build --release
   Compiling core v0.0.1 (file:///home/travis/build/ozkriff/zoc/core)
   Compiling glutin v0.6.1
   Compiling tempfile v2.1.4
   Compiling wayland-window v0.2.3
   Compiling gfx_window_glutin v0.12.0
   Compiling zoc v0.0.1 (file:///home/travis/build/ozkriff/zoc)
error[E0432]: unresolved import `$crate`
  --> src/pipeline.rs:8:1
   |
8  | gfx_defines! {
   | ^ no `$crate` in the root
   |
   = note: this error originates in a macro outside of the current crate
error[E0433]: failed to resolve. Use of undeclared type or module `gfx`
  --> src/pipeline.rs:15:22
   |
15 |         basic_color: gfx::Global<[f32; 4]> = "u_Basic_color",
   |                      ^^^^^^^^^^^^^^^^^^^^^ Use of undeclared type or module `gfx`
...
ready for work bug high

All 12 comments

Looks like a rust-lang regression (https://github.com/rust-lang/rust/issues/37352), almost fixed (PR https://github.com/rust-lang/rust/pull/37361 waiting for merge).

Now the error says:

. . .
warning: `$crate` may not be imported
  --> src/pipeline.rs:8:1
   |
8  | gfx_defines! {
   | ^
   |
   = note: `use $crate;` was erroneously allowed and will become a hard error in a future release
   = note: this error originates in a macro outside of the current crate
error[E0433]: failed to resolve. Use of undeclared type or module `gfx`
  --> src/pipeline.rs:15:22
   |
15 |         basic_color: gfx::Global<[f32; 4]> = "u_Basic_color",
   |                      ^^^^^^^^^^^^^^^^^^^^^ Use of undeclared type or module `gfx`
. . .

https://travis-ci.org/ozkriff/zoc/jobs/171525019

Just to offer another example...

(snip)

   Compiling piston2d-gfx_graphics v0.31.2
warning: `$crate` may not be imported
  --> /Users/jeff/.cargo/registry/src/github.com-1ecc6299db9ec823/piston2d-gfx_graphics-0.31.2/src/back_end.rs:30:1
   |
30 | gfx_pipeline_base!( pipe_colored {
   | ^
   |
   = note: `use $crate;` was erroneously allowed and will become a hard error in a future release
   = note: this error originates in a macro outside of the current crate

warning: `$crate` may not be imported
  --> /Users/jeff/.cargo/registry/src/github.com-1ecc6299db9ec823/piston2d-gfx_graphics-0.31.2/src/back_end.rs:39:1
   |
39 | gfx_pipeline_base!( pipe_textured {
   | ^
   |
   = note: `use $crate;` was erroneously allowed and will become a hard error in a future release
   = note: this error originates in a macro outside of the current crate

error[E0433]: failed to resolve. Use of undeclared type or module `gfx`
  --> /Users/jeff/.cargo/registry/src/github.com-1ecc6299db9ec823/piston2d-gfx_graphics-0.31.2/src/back_end.rs:31:10
   |
31 |     pos: gfx::VertexBuffer<PositionFormat>,
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use of undeclared type or module `gfx`

(snip)

[jeff@host:~/Projects/planetkit]$ rustup run nightly rustc --version
rustc 1.14.0-nightly (3f4408347 2016-10-27)

@kvark Could you update crates.io version?

Apparently, this change breaks rust-stable, so I yanked v0.12.2 for now...

Should this issue be re-opened?

Yes. Apparently, now it works on nightly but broken on stable :/

Edit2: Ok, actually I think it is an issue in how gfx_pipeline_base is defined.
Edit: Looks like this is actually an issue in PistonDevelopers/gfx_graphics - my mistake!

Still having this issue on latest nightly (1.15 / 2016-11-15).

   Compiling piston2d-gfx_graphics v0.33.1
warning: `$crate` may not be imported
  --> C:\Users\Andy\.cargo\registry\src\github.com-1ecc6299db9ec823\piston2d-gfx_graphics-0.33.1\src\back_end.rs:30:1
   |
30 | gfx_pipeline_base!( pipe_colored {
   | ^
   |
   = note: `use $crate;` was erroneously allowed and will become a hard error in a future release
   = note: this error originates in a macro outside of the current crate

warning: `$crate` may not be imported
  --> C:\Users\Andy\.cargo\registry\src\github.com-1ecc6299db9ec823\piston2d-gfx_graphics-0.33.1\src\back_end.rs:39:1
   |
39 | gfx_pipeline_base!( pipe_textured {
   | ^
   |
   = note: `use $crate;` was erroneously allowed and will become a hard error in a future release
   = note: this error originates in a macro outside of the current crate

error[E0432]: unresolved import ``
  --> C:\Users\Andy\.cargo\registry\src\github.com-1ecc6299db9ec823\piston2d-gfx_graphics-0.33.1\src\back_end.rs:30:1
   |
30 | gfx_pipeline_base!( pipe_colored {
   | ^ no `` in the root
   |
   = note: this error originates in a macro outside of the current crate

error[E0432]: unresolved import ``
  --> C:\Users\Andy\.cargo\registry\src\github.com-1ecc6299db9ec823\piston2d-gfx_graphics-0.33.1\src\back_end.rs:39:1
   |
39 | gfx_pipeline_base!( pipe_textured {
   | ^ no `` in the root
   |
   = note: this error originates in a macro outside of the current crate

error: aborting due to 2 previous errors

Build failed, waiting for other jobs to finish...
error: Could not compile `piston2d-gfx_graphics`.

To learn more, run the command again with --verbose.

Hi !

I get the previous error on my project too, I'm on gfx 0.12.2

   Compiling $crate v0.1.0 (file:///.../.../$crate)
error[E0432]: unresolved import `super::gfx`
  --> src/gfx/chunk_manager.rs:10:1
   |
10 | gfx_defines!{
   | ^ no `gfx` in `chunk_manager`
   |
   = note: this error originates in a macro outside of the current crate

error: aborting due to previous error

error: Could not compile `$crate`.

Are you importing gfx in the file? Like:

use gfx;

gfx_defines! {
   // ...
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

kvark picture kvark  路  3Comments

mjadczak picture mjadczak  路  4Comments

kvark picture kvark  路  4Comments

msiglreith picture msiglreith  路  3Comments

grovesNL picture grovesNL  路  3Comments