about summary refs log tree commit diff
path: root/tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.rs
blob: 3c3815054502f304457d9e08de7c4fa0c19d0739 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! Tests that compiler yields error E0191 when value with existing trait implementation
//! is cast as same `dyn` trait without specifying associated type at the cast.
//!
//! # Context
//! Original issue: https://github.com/rust-lang/rust/issues/21950

trait Add<Rhs=Self> {
    type Output;
}

impl Add for i32 {
    type Output = i32;
}

fn main() {
    let x = &10 as &dyn Add<i32, Output = i32>; //OK
    let x = &10 as &dyn Add;
    //~^ ERROR E0191
}