Skip to content

Commit 9b611a3

Browse files
committed
update tests
1 parent 05d0417 commit 9b611a3

File tree

101 files changed

+430
-471
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+430
-471
lines changed

tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ fn foo() -> impl Sized {
1414
loop {
1515
match foo() {
1616
//~^ ERROR higher-ranked subtype error
17-
//~^^ ERROR higher-ranked subtype error
17+
//~| ERROR higher-ranked subtype error
18+
//~| ERROR higher-ranked subtype error
19+
//~| ERROR higher-ranked subtype error
1820
Subtype::Bar => (),
1921
//~^ ERROR higher-ranked subtype error
20-
//~^^ ERROR higher-ranked subtype error
22+
//~| ERROR higher-ranked subtype error
2123
Supertype::Var(x) => {}
2224
}
2325
}

tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.stderr

+19-3
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,34 @@ LL | match foo() {
2525
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
2626

2727
error: higher-ranked subtype error
28-
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:18:13
28+
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:15:15
29+
|
30+
LL | match foo() {
31+
| ^^^^^
32+
|
33+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
34+
35+
error: higher-ranked subtype error
36+
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:15:15
37+
|
38+
LL | match foo() {
39+
| ^^^^^
40+
|
41+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
42+
43+
error: higher-ranked subtype error
44+
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:20:13
2945
|
3046
LL | Subtype::Bar => (),
3147
| ^^^^^^^^^^^^
3248

3349
error: higher-ranked subtype error
34-
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:18:13
50+
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:20:13
3551
|
3652
LL | Subtype::Bar => (),
3753
| ^^^^^^^^^^^^
3854
|
3955
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
4056

41-
error: aborting due to 4 previous errors; 1 warning emitted
57+
error: aborting due to 6 previous errors; 1 warning emitted
4258

tests/ui/coroutine/clone-rpit.next.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ note: ...which requires type-checking `foo::{closure#0}`...
3535
LL | move |_: ()| {
3636
| ^^^^^^^^^^^^
3737
= note: ...which again requires type-checking `foo`, completing the cycle
38-
note: cycle used when computing type of opaque `foo::{opaque#0}`
39-
--> $DIR/clone-rpit.rs:13:25
38+
note: cycle used when match-checking `foo`
39+
--> $DIR/clone-rpit.rs:13:1
4040
|
4141
LL | pub fn foo<'a, 'b>() -> impl Clone {
42-
| ^^^^^^^^^^
42+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4343
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
4444

4545
error: aborting due to 1 previous error

tests/ui/generic-associated-types/issue-87258_a.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ pub trait Trait2 {
1515

1616
impl<'c, S: Trait2> Trait2 for &'c mut S {
1717
type FooFuture<'a> = impl Trait1;
18-
//~^ ERROR unconstrained opaque type
1918
fn foo<'a>() -> Self::FooFuture<'a> {
19+
//~^ ERROR item does not constrain
2020
Struct(unimplemented!())
2121
}
2222
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
error: unconstrained opaque type
1+
error: item does not constrain `<&'c mut S as Trait2>::FooFuture::{opaque#0}`
2+
--> $DIR/issue-87258_a.rs:18:8
3+
|
4+
LL | fn foo<'a>() -> Self::FooFuture<'a> {
5+
| ^^^
6+
|
7+
= note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
8+
note: this opaque type is supposed to be constrained
29
--> $DIR/issue-87258_a.rs:17:26
310
|
411
LL | type FooFuture<'a> = impl Trait1;
512
| ^^^^^^^^^^^
6-
|
7-
= note: `FooFuture` must be used in combination with a concrete type within the same impl
813

914
error: aborting due to 1 previous error
1015

tests/ui/generic-associated-types/issue-87258_b.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ pub trait Trait2 {
1414
}
1515

1616
type Helper<'xenon, 'yttrium, KABOOM: Trait2> = impl Trait1;
17-
//~^ ERROR unconstrained opaque type
1817

1918
impl<'c, S: Trait2> Trait2 for &'c mut S {
2019
type FooFuture<'a> = Helper<'c, 'a, S>;
2120
#[define_opaque(Helper)]
2221
fn foo<'a>() -> Self::FooFuture<'a> {
22+
//~^ ERROR item does not constrain `Helper::{opaque#0}`
2323
Struct(unimplemented!())
2424
}
2525
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
error: unconstrained opaque type
1+
error: item does not constrain `Helper::{opaque#0}`
2+
--> $DIR/issue-87258_b.rs:21:8
3+
|
4+
LL | fn foo<'a>() -> Self::FooFuture<'a> {
5+
| ^^^
6+
|
7+
= note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
8+
note: this opaque type is supposed to be constrained
29
--> $DIR/issue-87258_b.rs:16:49
310
|
411
LL | type Helper<'xenon, 'yttrium, KABOOM: Trait2> = impl Trait1;
512
| ^^^^^^^^^^^
6-
|
7-
= note: `Helper` must be used in combination with a concrete type within the same crate
813

914
error: aborting due to 1 previous error
1015

Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
1-
error: item does not constrain `Foo::{opaque#0}`
2-
--> $DIR/norm-before-method-resolution-opaque-type.rs:17:4
3-
|
4-
LL | fn weird_bound<X>(x: &<X as Trait<'static>>::Out<Foo>) -> X
5-
| ^^^^^^^^^^^
6-
|
7-
= note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
8-
note: this opaque type is supposed to be constrained
9-
--> $DIR/norm-before-method-resolution-opaque-type.rs:14:12
10-
|
11-
LL | type Foo = impl Sized;
12-
| ^^^^^^^^^^
13-
141
error[E0507]: cannot move out of `*x` which is behind a shared reference
15-
--> $DIR/norm-before-method-resolution-opaque-type.rs:23:13
2+
--> $DIR/norm-before-method-resolution-opaque-type.rs:22:13
163
|
174
LL | let x = *x;
185
| ^^ move occurs because `*x` has type `<X as Trait<'_>>::Out<Foo>`, which does not implement the `Copy` trait
@@ -23,6 +10,6 @@ LL - let x = *x;
2310
LL + let x = x;
2411
|
2512

26-
error: aborting due to 2 previous errors
13+
error: aborting due to 1 previous error
2714

2815
For more information about this error, try `rustc --explain E0507`.

tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ type Foo = impl Sized;
1515

1616
#[define_opaque(Foo)]
1717
fn weird_bound<X>(x: &<X as Trait<'static>>::Out<Foo>) -> X
18-
//[old]~^ ERROR: item does not constrain
1918
where
2019
for<'a> X: Trait<'a>,
2120
for<'a> <X as Trait<'a>>::Out<()>: Copy,

tests/ui/impl-trait/impl-fn-hrtb-bounds-2.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
use std::fmt::Debug;
33

44
fn a() -> impl Fn(&u8) -> impl Debug {
5-
|x| x //~ ERROR hidden type for `impl Debug` captures lifetime that does not appear in bounds
5+
|x| x
6+
//~^ ERROR hidden type for `impl Debug` captures lifetime that does not appear in bounds
7+
//~| ERROR hidden type for `impl Debug` captures lifetime that does not appear in bounds
68
}
79

810
fn main() {}

tests/ui/impl-trait/impl-fn-hrtb-bounds-2.stderr

+11-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ LL | |x| x
88
| |
99
| hidden type `&u8` captures the anonymous lifetime as defined here
1010

11-
error: aborting due to 1 previous error
11+
error[E0700]: hidden type for `impl Debug` captures lifetime that does not appear in bounds
12+
--> $DIR/impl-fn-hrtb-bounds-2.rs:5:5
13+
|
14+
LL | fn a() -> impl Fn(&u8) -> impl Debug {
15+
| ---------- opaque type defined here
16+
LL | |x| x
17+
| ^^^^^
18+
|
19+
= note: hidden type `&u8` captures lifetime `'_`
20+
21+
error: aborting due to 2 previous errors
1222

1323
For more information about this error, try `rustc --explain E0700`.

tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
55
//~^ WARNING elided lifetime has a name
66
|x| x
77
//~^ ERROR expected generic lifetime parameter, found `'_`
8+
//~| ERROR expected generic lifetime parameter, found `'_`
89
}
910

1011
fn _b<'a>() -> impl Fn(&'a u8) -> (impl Debug + 'a) {

tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr

+10-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ LL |
1515
LL | |x| x
1616
| ^
1717

18-
error: aborting due to 1 previous error; 1 warning emitted
18+
error[E0792]: expected generic lifetime parameter, found `'_`
19+
--> $DIR/impl-fn-predefined-lifetimes.rs:6:5
20+
|
21+
LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
22+
| -- this generic parameter must be used with a generic lifetime parameter
23+
LL |
24+
LL | |x| x
25+
| ^^^^^
26+
27+
error: aborting due to 2 previous errors; 1 warning emitted
1928

2029
For more information about this error, try `rustc --explain E0792`.

tests/ui/impl-trait/issue-55872-1.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ impl<S: Default> Bar for S {
1313
//~^ ERROR impl has stricter requirements than trait
1414
//~| ERROR the trait bound `S: Copy` is not satisfied in `(S, T)` [E0277]
1515
//~| ERROR the trait bound `T: Copy` is not satisfied in `(S, T)` [E0277]
16+
//~| ERROR type parameter `T` is part of concrete type
1617
(S::default(), T::default())
1718
}
1819
}

tests/ui/impl-trait/issue-55872-1.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ help: consider further restricting type parameter `T` with trait `Copy`
3737
LL | fn foo<T: Default + std::marker::Copy>() -> Self::E {
3838
| +++++++++++++++++++
3939

40-
error: aborting due to 3 previous errors
40+
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
41+
--> $DIR/issue-55872-1.rs:12:29
42+
|
43+
LL | fn foo<T: Default>() -> Self::E {
44+
| ^^^^^^^
45+
46+
error: aborting due to 4 previous errors
4147

4248
Some errors have detailed explanations: E0276, E0277.
4349
For more information about an error, try `rustc --explain E0276`.

tests/ui/impl-trait/issue-55872-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ pub trait Bar {
1111
impl<S> Bar for S {
1212
type E = impl std::marker::Send;
1313
fn foo<T>() -> Self::E {
14-
async {}
1514
//~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
1615
//~| ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
16+
async {}
1717
}
1818
}
1919

tests/ui/impl-trait/issue-55872-2.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
2-
--> $DIR/issue-55872-2.rs:14:9
2+
--> $DIR/issue-55872-2.rs:13:20
33
|
4-
LL | async {}
5-
| ^^^^^^^^
4+
LL | fn foo<T>() -> Self::E {
5+
| ^^^^^^^
66

77
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
8-
--> $DIR/issue-55872-2.rs:14:9
8+
--> $DIR/issue-55872-2.rs:13:20
99
|
10-
LL | async {}
11-
| ^^^^^^^^
10+
LL | fn foo<T>() -> Self::E {
11+
| ^^^^^^^
1212
|
1313
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1414

tests/ui/impl-trait/issue-55872-3.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ impl<S> Bar for S {
1313
type E = impl std::marker::Copy;
1414
fn foo<T>() -> Self::E {
1515
//~^ ERROR : Copy` is not satisfied [E0277]
16+
//~| ERROR type parameter `T` is part of concrete type
1617
async {}
1718
}
1819
}
+11-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:16:9: 16:14}: Copy` is not satisfied
1+
error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:17:9: 17:14}: Copy` is not satisfied
22
--> $DIR/issue-55872-3.rs:14:20
33
|
44
LL | fn foo<T>() -> Self::E {
5-
| ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:16:9: 16:14}`
6-
LL |
5+
| ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:17:9: 17:14}`
6+
...
77
LL | async {}
8-
| -------- return type was inferred to be `{async block@$DIR/issue-55872-3.rs:16:9: 16:14}` here
8+
| -------- return type was inferred to be `{async block@$DIR/issue-55872-3.rs:17:9: 17:14}` here
99

10-
error: aborting due to 1 previous error
10+
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
11+
--> $DIR/issue-55872-3.rs:14:20
12+
|
13+
LL | fn foo<T>() -> Self::E {
14+
| ^^^^^^^
15+
16+
error: aborting due to 2 previous errors
1117

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

tests/ui/impl-trait/issue-55872.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ impl<S> Bar for S {
1010
type E = impl Copy;
1111

1212
fn foo<T>() -> Self::E {
13-
|| ()
1413
//~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
14+
|| ()
1515
}
1616
}
1717

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
2-
--> $DIR/issue-55872.rs:13:9
2+
--> $DIR/issue-55872.rs:12:20
33
|
4-
LL | || ()
5-
| ^^^^^
4+
LL | fn foo<T>() -> Self::E {
5+
| ^^^^^^^
66

77
error: aborting due to 1 previous error
88

tests/ui/impl-trait/issue-99073-2.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ fn main() {
77
fn test<T: Display>(t: T, recurse: bool) -> impl Display {
88
let f = || {
99
let i: u32 = test::<i32>(-1, false);
10-
//~^ ERROR concrete type differs from previous defining opaque type use
11-
//~| ERROR expected generic type parameter, found `i32`
10+
//~^ ERROR expected generic type parameter, found `i32`
1211
println!("{i}");
1312
};
1413
if recurse {
+1-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
error: concrete type differs from previous defining opaque type use
2-
--> $DIR/issue-99073-2.rs:9:22
3-
|
4-
LL | let i: u32 = test::<i32>(-1, false);
5-
| ^^^^^^^^^^^^^^^^^^^^^^ expected `T`, got `u32`
6-
|
7-
note: previous use here
8-
--> $DIR/issue-99073-2.rs:7:45
9-
|
10-
LL | fn test<T: Display>(t: T, recurse: bool) -> impl Display {
11-
| ^^^^^^^^^^^^
12-
131
error[E0792]: expected generic type parameter, found `i32`
142
--> $DIR/issue-99073-2.rs:9:22
153
|
@@ -19,6 +7,6 @@ LL | let f = || {
197
LL | let i: u32 = test::<i32>(-1, false);
208
| ^^^^^^^^^^^^^^^^^^^^^^
219

22-
error: aborting due to 2 previous errors
10+
error: aborting due to 1 previous error
2311

2412
For more information about this error, try `rustc --explain E0792`.

tests/ui/impl-trait/issue-99073.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ fn main() {
44

55
fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() {
66
move || f(fix(&f))
7-
//~^ ERROR concrete type differs from previous defining opaque type use
8-
//~| ERROR expected generic type parameter, found `&F`
7+
//~^ ERROR expected generic type parameter, found `&F`
98
}
+3-15
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
1-
error: concrete type differs from previous defining opaque type use
2-
--> $DIR/issue-99073.rs:6:13
3-
|
4-
LL | move || f(fix(&f))
5-
| ^^^^^^^ expected `{closure@$DIR/issue-99073.rs:6:3: 6:10}`, got `G`
6-
|
7-
note: previous use here
8-
--> $DIR/issue-99073.rs:5:36
9-
|
10-
LL | fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() {
11-
| ^^^^^^^^^
12-
131
error[E0792]: expected generic type parameter, found `&F`
14-
--> $DIR/issue-99073.rs:6:11
2+
--> $DIR/issue-99073.rs:6:13
153
|
164
LL | fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() {
175
| - this generic parameter must be used with a generic type parameter
186
LL | move || f(fix(&f))
19-
| ^^^^^^^^^^
7+
| ^^^^^^^
208

21-
error: aborting due to 2 previous errors
9+
error: aborting due to 1 previous error
2210

2311
For more information about this error, try `rustc --explain E0792`.

0 commit comments

Comments
 (0)