diff options
| author | Christopher Vittal <christopher.vittal@gmail.com> | 2017-11-14 20:38:07 -0500 |
|---|---|---|
| committer | Christopher Vittal <christopher.vittal@gmail.com> | 2017-11-15 15:46:01 -0500 |
| commit | 22f0940f2d7076773966de425f5dfc3afb012164 (patch) | |
| tree | e6b81d6733a3f2576cac05e61275006b0460d210 | |
| parent | f710d41f77853279832880cc9b3e01ea141daac9 (diff) | |
| download | rust-22f0940f2d7076773966de425f5dfc3afb012164.tar.gz rust-22f0940f2d7076773966de425f5dfc3afb012164.zip | |
Add cases to where-allowed.rs
| -rw-r--r-- | src/test/compile-fail/impl-trait/where-allowed.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/test/compile-fail/impl-trait/where-allowed.rs b/src/test/compile-fail/impl-trait/where-allowed.rs index a4361446020..af83a2d0a23 100644 --- a/src/test/compile-fail/impl-trait/where-allowed.rs +++ b/src/test/compile-fail/impl-trait/where-allowed.rs @@ -48,7 +48,6 @@ fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() } // Disallowed fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() } //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types -// FIXME -- no error currently // Disallowed fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() } @@ -57,7 +56,6 @@ fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() } // Disallowed fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() } //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types -// FIXME -- no error currently // Disallowed fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() } @@ -66,7 +64,6 @@ fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() } // Disallowed fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() } //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types -// FIXME -- no error currently // Disallowed fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() } @@ -75,7 +72,15 @@ fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() } // Disallowed fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() } //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types -// FIXME -- no error currently + +// Disallowed +fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() } +//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types + +// Disallowed +fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() } +//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types + // Allowed fn in_impl_Trait_in_parameters(_: impl Iterator<Item = impl Iterator>) { panic!() } |
