Skip to content

Commit 20c648c

Browse files
Normalize before checking if local is freeze in deduced_param_attrs
1 parent 0768872 commit 20c648c

File tree

2 files changed

+185
-1
lines changed

2 files changed

+185
-1
lines changed

compiler/rustc_mir_transform/src/deduce_param_attrs.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,12 @@ pub fn deduced_param_attrs<'tcx>(
203203
body.local_decls.iter().skip(1).take(body.arg_count).enumerate().map(
204204
|(arg_index, local_decl)| DeducedParamAttrs {
205205
read_only: !deduce_read_only.mutable_args.contains(arg_index)
206-
&& local_decl.ty.is_freeze(tcx, param_env),
206+
// We must normalize here to reveal opaques and normalize
207+
// their substs, otherwise we'll see exponential blow-up in
208+
// compile times: #113372
209+
&& tcx
210+
.normalize_erasing_regions(param_env, local_decl.ty)
211+
.is_freeze(tcx, param_env),
207212
},
208213
),
209214
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
// build-pass
2+
// compile-flags: -Copt-level=s -Clto=fat
3+
// no-prefer-dynamic
4+
// edition: 2021
5+
6+
#![recursion_limit = "256"]
7+
8+
fn main() {
9+
spawn(move || main0())
10+
}
11+
12+
fn spawn<F>(future: impl FnOnce() -> F) {
13+
future();
14+
}
15+
16+
async fn main0() {
17+
main1().await;
18+
main2().await;
19+
}
20+
async fn main1() {
21+
main2().await;
22+
main3().await;
23+
}
24+
async fn main2() {
25+
main3().await;
26+
main4().await;
27+
}
28+
async fn main3() {
29+
main4().await;
30+
main5().await;
31+
}
32+
async fn main4() {
33+
main5().await;
34+
main6().await;
35+
}
36+
async fn main5() {
37+
main6().await;
38+
main7().await;
39+
}
40+
async fn main6() {
41+
main7().await;
42+
main8().await;
43+
}
44+
async fn main7() {
45+
main8().await;
46+
main9().await;
47+
}
48+
async fn main8() {
49+
main9().await;
50+
main10().await;
51+
}
52+
async fn main9() {
53+
main10().await;
54+
main11().await;
55+
}
56+
async fn main10() {
57+
main11().await;
58+
main12().await;
59+
}
60+
async fn main11() {
61+
main12().await;
62+
main13().await;
63+
}
64+
async fn main12() {
65+
main13().await;
66+
main14().await;
67+
}
68+
async fn main13() {
69+
main14().await;
70+
main15().await;
71+
}
72+
async fn main14() {
73+
main15().await;
74+
main16().await;
75+
}
76+
async fn main15() {
77+
main16().await;
78+
main17().await;
79+
}
80+
async fn main16() {
81+
main17().await;
82+
main18().await;
83+
}
84+
async fn main17() {
85+
main18().await;
86+
main19().await;
87+
}
88+
async fn main18() {
89+
main19().await;
90+
main20().await;
91+
}
92+
async fn main19() {
93+
main20().await;
94+
main21().await;
95+
}
96+
async fn main20() {
97+
main21().await;
98+
main22().await;
99+
}
100+
async fn main21() {
101+
main22().await;
102+
main23().await;
103+
}
104+
async fn main22() {
105+
main23().await;
106+
main24().await;
107+
}
108+
async fn main23() {
109+
main24().await;
110+
main25().await;
111+
}
112+
async fn main24() {
113+
main25().await;
114+
main26().await;
115+
}
116+
async fn main25() {
117+
main26().await;
118+
main27().await;
119+
}
120+
async fn main26() {
121+
main27().await;
122+
main28().await;
123+
}
124+
async fn main27() {
125+
main28().await;
126+
main29().await;
127+
}
128+
async fn main28() {
129+
main29().await;
130+
main30().await;
131+
}
132+
async fn main29() {
133+
main30().await;
134+
main31().await;
135+
}
136+
async fn main30() {
137+
main31().await;
138+
main32().await;
139+
}
140+
async fn main31() {
141+
main32().await;
142+
main33().await;
143+
}
144+
async fn main32() {
145+
main33().await;
146+
main34().await;
147+
}
148+
async fn main33() {
149+
main34().await;
150+
main35().await;
151+
}
152+
async fn main34() {
153+
main35().await;
154+
main36().await;
155+
}
156+
async fn main35() {
157+
main36().await;
158+
main37().await;
159+
}
160+
async fn main36() {
161+
main37().await;
162+
main38().await;
163+
}
164+
async fn main37() {
165+
main38().await;
166+
main39().await;
167+
}
168+
async fn main38() {
169+
main39().await;
170+
main40().await;
171+
}
172+
async fn main39() {
173+
main40().await;
174+
}
175+
async fn main40() {
176+
boom(&mut ()).await;
177+
}
178+
179+
async fn boom(f: &mut ()) {}

0 commit comments

Comments
 (0)