Skip to content

Commit dbacf0c

Browse files
committed
Test err on impl Trait projection within dyn Trait
1 parent f1fbf79 commit dbacf0c

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/test/ui/impl_trait_projections.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
#![feature(conservative_impl_trait, universal_impl_trait)]
10+
#![feature(dyn_trait, conservative_impl_trait, universal_impl_trait)]
1111

1212
use std::fmt::Debug;
1313
use std::option;
@@ -40,4 +40,11 @@ fn projection_with_named_trait_inside_path_is_disallowed()
4040
(1i32..100).next().unwrap()
4141
}
4242

43+
fn projection_from_impl_trait_inside_dyn_trait_is_disallowed()
44+
-> <dyn Iterator<Item = impl Debug> as Iterator>::Item
45+
//~^ ERROR `impl Trait` is not allowed in path parameters
46+
{
47+
panic!()
48+
}
49+
4350
fn main() {}

src/test/ui/impl_trait_projections.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ error[E0667]: `impl Trait` is not allowed in path parameters
1616
37 | -> <::std::ops::Range<impl Debug> as Iterator>::Item
1717
| ^^^^^^^^^^
1818

19+
error[E0667]: `impl Trait` is not allowed in path parameters
20+
--> $DIR/impl_trait_projections.rs:44:29
21+
|
22+
44 | -> <dyn Iterator<Item = impl Debug> as Iterator>::Item
23+
| ^^^^^^^^^^
24+
1925
error[E0223]: ambiguous associated type
2026
--> $DIR/impl_trait_projections.rs:23:50
2127
|
@@ -24,5 +30,5 @@ error[E0223]: ambiguous associated type
2430
|
2531
= note: specify the type using the syntax `<impl std::iter::Iterator as Trait>::Item`
2632

27-
error: aborting due to 4 previous errors
33+
error: aborting due to 5 previous errors
2834

0 commit comments

Comments
 (0)