Skip to content

Commit 5883d3d

Browse files
committed
Move @has checks closer to corresponding doc comments
1 parent 71ca884 commit 5883d3d

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

src/test/rustdoc/intra-doc-link-generic-params.rs

+19-15
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,38 @@
55
//! Here's a link to [`Vec<T>`] and one to [`Box<Vec<Option<T>>>`].
66
//! Here's a link to [`Iterator<Box<T>>::Item`].
77
//!
8+
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html"]' 'Vec<T>'
9+
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html"]' 'Box<Vec<Option<T>>>'
10+
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item"]' 'Iterator<Box<T>>::Item'
11+
812
//! And what about a link to [just `Option`](Option) and, [with the generic, `Option<T>`](Option<T>)?
913
//!
14+
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html"]' 'just Option'
15+
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html"]' 'with the generic, Option<T>'
16+
1017
//! We should also try linking to [`Result<T, E>`]; it has *two* generics!
1118
//!
19+
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"]' 'Result<T, E>'
20+
1221
//! Now let's test a trickier case: [`Vec::<T>::new`], or you could write it
1322
//! [with parentheses as `Vec::<T>::new()`][Vec::<T>::new()].
1423
//! And what about something even harder? That would be [`Vec::<Box<T>>::new()`].
1524
//!
25+
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.new"]' 'Vec::<T>::new'
26+
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.new"]' 'with parentheses as Vec::<T>::new()'
27+
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.new"]' 'Vec::<Box<T>>::new()'
28+
1629
//! This is also pretty tricky: [`TypeId::of::<String>()`].
1730
//! And this too: [`Vec::<std::error::Error>::len`].
1831
//!
32+
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html#method.of"]' 'TypeId::of::<String>()'
33+
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.len"]' 'Vec::<std::error::Error>::len'
34+
1935
//! We unofficially and implicitly support things that aren't valid in the actual Rust syntax, like
2036
//! [`Box::<T>new()`]. We may not support them in the future!
2137
//!
38+
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html#method.new"]' 'Box::<T>new()'
39+
2240
//! These will be resolved as regular links:
2341
//! - [`this is <invalid syntax> first`](https://www.rust-lang.org)
2442
//! - [`this is <invalid syntax> twice`]
@@ -30,21 +48,7 @@
3048
//! [`this is <invalid syntax> twice`]: https://www.rust-lang.org
3149
//! [rlo]: https://www.rust-lang.org
3250
//! [c > d]: https://www.rust-lang.org
33-
34-
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html"]' 'Vec<T>'
35-
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html"]' 'Box<Vec<Option<T>>>'
36-
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item"]' 'Iterator<Box<T>>::Item'
37-
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html"]' 'just Option'
38-
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html"]' 'with the generic, Option<T>'
39-
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"]' 'Result<T, E>'
40-
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.new"]' 'Vec::<T>::new'
41-
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.new"]' 'with parentheses as Vec::<T>::new()'
42-
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.new"]' 'Vec::<Box<T>>::new()'
43-
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html#method.of"]' 'TypeId::of::<String>()'
44-
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.len"]' 'Vec::<std::error::Error>::len'
45-
46-
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html#method.new"]' 'Box::<T>new()'
47-
51+
//!
4852
// @has foo/index.html '//a[@href="https://www.rust-lang.org"]' 'this is <invalid syntax> first'
4953
// @has foo/index.html '//a[@href="https://www.rust-lang.org"]' 'this is <invalid syntax> twice'
5054
// @has foo/index.html '//a[@href="https://www.rust-lang.org"]' '<invalid syntax> thrice'

0 commit comments

Comments
 (0)