Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove gfx import in pipeline macro #1081

Closed
wants to merge 1 commit into from
Closed

Conversation

msiglreith
Copy link
Contributor

As RFC 1560 (rust-lang/rfcs#1560) is now stabilized on nightly 1.14.0 use super::* will now import all occurences of use gfx; from the parent module. This allows to compile code like following:

#[macro_use]
extern crate gfx as gfx_temp;

mod foo {
    // Import `gfx` into this module.
    // The new pipeline module created in the macro has access
    // to this import via `use super::*;`
    use gfx_temp; 

    gfx_defines!{
        vertex Vertex {
            pos: [f32; 4] = "a_Pos",
            tex_coord: [f32; 2] = "a_TexCoord",
        }

        pipeline pipe {
            vbuf: gfx_temp::VertexBuffer<Vertex> = (),
        }
    }
}

So as long as the gfx module is imported in the module where you define the pipeline everything should work. Following this condition the regression #1070 would be resolved.

@msiglreith
Copy link
Contributor Author

Is there an option for conditional compilation depening on rustc version? Rust compiler <1.14.0 still require the use $crates; approach, while newer versions would make use of the item_like_imports feature.

@kvark
Copy link
Member

kvark commented Nov 28, 2016

Hmm. Everything is great, except that it doesn't build on Linux stable (according to Travis)...

@msiglreith
Copy link
Contributor Author

Rust stable is still 1.13.0 which doesn't support item_like_imports and still requires the legacy use $crates; way. 1.14.0 will go out of beta around end of december.

@sectopod
Copy link
Contributor

Is this still needed? I was under impression that gfx now compiles fine on nightly/stable

@msiglreith
Copy link
Contributor Author

I think the example above won't compile with the current master branch, but I can double-check this!
1.14 is scheduled to become stable at 22nd december, then this PR should also build without problems on stable.

@kvark
Copy link
Member

kvark commented Dec 14, 2016

@msiglreith ok, so you are saying we should be safe to merge this for 1.14? We'd also need to update the appveyor to use the new version.

@msiglreith
Copy link
Contributor Author

@kvark Yes, but I'll try to check other projects (e.g zoc) if this might cause some issues.

@msiglreith
Copy link
Contributor Author

Hm, looks like the item_like_imports feature didn't make it into the stable release. Closing this for the moment and create a new PR, when it finally becomes active in the stable channel.

@msiglreith msiglreith closed this Dec 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants