1
Fork 0

Add tcx::lower_impl_trait_in_trait_to_assoc_ty to avoid accessing through sess.opts.unstable_opts

This commit is contained in:
Santiago Pastorino 2023-03-03 18:27:25 -03:00
parent 7820b62d20
commit c2238527e6
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
3 changed files with 7 additions and 3 deletions

View file

@ -1104,7 +1104,7 @@ fn should_encode_const(def_kind: DefKind) -> bool {
// We only encode impl trait in trait when using `lower-impl-trait-in-trait-to-assoc-ty` unstable
// option.
fn should_encode_fn_impl_trait_in_trait<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
if tcx.sess.opts.unstable_opts.lower_impl_trait_in_trait_to_assoc_ty
if tcx.lower_impl_trait_in_trait_to_assoc_ty()
&& let Some(assoc_item) = tcx.opt_associated_item(def_id)
&& assoc_item.container == ty::AssocItemContainer::TraitContainer
&& assoc_item.kind == ty::AssocKind::Fn