Feature gate `impl_trait_in_fn_trait_return`

This commit is contained in:
Maybe Waffle 2022-07-25 01:54:47 +04:00
parent 00f22771f6
commit cc752f5665
3 changed files with 7 additions and 1 deletions

View File

@ -363,7 +363,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
// fn f(_: impl Fn() -> impl Debug) -> impl Fn() -> impl Debug
// // disallowed --^^^^^^^^^^ allowed --^^^^^^^^^^
// ```
FnRetTy::Ty(ty) if matches!(itctx, ImplTraitContext::ReturnPositionOpaqueTy { .. }) => {
FnRetTy::Ty(ty)
if matches!(itctx, ImplTraitContext::ReturnPositionOpaqueTy { .. })
&& self.tcx.features().impl_trait_in_fn_trait_return =>
{
self.lower_ty(&ty, itctx)
}
FnRetTy::Ty(ty) => {

View File

@ -414,6 +414,8 @@ declare_features! (
(active, half_open_range_patterns_in_slices, "CURRENT_RUSTC_VERSION", Some(67264), None),
/// Allows `if let` guard in match arms.
(active, if_let_guard, "1.47.0", Some(51114), None),
/// Allows `impl Trait` as output type in `Fn` traits in return position of functions.
(active, impl_trait_in_fn_trait_return, "1.64.0", Some(99697), None),
/// Allows using imported `main` function
(active, imported_main, "1.53.0", Some(28937), None),
/// Allows associated types in inherent impls.

View File

@ -813,6 +813,7 @@ symbols! {
impl_lint_pass,
impl_macros,
impl_trait_in_bindings,
impl_trait_in_fn_trait_return,
implied_by,
import,
import_name_type,