Commit 3dfd4c1
committed
Auto merge of rust-lang#16915 - 6d7a:master, r=HKalbasi
fix: Prevent stack overflow in recursive const types
In the evaluation of const values of recursive types certain declarations could cause an endless call-loop within the interpreter (hir-ty’s create_memory_map), which would lead to a stack overflow.
This commit adds a check that prevents values that contain an address in their value (such as TyKind::Ref) from being allocated at the address they contain.
The commit also adds a test for this edge case.2 files changed
+72
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2825 | 2825 | | |
2826 | 2826 | | |
2827 | 2827 | | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1931 | 1931 | | |
1932 | 1932 | | |
1933 | 1933 | | |
| 1934 | + | |
1934 | 1935 | | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
1935 | 1939 | | |
1936 | 1940 | | |
1937 | 1941 | | |
| |||
1970 | 1974 | | |
1971 | 1975 | | |
1972 | 1976 | | |
1973 | | - | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
1974 | 1985 | | |
1975 | 1986 | | |
1976 | 1987 | | |
| |||
1984 | 1995 | | |
1985 | 1996 | | |
1986 | 1997 | | |
1987 | | - | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
1988 | 2006 | | |
1989 | 2007 | | |
1990 | 2008 | | |
| |||
1993 | 2011 | | |
1994 | 2012 | | |
1995 | 2013 | | |
1996 | | - | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
1997 | 2022 | | |
1998 | 2023 | | |
1999 | 2024 | | |
| |||
2008 | 2033 | | |
2009 | 2034 | | |
2010 | 2035 | | |
2011 | | - | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
2012 | 2044 | | |
2013 | 2045 | | |
2014 | 2046 | | |
| |||
2027 | 2059 | | |
2028 | 2060 | | |
2029 | 2061 | | |
2030 | | - | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
2031 | 2070 | | |
2032 | 2071 | | |
2033 | 2072 | | |
| |||
2038 | 2077 | | |
2039 | 2078 | | |
2040 | 2079 | | |
2041 | | - | |
| 2080 | + | |
2042 | 2081 | | |
2043 | 2082 | | |
2044 | 2083 | | |
| |||
0 commit comments