Skip to content

Commit a5d56ca

Browse files
authored
Unrolled build for #146536
Rollup merge of #146536 - omskscream:#133895/clean-ui-tests, r=davidtwco clean up several trait related UI tests Part of #133895 Cleaned up several `issue-xxxx` trait related tests from `/tests/ui/issues`, one commit per issue for review. Will squash them once approved. Related issues: #19479 #2284 #18088 #21950
2 parents 4645a79 + 22aecd3 commit a5d56ca

8 files changed

+60
-34
lines changed

tests/ui/issues/issue-18088.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/ui/issues/issue-21950.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/ui/issues/issue-2284.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/ui/issues/issue-19479.rs renamed to tests/ui/traits/associated_type_bound/assoc-type-via-another-trait-issue-19479.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
//@ check-pass
22

3+
//! Tests that it's possible to define an associated type in a trait
4+
//! using an associated type from type parameter bound trait in a blanket implementation.
5+
//!
6+
//! # Context
7+
//! Original issue: https://github.com/rust-lang/rust/issues/19479
8+
39
trait Base {
410
fn dummy(&self) { }
511
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//! Tests that compiler yields error E0191 when value with existing trait implementation
2+
//! is cast as same `dyn` trait without specifying associated type at the cast.
3+
//!
4+
//! # Context
5+
//! Original issue: https://github.com/rust-lang/rust/issues/21950
6+
7+
trait Add<Rhs=Self> {
8+
type Output;
9+
}
10+
11+
impl Add for i32 {
12+
type Output = i32;
13+
}
14+
15+
fn main() {
16+
let x = &10 as &dyn Add<i32, Output = i32>; //OK
17+
let x = &10 as &dyn Add;
18+
//~^ ERROR E0191
19+
}

tests/ui/issues/issue-21950.stderr renamed to tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0191]: the value of the associated type `Output` in `Add` must be specified
2-
--> $DIR/issue-21950.rs:10:25
2+
--> $DIR/cast-as-dyn-trait-wo-assoc-type-issue-21950.rs:17:25
33
|
44
LL | type Output;
55
| ----------- `Output` defined here
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@ run-pass
2+
#![allow(dead_code)]
3+
4+
//! Tests that user-defined trait is prioritized in compile time over
5+
//! the core::marker trait with the same name, allowing shadowing core traits.
6+
//!
7+
//! # Context
8+
//! Original issue: https://github.com/rust-lang/rust/issues/2284
9+
//! Original fix pull request: https://github.com/rust-lang/rust/pull/3792
10+
11+
12+
trait Send {
13+
fn f(&self);
14+
}
15+
16+
fn f<T:Send>(t: T) {
17+
t.f();
18+
}
19+
20+
pub fn main() {
21+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ check-pass
2+
3+
//! Tests that operators from supertrait are available directly on `self` for an inheritor trait.
4+
//!
5+
//! # Context
6+
//! Original issue: https://github.com/rust-lang/rust/issues/18088
7+
8+
pub trait Indexable<T>: std::ops::Index<usize, Output = T> {
9+
fn index2(&self, i: usize) -> &T {
10+
&self[i]
11+
}
12+
}
13+
fn main() {}

0 commit comments

Comments
 (0)