Skip to content

Commit

Permalink
Test err on impl Trait projection within dyn Trait
Browse files Browse the repository at this point in the history
  • Loading branch information
cramertj committed Feb 14, 2018
1 parent f1fbf79 commit dbacf0c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/test/ui/impl_trait_projections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait, universal_impl_trait)]
#![feature(dyn_trait, conservative_impl_trait, universal_impl_trait)]

use std::fmt::Debug;
use std::option;
Expand Down Expand Up @@ -40,4 +40,11 @@ fn projection_with_named_trait_inside_path_is_disallowed()
(1i32..100).next().unwrap()
}

fn projection_from_impl_trait_inside_dyn_trait_is_disallowed()
-> <dyn Iterator<Item = impl Debug> as Iterator>::Item
//~^ ERROR `impl Trait` is not allowed in path parameters
{
panic!()
}

fn main() {}
8 changes: 7 additions & 1 deletion src/test/ui/impl_trait_projections.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ error[E0667]: `impl Trait` is not allowed in path parameters
37 | -> <::std::ops::Range<impl Debug> as Iterator>::Item
| ^^^^^^^^^^

error[E0667]: `impl Trait` is not allowed in path parameters
--> $DIR/impl_trait_projections.rs:44:29
|
44 | -> <dyn Iterator<Item = impl Debug> as Iterator>::Item
| ^^^^^^^^^^

error[E0223]: ambiguous associated type
--> $DIR/impl_trait_projections.rs:23:50
|
Expand All @@ -24,5 +30,5 @@ error[E0223]: ambiguous associated type
|
= note: specify the type using the syntax `<impl std::iter::Iterator as Trait>::Item`

error: aborting due to 4 previous errors
error: aborting due to 5 previous errors

0 comments on commit dbacf0c

Please sign in to comment.