Commit b8757de
committed
error: switch everything over to structured errors
This was an incredibly tedious and tortuous refactor. But this removes
almost all of the "create ad hoc stringly-typed errors everywhere."
This partially makes progress toward #418, but my initial impetus for
doing this was to see if I could reduce binary size and improve
compilation times. My general target was to see if I could reduce total
LLVM lines. I tested this with [Biff] using this command in the root of
the Biff repo:
```
cargo llvm-lines --profile release-lto
```
Before this change, Biff had 768,596 LLVM lines. With this change, it
has 757,331 lines. So... an improvement, but a very modest one.
What about compilation times? This does seem to translate to---also a
modest---improvement. For compiling release builds of Biff. Before:
```
$ hyperfine -w1 --prepare 'cargo clean' 'cargo b -r'
Benchmark 1: cargo b -r
Time (mean ± σ): 7.776 s ± 0.052 s [User: 65.876 s, System: 2.621 s]
Range (min … max): 7.690 s … 7.862 s 10 runs
```
After:
```
$ hyperfine -w1 --prepare 'cargo clean' 'cargo b -r'
Benchmark 1: cargo b -r
Time (mean ± σ): 7.591 s ± 0.067 s [User: 65.686 s, System: 2.564 s]
Range (min … max): 7.504 s … 7.689 s 10 runs
```
What about dev builds? Before:
```
$ hyperfine -w1 --prepare 'cargo clean' 'cargo b'
Benchmark 1: cargo b
Time (mean ± σ): 4.074 s ± 0.022 s [User: 14.493 s, System: 1.818 s]
Range (min … max): 4.037 s … 4.099 s 10 runs
```
After:
```
$ hyperfine -w1 --prepare 'cargo clean' 'cargo b'
Benchmark 1: cargo b
Time (mean ± σ): 4.541 s ± 0.027 s [User: 15.385 s, System: 2.081 s]
Range (min … max): 4.503 s … 4.591 s 10 runs
```
Well... that's disappointing. A modest improvement to release builds,
but a fairly large regression in dev builds. Maybe it's because of the
additional hand-written impls for new structured error types? Bah.
And binary size? Normal release builds (not LTO) of Biff that were
stripped were 4,431,456 bytes before this change and 4,392,064 after.
Hopefully this will unlock other improvements to justify doing this.
Note also that this slims down a number of error messages.
[Biff]: https://github.com/BurntSushi/biff1 parent 3765a52 commit b8757de
File tree
79 files changed
+5522
-3863
lines changed- src
- civil
- error
- fmt
- tz
- fmt
- friendly
- strtime
- temporal
- tz
- db
- bundled
- concatenated
- zoneinfo
- system
- windows
- util
- round
- testprograms/invalid-tz-environment-variable
- tests/tc39_262/span
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
79 files changed
+5522
-3863
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
63 | | - | |
| 66 | + | |
64 | 67 | | |
65 | | - | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
84 | 118 | | |
85 | 119 | | |
86 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
3 | 57 | | |
4 | 58 | | |
5 | 59 | | |
| |||
15 | 69 | | |
16 | 70 | | |
17 | 71 | | |
18 | | - | |
| 72 | + | |
19 | 73 | | |
20 | 74 | | |
21 | 75 | | |
22 | 76 | | |
23 | 77 | | |
24 | 78 | | |
| 79 | + | |
| 80 | + | |
25 | 81 | | |
26 | 82 | | |
27 | 83 | | |
28 | 84 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 85 | + | |
34 | 86 | | |
35 | 87 | | |
36 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
1057 | 1057 | | |
1058 | 1058 | | |
1059 | 1059 | | |
1060 | | - | |
| 1060 | + | |
1061 | 1061 | | |
1062 | 1062 | | |
1063 | 1063 | | |
| |||
1515 | 1515 | | |
1516 | 1516 | | |
1517 | 1517 | | |
1518 | | - | |
1519 | | - | |
1520 | | - | |
1521 | | - | |
1522 | | - | |
1523 | | - | |
1524 | | - | |
1525 | | - | |
| 1518 | + | |
| 1519 | + | |
1526 | 1520 | | |
1527 | 1521 | | |
1528 | 1522 | | |
| |||
2941 | 2935 | | |
2942 | 2936 | | |
2943 | 2937 | | |
2944 | | - | |
2945 | | - | |
2946 | | - | |
2947 | | - | |
2948 | | - | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
2949 | 2941 | | |
2950 | 2942 | | |
2951 | 2943 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
1695 | 1695 | | |
1696 | 1696 | | |
1697 | 1697 | | |
1698 | | - | |
1699 | | - | |
1700 | | - | |
1701 | | - | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
1702 | 1701 | | |
1703 | 1702 | | |
1704 | 1703 | | |
1705 | | - | |
1706 | | - | |
1707 | | - | |
1708 | | - | |
1709 | | - | |
1710 | | - | |
1711 | | - | |
1712 | | - | |
1713 | | - | |
1714 | | - | |
1715 | | - | |
1716 | | - | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
1717 | 1710 | | |
1718 | 1711 | | |
1719 | 1712 | | |
| |||
1727 | 1720 | | |
1728 | 1721 | | |
1729 | 1722 | | |
1730 | | - | |
1731 | | - | |
1732 | | - | |
1733 | | - | |
1734 | | - | |
1735 | | - | |
1736 | | - | |
1737 | | - | |
1738 | | - | |
1739 | | - | |
1740 | | - | |
1741 | | - | |
1742 | | - | |
1743 | | - | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
1744 | 1731 | | |
1745 | 1732 | | |
1746 | 1733 | | |
| |||
1751 | 1738 | | |
1752 | 1739 | | |
1753 | 1740 | | |
1754 | | - | |
1755 | | - | |
1756 | | - | |
1757 | | - | |
1758 | | - | |
1759 | | - | |
1760 | | - | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
1761 | 1744 | | |
1762 | 1745 | | |
1763 | 1746 | | |
| |||
3552 | 3535 | | |
3553 | 3536 | | |
3554 | 3537 | | |
3555 | | - | |
3556 | | - | |
3557 | | - | |
| 3538 | + | |
| 3539 | + | |
| 3540 | + | |
| 3541 | + | |
3558 | 3542 | | |
3559 | 3543 | | |
3560 | 3544 | | |
| |||
3592 | 3576 | | |
3593 | 3577 | | |
3594 | 3578 | | |
3595 | | - | |
3596 | | - | |
3597 | | - | |
| 3579 | + | |
3598 | 3580 | | |
3599 | 3581 | | |
3600 | 3582 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
714 | | - | |
715 | | - | |
716 | | - | |
| 714 | + | |
717 | 715 | | |
718 | 716 | | |
719 | 717 | | |
| |||
0 commit comments