Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: rename issue-\d+.rs tests to have meaningful names (part 7) #125382

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// https://github.com/rust-lang/rust/issues/82465
#![crate_name = "foo"]

use std::convert::AsRef;
pub struct Local;

// @has issue_82465_asref_for_and_of_local/struct.Local.html '//h3[@class="code-header"]' 'impl AsRef<str> for Local'
// @has foo/struct.Local.html '//h3[@class="code-header"]' 'impl AsRef<str> for Local'
impl AsRef<str> for Local {
fn as_ref(&self) -> &str {
todo!()
Expand Down
notriddle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This test ensures that a publicly re-exported private trait will
// appear in the blanket impl list.

// https://github.com/rust-lang/rust/issues/94183
#![crate_name = "foo"]

// @has 'foo/struct.S.html'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// This test ensure that #[doc(hidden)] is applied correctly in enum variant fields.
// https://github.com/rust-lang/rust/issues/88600
#![crate_name = "foo"]

// Denotes a field which should be hidden.
pub struct H;

// Denotes a field which should not be hidden (shown).
pub struct S;

// @has issue_88600/enum.FooEnum.html
// @has foo/enum.FooEnum.html
pub enum FooEnum {
// @has - '//*[@id="variant.HiddenTupleItem"]//h3' 'HiddenTupleItem(/* private fields */)'
// @count - '//*[@id="variant.HiddenTupleItem.field.0"]' 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/89309
#![crate_name = "foo"]

// @has foo/trait.Read.html
Expand Down
9 changes: 0 additions & 9 deletions tests/rustdoc/issue-86620.rs

This file was deleted.

14 changes: 0 additions & 14 deletions tests/rustdoc/issue-89852.rs

This file was deleted.

2 changes: 0 additions & 2 deletions tests/rustdoc/issue-95873.rs

This file was deleted.

11 changes: 11 additions & 0 deletions tests/rustdoc/method-anchor-in-blanket-impl-86620.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ aux-build:issue-86620-1.rs
#![crate_name = "foo"]
// https://github.com/rust-lang/rust/issues/86620

extern crate issue_86620_1;
notriddle marked this conversation as resolved.
Show resolved Hide resolved

use issue_86620_1::*;

// @!has foo/struct.S.html '//*[@id="method.vzip"]//a[@class="fnname"]/@href' #tymethod.vzip
// @has foo/struct.S.html '//*[@id="method.vzip"]//a[@class="anchor"]/@href' #method.vzip
pub struct S;
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//@ build-aux-docs
//@ ignore-cross-compile

// https://github.com/rust-lang/rust/issues/99221
#![crate_name = "foo"]

#[macro_use]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/83375
#![crate_name = "foo"]

pub mod sub {
Expand All @@ -8,9 +9,9 @@ pub mod sub {
}
}

#[doc(inline)]
pub use sub::*;

// @count foo/index.html '//a[@class="mod"][@title="mod foo::prelude"]' 1
// @count foo/prelude/index.html '//div[@class="item-row"]' 0
pub mod prelude {}

#[doc(inline)]
pub use sub::*;
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/83375
#![crate_name = "foo"]

pub mod sub {
Expand All @@ -8,9 +9,9 @@ pub mod sub {
}
}

#[doc(inline)]
pub use sub::*;

// @count foo/index.html '//a[@class="mod"][@title="mod foo::prelude"]' 1
// @count foo/prelude/index.html '//div[@class="item-row"]' 0
pub mod prelude {}

#[doc(inline)]
pub use sub::*;
notriddle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Regression test for issue #80233
// Tests that we don't ICE when processing auto traits
// https://github.com/rust-lang/rust/issues/80233

#![crate_type = "lib"]
#![crate_name = "foo"]
pub trait Trait1 {}

pub trait Trait2 {
Expand Down Expand Up @@ -30,7 +32,7 @@ impl<T: Trait3> Trait3 for Vec<T> {

pub struct Struct1 {}

// @has issue_80233_normalize_auto_trait/struct.Question.html
// @has foo/struct.Question.html
// @has - '//h3[@class="code-header"]' 'impl<T> Send for Question<T>'
pub struct Question<T: Trait1> {
pub ins: <<Vec<T> as Trait3>::Type3 as Trait2>::Type2,
Expand Down
notriddle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This test ensures that if a private re-export is present in a public API, it'll be
// replaced by the first public item in the re-export chain or by the private item.

// https://github.com/rust-lang/rust/issues/81141
#![crate_name = "foo"]

use crate::bar::Bar as Alias;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ edition:2015

// https://github.com/rust-lang/rust/issues/81141
#![crate_name = "foo"]

use external::Public as Private;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/81141
#![crate_name = "foo"]

use crate::bar::Foo as Alias;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ compile-flags: -Z unstable-options --document-hidden-items

// https://github.com/rust-lang/rust/issues/81141
#![crate_name = "foo"]

#[doc(hidden)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ compile-flags: --document-private-items

// https://github.com/rust-lang/rust/issues/81141
#![crate_name = "foo"]

use crate::bar::Bar as Alias;
Expand Down
16 changes: 16 additions & 0 deletions tests/rustdoc/pub-use-exported-macro-89852.rs
notriddle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//@ edition:2018

// https://github.com/rust-lang/rust/issues/89852
#![crate_name = "foo"]
#![no_core]
#![feature(no_core)]

// @matchesraw 'foo/sidebar-items.js' '"repro"'
// @!matchesraw 'foo/sidebar-items.js' '"repro".*"repro"'

#[macro_export]
macro_rules! repro {
() => {};
}

pub use crate::repro as repro2;
notriddle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ compile-flags: --document-private-items

// This ensures that no ICE is triggered when rustdoc is run on this code.
// https://github.com/rust-lang/rust/issues/95633

mod stdlib {
pub (crate) use std::i8;
Expand Down
5 changes: 5 additions & 0 deletions tests/rustdoc/pub-use-root-path-95873.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// https://github.com/rust-lang/rust/issues/95873
#![crate_name = "foo"]

// @has foo/index.html "//*[@class='item-name']" "pub use ::std as x;"
pub use ::std as x;
notriddle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ aux-build:issue-85454.rs
//@ build-aux-docs
#![crate_name = "foo"]
// https://github.com/rust-lang/rust/issues/85454

extern crate issue_85454;

Expand Down
notriddle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ aux-build:issue-98697-reexport-with-anonymous-lifetime.rs
//@ ignore-cross-compile
#![crate_name = "foo"]

// When reexporting a function with a HRTB with anonymous lifetimes,
// make sure the anonymous lifetimes are not rendered.
Expand All @@ -8,10 +9,10 @@

extern crate issue_98697_reexport_with_anonymous_lifetime;

// @has issue_98697/fn.repro.html '//pre[@class="rust item-decl"]/code' 'fn repro<F>()where F: Fn(&str)'
// @!has issue_98697/fn.repro.html '//pre[@class="rust item-decl"]/code' 'for<'
// @has foo/fn.repro.html '//pre[@class="rust item-decl"]/code' 'fn repro<F>()where F: Fn(&str)'
// @!has foo/fn.repro.html '//pre[@class="rust item-decl"]/code' 'for<'
pub use issue_98697_reexport_with_anonymous_lifetime::repro;

// @has issue_98697/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl MyTrait<&Extra> for Extra'
// @!has issue_98697/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl<'
// @has foo/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl MyTrait<&Extra> for Extra'
// @!has foo/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl<'
pub use issue_98697_reexport_with_anonymous_lifetime::Extra;
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ should-fail
// https://github.com/rust-lang/rust/issues/96381

#![allow(unused)]

Expand Down
Loading