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
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:
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.
$ 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.
I believe this is currently expected behavior; but we've discussed this in the past (#53583 (comment)) and I think it would be interesting to see an RFC that discusses and proposes something in this space.
Activity
Centril commentedon Oct 3, 2018
I believe this is currently expected behavior; but we've discussed this in the past (#53583 (comment)) and I think it would be interesting to see an RFC that discusses and proposes something in this space.
akatechis commentedon Oct 3, 2018
For the sake of completeness, my rustc and cargo versions are:
Centril commentedon Oct 3, 2018
cc @nrc, @petrochenkov
kellda commentedon Mar 9, 2023
This is stabilized since Rust 1.54.0: #83366