@@ -169,26 +169,11 @@ pub(super) fn deduced_param_attrs<'tcx>(
169169
170170 // Set the `readonly` attribute for every argument that we concluded is immutable and that
171171 // contains no UnsafeCells.
172- //
173- // FIXME: This is overly conservative around generic parameters: `is_freeze()` will always
174- // return false for them. For a description of alternatives that could do a better job here,
175- // see [1].
176- //
177- // [1]: https://github.com/rust-lang/rust/pull/103172#discussion_r999139997
178- let typing_env = body. typing_env ( tcx) ;
179- let mut deduced_param_attrs = tcx. arena . alloc_from_iter (
180- body. local_decls . iter ( ) . skip ( 1 ) . take ( body. arg_count ) . enumerate ( ) . map (
181- |( arg_index, local_decl) | DeducedParamAttrs {
182- read_only : deduce. read_only . contains ( arg_index) || (
183- deduce. read_only_when_freeze . contains ( arg_index)
184- // We must normalize here to reveal opaques and normalize
185- // their generic parameters, otherwise we'll see exponential
186- // blow-up in compile times: #113372
187- && tcx. normalize_erasing_regions ( typing_env, local_decl. ty ) . is_freeze ( tcx, typing_env) )
188-
189- }
190- ) ,
191- ) ;
172+ let mut deduced_param_attrs =
173+ tcx. arena . alloc_from_iter ( ( 0 ..body. arg_count ) . map ( |arg_index| DeducedParamAttrs {
174+ read_only : deduce. read_only . contains ( arg_index) ,
175+ read_only_when_freeze : deduce. read_only_when_freeze . contains ( arg_index) ,
176+ } ) ) ;
192177
193178 // Trailing parameters past the size of the `deduced_param_attrs` array are assumed to have the
194179 // default set of attributes, so we don't have to store them explicitly. Pop them off to save a
0 commit comments