# [Solved] Need help understanding a macro error

#1

I’m trying to invoke a macro like this:

pipeline_layout! {
set0: {
tiles_in: StorageBuffer<cs::ty::TileDynamic>,
tiles_out: StorageBuffer<cs::ty::TileDynamic>
}
}

…which should then invoke the same macro recursively here: https://github.com/tomaka/vulkano/blob/02ff4793266ecdd3cfa36cd30d981dff0c93e0fc/vulkano/src/descriptor/pipeline_layout/custom_pipeline_macro.rs#L85

The line above should expand to:

pipeline_layout!{__inner__ (0) set0: { tiles: StorageBuffer<cs::ty::TileRead>, tiles_in: StorageBuffer<cs::ty::TileDynamic>, tiles_out: StorageBuffer<cs::ty::TileDynamic> }}

… which should trigger the match right under: https://github.com/tomaka/vulkano/blob/02ff4793266ecdd3cfa36cd30d981dff0c93e0fc/vulkano/src/descriptor/pipeline_layout/custom_pipeline_macro.rs#L88

However this fails with the following compilation error:

src\descriptor\pipeline_layout\custom_pipeline_macro.rs:85:58: 85:59 error: expe
cted one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `tiles_in`
src\descriptor\pipeline_layout\custom_pipeline_macro.rs:85         pipeline_layo
ut!{__inner__ (0) \$(\$name: {\$(\$field: \$ty),*})*}

^

#2

I was advised to try using trace-macros. The result is the same as expected:

pipeline_layout! { __inner__ ( 0 ) set0 : {
tiles : StorageBuffer<cs::ty::TileRead> , tiles_in :
StorageBuffer<cs::ty::TileDynamic> , tiles_out :
StorageBuffer<cs::ty::TileDynamic> } }

#3

Interesingly, it appears to parse correctly on the playpen: http://is.gd/oFLx7x

#4

I found the problem! If I remove the “descriptors” parameter here, the error disappears.
The problem was due to a missing comma at line 145, and not at line 85 like the error says.