Skip to content

Commit 6939aa1

Browse files
committed
adapt and bless ui tests
1 parent 01acc8b commit 6939aa1

36 files changed

Lines changed: 215 additions & 75 deletions

tests/ui/associated-consts/assoc-const-eq-ty-alias-noninteracting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ trait SuperTrait {
2323

2424
fn take0(_: impl Trait<N = 0, N = ()>) {}
2525

26-
fn take1(_: impl Trait<Q = "...", Q = [()]>) {}
26+
fn take1(_: impl Trait<Q = "...", Q = ()>) {}
2727

2828
fn main() {}

tests/ui/associated-type-bounds/issue-102335-ty.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ trait T {
22
type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint
33
//~^ ERROR associated item constraints are not allowed here
44
//~| ERROR associated item constraints are not allowed here
5+
//~| ERROR: the trait bound `(): Q` is not satisfied [E0277]
56
}
67

78
trait T2 {
89
type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints
910
//~^ ERROR associated item constraints are not allowed here
1011
//~| ERROR associated item constraints are not allowed here
12+
//~| ERROR: the trait bound `(): Q` is not satisfied [E0277]
1113
}
1214

1315
trait Q {}

tests/ui/associated-type-bounds/issue-102335-ty.stderr

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,20 @@ LL - type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint
2323
LL + type A: S<C = ()>; // Just one erroneous equality constraint
2424
|
2525

26+
error[E0277]: the trait bound `(): Q` is not satisfied
27+
--> $DIR/issue-102335-ty.rs:2:15
28+
|
29+
LL | type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint
30+
| ^^^^^^^^^^^^^^^^^ the trait `Q` is not implemented for `()`
31+
|
32+
help: this trait has no implementations, consider adding one
33+
--> $DIR/issue-102335-ty.rs:15:1
34+
|
35+
LL | trait Q {}
36+
| ^^^^^^^
37+
2638
error[E0229]: associated item constraints are not allowed here
27-
--> $DIR/issue-102335-ty.rs:8:17
39+
--> $DIR/issue-102335-ty.rs:9:17
2840
|
2941
LL | type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints
3042
| ^^^^^^^^^ associated item constraint not allowed here
@@ -36,7 +48,7 @@ LL + type A: S<C<X = i32> = ()>; // More than one erroneous equality constra
3648
|
3749

3850
error[E0229]: associated item constraints are not allowed here
39-
--> $DIR/issue-102335-ty.rs:8:17
51+
--> $DIR/issue-102335-ty.rs:9:17
4052
|
4153
LL | type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints
4254
| ^^^^^^^^^ associated item constraint not allowed here
@@ -48,6 +60,19 @@ LL - type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equal
4860
LL + type A: S<C<X = i32> = ()>; // More than one erroneous equality constraints
4961
|
5062

51-
error: aborting due to 4 previous errors
63+
error[E0277]: the trait bound `(): Q` is not satisfied
64+
--> $DIR/issue-102335-ty.rs:9:15
65+
|
66+
LL | type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints
67+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Q` is not implemented for `()`
68+
|
69+
help: this trait has no implementations, consider adding one
70+
--> $DIR/issue-102335-ty.rs:15:1
71+
|
72+
LL | trait Q {}
73+
| ^^^^^^^
74+
75+
error: aborting due to 6 previous errors
5276

53-
For more information about this error, try `rustc --explain E0229`.
77+
Some errors have detailed explanations: E0229, E0277.
78+
For more information about an error, try `rustc --explain E0229`.

tests/ui/async-await/async-fn/dyn-in-return-type.fixed

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ trait T {
1212
//~^ ERROR return type cannot be a trait object without pointer indirection
1313
//~| HELP consider returning an `impl Trait` instead of a `dyn Trait`
1414
//~| HELP alternatively, box the return type, and wrap all of the returned values in `Box::new`
15+
//~| ERROR: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time [E0277]
16+
//~| HELP: the trait `Sized` is not implemented for `(dyn Debug + 'static)`
1517
Box::new("")
1618
}
1719
}

tests/ui/async-await/async-fn/dyn-in-return-type.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ trait T {
1212
//~^ ERROR return type cannot be a trait object without pointer indirection
1313
//~| HELP consider returning an `impl Trait` instead of a `dyn Trait`
1414
//~| HELP alternatively, box the return type, and wrap all of the returned values in `Box::new`
15+
//~| ERROR: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time [E0277]
16+
//~| HELP: the trait `Sized` is not implemented for `(dyn Debug + 'static)`
1517
Box::new("")
1618
}
1719
}

