From 3dab2d210f284ae9dcb6af657290b9e0a902c4bb Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Mon, 12 Jul 2021 19:04:51 +0800 Subject: suggest removing disambiguator if linking to field --- src/test/rustdoc-ui/intra-doc/field-ice.rs | 11 +++++++++++ src/test/rustdoc-ui/intra-doc/field-ice.stderr | 15 +++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/test/rustdoc-ui/intra-doc/field-ice.rs create mode 100644 src/test/rustdoc-ui/intra-doc/field-ice.stderr (limited to 'src/test') diff --git a/src/test/rustdoc-ui/intra-doc/field-ice.rs b/src/test/rustdoc-ui/intra-doc/field-ice.rs new file mode 100644 index 00000000000..c5d501e38da --- /dev/null +++ b/src/test/rustdoc-ui/intra-doc/field-ice.rs @@ -0,0 +1,11 @@ +#![deny(rustdoc::broken_intra_doc_links)] +//~^NOTE the lint level is defined here + +/// [`Foo::bar`] +/// [`Foo::bar()`] +//~^ERROR incompatible link kind for `Foo::bar` +//~|HELP to link to the field, remove the disambiguator +//~|NOTE this link resolved to a field, which is not a function +pub struct Foo { + pub bar: u8 +} diff --git a/src/test/rustdoc-ui/intra-doc/field-ice.stderr b/src/test/rustdoc-ui/intra-doc/field-ice.stderr new file mode 100644 index 00000000000..ccb05b84a72 --- /dev/null +++ b/src/test/rustdoc-ui/intra-doc/field-ice.stderr @@ -0,0 +1,15 @@ +error: incompatible link kind for `Foo::bar` + --> $DIR/field-ice.rs:5:6 + | +LL | /// [`Foo::bar()`] + | ^^^^^^^^^^^^ help: to link to the field, remove the disambiguator: ``Foo::bar`` + | +note: the lint level is defined here + --> $DIR/field-ice.rs:1:9 + | +LL | #![deny(rustdoc::broken_intra_doc_links)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this link resolved to a field, which is not a function + +error: aborting due to previous error + -- cgit 1.4.1-3-g733a5