Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
b60f7b51a27dfd9cbc5ecaa56ee679cd1b67f4c4
rust/tests/rustdoc/issue-47197-blank-line-in-doc-block.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

9 lines
160 B
Rust
Raw Normal View History

wherein careful doc-decoration arithmetic proves quite the ICE-breaker 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.
2018-01-04 23:09:02 -08:00
// @has issue_47197_blank_line_in_doc_block/fn.whose_woods_these_are_i_think_i_know.html
/**
* snow
* ice
*/
pub fn whose_woods_these_are_i_think_i_know() {}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 1301ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API