tests/ui/async-await/async-fn/dyn-in-return-type.stderr

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LL | async fn f(&self) -> Box<dyn core::fmt::Debug> {
3131
| ++++ +
3232

3333
error[E0746]: return type cannot be a trait object without pointer indirection
34-
--> $DIR/dyn-in-return-type.rs:19:26
34+
--> $DIR/dyn-in-return-type.rs:21:26
3535
|
3636
LL | async fn f(&self) -> dyn core::fmt::Debug {
3737
| ^^^^^^^^^^^^^^^^^^^^
@@ -46,6 +46,15 @@ help: alternatively, box the return type, and wrap all of the returned values in
4646
LL | async fn f(&self) -> Box<dyn core::fmt::Debug> {
4747
| ++++ +
4848

49-
error: aborting due to 3 previous errors
49+
error[E0277]: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time
50+
--> $DIR/dyn-in-return-type.rs:11:26
51+
|
52+
LL | async fn f(&self) -> dyn core::fmt::Debug {
53+
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
54+
|
55+
= help: the trait `Sized` is not implemented for `(dyn Debug + 'static)`
56+
57+
error: aborting due to 4 previous errors
5058

51-
For more information about this error, try `rustc --explain E0746`.
59+
Some errors have detailed explanations: E0277, E0746.
60+
For more information about an error, try `rustc --explain E0277`.

tests/ui/closures/issue-111932.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
trait Foo: std::fmt::Debug {}
22

3-
fn print_foos(foos: impl Iterator<Item = dyn Foo>) {
3+
fn print_foos(foos: impl Iterator<Item = dyn Foo>) { //~ ERROR [E0277]
44
foos.for_each(|foo| { //~ ERROR [E0277]
55
println!("{:?}", foo); //~ ERROR [E0277]
66
});

tests/ui/closures/issue-111932.stderr

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time
2+
--> $DIR/issue-111932.rs:3:35
3+
|
4+
LL | fn print_foos(foos: impl Iterator<Item = dyn Foo>) {
5+
| ^^^^^^^^^^^^^^ doesn't have a size known at compile-time
6+
|
7+
= help: the trait `Sized` is not implemented for `(dyn Foo + 'static)`
8+
19
error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time
210
--> $DIR/issue-111932.rs:4:20
311
|
@@ -19,6 +27,6 @@ LL | println!("{:?}", foo);
1927
= help: the trait `Sized` is not implemented for `dyn Foo`
2028
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
2129

22-
error: aborting due to 2 previous errors
30+
error: aborting due to 3 previous errors
2331

2432
For more information about this error, try `rustc --explain E0277`.

tests/ui/dropck/constrained_by_assoc_type_equality_and_self_ty.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
trait Trait {
22
type Assoc;
3+
//~^ ERROR: `Drop` impl requires `U: Sized` but the struct it is implemented for does not [E0367]
34
}
45

56
struct Foo<T: Trait, U: ?Sized>(T, U);
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
error[E0367]: `Drop` impl requires `<T as Trait>::Assoc == U` but the struct it is implemented for does not
2-
--> $DIR/constrained_by_assoc_type_equality_and_self_ty.rs:7:15
2+
--> $DIR/constrained_by_assoc_type_equality_and_self_ty.rs:8:15
33
|
44
LL | impl<T: Trait<Assoc = U>, U: ?Sized> Drop for Foo<T, U> {
55
| ^^^^^^^^^
66
|
77
note: the implementor must specify the same requirement
8-
--> $DIR/constrained_by_assoc_type_equality_and_self_ty.rs:5:1
8+
--> $DIR/constrained_by_assoc_type_equality_and_self_ty.rs:6:1
99
|
1010
LL | struct Foo<T: Trait, U: ?Sized>(T, U);
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

13-
error: aborting due to 1 previous error
13+
error[E0367]: `Drop` impl requires `U: Sized` but the struct it is implemented for does not
14+
--> $DIR/constrained_by_assoc_type_equality_and_self_ty.rs:2:5
15+
|
16+
LL | type Assoc;
17+
| ^^^^^^^^^^^
18+
|
19+
note: the implementor must specify the same requirement
20+
--> $DIR/constrained_by_assoc_type_equality_and_self_ty.rs:6:1
21+
|
22+
LL | struct Foo<T: Trait, U: ?Sized>(T, U);
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
25+
error: aborting due to 2 previous errors
1426

1527
For more information about this error, try `rustc --explain E0367`.

0 commit comments

Comments
 (0)