Open
Description
Not sure if this should be an RFC or a bug/issue, but I'm trying to add an attribute to a struct where the value of the attribute is a &'static str
. It would be nice to have the contents of the string in a separate file so I can have syntax highlighting when editing that file, and then have that be pulled in to the rust module and built. The following should reproduce the issue:
Cargo.toml
:
[package]
name = "handmade-rs"
version = "0.1.0"
edition = "2018"
[dependencies]
winit = "0.17"
vulkano = "0.10.0"
vulkano-win = "0.10.0"
vulkano-shader-derive = "0.10.0"
And then in a module, try to compile the following. The src
attribute takes a string as its value, that contains the source code of the shader to compile.
#[derive(VulkanoShader)]
#[ty="compute"]
#[src=include_str!("./compute_shader.glsl")]
pub struct Dummy;
When I compile, I get the following output:
$ cargo b
Compiling handmade-rs v0.1.0 (C:\Users\Alexandros\workspace\handmade-rs)
error: expected `]`, found `!`
--> src\shaders\compute.rs:4:18
|
4 | #[src=include_str!("./compute_shader.glsl")]
| ^ expected `]`
error: aborting due to previous error
error: Could not compile `handmade-rs`.
To learn more, run the command again with --verbose.