Commit ee11bfd
committed
Auto merge of rust-lang#106352 - kornelski:read_line-doc, r=scottmcm
Document read_line gotchas
1. The "You do not need to clear the buffer before appending" advice is ambiguous, because it depends what you use this function for. For a rather common case of reading individual lines in a loop, it _is_ necessary to clear the buffer.
2. The docs warn about a DoS risk. I've added a hint how to mitigate unbounded memory growth.1 file changed
+7
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2137 | 2137 | | |
2138 | 2138 | | |
2139 | 2139 | | |
2140 | | - | |
2141 | | - | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
2142 | 2144 | | |
2143 | 2145 | | |
2144 | 2146 | | |
| |||
2151 | 2153 | | |
2152 | 2154 | | |
2153 | 2155 | | |
2154 | | - | |
| 2156 | + | |
2155 | 2157 | | |
2156 | 2158 | | |
| 2159 | + | |
| 2160 | + | |
2157 | 2161 | | |
2158 | 2162 | | |
2159 | 2163 | | |
| |||
0 commit comments