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