Skip to content

Commit baa35b0

Browse files
Merge #4280
4280: Add documents owner for ImplDef and SourceFile r=matklad a=edwin0cheng When working on #3182, I found that `ImplDef` and `SourceFile` do not implemet `DocCommentsOwer` trait, and I tested it in `cargo doc` that `impl` could has some doc-comments. I am not so sure about `SourceFile` case, but in theory if that file is a crate root, the doc comment of it should represent the whole crate documentation, right ? Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2 parents 76c2f4e + f90fbaf commit baa35b0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/ra_syntax/src/ast/generated/nodes.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub struct SourceFile {
1212
}
1313
impl ast::ModuleItemOwner for SourceFile {}
1414
impl ast::AttrsOwner for SourceFile {}
15+
impl ast::DocCommentsOwner for SourceFile {}
1516
impl SourceFile {
1617
pub fn modules(&self) -> AstChildren<Module> { support::children(&self.syntax) }
1718
}
@@ -259,6 +260,7 @@ pub struct ImplDef {
259260
}
260261
impl ast::TypeParamsOwner for ImplDef {}
261262
impl ast::AttrsOwner for ImplDef {}
263+
impl ast::DocCommentsOwner for ImplDef {}
262264
impl ImplDef {
263265
pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
264266
pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }

xtask/src/ast_src.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ macro_rules! ast_enums {
305305
pub(crate) const AST_SRC: AstSrc = AstSrc {
306306
tokens: &["Whitespace", "Comment", "String", "RawString"],
307307
nodes: &ast_nodes! {
308-
struct SourceFile: ModuleItemOwner, AttrsOwner {
308+
struct SourceFile: ModuleItemOwner, AttrsOwner, DocCommentsOwner {
309309
modules: [Module],
310310
}
311311

@@ -401,7 +401,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
401401
T![;]
402402
}
403403

404-
struct ImplDef: TypeParamsOwner, AttrsOwner {
404+
struct ImplDef: TypeParamsOwner, AttrsOwner, DocCommentsOwner {
405405
T![default],
406406
T![const],
407407
T![unsafe],

0 commit comments

Comments
 (0)