diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/iter_on_single_items.fixed | 24 | ||||
| -rw-r--r-- | tests/ui/iter_on_single_items.rs | 24 |
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/ui/iter_on_single_items.fixed b/tests/ui/iter_on_single_items.fixed index b43fad6449c..044037aac2e 100644 --- a/tests/ui/iter_on_single_items.fixed +++ b/tests/ui/iter_on_single_items.fixed @@ -66,3 +66,27 @@ fn main() { custom_option::custom_option(); in_macros!(); } + +mod issue14981 { + use std::option::IntoIter; + fn takes_into_iter(_: impl IntoIterator<Item = i32>) {} + + fn let_stmt() { + macro_rules! x { + ($e:expr) => { + let _: IntoIter<i32> = $e; + }; + } + x!(Some(5).into_iter()); + } + + fn fn_ptr() { + fn some_func(_: IntoIter<i32>) -> IntoIter<i32> { + todo!() + } + some_func(Some(5).into_iter()); + + const C: fn(IntoIter<i32>) -> IntoIter<i32> = <IntoIter<i32> as IntoIterator>::into_iter; + C(Some(5).into_iter()); + } +} diff --git a/tests/ui/iter_on_single_items.rs b/tests/ui/iter_on_single_items.rs index 625c96d3ef1..c925d0e480f 100644 --- a/tests/ui/iter_on_single_items.rs +++ b/tests/ui/iter_on_single_items.rs @@ -66,3 +66,27 @@ fn main() { custom_option::custom_option(); in_macros!(); } + +mod issue14981 { + use std::option::IntoIter; + fn takes_into_iter(_: impl IntoIterator<Item = i32>) {} + + fn let_stmt() { + macro_rules! x { + ($e:expr) => { + let _: IntoIter<i32> = $e; + }; + } + x!(Some(5).into_iter()); + } + + fn fn_ptr() { + fn some_func(_: IntoIter<i32>) -> IntoIter<i32> { + todo!() + } + some_func(Some(5).into_iter()); + + const C: fn(IntoIter<i32>) -> IntoIter<i32> = <IntoIter<i32> as IntoIterator>::into_iter; + C(Some(5).into_iter()); + } +} |
