Skip to content

Commit 7bc0ca3

Browse files
committed
Preserve mod and brace token spans in macro output
1 parent 5b4b829 commit 7bc0ca3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

macro/src/expand.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,17 @@ fn expand(ffi: Module, doc: Doc, attrs: OtherAttrs, apis: &[Api], types: &Types)
114114
}
115115

116116
let vis = &ffi.vis;
117+
let mod_token = &ffi.mod_token;
117118
let ident = &ffi.ident;
119+
let span = ffi.brace_token.span;
120+
let expanded = quote_spanned!(span=> {#expanded});
118121

119122
quote! {
120123
#doc
121124
#attrs
122125
#[deny(improper_ctypes)]
123126
#[allow(non_snake_case)]
124-
#vis mod #ident {
125-
#expanded
126-
}
127+
#vis #mod_token #ident #expanded
127128
}
128129
}
129130

0 commit comments

Comments
 (0)