Skip to content

Commit f6e5448

Browse files
authored
Rollup merge of rust-lang#105027 - aDotInTheVoid:rdj-foreign-variant-test, r=GuillaumeGomez
Rustdoc-Json: Add tests for linking to foreign variants. I initially taught these would be bugs, but it turn out they work perfectly, and the variant is added to paths. Most of the work is done by jsondoclint checking all the ID's resolve (although this wont happen for links until rust-lang#105015, which in turn is blocked on removing foreign traits), but we do check that neither the enum nor the variant is inlined, so it must be resolved correctly through paths. r? ``@GuillaumeGomez``
2 parents 0e7f159 + d958f37 commit f6e5448

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pub enum Color {
2+
Red,
3+
Green,
4+
Blue,
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// aux-build: color.rs
2+
3+
//! The purpose of this test it to have a link to [a foreign variant](Red).
4+
5+
extern crate color;
6+
use color::Color::Red;
7+
8+
// @set red = "$.index[*][?(@.inner.is_crate == true)].links.Red"
9+
10+
// @!has "$.index[*][?(@.name == 'Red')]"
11+
// @!has "$.index[*][?(@.name == 'Color')]"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// aux-build: color.rs
2+
3+
extern crate color;
4+
5+
// @is "$.index[*][?(@.inner.name == 'Red')].kind" '"import"'
6+
pub use color::Color::Red;
7+
8+
// @!has "$.index[*][?(@.name == 'Red')]"
9+
// @!has "$.index[*][?(@.name == 'Color')]"

0 commit comments

Comments
 (0)