From 619a6964c757e9e94253fa6618fb03519ad2b55e Mon Sep 17 00:00:00 2001 From: omskscream Date: Sat, 13 Sep 2025 22:41:43 +0300 Subject: [PATCH 1/4] clean up issue-2284 (core marker trait name shadowing) --- tests/ui/issues/issue-2284.rs | 13 ------------ .../core-marker-name-shadowing-issue-2284.rs | 21 +++++++++++++++++++ 2 files changed, 21 insertions(+), 13 deletions(-) delete mode 100644 tests/ui/issues/issue-2284.rs create mode 100644 tests/ui/traits/core-marker-name-shadowing-issue-2284.rs diff --git a/tests/ui/issues/issue-2284.rs b/tests/ui/issues/issue-2284.rs deleted file mode 100644 index 358331ecd9a4c..0000000000000 --- a/tests/ui/issues/issue-2284.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ run-pass -#![allow(dead_code)] - -trait Send { - fn f(&self); -} - -fn f(t: T) { - t.f(); -} - -pub fn main() { -} diff --git a/tests/ui/traits/core-marker-name-shadowing-issue-2284.rs b/tests/ui/traits/core-marker-name-shadowing-issue-2284.rs new file mode 100644 index 0000000000000..e5d083ac8c3fb --- /dev/null +++ b/tests/ui/traits/core-marker-name-shadowing-issue-2284.rs @@ -0,0 +1,21 @@ +//@ run-pass +#![allow(dead_code)] + +//! Tests that user-defined trait is prioritized in compile time over +//! the core::marker trait with the same name, allowing shadowing core traits. +//! +//! # Context +//! Original issue: https://github.com/rust-lang/rust/issues/2284 +//! Original fix pull request: https://github.com/rust-lang/rust/pull/3792 + + +trait Send { + fn f(&self); +} + +fn f(t: T) { + t.f(); +} + +pub fn main() { +} From 05a5c7d0a104d3c3efbccb0aaf01b51495ad3080 Mon Sep 17 00:00:00 2001 From: omskscream Date: Sat, 13 Sep 2025 23:43:20 +0300 Subject: [PATCH 2/4] clean up issue-19479 (assoc type from another trait) --- .../assoc-type-via-another-trait-issue-19479.rs} | 6 ++++++ 1 file changed, 6 insertions(+) rename tests/ui/{issues/issue-19479.rs => traits/associated_type_bound/assoc-type-via-another-trait-issue-19479.rs} (50%) diff --git a/tests/ui/issues/issue-19479.rs b/tests/ui/traits/associated_type_bound/assoc-type-via-another-trait-issue-19479.rs similarity index 50% rename from tests/ui/issues/issue-19479.rs rename to tests/ui/traits/associated_type_bound/assoc-type-via-another-trait-issue-19479.rs index ed586b7655028..f17a89bcb5f42 100644 --- a/tests/ui/issues/issue-19479.rs +++ b/tests/ui/traits/associated_type_bound/assoc-type-via-another-trait-issue-19479.rs @@ -1,5 +1,11 @@ //@ check-pass +//! Tests that it's possible to define an associated type in a trait +//! using an associated type from type parameter bound trait in a blanket implementation. +//! +//! # Context +//! Original issue: https://github.com/rust-lang/rust/issues/19479 + trait Base { fn dummy(&self) { } } From 8ee3a08b871f8b24075f67eda06330f7005cd435 Mon Sep 17 00:00:00 2001 From: omskscream Date: Sat, 13 Sep 2025 23:56:55 +0300 Subject: [PATCH 3/4] clean up issue-18088 (operator from supertrait) --- tests/ui/issues/issue-18088.rs | 8 -------- .../inheritance/supertrait-operator-issue-18088.rs | 13 +++++++++++++ 2 files changed, 13 insertions(+), 8 deletions(-) delete mode 100644 tests/ui/issues/issue-18088.rs create mode 100644 tests/ui/traits/inheritance/supertrait-operator-issue-18088.rs diff --git a/tests/ui/issues/issue-18088.rs b/tests/ui/issues/issue-18088.rs deleted file mode 100644 index ba198884c639f..0000000000000 --- a/tests/ui/issues/issue-18088.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ check-pass - -pub trait Indexable: std::ops::Index { - fn index2(&self, i: usize) -> &T { - &self[i] - } -} -fn main() {} diff --git a/tests/ui/traits/inheritance/supertrait-operator-issue-18088.rs b/tests/ui/traits/inheritance/supertrait-operator-issue-18088.rs new file mode 100644 index 0000000000000..8bd45cd54a445 --- /dev/null +++ b/tests/ui/traits/inheritance/supertrait-operator-issue-18088.rs @@ -0,0 +1,13 @@ +//@ check-pass + +//! Tests that operators from supertrait are available directly on `self` for an inheritor trait. +//! +//! # Context +//! Original issue: https://github.com/rust-lang/rust/issues/18088 + +pub trait Indexable: std::ops::Index { + fn index2(&self, i: usize) -> &T { + &self[i] + } +} +fn main() {} From 22aecd3001038d0ac00ecd06985e2b0abc57e6dc Mon Sep 17 00:00:00 2001 From: omskscream Date: Sun, 14 Sep 2025 01:18:18 +0300 Subject: [PATCH 4/4] clean up issue-21950 (dyn trait cast without assoc type at the cast) --- tests/ui/issues/issue-21950.rs | 12 ------------ ...-as-dyn-trait-wo-assoc-type-issue-21950.rs | 19 +++++++++++++++++++ ...yn-trait-wo-assoc-type-issue-21950.stderr} | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) delete mode 100644 tests/ui/issues/issue-21950.rs create mode 100644 tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.rs rename tests/ui/{issues/issue-21950.stderr => traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.stderr} (85%) diff --git a/tests/ui/issues/issue-21950.rs b/tests/ui/issues/issue-21950.rs deleted file mode 100644 index 7a85ac91bca0f..0000000000000 --- a/tests/ui/issues/issue-21950.rs +++ /dev/null @@ -1,12 +0,0 @@ -trait Add { - type Output; -} - -impl Add for i32 { - type Output = i32; -} - -fn main() { - let x = &10 as &dyn Add; - //~^ ERROR E0191 -} diff --git a/tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.rs b/tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.rs new file mode 100644 index 0000000000000..3c3815054502f --- /dev/null +++ b/tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.rs @@ -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 { + type Output; +} + +impl Add for i32 { + type Output = i32; +} + +fn main() { + let x = &10 as &dyn Add; //OK + let x = &10 as &dyn Add; + //~^ ERROR E0191 +} diff --git a/tests/ui/issues/issue-21950.stderr b/tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.stderr similarity index 85% rename from tests/ui/issues/issue-21950.stderr rename to tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.stderr index 24230cfe17f3d..5f4974e6f237d 100644 --- a/tests/ui/issues/issue-21950.stderr +++ b/tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.stderr @@ -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