Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move
src/test/rustdoc
intra-doc link tests into a subdirectory
They were starting to get unwieldy.
- Loading branch information
Showing
64 changed files
with
254 additions
and
258 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
// ignore-tidy-linelength | ||
#![deny(intra_doc_link_resolution_failure)] | ||
#![feature(associated_type_defaults)] | ||
|
||
pub trait TraitWithDefault { | ||
type T = usize; | ||
fn f() -> Self::T { | ||
0 | ||
} | ||
} | ||
|
||
/// Link to [UsesDefaults::T] and [UsesDefaults::f] | ||
// @has 'associated_defaults/struct.UsesDefaults.html' '//a[@href="../associated_defaults/struct.UsesDefaults.html#associatedtype.T"]' 'UsesDefaults::T' | ||
// @has 'associated_defaults/struct.UsesDefaults.html' '//a[@href="../associated_defaults/struct.UsesDefaults.html#method.f"]' 'UsesDefaults::f' | ||
pub struct UsesDefaults; | ||
impl TraitWithDefault for UsesDefaults {} | ||
|
||
/// Link to [OverridesDefaults::T] and [OverridesDefaults::f] | ||
// @has 'associated_defaults/struct.OverridesDefaults.html' '//a[@href="../associated_defaults/struct.OverridesDefaults.html#associatedtype.T"]' 'OverridesDefaults::T' | ||
// @has 'associated_defaults/struct.OverridesDefaults.html' '//a[@href="../associated_defaults/struct.OverridesDefaults.html#method.f"]' 'OverridesDefaults::f' | ||
pub struct OverridesDefaults; | ||
impl TraitWithDefault for OverridesDefaults { | ||
type T = bool; | ||
fn f() -> bool { | ||
true | ||
} | ||
} |
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,61 @@ | ||
// ignore-tidy-linelength | ||
#![deny(intra_doc_link_resolution_failure)] | ||
|
||
/// [`std::collections::BTreeMap::into_iter`] | ||
/// [`String::from`] is ambiguous as to which `From` impl | ||
/// [Vec::into_iter()] uses a disambiguator | ||
// @has 'associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/collections/btree/map/struct.BTreeMap.html#method.into_iter"]' 'std::collections::BTreeMap::into_iter' | ||
// @has 'associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html#method.from"]' 'String::from' | ||
// @has 'associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.into_iter"]' 'Vec::into_iter' | ||
pub fn foo() {} | ||
|
||
/// Link to [MyStruct], [link from struct][MyStruct::method], [MyStruct::clone], [MyStruct::Input] | ||
// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html"]' 'MyStruct' | ||
// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html#method.method"]' 'link from struct' | ||
// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html#method.clone"]' 'MyStruct::clone' | ||
// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html#associatedtype.Input"]' 'MyStruct::Input' | ||
pub struct MyStruct { foo: () } | ||
|
||
impl Clone for MyStruct { | ||
fn clone(&self) -> Self { | ||
MyStruct | ||
} | ||
} | ||
|
||
pub trait T { | ||
type Input; | ||
fn method(i: Self::Input); | ||
} | ||
|
||
impl T for MyStruct { | ||
type Input = usize; | ||
|
||
/// [link from method][MyStruct::method] on method | ||
// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html#method.method"]' 'link from method' | ||
fn method(i: usize) { | ||
} | ||
} | ||
|
||
/// Ambiguity between which trait to use | ||
pub trait T1 { | ||
fn ambiguous_method(); | ||
} | ||
|
||
pub trait T2 { | ||
fn ambiguous_method(); | ||
} | ||
|
||
/// Link to [S::ambiguous_method] | ||
// FIXME: there is no way to disambiguate these. | ||
// Since we have `#[deny(intra_doc_failure)]`, we still know it was one or the other. | ||
pub struct S; | ||
|
||
impl T1 for S { | ||
fn ambiguous_method() {} | ||
} | ||
|
||
impl T2 for S { | ||
fn ambiguous_method() {} | ||
} | ||
|
||
fn main() {} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
2 changes: 1 addition & 1 deletion
2
...test/rustdoc/intra-link-builtin-macros.rs → src/test/rustdoc/intra-doc/builtin-macros.rs
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// @has intra_link_builtin_macros/index.html | ||
// @has builtin_macros/index.html | ||
// @has - '//a/@href' 'https://doc.rust-lang.org/nightly/core/macro.cfg.html' | ||
//! [cfg] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,51 @@ | ||
// ignore-tidy-linelength | ||
#![deny(intra_doc_link_resolution_failure)] | ||
// first try backticks | ||
/// Trait: [`trait@Name`], fn: [`fn@Name`], [`Name`][`macro@Name`] | ||
// @has disambiguators_removed/struct.AtDisambiguator.html | ||
// @has - '//a[@href="../disambiguators_removed/trait.Name.html"][code]' "Name" | ||
// @has - '//a[@href="../disambiguators_removed/fn.Name.html"][code]' "Name" | ||
// @has - '//a[@href="../disambiguators_removed/macro.Name.html"][code]' "Name" | ||
pub struct AtDisambiguator; | ||
|
||
/// fn: [`Name()`], macro: [`Name!`] | ||
// @has disambiguators_removed/struct.SymbolDisambiguator.html | ||
// @has - '//a[@href="../disambiguators_removed/fn.Name.html"][code]' "Name()" | ||
// @has - '//a[@href="../disambiguators_removed/macro.Name.html"][code]' "Name!" | ||
pub struct SymbolDisambiguator; | ||
|
||
// Now make sure that backticks aren't added if they weren't already there | ||
/// [fn@Name] | ||
// @has disambiguators_removed/trait.Name.html | ||
// @has - '//a[@href="../disambiguators_removed/fn.Name.html"]' "Name" | ||
// @!has - '//a[@href="../disambiguators_removed/fn.Name.html"][code]' "Name" | ||
|
||
// FIXME: this will turn !() into ! alone | ||
/// [Name!()] | ||
// @has - '//a[@href="../disambiguators_removed/macro.Name.html"]' "Name!" | ||
pub trait Name {} | ||
|
||
#[allow(non_snake_case)] | ||
|
||
// Try collapsed reference links | ||
/// [macro@Name][] | ||
// @has disambiguators_removed/fn.Name.html | ||
// @has - '//a[@href="../disambiguators_removed/macro.Name.html"]' "Name" | ||
|
||
// Try links that have the same text as a generated URL | ||
/// Weird URL aligned [../disambiguators_removed/macro.Name.html][trait@Name] | ||
// @has - '//a[@href="../disambiguators_removed/trait.Name.html"]' "../disambiguators_removed/macro.Name.html" | ||
pub fn Name() {} | ||
|
||
#[macro_export] | ||
// Rustdoc doesn't currently handle links that have weird interspersing of inline code blocks. | ||
/// [fn@Na`m`e] | ||
// @has disambiguators_removed/macro.Name.html | ||
// @has - '//a[@href="../disambiguators_removed/fn.Name.html"]' "fn@Name" | ||
|
||
// It also doesn't handle any case where the code block isn't the whole link text: | ||
/// [trait@`Name`] | ||
// @has - '//a[@href="../disambiguators_removed/trait.Name.html"]' "trait@Name" | ||
macro_rules! Name { | ||
() => () | ||
} |
File renamed without changes.
File renamed without changes.
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,17 @@ | ||
#![feature(extern_types)] | ||
|
||
extern { | ||
pub type ExternType; | ||
} | ||
|
||
impl ExternType { | ||
pub fn f(&self) { | ||
|
||
} | ||
} | ||
|
||
// @has 'extern_type/foreigntype.ExternType.html' | ||
// @has 'extern_type/fn.links_to_extern_type.html' \ | ||
// 'href="../extern_type/foreigntype.ExternType.html#method.f"' | ||
/// See also [ExternType::f] | ||
pub fn links_to_extern_type() {} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,16 @@ | ||
#![deny(broken_intra_doc_links)] | ||
|
||
|
||
pub fn foo() { | ||
|
||
} | ||
|
||
pub mod foo {} | ||
// @has mod_ambiguity/struct.A.html '//a/@href' '../mod_ambiguity/foo/index.html' | ||
/// Module is [`module@foo`] | ||
pub struct A; | ||
|
||
|
||
// @has mod_ambiguity/struct.B.html '//a/@href' '../mod_ambiguity/fn.foo.html' | ||
/// Function is [`fn@foo`] | ||
pub struct B; |
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,5 @@ | ||
// ignore-tidy-linelength | ||
#![deny(broken_intra_doc_links)] | ||
|
||
//! [i32::MAX] | ||
// @has prim_assoc/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.i32.html#associatedconstant.MAX"]' "i32::MAX" |
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
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,17 @@ | ||
// ignore-tidy-linelength | ||
#![deny(broken_intra_doc_links)] | ||
|
||
pub mod char { | ||
/// [char] | ||
// @has prim_precedence/char/struct.Inner.html '//a/@href' 'https://doc.rust-lang.org/nightly/std/primitive.char.html' | ||
pub struct Inner; | ||
} | ||
|
||
/// See [prim@char] | ||
// @has prim_precedence/struct.MyString.html '//a/@href' 'https://doc.rust-lang.org/nightly/std/primitive.char.html' | ||
pub struct MyString; | ||
|
||
/// See also [crate::char] and [mod@char] | ||
// @has prim_precedence/struct.MyString2.html '//*[@href="../prim_precedence/char/index.html"]' 'crate::char' | ||
// @has - '//*[@href="../prim_precedence/char/index.html"]' 'mod@char' | ||
pub struct MyString2; |
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
File renamed without changes.
File renamed without changes.
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,27 @@ | ||
// aux-build:proc-macro-macro.rs | ||
// build-aux-docs | ||
#![deny(broken_intra_doc_links)] | ||
|
||
extern crate proc_macro_macro; | ||
|
||
|
||
pub use proc_macro_macro::{DeriveA, attr_a}; | ||
use proc_macro_macro::{DeriveB, attr_b}; | ||
|
||
// @has proc_macro/struct.Foo.html | ||
// @has - '//a/@href' '../proc_macro/derive.DeriveA.html' | ||
// @has - '//a/@href' '../proc_macro/attr.attr_a.html' | ||
// @has - '//a/@href' '../proc_macro/trait.DeriveTrait.html' | ||
// @has - '//a/@href' '../proc_macro_macro/derive.DeriveB.html' | ||
// @has - '//a/@href' '../proc_macro_macro/attr.attr_b.html' | ||
/// Link to [DeriveA], [attr_a], [DeriveB], [attr_b], [DeriveTrait] | ||
pub struct Foo; | ||
|
||
// @has proc_macro/struct.Bar.html | ||
// @has - '//a/@href' '../proc_macro/derive.DeriveA.html' | ||
// @has - '//a/@href' '../proc_macro/attr.attr_a.html' | ||
/// Link to [deriveA](derive@DeriveA) [attr](macro@attr_a) | ||
pub struct Bar; | ||
|
||
// this should not cause ambiguity errors | ||
pub trait DeriveTrait {} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
Oops, something went wrong.