diff options
| author | Caio <c410.f3r@gmail.com> | 2021-01-16 15:54:05 -0300 |
|---|---|---|
| committer | Caio <c410.f3r@gmail.com> | 2021-01-16 19:46:54 -0300 |
| commit | ad35979c50366d6b0fbcda99215f1c4e926e5dab (patch) | |
| tree | 8bc4fd6168831ee45cf114456cc70d4cf49266d8 /src/test/ui/impl-trait/nested_impl_trait.rs | |
| parent | 63a83c5f55801b17b77adf690db397d17c706c48 (diff) | |
| download | rust-ad35979c50366d6b0fbcda99215f1c4e926e5dab.tar.gz rust-ad35979c50366d6b0fbcda99215f1c4e926e5dab.zip | |
Move some tests to more reasonable directories - 2
Address comments Update limits
Diffstat (limited to 'src/test/ui/impl-trait/nested_impl_trait.rs')
| -rw-r--r-- | src/test/ui/impl-trait/nested_impl_trait.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/nested_impl_trait.rs b/src/test/ui/impl-trait/nested_impl_trait.rs new file mode 100644 index 00000000000..be2c21a7743 --- /dev/null +++ b/src/test/ui/impl-trait/nested_impl_trait.rs @@ -0,0 +1,30 @@ +use std::fmt::Debug; + +fn fine(x: impl Into<u32>) -> impl Into<u32> { x } + +fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x } +//~^ ERROR nested `impl Trait` is not allowed + +fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {} +//~^ ERROR nested `impl Trait` is not allowed +//~^^ `impl Trait` not allowed + +fn bad_in_arg_position(_: impl Into<impl Debug>) { } +//~^ ERROR nested `impl Trait` is not allowed + +struct X; +impl X { + fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x } + //~^ ERROR nested `impl Trait` is not allowed +} + +fn allowed_in_assoc_type() -> impl Iterator<Item=impl Fn()> { + vec![|| println!("woot")].into_iter() +} + +fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> { +//~^ `impl Trait` not allowed + || 5 +} + +fn main() {} |
