From 45ccd50d0e52e006fdd81f854b4cd711ac439e85 Mon Sep 17 00:00:00 2001 From: Camelid Date: Sun, 4 Apr 2021 15:31:43 -0700 Subject: Don't report disambiguator error if link would have been ignored This prevents us from warning on links such as ``. Note that we still warn on links such as `` because they have no dots in them. However, the links will still work, even though a warning is reported. --- src/test/rustdoc-ui/intra-doc/email-address-localhost.rs | 6 ++++++ .../rustdoc-ui/intra-doc/email-address-localhost.stderr | 15 +++++++++++++++ src/test/rustdoc/intra-doc/email-address.rs | 6 ++++++ 3 files changed, 27 insertions(+) create mode 100644 src/test/rustdoc-ui/intra-doc/email-address-localhost.rs create mode 100644 src/test/rustdoc-ui/intra-doc/email-address-localhost.stderr create mode 100644 src/test/rustdoc/intra-doc/email-address.rs (limited to 'src/test') diff --git a/src/test/rustdoc-ui/intra-doc/email-address-localhost.rs b/src/test/rustdoc-ui/intra-doc/email-address-localhost.rs new file mode 100644 index 00000000000..417618c7458 --- /dev/null +++ b/src/test/rustdoc-ui/intra-doc/email-address-localhost.rs @@ -0,0 +1,6 @@ +#![deny(warnings)] + +//! Email me at . +//~^ ERROR unknown disambiguator `hello` + +//! This should *not* warn: . diff --git a/src/test/rustdoc-ui/intra-doc/email-address-localhost.stderr b/src/test/rustdoc-ui/intra-doc/email-address-localhost.stderr new file mode 100644 index 00000000000..de215b2163b --- /dev/null +++ b/src/test/rustdoc-ui/intra-doc/email-address-localhost.stderr @@ -0,0 +1,15 @@ +error: unknown disambiguator `hello` + --> $DIR/email-address-localhost.rs:3:18 + | +LL | //! Email me at . + | ^^^^^ + | +note: the lint level is defined here + --> $DIR/email-address-localhost.rs:1:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(warnings)]` + +error: aborting due to previous error + diff --git a/src/test/rustdoc/intra-doc/email-address.rs b/src/test/rustdoc/intra-doc/email-address.rs new file mode 100644 index 00000000000..c407eb80da2 --- /dev/null +++ b/src/test/rustdoc/intra-doc/email-address.rs @@ -0,0 +1,6 @@ +//! Email me at . +//! Email me at . +//! Email me at (this warns but will still become a link). +// @has email_address/index.html '//a[@href="mailto:hello@example.com"]' 'hello@example.com' +// @has email_address/index.html '//a[@href="mailto:hello-world@example.com"]' 'hello-world@example.com' +// @has email_address/index.html '//a[@href="mailto:hello@localhost"]' 'hello@localhost' -- cgit 1.4.1-3-g733a5