Fix issue with DOC_MARKDOWN and punctuation

This commit is contained in:
mcarton 2016-05-05 21:32:48 +02:00
parent 397b940225
commit e14e1a7148
2 changed files with 12 additions and 3 deletions

View file

@ -133,9 +133,6 @@ pub fn check_doc(cx: &EarlyContext, valid_idents: &[String], doc: &str, span: Sp
match chars.next() { match chars.next() {
Some((_, c)) => { Some((_, c)) => {
match c { match c {
c if c.is_whitespace() => {
current_word_begin = jump_to!(@next_char, chars, len);
}
'`' => { '`' => {
current_word_begin = jump_to!(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, None => return,
} }
} }
// anything thats 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)) { let end = match chars.find(|&(_, c)| !is_word_char(c)) {
Some((end, _)) => end, Some((end, _)) => end,

View file

@ -107,3 +107,11 @@ fn main() {
test_emphasis(); test_emphasis();
test_units(); 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() {
}