Skip to content

Commit 4e1f065

Browse files
committed
Preserve docs on aliases
1 parent dcd1455 commit 4e1f065

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

macro/src/expand.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,11 @@ fn expand_rust_function_shim_impl(
659659
}
660660

661661
fn expand_type_alias(alias: &TypeAlias) -> TokenStream {
662+
let doc = &alias.doc;
662663
let ident = &alias.ident;
663664
let ty = &alias.ty;
664665
quote! {
666+
#doc
665667
pub type #ident = #ty;
666668
}
667669
}

syntax/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ pub enum AliasKind {
8585

8686
pub struct TypeAlias {
8787
pub kind: AliasKind,
88+
pub doc: Doc,
8889
pub type_token: Token![type],
8990
pub ident: Ident,
9091
pub eq_token: Token![=],

syntax/parse.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,11 @@ fn parse_extern_verbatim(cx: &mut Errors, tokens: &TokenStream, lang: Lang) -> R
396396
let eq_token: Token![=] = input.parse()?;
397397
let ty: RustType = input.parse()?;
398398
let semi_token: Token![;] = input.parse()?;
399-
attrs::parse_doc(cx, &attrs);
399+
let doc = attrs::parse_doc(cx, &attrs);
400400

401401
Ok(TypeAlias {
402402
kind: AliasKind::OpaqueCpp,
403+
doc,
403404
type_token,
404405
ident,
405406
eq_token,

0 commit comments

Comments
 (0)