Description
This issue is quite similar to #80004, which I also worked on, so I have a general idea of how it might be able to be fixed.
I tried this code:
/// ```rust ignore
/// async fn quux() {} // rust 2018+ keyword, fixed in #80226
///
/// #[repr(C)]
/// union ExampleUnion { // weak keyword, not working
/// foo: u8,
/// bar: u16
/// }
///
/// fn bar () {
/// let mut a = 0;
/// abstract blah; // reserved keyword, working
/// }
pub fn foo() {}
I expected to see this happen: union
is highlighted, even though it is a weak keyword, as it is acting as a keyword in that location in the code
Instead, this happened: They were not highlighted, but regular keywords including reserved ones and edition 2018+ ones (fixed in #80266) were.
The issue is here, because Ident::is_reserved
does not check for weak keyword status:
rust/src/librustdoc/html/highlight.rs
Lines 139 to 147 in 8db7973
Meta
Tested
rustc --version --verbose
:
stable:
rustc 1.52.0 (88f19c6da 2021-05-03)
binary: rustc
commit-hash: 88f19c6dab716c6281af7602e30f413e809c5974
commit-date: 2021-05-03
host: x86_64-unknown-linux-gnu
release: 1.52.0
LLVM version: 12.0.0
nightly:
rustc 1.54.0-nightly (bacf770f2 2021-05-05)
binary: rustc
commit-hash: bacf770f2983a52f31e3537db5f0fe1ef2eaa874
commit-date: 2021-05-05
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.0
Backtrace is not applicable.
@rustbot claim
@rustbot modify labels: +A-rustdoc +A-rustdoc-ui +C-bug