This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 3a90bed
committed
Auto merge of rust-lang#96296 - cjgillot:remove-label-lt-shadow, r=petrochenkov
Remove label/lifetime shadowing warnings
This PR removes some pre-1.0 shadowing warnings for labels and lifetimes.
The current behaviour of the compiler is to warn
* labels that shadow unrelated labels in the same function --> removed
```rust
'a: loop {}
'a: loop {} // STOP WARNING
```
* labels that shadow enclosing labels --> kept, but only if shadowing is hygienic
```rust
'a: loop {
'a: loop {} // KEEP WARNING
}
```
* labels that shadow lifetime --> removed
```rust
fn foo<'a>() {
'a: loop {} // STOP WARNING
}
```
* lifetimes that shadow labels --> removed
```rust
'a: loop {
let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>; // STOP WARNING
}
```
* lifetimes that shadow lifetimes --> kept
```rust
fn foo<'a>() {
let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>; // KEEP WARNING
}
```
Closes rust-lang#31745.
-----
From `@petrochenkov` in rust-lang#95781 (comment)
> I think we should remove these silly checks entirely.
> They were introduced long time ago in case some new language features appear and require this space.
> Now we have another mechanism for such language changes - editions, and if "lifetimes in expressions" or something like that needs to be introduced it could be introduced as an edition change.
> However, there was no plans to introduce anything like for years, so it's unlikely that even the edition mechanism will be necessary.
r? rust-lang/langFile tree
31 files changed
+223
-1751
lines changed- compiler
- rustc_ast_lowering/src
- rustc_error_codes/src/error_codes
- rustc_resolve/src
- late
- src/test/ui
- error-codes
- for-loop-while
- generic-associated-types
- hygiene
- lint
- loops
- macros
- regions
31 files changed
+223
-1751
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1848 | 1848 | | |
1849 | 1849 | | |
1850 | 1850 | | |
1851 | | - | |
1852 | | - | |
1853 | | - | |
1854 | | - | |
1855 | | - | |
1856 | | - | |
1857 | | - | |
1858 | | - | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
1859 | 1860 | | |
1860 | 1861 | | |
1861 | 1862 | | |
| |||
1880 | 1881 | | |
1881 | 1882 | | |
1882 | 1883 | | |
1883 | | - | |
1884 | | - | |
1885 | | - | |
1886 | | - | |
1887 | 1884 | | |
1888 | 1885 | | |
1889 | 1886 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | | - | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
175 | 192 | | |
176 | 193 | | |
177 | 194 | | |
| |||
732 | 749 | | |
733 | 750 | | |
734 | 751 | | |
735 | | - | |
| 752 | + | |
736 | 753 | | |
737 | 754 | | |
738 | 755 | | |
| |||
1531 | 1548 | | |
1532 | 1549 | | |
1533 | 1550 | | |
1534 | | - | |
| 1551 | + | |
1535 | 1552 | | |
1536 | 1553 | | |
1537 | | - | |
1538 | | - | |
1539 | | - | |
1540 | | - | |
1541 | 1554 | | |
1542 | 1555 | | |
1543 | 1556 | | |
| |||
1553 | 1566 | | |
1554 | 1567 | | |
1555 | 1568 | | |
1556 | | - | |
| 1569 | + | |
1557 | 1570 | | |
1558 | | - | |
1559 | | - | |
1560 | | - | |
1561 | | - | |
1562 | | - | |
1563 | | - | |
1564 | | - | |
1565 | | - | |
1566 | | - | |
1567 | | - | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
1568 | 1576 | | |
1569 | 1577 | | |
1570 | 1578 | | |
| |||
1573 | 1581 | | |
1574 | 1582 | | |
1575 | 1583 | | |
1576 | | - | |
1577 | | - | |
1578 | | - | |
1579 | | - | |
1580 | | - | |
| 1584 | + | |
1581 | 1585 | | |
1582 | 1586 | | |
1583 | 1587 | | |
1584 | 1588 | | |
1585 | 1589 | | |
1586 | 1590 | | |
1587 | 1591 | | |
1588 | | - | |
1589 | | - | |
1590 | | - | |
1591 | | - | |
1592 | | - | |
1593 | | - | |
1594 | | - | |
1595 | | - | |
1596 | | - | |
1597 | | - | |
1598 | | - | |
1599 | | - | |
1600 | | - | |
1601 | | - | |
1602 | | - | |
1603 | | - | |
| 1592 | + | |
| 1593 | + | |
1604 | 1594 | | |
1605 | 1595 | | |
1606 | 1596 | | |
| |||
1895 | 1885 | | |
1896 | 1886 | | |
1897 | 1887 | | |
| 1888 | + | |
| 1889 | + | |
1898 | 1890 | | |
1899 | 1891 | | |
1900 | 1892 | | |
| |||
1910 | 1902 | | |
1911 | 1903 | | |
1912 | 1904 | | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
1913 | 1913 | | |
1914 | 1914 | | |
1915 | 1915 | | |
1916 | 1916 | | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
1917 | 1926 | | |
1918 | 1927 | | |
1919 | 1928 | | |
1920 | 1929 | | |
1921 | | - | |
1922 | | - | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
1923 | 1935 | | |
1924 | 1936 | | |
1925 | 1937 | | |
| |||
1936 | 1948 | | |
1937 | 1949 | | |
1938 | 1950 | | |
| 1951 | + | |
| 1952 | + | |
1939 | 1953 | | |
1940 | 1954 | | |
1941 | 1955 | | |
| |||
1949 | 1963 | | |
1950 | 1964 | | |
1951 | 1965 | | |
| 1966 | + | |
| 1967 | + | |
1952 | 1968 | | |
1953 | 1969 | | |
1954 | 1970 | | |
| |||
3114 | 3130 | | |
3115 | 3131 | | |
3116 | 3132 | | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
3117 | 3138 | | |
3118 | 3139 | | |
3119 | 3140 | | |
| |||
3219 | 3240 | | |
3220 | 3241 | | |
3221 | 3242 | | |
3222 | | - | |
3223 | | - | |
3224 | | - | |
3225 | | - | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
| 3247 | + | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
3226 | 3252 | | |
3227 | 3253 | | |
3228 | 3254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
2036 | 2037 | | |
2037 | 2038 | | |
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 | + | |
2039 | 2068 | | |
2040 | 2069 | | |
2041 | 2070 | | |
| |||
0 commit comments