2019-03-30 22:06:09 +00:00
|
|
|
//@ run-pass
|
|
|
|
|
2018-10-12 00:50:03 +00:00
|
|
|
#![feature(trait_alias)]
|
|
|
|
|
2018-10-22 00:58:34 +00:00
|
|
|
trait Foo = PartialEq<i32> + Send;
|
|
|
|
trait Bar = Foo + Sync;
|
2018-10-12 00:50:03 +00:00
|
|
|
|
2018-10-25 00:03:25 +00:00
|
|
|
trait I32Iterator = Iterator<Item = i32>;
|
|
|
|
|
2018-10-12 00:50:03 +00:00
|
|
|
pub fn main() {
|
2018-10-25 00:03:25 +00:00
|
|
|
let a: &dyn Bar = &123;
|
2018-10-22 00:58:34 +00:00
|
|
|
assert!(*a == 123);
|
|
|
|
let b = Box::new(456) as Box<dyn Foo>;
|
|
|
|
assert!(*b == 456);
|
2018-10-25 00:03:25 +00:00
|
|
|
|
2018-11-05 02:02:43 +00:00
|
|
|
let c: &mut dyn I32Iterator = &mut vec![123].into_iter();
|
2018-11-04 04:47:10 +00:00
|
|
|
assert_eq!(c.next(), Some(123));
|
2018-10-12 00:50:03 +00:00
|
|
|
}
|