rust/tests/ui/traits/alias/maybe-bound.rs

30 lines
505 B
Rust
Raw Normal View History

// build-pass (FIXME(62277): could be check-pass?)
2019-05-01 20:21:20 -05:00
2019-03-30 17:06:09 -05:00
// Test that `dyn ... + ?Sized + ...` resulting from the expansion of trait aliases is okay.
#![feature(trait_alias)]
2019-05-01 20:21:20 -05:00
trait Foo {}
2019-03-30 17:06:09 -05:00
trait S = ?Sized;
// Nest a couple of levels deep:
trait _0 = S;
trait _1 = _0;
// Straight list expansion:
2019-05-01 20:21:20 -05:00
type _T0 = dyn _1 + Foo;
2019-03-30 17:06:09 -05:00
// In second position:
2019-05-01 20:21:20 -05:00
type _T1 = dyn Foo + _1;
2019-03-30 17:06:09 -05:00
// ... and with an auto trait:
2019-05-01 20:21:20 -05:00
type _T2 = dyn Foo + Send + _1;
2019-03-30 17:06:09 -05:00
// Twice:
trait _2 = _1 + _1;
2019-05-01 20:21:20 -05:00
type _T3 = dyn _2 + Foo;
2019-03-30 17:06:09 -05:00
fn main() {}