Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
clean up issue-21950 (dyn trait cast without assoc type at the cast)
  • Loading branch information
omskscream committed Sep 14, 2025
commit 22aecd3001038d0ac00ecd06985e2b0abc57e6dc
12 changes: 0 additions & 12 deletions tests/ui/issues/issue-21950.rs

This file was deleted.

19 changes: 19 additions & 0 deletions tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0191]: the value of the associated type `Output` in `Add` must be specified
--> $DIR/issue-21950.rs:10:25
--> $DIR/cast-as-dyn-trait-wo-assoc-type-issue-21950.rs:17:25
|
LL | type Output;
| ----------- `Output` defined here
Expand Down
Loading