File tree 1 file changed +12
-3
lines changed
compiler/rustc_metadata/src/rmeta
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 {
1101
1101
}
1102
1102
}
1103
1103
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
+ }
1107
1116
}
1108
1117
1109
1118
impl < ' a , ' tcx > EncodeContext < ' a , ' tcx > {
You can’t perform that action at this time.
0 commit comments