Skip to content

Commit bed5ff4

Browse files
author
Alexander Regueiro
committed
Updated tests and stderr files.
1 parent 571182a commit bed5ff4

12 files changed

+146
-61
lines changed

src/test/run-pass/issues/issue-21058.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
// run-pass
2+
23
#![allow(dead_code)]
34
#![feature(core_intrinsics)]
45

56
struct NT(str);
67
struct DST { a: u32, b: str }
78

89
fn main() {
9-
// type_name should support unsized types
10+
// `type_name` should support unsized types
1011
assert_eq!(unsafe {(
1112
// Slice
1213
std::intrinsics::type_name::<[u8]>(),
13-
// str
14+
// `str`
1415
std::intrinsics::type_name::<str>(),
1516
// Trait
1617
std::intrinsics::type_name::<Send>(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
warning: duplicate auto trait `std::marker::Sync` found in trait object
2+
--> $DIR/issue-33140.rs:33:21
3+
|
4+
LL | impl Trait2 for dyn Sync + Send + Sync {
5+
| ^^^^ ^^^^ subsequent use of auto trait
6+
| |
7+
| first use of auto trait
8+
|
9+
= note: #[warn(duplicate_auto_traits_in_trait_objects)] on by default
10+
11+
warning: duplicate auto trait `std::marker::Sync` found in trait object
12+
--> $DIR/issue-33140.rs:54:21
13+
|
14+
LL | assert_eq!(<dyn Sync+Send+Sync>::uvw(), true);
15+
| ^^^^ ^^^^ subsequent use of auto trait
16+
| |
17+
| first use of auto trait
18+
19+
warning: duplicate auto trait `std::marker::Sync` found in trait object
20+
--> $DIR/issue-33140.rs:33:21
21+
|
22+
LL | impl Trait2 for dyn Sync + Send + Sync {
23+
| ^^^^ ^^^^ subsequent use of auto trait
24+
| |
25+
| first use of auto trait
26+

src/test/run-pass/traits/trait-object-auto-dedup.stderr

-17
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ LL | fn takes_dyn_trait_send_send(_: Box<dyn Trait + Send + Send>) {}
77
| first use of auto trait
88
|
99
= note: #[warn(duplicate_auto_traits_in_trait_objects)] on by default
10-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
11-
= note: for more information, see issue #56522 <https://github.com/rust-lang/rust/issues/56522>
1210

1311
warning: duplicate auto trait `std::marker::Send` found in trait object
1412
--> $DIR/trait-object-auto-dedup.rs:29:54
@@ -17,9 +15,6 @@ LL | fn takes_dyn_trait_send_sendalias(_: Box<dyn Trait + Send + SendAlias>) {}
1715
| ^^^^ ^^^^^^^^^ subsequent use of auto trait
1816
| |
1917
| first use of auto trait
20-
|
21-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
22-
= note: for more information, see issue #56522 <https://github.com/rust-lang/rust/issues/56522>
2318

2419
warning: duplicate auto trait `std::marker::Send` found in trait object
2520
--> $DIR/trait-object-auto-dedup.rs:31:18
@@ -28,9 +23,6 @@ LL | impl dyn Trait + Send + Send {
2823
| ^^^^ ^^^^ subsequent use of auto trait
2924
| |
3025
| first use of auto trait
31-
|
32-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
33-
= note: for more information, see issue #56522 <https://github.com/rust-lang/rust/issues/56522>
3426

3527
warning: duplicate auto trait `std::marker::Send` found in trait object
3628
--> $DIR/trait-object-auto-dedup.rs:38:46
@@ -39,9 +31,6 @@ LL | let dyn_trait_send_send: Box<dyn Trait + Send + Send> = dyn_trait_send;
3931
| ^^^^ ^^^^ subsequent use of auto trait
4032
| |
4133
| first use of auto trait
42-
|
43-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
44-
= note: for more information, see issue #56522 <https://github.com/rust-lang/rust/issues/56522>
4534

4635
warning: duplicate auto trait `std::marker::Send` found in trait object
4736
--> $DIR/trait-object-auto-dedup.rs:45:67
@@ -50,9 +39,6 @@ LL | let dyn_trait_send_send = Box::new(Struct) as Box<dyn Trait + Send + Se
5039
| ^^^^ ^^^^ subsequent use of auto trait
5140
| |
5241
| first use of auto trait
53-
|
54-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
55-
= note: for more information, see issue #56522 <https://github.com/rust-lang/rust/issues/56522>
5642

5743
warning: duplicate auto trait `std::marker::Send` found in trait object
5844
--> $DIR/trait-object-auto-dedup.rs:28:49
@@ -61,7 +47,4 @@ LL | fn takes_dyn_trait_send_send(_: Box<dyn Trait + Send + Send>) {}
6147
| ^^^^ ^^^^ subsequent use of auto trait
6248
| |
6349
| first use of auto trait
64-
|
65-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
66-
= note: for more information, see issue #56522 <https://github.com/rust-lang/rust/issues/56522>
6750

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
fn main() {
2-
&1 as Send; //~ ERROR cast to unsized
3-
Box::new(1) as Send; //~ ERROR cast to unsized
2+
&1 as Send; //~ ERROR cast to unsized type
3+
Box::new(1) as Send; //~ ERROR cast to unsized type
44
}

src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
error[E0620]: cast to unsized type: `&{integer}` as `dyn std::marker::Send`
22
--> $DIR/cast-to-unsized-trait-object-suggestion.rs:2:5
33
|
4-
LL | &1 as Send; //~ ERROR cast to unsized
4+
LL | &1 as Send; //~ ERROR cast to unsized type
55
| ^^^^^^----
66
| |
77
| help: try casting to a reference instead: `&Send`
88

99
error[E0620]: cast to unsized type: `std::boxed::Box<{integer}>` as `dyn std::marker::Send`
1010
--> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5
1111
|
12-
LL | Box::new(1) as Send; //~ ERROR cast to unsized
12+
LL | Box::new(1) as Send; //~ ERROR cast to unsized type
1313
| ^^^^^^^^^^^^^^^----
1414
| |
1515
| help: try casting to a `Box` instead: `Box<Send>`

src/test/ui/issues/issue-33140.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore-tidy-linelength
2+
13
#![deny(order_dependent_trait_objects)]
24

35
trait Trait {
@@ -25,6 +27,7 @@ impl Trait2 for dyn Send + Sync {
2527
impl Trait2 for dyn Sync + Send + Sync {
2628
//~^ ERROR conflicting implementations
2729
//~| hard error
30+
//~^^^ WARNING duplicate auto trait `std::marker::Sync` found in trait object [duplicate_auto_traits_in_trait_objects]
2831
fn uvw() -> bool { true }
2932
}
3033

@@ -43,10 +46,10 @@ impl Foo<dyn Sync + Send> {
4346
}
4447

4548
fn main() {
46-
assert_eq!(<Send+Sync>::xyz(), false);
47-
assert_eq!(<Sync+Send>::xyz(), true);
48-
assert_eq!(<Send+Sync>::uvw(), false);
49-
assert_eq!(<Sync+Send+Sync>::uvw(), true);
50-
assert_eq!(<Foo<Send+Sync>>::abc(), false);
51-
assert_eq!(<Foo<Sync+Send>>::abc(), true);
49+
assert_eq!(<Send + Sync>::xyz(), false);
50+
assert_eq!(<Sync + Send>::xyz(), true);
51+
assert_eq!(<Send + Sync>::uvw(), false);
52+
assert_eq!(<Sync + Send + Sync>::uvw(), true);
53+
assert_eq!(<Foo<Send + Sync>>::abc(), false);
54+
assert_eq!(<Foo<Sync + Send>>::abc(), true);
5255
}

src/test/ui/issues/issue-33140.stderr

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
warning: duplicate auto trait `std::marker::Sync` found in trait object
2+
--> $DIR/issue-33140.rs:27:21
3+
|
4+
LL | impl Trait2 for dyn Sync + Send + Sync {
5+
| ^^^^ ^^^^ subsequent use of auto trait
6+
| |
7+
| first use of auto trait
8+
|
9+
= note: #[warn(duplicate_auto_traits_in_trait_objects)] on by default
10+
111
error: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
2-
--> $DIR/issue-33140.rs:11:1
12+
--> $DIR/issue-33140.rs:13:1
313
|
414
LL | impl Trait for dyn Send + Sync {
515
| ------------------------------ first implementation here
@@ -8,15 +18,15 @@ LL | impl Trait for dyn Sync + Send {
818
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
919
|
1020
note: lint level defined here
11-
--> $DIR/issue-33140.rs:1:9
21+
--> $DIR/issue-33140.rs:3:9
1222
|
1323
LL | #![deny(order_dependent_trait_objects)]
1424
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1525
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1626
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
1727

1828
error: conflicting implementations of trait `Trait2` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
19-
--> $DIR/issue-33140.rs:25:1
29+
--> $DIR/issue-33140.rs:27:1
2030
|
2131
LL | impl Trait2 for dyn Send + Sync {
2232
| ------------------------------- first implementation here
@@ -28,7 +38,7 @@ LL | impl Trait2 for dyn Sync + Send + Sync {
2838
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
2939

3040
error: duplicate definitions with name `abc` (E0592)
31-
--> $DIR/issue-33140.rs:33:5
41+
--> $DIR/issue-33140.rs:36:5
3242
|
3343
LL | / fn abc() -> bool { //~ ERROR duplicate definitions with name `abc`
3444
LL | | //~| hard error
+8-19
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,37 @@
11
warning: duplicate auto trait `std::marker::Send` found in trait object
2-
--> $DIR/lint-duplicate-traits.rs:11:18
2+
--> $DIR/lint-duplicate-traits.rs:13:18
33
|
4-
LL | impl Foo for dyn Send + Send {}
4+
LL | impl Bar for dyn Send + Send {}
55
| ^^^^ ^^^^ subsequent use of auto trait
66
| |
77
| first use of auto trait
88
|
99
= note: #[warn(duplicate_auto_traits_in_trait_objects)] on by default
10-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
11-
= note: for more information, see issue #56522 <https://github.com/rust-lang/rust/issues/56522>
1210

1311
warning: duplicate auto trait `std::marker::Send` found in trait object
14-
--> $DIR/lint-duplicate-traits.rs:13:18
12+
--> $DIR/lint-duplicate-traits.rs:15:18
1513
|
16-
LL | impl Foo for dyn Send + Sync + Send + SyncAlias {}
14+
LL | impl Baz for dyn Send + Sync + Send + SyncAlias {}
1715
| ^^^^ ^^^^ subsequent use of auto trait
1816
| |
1917
| first use of auto trait
20-
|
21-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
22-
= note: for more information, see issue #56522 <https://github.com/rust-lang/rust/issues/56522>
2318

2419
warning: duplicate auto trait `std::marker::Sync` found in trait object
25-
--> $DIR/lint-duplicate-traits.rs:13:25
20+
--> $DIR/lint-duplicate-traits.rs:15:25
2621
|
2722
LL | trait SyncAlias = Sync;
2823
| ---- subsequent use of auto trait
2924
...
30-
LL | impl Foo for dyn Send + Sync + Send + SyncAlias {}
25+
LL | impl Baz for dyn Send + Sync + Send + SyncAlias {}
3126
| ^^^^ ^^^^^^^^^
3227
| |
3328
| first use of auto trait
34-
|
35-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
36-
= note: for more information, see issue #56522 <https://github.com/rust-lang/rust/issues/56522>
3729

3830
warning: duplicate auto trait `std::marker::Send` found in trait object
39-
--> $DIR/lint-duplicate-traits.rs:11:18
31+
--> $DIR/lint-duplicate-traits.rs:13:18
4032
|
41-
LL | impl Foo for dyn Send + Send {}
33+
LL | impl Bar for dyn Send + Send {}
4234
| ^^^^ ^^^^ subsequent use of auto trait
4335
| |
4436
| first use of auto trait
45-
|
46-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
47-
= note: for more information, see issue #56522 <https://github.com/rust-lang/rust/issues/56522>
4837

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// ignore-tidy-linelength
2+
3+
trait Foo {}
4+
5+
impl Foo for dyn Send {}
6+
7+
impl Foo for dyn Send + Send {}
8+
//~^ ERROR conflicting implementations
9+
//~| hard error
10+
//~^^^ WARNING duplicate auto trait `std::marker::Send` found in trait object [duplicate_auto_traits_in_trait_objects]
11+
12+
impl Foo for dyn Send + Sync {}
13+
14+
impl Foo for dyn Sync + Send {}
15+
//~^ ERROR conflicting implementations
16+
//~| hard error
17+
18+
impl Foo for dyn Send + Sync + Send {}
19+
//~^ ERROR conflicting implementations
20+
//~| hard error
21+
//~^^^ WARNING duplicate auto trait `std::marker::Send` found in trait object [duplicate_auto_traits_in_trait_objects]
22+
23+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
warning: duplicate auto trait `std::marker::Send` found in trait object
2+
--> $DIR/lint-incoherent-auto-trait-objects.rs:7:18
3+
|
4+
LL | impl Foo for dyn Send + Send {}
5+
| ^^^^ ^^^^ subsequent use of auto trait
6+
| |
7+
| first use of auto trait
8+
|
9+
= note: #[warn(duplicate_auto_traits_in_trait_objects)] on by default
10+
11+
warning: duplicate auto trait `std::marker::Send` found in trait object
12+
--> $DIR/lint-incoherent-auto-trait-objects.rs:18:18
13+
|
14+
LL | impl Foo for dyn Send + Sync + Send {}
15+
| ^^^^ ^^^^ subsequent use of auto trait
16+
| |
17+
| first use of auto trait
18+
19+
error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + 'static)`: (E0119)
20+
--> $DIR/lint-incoherent-auto-trait-objects.rs:7:1
21+
|
22+
LL | impl Foo for dyn Send {}
23+
| --------------------- first implementation here
24+
LL |
25+
LL | impl Foo for dyn Send + Send {}
26+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)`
27+
|
28+
= note: #[deny(order_dependent_trait_objects)] on by default
29+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
30+
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
31+
32+
error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
33+
--> $DIR/lint-incoherent-auto-trait-objects.rs:14:1
34+
|
35+
LL | impl Foo for dyn Send + Sync {}
36+
| ---------------------------- first implementation here
37+
LL |
38+
LL | impl Foo for dyn Sync + Send {}
39+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
40+
|
41+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
42+
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
43+
44+
error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Sync + std::marker::Send + 'static)`: (E0119)
45+
--> $DIR/lint-incoherent-auto-trait-objects.rs:18:1
46+
|
47+
LL | impl Foo for dyn Sync + Send {}
48+
| ---------------------------- first implementation here
49+
...
50+
LL | impl Foo for dyn Send + Sync + Send {}
51+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Sync + std::marker::Send + 'static)`
52+
|
53+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
54+
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
55+
56+
error: aborting due to 3 previous errors
57+

src/test/ui/traits/trait-object-auto-dedup-in-impl.rs

-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ trait Trait {}
1212
type Send1 = Trait + Send;
1313
type Send2 = Trait + Send + Send;
1414
//~^ WARNING duplicate auto trait `std::marker::Send` found in trait object [duplicate_auto_traits_in_trait_objects]
15-
//~| this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1615

1716
fn main () {}
1817

@@ -22,6 +21,5 @@ impl Trait + Send {
2221

2322
impl Trait + Send + Send {
2423
//~^ WARNING duplicate auto trait `std::marker::Send` found in trait object [duplicate_auto_traits_in_trait_objects]
25-
//~| this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2624
fn test(&self) { println!("two"); }
2725
}

src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr

+2-7
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,17 @@ LL | type Send2 = Trait + Send + Send;
77
| first use of auto trait
88
|
99
= note: #[warn(duplicate_auto_traits_in_trait_objects)] on by default
10-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
11-
= note: for more information, see issue #56522 <https://github.com/rust-lang/rust/issues/56522>
1210

1311
warning: duplicate auto trait `std::marker::Send` found in trait object
14-
--> $DIR/trait-object-auto-dedup-in-impl.rs:23:14
12+
--> $DIR/trait-object-auto-dedup-in-impl.rs:22:14
1513
|
1614
LL | impl Trait + Send + Send {
1715
| ^^^^ ^^^^ subsequent use of auto trait
1816
| |
1917
| first use of auto trait
20-
|
21-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
22-
= note: for more information, see issue #56522 <https://github.com/rust-lang/rust/issues/56522>
2318

2419
error[E0592]: duplicate definitions with name `test`
25-
--> $DIR/trait-object-auto-dedup-in-impl.rs:20:5
20+
--> $DIR/trait-object-auto-dedup-in-impl.rs:19:5
2621
|
2722
LL | fn test(&self) { println!("one"); } //~ ERROR duplicate definitions with name `test`
2823
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `test`

0 commit comments

Comments
 (0)