From 903e30b50365ef18c047c4f552622dce2529a559 Mon Sep 17 00:00:00 2001 From: Josh Chase Date: Thu, 13 Oct 2016 12:15:06 -0700 Subject: [PATCH] Quick fix for "impl Trait" * Remove "TODO" conversion * Add a couple of simple test cases Fix courtesy of @signaraiona --- src/types.rs | 5 ++--- tests/source/type.rs | 4 ++++ tests/target/type.rs | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/types.rs b/src/types.rs index 624f17f6be8..cb5b71181a5 100644 --- a/src/types.rs +++ b/src/types.rs @@ -618,9 +618,8 @@ impl Rewrite for ast::Ty { ast::TyKind::Mac(..) | ast::TyKind::Typeof(..) => unreachable!(), ast::TyKind::ImplicitSelf => Some(String::from("")), - ast::TyKind::ImplTrait(..) => { - // FIXME(#1154) Implement impl Trait - Some(String::from("impl TODO")) + ast::TyKind::ImplTrait(ref it) => { + it.rewrite(context, width, offset).map(|it_str| format!("impl {}", it_str)) } } } diff --git a/tests/source/type.rs b/tests/source/type.rs index 92da1010641..148abc30885 100644 --- a/tests/source/type.rs +++ b/tests/source/type.rs @@ -14,3 +14,7 @@ struct F { } fn issue_1006(def_id_to_string: for<'a, 'b> unsafe fn(TyCtxt<'b, 'tcx, 'tcx>, DefId) -> String) {} + +fn impl_trait_fn_1() -> impl Fn(i32) -> Option {} + +fn impl_trait_fn_2() -> impl Future {} diff --git a/tests/target/type.rs b/tests/target/type.rs index 75655c913ec..6101442e072 100644 --- a/tests/target/type.rs +++ b/tests/target/type.rs @@ -23,3 +23,7 @@ struct F { } fn issue_1006(def_id_to_string: for<'a, 'b> unsafe fn(TyCtxt<'b, 'tcx, 'tcx>, DefId) -> String) {} + +fn impl_trait_fn_1() -> impl Fn(i32) -> Option {} + +fn impl_trait_fn_2() -> impl Future {}