The Rust compiler has an unused_doc_comments lint that warns about doc comments applied to nodes of the wrong kind. But it does not warn about nodes of the right kind that are simply inaccessible.
Consider the program below (playground). unused_doc_comments warns about doc comment preceding the statement, but not the one preceding the constant.
fn main() {
/// A constant
const GREETING: &str = "Hello, world!";
/// A statement
println!("{GREETING}");
}