about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-18 08:15:57 +0000
committerbors <bors@rust-lang.org>2023-08-18 08:15:57 +0000
commit0f7f6b70617fbcda9f73755fa9b560bfb0a588eb (patch)
treedcdab75999c8e6c5663e18874c8f8e78d5a71c29 /compiler/rustc_mir_transform/src
parenta1e1dba9cc40a90409bccb8b19e359c4bdf573e5 (diff)
parent20c648c5827a2a774f4b6aeb36804c845130659b (diff)
downloadrust-0f7f6b70617fbcda9f73755fa9b560bfb0a588eb.tar.gz
rust-0f7f6b70617fbcda9f73755fa9b560bfb0a588eb.zip
Auto merge of #114948 - compiler-errors:normalize-before-freeze, r=lcnr
Normalize before checking if local is freeze in `deduced_param_attrs`

Not normalizing the local type eagerly results in possibly exponential amounts of normalization happening downstream in `is_freeze_raw`.

Fixes #113372
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/deduce_param_attrs.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/deduce_param_attrs.rs b/compiler/rustc_mir_transform/src/deduce_param_attrs.rs
index 60ca3dfb2da..79645310a39 100644
--- a/compiler/rustc_mir_transform/src/deduce_param_attrs.rs
+++ b/compiler/rustc_mir_transform/src/deduce_param_attrs.rs
@@ -203,7 +203,12 @@ pub fn deduced_param_attrs<'tcx>(
         body.local_decls.iter().skip(1).take(body.arg_count).enumerate().map(
             |(arg_index, local_decl)| DeducedParamAttrs {
                 read_only: !deduce_read_only.mutable_args.contains(arg_index)
-                    && local_decl.ty.is_freeze(tcx, param_env),
+                    // We must normalize here to reveal opaques and normalize
+                    // their substs, otherwise we'll see exponential blow-up in
+                    // compile times: #113372
+                    && tcx
+                        .normalize_erasing_regions(param_env, local_decl.ty)
+                        .is_freeze(tcx, param_env),
             },
         ),
     );