From e14e1a7148375499731f9549eadf5172050fd99a Mon Sep 17 00:00:00 2001 From: mcarton Date: Thu, 5 May 2016 21:32:48 +0200 Subject: [PATCH] Fix issue with `DOC_MARKDOWN` and punctuation --- src/doc.rs | 7 ++++--- tests/compile-fail/doc.rs | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/doc.rs b/src/doc.rs index 6212a025c..00c3e4398 100644 --- a/src/doc.rs +++ b/src/doc.rs @@ -133,9 +133,6 @@ pub fn check_doc(cx: &EarlyContext, valid_idents: &[String], doc: &str, span: Sp match chars.next() { Some((_, c)) => { match c { - c if c.is_whitespace() => { - current_word_begin = jump_to!(@next_char, chars, len); - } '`' => { current_word_begin = jump_to!(chars, '`', len); } @@ -171,6 +168,10 @@ pub fn check_doc(cx: &EarlyContext, valid_idents: &[String], doc: &str, span: Sp None => return, } } + // anything that’s neither alphanumeric nor '_' is not part of an ident anyway + c if !c.is_alphanumeric() && c != '_' => { + current_word_begin = jump_to!(@next_char, chars, len); + } _ => { let end = match chars.find(|&(_, c)| !is_word_char(c)) { Some((end, _)) => end, diff --git a/tests/compile-fail/doc.rs b/tests/compile-fail/doc.rs index 7a150ba37..045174db7 100755 --- a/tests/compile-fail/doc.rs +++ b/tests/compile-fail/doc.rs @@ -107,3 +107,11 @@ fn main() { test_emphasis(); test_units(); } + +/// I am confused by brackets? (`x_y`) +/// I am confused by brackets? (foo `x_y`) +/// I am confused by brackets? (`x_y` foo) +/// be_sure_we_got_to_the_end_of_it +//~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks +fn issue900() { +}