Skip to content

Commit 5b154a7

Browse files
Add regression test for intra doc link type alias disambiguator for primitive
1 parent a08208c commit 5b154a7

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Ensure that no warning is emitted if the disambiguator is used for type alias.
2+
// Regression test for <https://github.com/rust-lang/rust/issues/146855>.
3+
4+
//@ check-pass
5+
6+
#![deny(rustdoc::broken_intra_doc_links)]
7+
8+
pub struct Foo;
9+
#[allow(non_camel_case_types)]
10+
pub type f32 = Foo;
11+
12+
/// This function returns [`type@f32`]" and not [`prim@f32`].
13+
pub fn my_fn() -> f32 {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Ensure that no warning is emitted if the disambiguator is used for type alias.
2+
// Regression test for <https://github.com/rust-lang/rust/issues/146855>.
3+
4+
#![crate_name = "foo"]
5+
6+
pub struct Foo;
7+
#[allow(non_camel_case_types)]
8+
pub type f32 = Foo;
9+
10+
/// This function returns [`type@f32`] and not [bla][`prim@f32`].
11+
//@ has 'foo/fn.my_fn.html'
12+
//@ has - '//a[@href="type.f32.html"]' "f32"
13+
//@ has - '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.f32.html"]' "bla"
14+
pub fn my_fn() -> f32 {}

0 commit comments

Comments
 (0)