Closed
Description
Following up on an issue first discovered in #12386. ///
-style Doc comments placed on pub mod
lines appear twice in the AST.
In this minimal example, there are two files: mod.rs and test.rs.
mod.rs contains:
/// The 'test' module is elegant in its minimalism.
pub mod test;
test.rs contains:
/*! This summary statement describes the 'test' module */
pub fn print_test_message() {
println!("I am a test message.");
}
Compiling with rustc -Z ast-json mod.rs
produces the following AST fragment:
"items": [
{
"ident": "test",
"attrs": [
{
"node": {
"style": "AttrOuter",
"value": {
"node": [
"MetaNameValue",
"doc",
{
"node": [
"LitStr",
"/// The 'test' module is elegant in its minimalism. ",
"CookedStr"
],
"span": null
}
],
"span": null
},
"is_sugared_doc": true
},
"span": null
},
{
"node": {
"style": "AttrOuter",
"value": {
"node": [
"MetaNameValue",
"doc",
{
"node": [
"LitStr",
"/// The 'test' module is elegant in its minimalism. ",
"CookedStr"
],
"span": null
}
],
"span": null
},
"is_sugared_doc": true
},
"span": null
}
// .... remainder of AST follows
The complete AST can be found here.
Metadata
Metadata
Assignees
Labels
No labels