reference more reliable items in rustdoc tests

This commit is contained in:
joboet
2026-02-25 13:59:48 +01:00
parent 88cec3a1c0
commit e9ca34fe64
3 changed files with 19 additions and 19 deletions
@@ -4,8 +4,8 @@
//@ has 'src/foo/non-local-method.rs.html'
//@ has - '//a[@href="{{channel}}/core/sync/atomic/struct.AtomicIsize.html"]' 'std::sync::atomic::AtomicIsize'
use std::sync::atomic::AtomicIsize;
//@ has - '//a[@href="{{channel}}/alloc/boxed/struct.Box.html"]' 'std::boxed::Box'
use std::boxed::Box;
//@ has - '//a[@href="{{channel}}/std/io/trait.Read.html"]' 'std::io::Read'
use std::io::Read;
//@ has - '//a[@href="{{channel}}/std/io/index.html"]' 'std::io'
@@ -21,9 +21,9 @@ pub fn bar2<T: Read>(readable: T) {
}
pub fn bar() {
//@ has - '//a[@href="{{channel}}/core/sync/atomic/struct.AtomicIsize.html"]' 'AtomicIsize'
//@ has - '//a[@href="{{channel}}/core/sync/atomic/struct.AtomicIsize.html#method.new"]' 'new'
let _ = AtomicIsize::new(0);
//@ has - '//a[@href="{{channel}}/alloc/boxed/struct.Box.html"]' 'Box'
//@ has - '//a[@href="{{channel}}/alloc/boxed/struct.Box.html#method.new"]' 'new'
let _ = Box::new(0);
//@ has - '//a[@href="#49"]' 'local_private'
local_private();
}
@@ -1,26 +1,26 @@
// Regression test to ensure that both `AtomicU8` items are displayed but not the re-export.
// Regression test to ensure that both `Thing` items are displayed but not the re-export.
// https://github.com/rust-lang/rust/issues/105735
#![crate_name = "foo"]
#![no_std]
//@ has 'foo/index.html'
//@ has - '//dt/a[@class="type"]' 'AtomicU8'
//@ has - '//dt/a[@class="constant"]' 'AtomicU8'
//@ has - '//dt/a[@class="type"]' 'Thing'
//@ has - '//dt/a[@class="constant"]' 'Thing'
// We also ensure we don't have another item displayed.
//@ count - '//*[@id="main-content"]/*[@class="section-header"]' 2
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Type Aliases'
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Constants'
mod other {
pub type AtomicU8 = ();
pub type Thing = ();
}
mod thing {
pub use crate::other::AtomicU8;
pub use crate::other::Thing;
#[allow(non_upper_case_globals)]
pub const AtomicU8: () = ();
pub const Thing: () = ();
}
pub use crate::thing::AtomicU8;
pub use crate::thing::Thing;
@@ -1,22 +1,22 @@
// Regression test to ensure that both `AtomicU8` items are displayed but not the re-export.
// Regression test to ensure that both `Ordering` items are displayed but not the re-export.
// https://github.com/rust-lang/rust/issues/105735
#![crate_name = "foo"]
#![no_std]
//@ has 'foo/index.html'
//@ has - '//dt/a[@class="struct"]' 'AtomicU8'
//@ has - '//dt/a[@class="constant"]' 'AtomicU8'
//@ has - '//dt/a[@class="enum"]' 'Ordering'
//@ has - '//dt/a[@class="constant"]' 'Ordering'
// We also ensure we don't have another item displayed.
//@ count - '//*[@id="main-content"]/*[@class="section-header"]' 2
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Structs'
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Enums'
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Constants'
mod thing {
pub use core::sync::atomic::AtomicU8;
pub use core::cmp::Ordering;
#[allow(non_upper_case_globals)]
pub const AtomicU8: () = ();
pub const Ordering: () = ();
}
pub use crate::thing::AtomicU8;
pub use crate::thing::Ordering;