Skip to content

Commit 30ed152

Browse files
committed
update tests
1 parent 412c6e0 commit 30ed152

35 files changed

+366
-191
lines changed

tests/ui/associated-inherent-types/issue-109789.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0308]: mismatched types
2-
--> $DIR/issue-109789.rs:18:1
2+
--> $DIR/issue-109789.rs:18:11
33
|
44
LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {}
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
66
|
77
= note: expected struct `Foo<fn(&'static ())>`
88
found struct `Foo<for<'a> fn(&'a ())>`

tests/ui/dyn-star/param-env-infer.current.stderr

-18
This file was deleted.

tests/ui/dyn-star/param-env-infer.next.stderr

-38
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0282]: type annotations needed
2+
--> $DIR/param-env-region-infer.rs:16:10
3+
|
4+
LL | t as _
5+
| ^ cannot infer type
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0282`.

tests/ui/dyn-star/param-env-infer.rs renamed to tests/ui/dyn-star/param-env-region-infer.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
// revisions: current next
22
//[next] compile-flags: -Ztrait-solver=next
3+
//[next] check-pass
34
// incremental
45

6+
// checks that we don't ICE if there are region inference variables in the environment
7+
// when computing `PointerLike` builtin candidates.
8+
59
#![feature(dyn_star, pointer_like_trait)]
6-
//~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
10+
#![allow(incomplete_features)]
711

812
use std::fmt::Debug;
913
use std::marker::PointerLike;
1014

1115
fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
12-
//[next]~^ ERROR cycle detected when computing type of `make_dyn_star::{opaque#0}`
1316
t as _
1417
//[current]~^ ERROR type annotations needed
1518
}

tests/ui/for/issue-20605.next.stderr

+49-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,53 @@ error: the type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is
2020
LL | for item in *things { *item = 0 }
2121
| ^^^^^^^
2222

23-
error: aborting due to 3 previous errors
23+
error[E0277]: `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not an iterator
24+
--> $DIR/issue-20605.rs:5:17
25+
|
26+
LL | for item in *things { *item = 0 }
27+
| ^^^^^^^ `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not an iterator
28+
|
29+
= help: the trait `Iterator` is not implemented for `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter`
30+
31+
error: the type `&mut <dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed
32+
--> $DIR/issue-20605.rs:5:17
33+
|
34+
LL | for item in *things { *item = 0 }
35+
| ^^^^^^^
36+
37+
error[E0614]: type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced
38+
--> $DIR/issue-20605.rs:5:27
39+
|
40+
LL | for item in *things { *item = 0 }
41+
| ^^^^^
42+
43+
error[E0277]: the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
44+
--> $DIR/issue-20605.rs:5:9
45+
|
46+
LL | for item in *things { *item = 0 }
47+
| ^^^^ doesn't have a size known at compile-time
48+
|
49+
= help: the trait `Sized` is not implemented for `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item`
50+
= note: all local variables must have a statically known size
51+
= help: unsized locals are gated as an unstable feature
52+
53+
error: the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed
54+
--> $DIR/issue-20605.rs:5:17
55+
|
56+
LL | for item in *things { *item = 0 }
57+
| ^^^^^^^
58+
59+
error[E0277]: the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
60+
--> $DIR/issue-20605.rs:5:5
61+
|
62+
LL | for item in *things { *item = 0 }
63+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
64+
|
65+
= help: the trait `Sized` is not implemented for `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item`
66+
note: required by a bound in `None`
67+
--> $SRC_DIR/core/src/option.rs:LL:COL
68+
69+
error: aborting due to 9 previous errors
2470

25-
For more information about this error, try `rustc --explain E0277`.
71+
Some errors have detailed explanations: E0277, E0614.
72+
For more information about an error, try `rustc --explain E0277`.

tests/ui/for/issue-20605.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@
33

44
fn changer<'a>(mut things: Box<dyn Iterator<Item=&'a mut u8>>) {
55
for item in *things { *item = 0 }
6-
//~^ ERROR the size for values of type
7-
//[next]~^^ ERROR the type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed
8-
//[next]~| ERROR the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
6+
//[current]~^ ERROR the size for values of type
7+
//[next]~^^ ERROR the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
8+
//[next]~| ERROR the size for values of type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` cannot be known at compilation time
9+
//[next]~| ERROR the type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed
10+
//[next]~| ERROR `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not an iterator
11+
//[next]~| ERROR the type `&mut <dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed
12+
//[next]~| ERROR the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
13+
//[next]~| ERROR the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed
14+
//[next]~| ERROR the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
15+
//[next]~| ERROR type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced
16+
// FIXME(-Ztrait-solver=next): these error messages are horrible and have to be
17+
// improved before we stabilize the new solver.
918
}
1019

