Skip to content

Commit 4954ca1

Browse files
authored
Merge pull request #332 from dtolnay/doc
Preserve docs on aliases
2 parents f2fbac7 + 890083d commit 4954ca1

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
@@ -657,9 +657,11 @@ fn expand_rust_function_shim_impl(
657657
}
658658

659659
fn expand_type_alias(alias: &TypeAlias) -> TokenStream {
660+
let doc = &alias.doc;
660661
let ident = &alias.ident;
661662
let ty = &alias.ty;
662663
quote! {
664+
#doc
663665
pub type #ident = #ty;
664666
}
665667
}

syntax/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub struct ExternFn {
7979
}
8080

8181
pub struct TypeAlias {
82+
pub doc: Doc,
8283
pub type_token: Token![type],
8384
pub ident: Ident,
8485
pub eq_token: Token![=],

syntax/parse.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,10 @@ 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 {
402+
doc,
402403
type_token,
403404
ident,
404405
eq_token,

0 commit comments

Comments
 (0)