Skip to content

Commit cc752f5

Browse files
committed
Feature gate impl_trait_in_fn_trait_return
1 parent 00f2277 commit cc752f5

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

compiler/rustc_ast_lowering/src/path.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
363363
// fn f(_: impl Fn() -> impl Debug) -> impl Fn() -> impl Debug
364364
// // disallowed --^^^^^^^^^^ allowed --^^^^^^^^^^
365365
// ```
366-
FnRetTy::Ty(ty) if matches!(itctx, ImplTraitContext::ReturnPositionOpaqueTy { .. }) => {
366+
FnRetTy::Ty(ty)
367+
if matches!(itctx, ImplTraitContext::ReturnPositionOpaqueTy { .. })
368+
&& self.tcx.features().impl_trait_in_fn_trait_return =>
369+
{
367370
self.lower_ty(&ty, itctx)
368371
}
369372
FnRetTy::Ty(ty) => {

compiler/rustc_feature/src/active.rs

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

compiler/rustc_span/src/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,7 @@ symbols! {
813813
impl_lint_pass,
814814
impl_macros,
815815
impl_trait_in_bindings,
816+
impl_trait_in_fn_trait_return,
816817
implied_by,
817818
import,
818819
import_name_type,

0 commit comments

Comments
 (0)