Skip to content

Commit afe3e27

Browse files
QuietMisdreavusManishearth
authored andcommitted
value-namespace items require a marker, so emit an error
1 parent b31bb09 commit afe3e27

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,8 +926,14 @@ impl Clean<Attributes> for [ast::Attribute] {
926926
// for structs, etc, and the link won't work.
927927
if let Ok(path) = resolve(false) {
928928
path.def
929-
} else if let Ok(path) = resolve(true) {
930-
path.def
929+
} else if let Ok(_path) = resolve(true) {
930+
let sp = attrs.doc_strings.first().map_or(DUMMY_SP, |a| a.span());
931+
cx.sess().struct_span_err(sp, &format!("could not resolve `{}`",
932+
path_str))
933+
.help(&format!("try `{0}()`, `static@{0}`, or `const@{0}`",
934+
path_str))
935+
.emit();
936+
continue;
931937
} else {
932938
// this could just be a normal link
933939
continue;

src/test/rustdoc/intra-links.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
//! * [`ThisTrait`](ThisTrait)
2828
//! * [`ThisAlias`](ThisAlias)
2929
//! * [`ThisUnion`](ThisUnion)
30-
//! * [`this_function`](this_function)
31-
//! * [`THIS_CONST`](THIS_CONST)
32-
//! * [`THIS_STATIC`](THIS_STATIC)
30+
//! * [`this_function`](this_function())
31+
//! * [`THIS_CONST`](const@THIS_CONST)
32+
//! * [`THIS_STATIC`](static@THIS_STATIC)
3333
//! * [`this_macro`](this_macro!)
3434
//!
3535
//! In addition, there's some specifics we want to look at. There's [a trait called

0 commit comments

Comments
 (0)