-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit fa696a3
authored
Rollup merge of #118391 - compiler-errors:lifetimes-eq, r=lcnr
Add `REDUNDANT_LIFETIMES` lint to detect lifetimes which are semantically redundant
There already is a `UNUSED_LIFETIMES` lint which is fired when we detect where clause bounds like `where 'a: 'static`, however, it doesn't use the full power of lexical region resolution to detect failures.
Right now `UNUSED_LIFETIMES` is an `Allow` lint, though presumably we could bump it to warn? I can (somewhat) easily implement a structured suggestion so this can be rustfix'd automatically, since we can just walk through the HIR body, replacing instances of the redundant lifetime.
Fixes #118376
r? lcnrFile tree
17 files changed
+332
-103
lines changed- compiler
- rustc_errors/src
- rustc_hir_analysis
- src
- check
- collect
- rustc_lint_defs/src
- rustc_middle/src/ty
- tests/ui
- generic-associated-types
- regions
17 files changed
+332
-103
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
46 | 46 |
| |
47 | 47 |
| |
48 | 48 |
| |
49 | + | ||
49 | 50 |
| |
50 | 51 |
| |
51 | 52 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
355 | 355 |
| |
356 | 356 |
| |
357 | 357 |
| |
358 | + | ||
359 | + | ||
360 | + | ||
358 | 361 |
| |
359 | 362 |
| |
360 | 363 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 | + | ||
11 | 12 |
| |
12 | 13 |
| |
13 | 14 |
| |
14 | 15 |
| |
15 | 16 |
| |
17 | + | ||
16 | 18 |
| |
17 | 19 |
| |
18 | 20 |
| |
| |||
136 | 138 |
| |
137 | 139 |
| |
138 | 140 |
| |
141 | + | ||
142 | + | ||
139 | 143 |
| |
140 | 144 |
| |
141 | 145 |
| |
| |||
2010 | 2014 |
| |
2011 | 2015 |
| |
2012 | 2016 |
| |
2017 | + | ||
2018 | + | ||
2019 | + | ||
2020 | + | ||
2021 | + | ||
2022 | + | ||
2023 | + | ||
2024 | + | ||
2025 | + | ||
2026 | + | ||
2027 | + | ||
2028 | + | ||
2029 | + | ||
2030 | + | ||
2031 | + | ||
2032 | + | ||
2033 | + | ||
2034 | + | ||
2035 | + | ||
2036 | + | ||
2037 | + | ||
2038 | + | ||
2039 | + | ||
2040 | + | ||
2041 | + | ||
2042 | + | ||
2043 | + | ||
2044 | + | ||
2045 | + | ||
2046 | + | ||
2047 | + | ||
2048 | + | ||
2049 | + | ||
2050 | + | ||
2051 | + | ||
2052 | + | ||
2053 | + | ||
2054 | + | ||
2055 | + | ||
2056 | + | ||
2057 | + | ||
2058 | + | ||
2059 | + | ||
2060 | + | ||
2061 | + | ||
2062 | + | ||
2063 | + | ||
2064 | + | ||
2065 | + | ||
2066 | + | ||
2067 | + | ||
2068 | + | ||
2069 | + | ||
2070 | + | ||
2071 | + | ||
2072 | + | ||
2073 | + | ||
2074 | + | ||
2075 | + | ||
2076 | + | ||
2077 | + | ||
2078 | + | ||
2079 | + | ||
2080 | + | ||
2081 | + | ||
2082 | + | ||
2083 | + | ||
2084 | + | ||
2085 | + | ||
2086 | + | ||
2087 | + | ||
2088 | + | ||
2089 | + | ||
2090 | + | ||
2091 | + | ||
2092 | + | ||
2093 | + | ||
2094 | + | ||
2095 | + | ||
2096 | + | ||
2097 | + | ||
2098 | + | ||
2099 | + | ||
2100 | + | ||
2101 | + | ||
2102 | + | ||
2103 | + | ||
2104 | + | ||
2105 | + | ||
2106 | + | ||
2107 | + | ||
2108 | + | ||
2109 | + | ||
2110 | + | ||
2111 | + | ||
2112 | + | ||
2113 | + | ||
2114 | + | ||
2115 | + | ||
2116 | + | ||
2117 | + | ||
2118 | + | ||
2119 | + | ||
2120 | + | ||
2121 | + | ||
2122 | + | ||
2123 | + | ||
2124 | + | ||
2125 | + | ||
2126 | + | ||
2127 | + | ||
2128 | + | ||
2129 | + | ||
2130 | + | ||
2131 | + | ||
2132 | + | ||
2133 | + | ||
2134 | + | ||
2135 | + | ||
2136 | + | ||
2137 | + | ||
2138 | + | ||
2139 | + | ||
2140 | + | ||
2141 | + | ||
2142 | + | ||
2143 | + | ||
2144 | + | ||
2145 | + | ||
2146 | + | ||
2147 | + | ||
2013 | 2148 |
| |
2014 | 2149 |
| |
2015 | 2150 |
|
Lines changed: 0 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 | - | ||
24 | 23 |
| |
25 | 24 |
| |
26 | 25 |
| |
| |||
867 | 866 |
| |
868 | 867 |
| |
869 | 868 |
| |
870 | - | ||
871 | - | ||
872 | - | ||
873 | - | ||
874 | - | ||
875 | - | ||
876 | - | ||
877 | - | ||
878 | - | ||
879 | - | ||
880 | - | ||
881 | - | ||
882 | - | ||
883 | - | ||
884 | - | ||
885 | - | ||
886 | - | ||
887 | - | ||
888 | - | ||
889 | - | ||
890 | - | ||
891 | - | ||
892 | - | ||
893 | - | ||
894 | - | ||
895 | 869 |
| |
896 | 870 |
| |
897 | 871 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
79 | 79 |
| |
80 | 80 |
| |
81 | 81 |
| |
82 | + | ||
82 | 83 |
| |
83 | 84 |
| |
84 | 85 |
| |
| |||
1707 | 1708 |
| |
1708 | 1709 |
| |
1709 | 1710 |
| |
1711 | + | ||
1712 | + | ||
1713 | + | ||
1714 | + | ||
1715 | + | ||
1716 | + | ||
1717 | + | ||
1718 | + | ||
1719 | + | ||
1720 | + | ||
1721 | + | ||
1722 | + | ||
1723 | + | ||
1724 | + | ||
1725 | + | ||
1726 | + | ||
1727 | + | ||
1728 | + | ||
1729 | + | ||
1730 | + | ||
1731 | + | ||
1732 | + | ||
1733 | + | ||
1734 | + | ||
1735 | + | ||
1736 | + | ||
1737 | + | ||
1710 | 1738 |
| |
1711 | 1739 |
| |
1712 | 1740 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
757 | 757 |
| |
758 | 758 |
| |
759 | 759 |
| |
760 | - | ||
760 | + | ||
761 | 761 |
| |
762 | 762 |
| |
763 | 763 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
8 | - | ||
9 | - | ||
10 | - | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
14 | - | ||
14 | + | ||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 | - | ||
23 | - | ||
24 | - | ||
25 | - | ||
22 | + | ||
23 | + | ||
24 | + | ||
26 | 25 |
| |
27 | 26 |
| |
28 | 27 |
| |
|
Lines changed: 2 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | - | ||
1 | + | ||
2 | 2 |
| |
3 | 3 |
| |
4 | - | ||
5 | - | ||
4 | + | ||
6 | 5 |
| |
7 | 6 |
| |
8 | 7 |
| |
|
0 commit comments