rustdoc generates <a title="..."> for intra-doc links, but the titles for enum variant fields seem incorrect.
I tried this code:
Cargo.toml:
[package]
name = "test"
version = "0.1.0"
edition = "2024"
src/lib.rs:
//!
//! <!--
//! START
//! -->
//! [Enum::Variant::field]
//! <!--
//! END
//! -->
//!
/// This is an enum.
pub enum Enum {
Variant { field: i32 }
}
Run the following commands:
$ cargo +nightly doc
$ sed -n '/START/,/END/p' target/doc/test/index.html
I expected to see this happen:
The generated title attribute is field test::Enum::Variant::field
Instead, this happened:
Generated title attribute is field test::Enum::field (Variant is missing)
$ sed -n '/START/,/END/p' target/doc/test/index.html
START
-->
<p><a href="enum.Enum.html#variant.Variant.field.field" title="field test::Enum::field">Enum::Variant::field</a></p>
<!--
END
Meta
rustc --version --verbose:
$ rustc +nightly -vV
rustc 1.99.0-nightly (c98d0cb27 2026-08-12)
binary: rustc
commit-hash: c98d0cb27cc63afdd62602a52eb4feb8a1c682dd
commit-date: 2026-08-12
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 23.1.0
Backtrace
rustdocgenerates<a title="...">for intra-doc links, but the titles for enum variant fields seem incorrect.I tried this code:
Cargo.toml:src/lib.rs:Run the following commands:
I expected to see this happen:
The generated
titleattribute isfield test::Enum::Variant::fieldInstead, this happened:
Generated
titleattribute isfield test::Enum::field(Variantis missing)Meta
rustc --version --verbose:Backtrace