Commit f69d8db
authored
Rollup merge of #131754 - compiler-errors:bivariance-bivariance, r=estebank
Don't report bivariance error when nesting a struct with field errors into another struct
We currently have logic to avoid reporting lifetime bivariance ("lifetime parameter ... is never used") errors when a struct has field resolution errors. However, this doesn't apply transitively. This PR implements a simple visitor to do so.
This was reported [here](https://twitter.com/fasterthanlime/status/1846257921086165033) since a `derive(Deserialize, Serialize)` ends up generating helper structs which have bivariant lifetimes due to containing the offending struct (that's being derived on).File tree
3 files changed
+72
-10
lines changed- compiler/rustc_hir_analysis/src/check
- tests/ui/variance
3 files changed
+72
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1875 | 1875 | | |
1876 | 1876 | | |
1877 | 1877 | | |
1878 | | - | |
1879 | | - | |
1880 | 1878 | | |
1881 | 1879 | | |
1882 | | - | |
1883 | | - | |
1884 | | - | |
1885 | | - | |
1886 | | - | |
| 1880 | + | |
1887 | 1881 | | |
1888 | 1882 | | |
1889 | 1883 | | |
1890 | 1884 | | |
1891 | 1885 | | |
1892 | 1886 | | |
1893 | | - | |
1894 | | - | |
1895 | | - | |
1896 | 1887 | | |
1897 | 1888 | | |
1898 | 1889 | | |
| |||
1955 | 1946 | | |
1956 | 1947 | | |
1957 | 1948 | | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
1958 | 1958 | | |
1959 | 1959 | | |
1960 | 1960 | | |
| |||
1965 | 1965 | | |
1966 | 1966 | | |
1967 | 1967 | | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
1968 | 2008 | | |
1969 | 2009 | | |
1970 | 2010 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments