Code comments in rmeta files

While doing some investigation into the contents of .rmeta files I noticed that almost all rustdoc comments are included in produced metadata. I was wondering what is the reason for the comments to be there?

Rustdoc will by default inline items when you re-export them in a different crate. For this inlining to work the doc comments need to be available.


Oh, I think understand it now. However, why are comments still included even if doc=false in the [lib] section of cargo.toml? Is there a way to disable this comment inclusion via rustc/cargo configuration, or do they get included, if they exist, no matter what?

Re-exports can still be documented even if the original crate does not. If you don't want doc-comments, I'd suggest writing normal comments instead.