about summary refs log tree commit diff
path: root/src/test/incremental/thinlto
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-01-09 01:58:45 +0800
committerGitHub <noreply@github.com>2018-01-09 01:58:45 +0800
commit4a6f440920a1b399edde29340fc21a3e32d42078 (patch)
tree9f3db8c897c57d001ce7780f2bca644db2e602b9 /src/test/incremental/thinlto
parentb5392f54503fdaf04df4b9578510b2baa944f4af (diff)
parent3cfea33432f223b934bddc207224d90e6a39c280 (diff)
downloadrust-4a6f440920a1b399edde29340fc21a3e32d42078.tar.gz
rust-4a6f440920a1b399edde29340fc21a3e32d42078.zip
Rollup merge of #47210 - zackmdavis:the_3rd_of_2_hardest_problems_in_computer_science, r=QuietMisdreavus
fix the doc-comment-decoration-trimming edge-case rustdoc ICE

This `horizontal_trim` function strips the leading whitespace from
doc-comments that have a left-asterisk-margin:

```
  /**
   * You know what I mean—
   *
   * comments like this!
   */
```

The index of the column of asterisks is `i`, and if trimming is deemed
possible, we slice each line from `i+1` to the end of the line. But if, in
particular, `i` was 0 _and_ there was an empty line (as in the example
given in the reporting issue), we ended up panicking trying to slice an
empty string from 0+1 (== 1).

Let's tighten our check to say that we can't trim when `i` is even the same
as the length of the line, not just when it's greater. (Any such cases
would panic trying to slice `line` from `line.len()+1`.)

Resolves #47197.
Diffstat (limited to 'src/test/incremental/thinlto')
0 files changed, 0 insertions, 0 deletions