Commit 6738cd4
committed
Auto merge of #40281 - jimmycuadra:try-from-from-str, r=aturon
Rename TryFrom's associated type and implement str::parse using TryFrom.
Per discussion on the tracking issue, naming `TryFrom`'s associated type `Error` is generally more consistent with similar traits in the Rust ecosystem, and what people seem to assume it should be called. It also helps disambiguate from `Result::Err`, the most common "Err".
See #33417 (comment).
`TryFrom<&str>` and `FromStr` are equivalent, so have the latter provide the former to ensure that. Using `TryFrom` in the implementation of `str::parse` means types that implement either trait can use it. When we're ready to stabilize `TryFrom`, we should update `FromStr` to
suggest implementing `TryFrom<&str>` instead for new code.
See #33417 (comment)
and #33417 (comment).
Refs #33417.4 files changed
+28
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
215 | | - | |
| 217 | + | |
216 | 218 | | |
217 | 219 | | |
218 | | - | |
| 220 | + | |
219 | 221 | | |
220 | 222 | | |
221 | 223 | | |
222 | 224 | | |
223 | 225 | | |
224 | 226 | | |
225 | | - | |
| 227 | + | |
226 | 228 | | |
227 | 229 | | |
228 | | - | |
| 230 | + | |
229 | 231 | | |
230 | 232 | | |
231 | 233 | | |
| |||
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
293 | | - | |
| 295 | + | |
294 | 296 | | |
295 | | - | |
| 297 | + | |
296 | 298 | | |
297 | 299 | | |
298 | 300 | | |
| |||
322 | 324 | | |
323 | 325 | | |
324 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2591 | 2591 | | |
2592 | 2592 | | |
2593 | 2593 | | |
2594 | | - | |
| 2594 | + | |
2595 | 2595 | | |
2596 | 2596 | | |
2597 | 2597 | | |
| |||
2623 | 2623 | | |
2624 | 2624 | | |
2625 | 2625 | | |
2626 | | - | |
| 2626 | + | |
2627 | 2627 | | |
2628 | 2628 | | |
2629 | 2629 | | |
| |||
2637 | 2637 | | |
2638 | 2638 | | |
2639 | 2639 | | |
2640 | | - | |
| 2640 | + | |
2641 | 2641 | | |
2642 | 2642 | | |
2643 | 2643 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
1782 | 1783 | | |
1783 | 1784 | | |
1784 | 1785 | | |
1785 | | - | |
| 1786 | + | |
1786 | 1787 | | |
1787 | 1788 | | |
1788 | 1789 | | |
| |||
2081 | 2082 | | |
2082 | 2083 | | |
2083 | 2084 | | |
2084 | | - | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
2085 | 2088 | | |
2086 | 2089 | | |
2087 | 2090 | | |
| |||
0 commit comments