File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
compiler/rustc_metadata/src/rmeta Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -1101,9 +1101,18 @@ fn should_encode_const(def_kind: DefKind) -> bool {
11011101 }
11021102}
11031103
1104- // Return `false` to avoid encoding impl trait in trait, while we don't use the query.
1105- fn should_encode_fn_impl_trait_in_trait < ' tcx > ( _tcx : TyCtxt < ' tcx > , _def_id : DefId ) -> bool {
1106- false
1104+ // We only encode impl trait in trait when using `lower-impl-trait-in-trait-to-assoc-ty` unstable
1105+ // option.
1106+ fn should_encode_fn_impl_trait_in_trait < ' tcx > ( tcx : TyCtxt < ' tcx > , def_id : DefId ) -> bool {
1107+ if tcx. sess . opts . unstable_opts . lower_impl_trait_in_trait_to_assoc_ty
1108+ && let Some ( assoc_item) = tcx. opt_associated_item ( def_id)
1109+ && assoc_item. container == ty:: AssocItemContainer :: TraitContainer
1110+ && assoc_item. kind == ty:: AssocKind :: Fn
1111+ {
1112+ true
1113+ } else {
1114+ false
1115+ }
11071116}
11081117
11091118impl < ' a , ' tcx > EncodeContext < ' a , ' tcx > {
You can’t perform that action at this time.
0 commit comments