about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorQuietMisdreavus <grey@quietmisdreavus.net>2018-01-08 13:20:19 -0600
committerManish Goregaokar <manishsmail@gmail.com>2018-01-22 15:24:31 +0530
commitafe3e27085752efd1d9affe1f9c95e67de4dcf5d (patch)
tree2fc3ff6e072cccc6669817109b03029949331b56 /src
parentb31bb097f519f03a5925da376d4ef2fbc8f30c62 (diff)
downloadrust-afe3e27085752efd1d9affe1f9c95e67de4dcf5d.tar.gz
rust-afe3e27085752efd1d9affe1f9c95e67de4dcf5d.zip
value-namespace items require a marker, so emit an error
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/clean/mod.rs10
-rw-r--r--src/test/rustdoc/intra-links.rs6
2 files changed, 11 insertions, 5 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index e1dbcb27864..5e8d6301acb 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -926,8 +926,14 @@ impl Clean<Attributes> for [ast::Attribute] {
                             // for structs, etc, and the link won't work.
                             if let Ok(path) = resolve(false) {
                                 path.def
-                            } else if let Ok(path) = resolve(true) {
-                                path.def
+                            } else if let Ok(_path) = resolve(true) {
+                                let sp = attrs.doc_strings.first().map_or(DUMMY_SP, |a| a.span());
+                                cx.sess().struct_span_err(sp, &format!("could not resolve `{}`",
+                                                                       path_str))
+                                         .help(&format!("try `{0}()`, `static@{0}`, or `const@{0}`",
+                                                        path_str))
+                                         .emit();
+                                continue;
                             } else {
                                 // this could just be a normal link
                                 continue;
diff --git a/src/test/rustdoc/intra-links.rs b/src/test/rustdoc/intra-links.rs
index cc9d288ba91..aa6f5538754 100644
--- a/src/test/rustdoc/intra-links.rs
+++ b/src/test/rustdoc/intra-links.rs
@@ -27,9 +27,9 @@
 //! * [`ThisTrait`](ThisTrait)
 //! * [`ThisAlias`](ThisAlias)
 //! * [`ThisUnion`](ThisUnion)
-//! * [`this_function`](this_function)
-//! * [`THIS_CONST`](THIS_CONST)
-//! * [`THIS_STATIC`](THIS_STATIC)
+//! * [`this_function`](this_function())
+//! * [`THIS_CONST`](const@THIS_CONST)
+//! * [`THIS_STATIC`](static@THIS_STATIC)
 //! * [`this_macro`](this_macro!)
 //!
 //! In addition, there's some specifics we want to look at. There's [a trait called