1120
fn main() {}

tests/ui/issues/issue-35570.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ trait Trait2<'a> {
77

88
fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) {
99
//~^ ERROR the trait bound `for<'a> (): Trait2<'a>` is not satisfied
10-
//~| ERROR the trait bound `for<'a> (): Trait2<'a>` is not satisfied
1110
let _e: (usize, usize) = unsafe{mem::transmute(param)};
1211
}
1312

tests/ui/issues/issue-35570.stderr

+1-11
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied
44
LL | fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) {
55
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()`
66

7-
error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied
8-
--> $DIR/issue-35570.rs:8:1
9-
|
10-
LL | / fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) {
11-
LL | |
12-
LL | |
13-
LL | | let _e: (usize, usize) = unsafe{mem::transmute(param)};
14-
LL | | }
15-
| |_^ the trait `for<'a> Trait2<'a>` is not implemented for `()`
16-
17-
error: aborting due to 2 previous errors
7+
error: aborting due to previous error
188

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

tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ trait Trait2<'a, 'b> {
2020
// do not infer that.
2121
fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
2222
//~^ ERROR the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied
23-
//~| ERROR the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied
2423
{
2524
}
2625

tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr

+1-16
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,6 @@ help: consider restricting type parameter `T`
99
LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
1010
| ++++++++++++++++++++++++
1111

12-
error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied
13-
--> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:1
14-
|
15-
LL | / fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
16-
LL | |
17-
LL | |
18-
LL | | {
19-
LL | | }
20-
| |_^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T`
21-
|
22-
help: consider restricting type parameter `T`
23-
|
24-
LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
25-
| ++++++++++++++++++++++++
26-
27-
error: aborting due to 2 previous errors
12+
error: aborting due to previous error
2813

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

tests/ui/traits/new-solver/alias-bound-unsound.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ impl Foo for () {
2121
fn main() {
2222
let x = String::from("hello, world");
2323
drop(<() as Foo>::copy_me(&x));
24-
//~^ ERROR `<() as Foo>::Item: Copy` is not satisfied
25-
//~| ERROR `<() as Foo>::Item` is not well-formed
26-
//~| ERROR `<() as Foo>::Item` is not well-formed
24+
//~^ ERROR the type `&<() as Foo>::Item` is not well-formed
2725
//~| ERROR `<() as Foo>::Item` is not well-formed
2826
println!("{x}");
2927
}
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,14 @@
1-
error[E0277]: the trait bound `<() as Foo>::Item: Copy` is not satisfied
2-
--> $DIR/alias-bound-unsound.rs:23:10
3-
|
4-
LL | drop(<() as Foo>::copy_me(&x));
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `<() as Foo>::Item`
6-
|
7-
note: required by a bound in `Foo::Item`
8-
--> $DIR/alias-bound-unsound.rs:10:30
9-
|
10-
LL | type Item: Copy
11-
| ---- required by a bound in this associated type
12-
LL | where
13-
LL | <Self as Foo>::Item: Copy;
14-
| ^^^^ required by this bound in `Foo::Item`
15-
16-
error: the type `<() as Foo>::Item` is not well-formed
17-
--> $DIR/alias-bound-unsound.rs:23:10
18-
|
19-
LL | drop(<() as Foo>::copy_me(&x));
20-
| ^^^^^^^^^^^^^^^^^^^^^^^^
21-
22-
error: the type `<() as Foo>::Item` is not well-formed
23-
--> $DIR/alias-bound-unsound.rs:23:5
1+
error: the type `&<() as Foo>::Item` is not well-formed
2+
--> $DIR/alias-bound-unsound.rs:23:31
243
|
254
LL | drop(<() as Foo>::copy_me(&x));
26-
| ^^^^
5+
| ^^
276

287
error: the type `<() as Foo>::Item` is not well-formed
298
--> $DIR/alias-bound-unsound.rs:23:10
309
|
3110
LL | drop(<() as Foo>::copy_me(&x));
3211
| ^^^^^^^^^^^^^^^^^^^^^^^^
3312

34-
error: aborting due to 4 previous errors
13+
error: aborting due to 2 previous errors
3514

36-
For more information about this error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
// compile-flags: -Ztrait-solver=next
22

3-
// check-pass
4-
// (should not pass, should be turned into a coherence-only test)
5-
6-
// check that a `alias-eq(<?0 as TraitB>::Assoc, <T as TraitB>::Assoc)` goal fails.
7-
8-
// FIXME(deferred_projection_equality): add a test that this is true during coherence
3+
// check that a `alias-eq(<?a as TraitB>::Assoc, <?b as TraitB>::Assoc)` goal fails
4+
// during coherence. We must not incorrectly constrain `?a` and `?b` to be
5+
// equal.
96

107
trait TraitB {
118
type Assoc;
129
}
1310

14-
fn needs_a<T: TraitB>() -> T::Assoc {
15-
unimplemented!()
16-
}
11+
trait Overlaps<T> {}
1712

18-
fn bar<T: TraitB>() {
19-
let _: <_ as TraitB>::Assoc = needs_a::<T>();
20-
}
13+
impl<T: TraitB> Overlaps<Box<T>> for <T as TraitB>::Assoc {}
14+
impl<U: TraitB> Overlaps<U> for <U as TraitB>::Assoc {}
15+
//~^ ERROR conflicting implementations of trait
2116

2217
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0119]: conflicting implementations of trait `Overlaps<Box<_>>` for type `<_ as TraitB>::Assoc`
2+
--> $DIR/alias_eq_substs_eq_not_intercrate.rs:14:1
3+
|
4+
LL | impl<T: TraitB> Overlaps<Box<T>> for <T as TraitB>::Assoc {}
5+
| --------------------------------------------------------- first implementation here
6+
LL | impl<U: TraitB> Overlaps<U> for <U as TraitB>::Assoc {}
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<_ as TraitB>::Assoc`
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0119`.

tests/ui/traits/new-solver/async.fail.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0271]: expected `[async block@$DIR/async.rs:12:17: 12:25]` to be a future that resolves to `i32`, but it resolves to `()`
1+
error[E0271]: type mismatch resolving `<[async block@$DIR/async.rs:12:17: 12:25] as Future>::Output == i32`
22
--> $DIR/async.rs:12:17
33
|
44
LL | needs_async(async {});
5-
| ----------- ^^^^^^^^ expected `i32`, found `()`
5+
| ----------- ^^^^^^^^ types differ
66
| |
77
| required by a bound introduced by this call
88
|

tests/ui/traits/new-solver/async.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn needs_async(_: impl Future<Output = i32>) {}
1010
#[cfg(fail)]
1111
fn main() {
1212
needs_async(async {});
13-
//[fail]~^ ERROR to be a future that resolves to `i32`, but it resolves to `()`
13+
//[fail]~^ ERROR type mismatch
1414
}
1515

1616
#[cfg(pass)]

tests/ui/traits/new-solver/dont-remap-tait-substs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// compile-flags: -Ztrait-solver=next
2-
// check-pass
2+
// known-bug: #112825
33

44
// Makes sure we don't prepopulate the MIR typeck of `define`
55
// with `Foo<T, U> = T`, but instead, `Foo<B, A> = B`, so that

0 commit comments

Comments
 (0)