mirror of https://github.com/rust-lang/rust
28 lines
1.0 KiB
Rust
28 lines
1.0 KiB
Rust
use std::ops::{Add, Sub, Mul, Div};
|
|
trait X<Rhs>: Mul<Rhs> + Div<Rhs> {}
|
|
trait Y<Rhs>: Div<Rhs, Output = Rhs> {
|
|
type A;
|
|
}
|
|
trait Z<Rhs>: Div<Rhs> {
|
|
type A;
|
|
type B;
|
|
}
|
|
trait Fine<Rhs>: Div<Rhs, Output = Rhs> {}
|
|
|
|
type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>;
|
|
//~^ ERROR only auto traits can be used as additional traits in a trait object
|
|
//~| ERROR the value of the associated types
|
|
type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
|
|
//~^ ERROR only auto traits can be used as additional traits in a trait object
|
|
//~| ERROR the value of the associated types
|
|
type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
|
|
//~^ ERROR only auto traits can be used as additional traits in a trait object
|
|
//~| ERROR the value of the associated types
|
|
type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
|
|
//~^ ERROR only auto traits can be used as additional traits in a trait object
|
|
//~| ERROR the value of the associated types
|
|
type Bal<Rhs> = dyn X<Rhs>;
|
|
//~^ ERROR the value of the associated types
|
|
|
|
fn main() {}
|