-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #87428 - GuillaumeGomez:union-highlighting, r=notriddle
Fix union keyword highlighting in rustdoc HTML sources I followed this logic: if I find an ident "union", I check if it followed by another ident or not. If it's the case, then I consider this is a keyword because it's declaring a union type. To do so I created a new Iterator which allows to peek the next items without moving the current iterator position. This is part of #85016. If the fix makes sense, I'll extend it to other weak keywords (the issue only mentions they exist but https://doc.rust-lang.org/nightly/reference/keywords.html#weak-keywords only talks about `dyn` and `'static` so not sure if there is anything else to be done?). cc `@notriddle` (you're one of the last ones who worked on this part of rustdoc so here you go 😉 ) r? `@jyn514`
- Loading branch information
Showing
4 changed files
with
91 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<span class="kw">union</span> <span class="ident">Foo</span> { | ||
<span class="ident">i</span>: <span class="ident">i8</span>, | ||
<span class="ident">u</span>: <span class="ident">i8</span>, | ||
} | ||
|
||
<span class="kw">fn</span> <span class="ident">main</span>() { | ||
<span class="kw">let</span> <span class="ident">union</span> <span class="op">=</span> <span class="number">0</span>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
union Foo { | ||
i: i8, | ||
u: i8, | ||
} | ||
|
||
fn main() { | ||
let union = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters