Test err on impl Trait projection within dyn Trait

This commit is contained in:
Taylor Cramer 2018-02-13 17:52:22 -08:00
parent f1fbf79223
commit dbacf0c56b
2 changed files with 15 additions and 2 deletions

View File

@ -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;
@ -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() {}

View File

@ -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
|
@ -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