diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-09-25 15:25:51 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-09-26 15:07:12 +0200 |
| commit | dba45cde68ba25b7fa790e4e36593b6fd55d6d8a (patch) | |
| tree | 115735af2448c097c08fe90361a79d6fd938af69 /tests/rustdoc | |
| parent | 7a2c1730336e487eed37e97014b7864ebd81962b (diff) | |
Add tests for new `tyalias` intra-doc link disambiguator
Diffstat (limited to 'tests/rustdoc')
| -rw-r--r-- | tests/rustdoc/intra-doc/type-alias-primitive.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/rustdoc/intra-doc/type-alias-primitive.rs b/tests/rustdoc/intra-doc/type-alias-primitive.rs new file mode 100644 index 00000000000..7504166cbcc --- /dev/null +++ b/tests/rustdoc/intra-doc/type-alias-primitive.rs @@ -0,0 +1,21 @@ +// Ensure that no warning is emitted if the disambiguator is used for type alias. +// Regression test for <https://github.com/rust-lang/rust/issues/146855>. + +#![crate_name = "foo"] +#![deny(rustdoc::broken_intra_doc_links)] + +pub struct Foo; + +#[allow(non_camel_case_types)] +pub type f32 = Foo; + +/// This function returns [`tyalias@f32`] and not [bla][`prim@f32`]. +//@ has 'foo/fn.my_fn.html' +//@ has - '//a[@href="type.f32.html"]' "f32" +//@ has - '//a[@href="{{channel}}/std/primitive.f32.html"]' "bla" +pub fn my_fn() -> f32 { 0. } + +/// This function returns [`typealias@f32`]. +//@ has 'foo/fn.my_other_fn.html' +//@ has - '//a[@href="type.f32.html"]' "f32" +pub fn my_other_fn() -> f32 { 0. } |
