Closed
Description
I noticed in the new bitflags v2 release that the flags are no longer showing up cargo doc
output. I filed a bug in the bitflags project for that, but it seems like potentially incorrect behavior on the part of cargo doc as well. Example code:
pub struct S;
trait T {}
const _: () = {
impl S {
// Does not show in docs.
pub const VAL: u32 = 0;
// Does not show in docs.
const fn f() {}
}
// Does not show in docs.
impl T for S {}
};
// Demonstrate that S::VAL and S::f are accessible.
pub const C1: u32 = S::VAL;
pub const C2: () = S::f();
// Demonstrate that S impls T
pub fn x() {
let _t: &dyn T = &S;
}
Since S::VAL
and S::f
are visible outside the empty const _: ()
item, I would expect them to show up in the cargo doc
output, but they don't. Similar for the impl T for S
.
This is not a regression as far as I can tell from checking a few versions of Rust at random.
Meta
rustc --version --verbose
:
rustc 1.68.0 (2c8cc3432 2023-03-06)
binary: rustc
commit-hash: 2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74
commit-date: 2023-03-06
host: x86_64-unknown-linux-gnu
release: 1.68.0
LLVM version: 15.0.6