diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/type/type-check-defaults.rs (renamed from src/test/ui/type/type-check-defaults.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check-defaults.stderr (renamed from src/test/ui/type/type-check-defaults.stderr) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/assignment-expected-bool.rs (renamed from src/test/ui/type/type-check/assignment-expected-bool.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/assignment-expected-bool.stderr (renamed from src/test/ui/type/type-check/assignment-expected-bool.stderr) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/assignment-in-if.rs (renamed from src/test/ui/type/type-check/assignment-in-if.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/assignment-in-if.stderr (renamed from src/test/ui/type/type-check/assignment-in-if.stderr) | 8 | ||||
-rw-r--r-- | tests/ui/type/type-check/cannot_infer_local_or_array.rs (renamed from src/test/ui/type/type-check/cannot_infer_local_or_array.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/cannot_infer_local_or_array.stderr (renamed from src/test/ui/type/type-check/cannot_infer_local_or_array.stderr) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/cannot_infer_local_or_vec.rs (renamed from src/test/ui/type/type-check/cannot_infer_local_or_vec.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/cannot_infer_local_or_vec.stderr (renamed from src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs (renamed from src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr (renamed from src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr) | 2 | ||||
-rw-r--r-- | tests/ui/type/type-check/issue-22897.rs (renamed from src/test/ui/type/type-check/issue-22897.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/issue-22897.stderr (renamed from src/test/ui/type/type-check/issue-22897.stderr) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/issue-40294.rs (renamed from src/test/ui/type/type-check/issue-40294.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/issue-40294.stderr | 17 | ||||
-rw-r--r-- | tests/ui/type/type-check/issue-41314.rs (renamed from src/test/ui/type/type-check/issue-41314.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/issue-41314.stderr (renamed from src/test/ui/type/type-check/issue-41314.stderr) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs (renamed from src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.stderr (renamed from src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.stderr) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.rs (renamed from src/test/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr (renamed from src/test/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/missing_trait_impl.rs (renamed from src/test/ui/type/type-check/missing_trait_impl.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/missing_trait_impl.stderr (renamed from src/test/ui/type/type-check/missing_trait_impl.stderr) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/point-at-inference-2.rs | 13 | ||||
-rw-r--r-- | tests/ui/type/type-check/point-at-inference-2.stderr | 51 | ||||
-rw-r--r-- | tests/ui/type/type-check/point-at-inference-3.fixed | 11 | ||||
-rw-r--r-- | tests/ui/type/type-check/point-at-inference-3.rs | 11 | ||||
-rw-r--r-- | tests/ui/type/type-check/point-at-inference-3.stderr | 18 | ||||
-rw-r--r-- | tests/ui/type/type-check/point-at-inference.rs | 12 | ||||
-rw-r--r-- | tests/ui/type/type-check/point-at-inference.stderr | 19 | ||||
-rw-r--r-- | tests/ui/type/type-check/unknown_type_for_closure.rs (renamed from src/test/ui/type/type-check/unknown_type_for_closure.rs) | 0 | ||||
-rw-r--r-- | tests/ui/type/type-check/unknown_type_for_closure.stderr (renamed from src/test/ui/type/type-check/unknown_type_for_closure.stderr) | 4 |
33 files changed, 161 insertions, 5 deletions
diff --git a/src/test/ui/type/type-check-defaults.rs b/tests/ui/type/type-check-defaults.rs index 6a0a7ed33..6a0a7ed33 100644 --- a/src/test/ui/type/type-check-defaults.rs +++ b/tests/ui/type/type-check-defaults.rs diff --git a/src/test/ui/type/type-check-defaults.stderr b/tests/ui/type/type-check-defaults.stderr index 9ba63ffe9..9ba63ffe9 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/tests/ui/type/type-check-defaults.stderr diff --git a/src/test/ui/type/type-check/assignment-expected-bool.rs b/tests/ui/type/type-check/assignment-expected-bool.rs index 191939bdb..191939bdb 100644 --- a/src/test/ui/type/type-check/assignment-expected-bool.rs +++ b/tests/ui/type/type-check/assignment-expected-bool.rs diff --git a/src/test/ui/type/type-check/assignment-expected-bool.stderr b/tests/ui/type/type-check/assignment-expected-bool.stderr index 56494baff..56494baff 100644 --- a/src/test/ui/type/type-check/assignment-expected-bool.stderr +++ b/tests/ui/type/type-check/assignment-expected-bool.stderr diff --git a/src/test/ui/type/type-check/assignment-in-if.rs b/tests/ui/type/type-check/assignment-in-if.rs index ada250df2..ada250df2 100644 --- a/src/test/ui/type/type-check/assignment-in-if.rs +++ b/tests/ui/type/type-check/assignment-in-if.rs diff --git a/src/test/ui/type/type-check/assignment-in-if.stderr b/tests/ui/type/type-check/assignment-in-if.stderr index 8ab08e25e..9f4558ada 100644 --- a/src/test/ui/type/type-check/assignment-in-if.stderr +++ b/tests/ui/type/type-check/assignment-in-if.stderr @@ -68,7 +68,9 @@ error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:44:18 | LL | if x == x && x = x && x == x { - | ^ expected `bool`, found `usize` + | ------ ^ expected `bool`, found `usize` + | | + | expected because this is `bool` error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:44:22 @@ -91,7 +93,9 @@ error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:51:28 | LL | if x == x && x == x && x = x { - | ^ expected `bool`, found `usize` + | ---------------- ^ expected `bool`, found `usize` + | | + | expected because this is `bool` error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:51:8 diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_array.rs b/tests/ui/type/type-check/cannot_infer_local_or_array.rs index af7552523..af7552523 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_array.rs +++ b/tests/ui/type/type-check/cannot_infer_local_or_array.rs diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr b/tests/ui/type/type-check/cannot_infer_local_or_array.stderr index e823bad26..e823bad26 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr +++ b/tests/ui/type/type-check/cannot_infer_local_or_array.stderr diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_vec.rs b/tests/ui/type/type-check/cannot_infer_local_or_vec.rs index e72ddabf3..e72ddabf3 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_vec.rs +++ b/tests/ui/type/type-check/cannot_infer_local_or_vec.rs diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr b/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr index b63d2a3b6..b63d2a3b6 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr +++ b/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs b/tests/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs index d21456439..d21456439 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs +++ b/tests/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr b/tests/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr index be60cda68..e544b3695 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr +++ b/tests/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `(Vec<T>,)` --> $DIR/cannot_infer_local_or_vec_in_tuples.rs:2:9 | LL | let (x, ) = (vec![], ); - | ^^^^^ + | ^^^^^ ---------- type must be known at this point | help: consider giving this pattern a type, where the type for type parameter `T` is specified | diff --git a/src/test/ui/type/type-check/issue-22897.rs b/tests/ui/type/type-check/issue-22897.rs index 8171a0ef1..8171a0ef1 100644 --- a/src/test/ui/type/type-check/issue-22897.rs +++ b/tests/ui/type/type-check/issue-22897.rs diff --git a/src/test/ui/type/type-check/issue-22897.stderr b/tests/ui/type/type-check/issue-22897.stderr index fae7b7926..fae7b7926 100644 --- a/src/test/ui/type/type-check/issue-22897.stderr +++ b/tests/ui/type/type-check/issue-22897.stderr diff --git a/src/test/ui/type/type-check/issue-40294.rs b/tests/ui/type/type-check/issue-40294.rs index 5493a4e5f..5493a4e5f 100644 --- a/src/test/ui/type/type-check/issue-40294.rs +++ b/tests/ui/type/type-check/issue-40294.rs diff --git a/tests/ui/type/type-check/issue-40294.stderr b/tests/ui/type/type-check/issue-40294.stderr new file mode 100644 index 000000000..d15fd2341 --- /dev/null +++ b/tests/ui/type/type-check/issue-40294.stderr @@ -0,0 +1,17 @@ +error[E0283]: type annotations needed: cannot satisfy `&'a T: Foo` + --> $DIR/issue-40294.rs:6:19 + | +LL | where &'a T : Foo, + | ^^^ + | +note: multiple `impl`s or `where` clauses satisfying `&'a T: Foo` found + --> $DIR/issue-40294.rs:6:19 + | +LL | where &'a T : Foo, + | ^^^ +LL | &'b T : Foo + | ^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/type/type-check/issue-41314.rs b/tests/ui/type/type-check/issue-41314.rs index cbd39f5f9..cbd39f5f9 100644 --- a/src/test/ui/type/type-check/issue-41314.rs +++ b/tests/ui/type/type-check/issue-41314.rs diff --git a/src/test/ui/type/type-check/issue-41314.stderr b/tests/ui/type/type-check/issue-41314.stderr index 4a9bf6106..4a9bf6106 100644 --- a/src/test/ui/type/type-check/issue-41314.stderr +++ b/tests/ui/type/type-check/issue-41314.stderr diff --git a/src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs b/tests/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs index c39ab9544..c39ab9544 100644 --- a/src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs +++ b/tests/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs diff --git a/src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.stderr b/tests/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.stderr index a431fe89c..a431fe89c 100644 --- a/src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.stderr +++ b/tests/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.stderr diff --git a/src/test/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.rs b/tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.rs index e50cc5865..e50cc5865 100644 --- a/src/test/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.rs +++ b/tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.rs diff --git a/src/test/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr b/tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr index 847bc517e..847bc517e 100644 --- a/src/test/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr +++ b/tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr diff --git a/src/test/ui/type/type-check/missing_trait_impl.rs b/tests/ui/type/type-check/missing_trait_impl.rs index 0e3e703a2..0e3e703a2 100644 --- a/src/test/ui/type/type-check/missing_trait_impl.rs +++ b/tests/ui/type/type-check/missing_trait_impl.rs diff --git a/src/test/ui/type/type-check/missing_trait_impl.stderr b/tests/ui/type/type-check/missing_trait_impl.stderr index 2b58cd418..2b58cd418 100644 --- a/src/test/ui/type/type-check/missing_trait_impl.stderr +++ b/tests/ui/type/type-check/missing_trait_impl.stderr diff --git a/tests/ui/type/type-check/point-at-inference-2.rs b/tests/ui/type/type-check/point-at-inference-2.rs new file mode 100644 index 000000000..6557d7fa1 --- /dev/null +++ b/tests/ui/type/type-check/point-at-inference-2.rs @@ -0,0 +1,13 @@ +fn bar(_: Vec<i32>) {} +fn baz(_: &Vec<&i32>) {} +fn main() { + let v = vec![&1]; + bar(v); //~ ERROR E0308 + let v = vec![]; + baz(&v); + baz(&v); + bar(v); //~ ERROR E0308 + let v = vec![]; + baz(&v); + bar(v); //~ ERROR E0308 +} diff --git a/tests/ui/type/type-check/point-at-inference-2.stderr b/tests/ui/type/type-check/point-at-inference-2.stderr new file mode 100644 index 000000000..1368aba0d --- /dev/null +++ b/tests/ui/type/type-check/point-at-inference-2.stderr @@ -0,0 +1,51 @@ +error[E0308]: mismatched types + --> $DIR/point-at-inference-2.rs:5:9 + | +LL | bar(v); + | --- ^ expected `i32`, found `&{integer}` + | | + | arguments to this function are incorrect + | + = note: expected struct `Vec<i32>` + found struct `Vec<&{integer}>` +note: function defined here + --> $DIR/point-at-inference-2.rs:1:4 + | +LL | fn bar(_: Vec<i32>) {} + | ^^^ ----------- + +error[E0308]: mismatched types + --> $DIR/point-at-inference-2.rs:9:9 + | +LL | bar(v); + | --- ^ expected `i32`, found `&i32` + | | + | arguments to this function are incorrect + | + = note: expected struct `Vec<i32>` + found struct `Vec<&i32>` +note: function defined here + --> $DIR/point-at-inference-2.rs:1:4 + | +LL | fn bar(_: Vec<i32>) {} + | ^^^ ----------- + +error[E0308]: mismatched types + --> $DIR/point-at-inference-2.rs:12:9 + | +LL | bar(v); + | --- ^ expected `i32`, found `&i32` + | | + | arguments to this function are incorrect + | + = note: expected struct `Vec<i32>` + found struct `Vec<&i32>` +note: function defined here + --> $DIR/point-at-inference-2.rs:1:4 + | +LL | fn bar(_: Vec<i32>) {} + | ^^^ ----------- + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type/type-check/point-at-inference-3.fixed b/tests/ui/type/type-check/point-at-inference-3.fixed new file mode 100644 index 000000000..44c057c0d --- /dev/null +++ b/tests/ui/type/type-check/point-at-inference-3.fixed @@ -0,0 +1,11 @@ +// run-rustfix +fn main() { + let mut v = Vec::new(); + v.push(0i32); + v.push(0); + v.push(1i32); //~ ERROR mismatched types + //~^ NOTE expected `i32`, found `u32` + //~| NOTE arguments to this method are incorrect + //~| NOTE associated function defined here + //~| HELP change the type of the numeric literal from `u32` to `i32` +} diff --git a/tests/ui/type/type-check/point-at-inference-3.rs b/tests/ui/type/type-check/point-at-inference-3.rs new file mode 100644 index 000000000..e7ae54384 --- /dev/null +++ b/tests/ui/type/type-check/point-at-inference-3.rs @@ -0,0 +1,11 @@ +// run-rustfix +fn main() { + let mut v = Vec::new(); + v.push(0i32); + v.push(0); + v.push(1u32); //~ ERROR mismatched types + //~^ NOTE expected `i32`, found `u32` + //~| NOTE arguments to this method are incorrect + //~| NOTE associated function defined here + //~| HELP change the type of the numeric literal from `u32` to `i32` +} diff --git a/tests/ui/type/type-check/point-at-inference-3.stderr b/tests/ui/type/type-check/point-at-inference-3.stderr new file mode 100644 index 000000000..d7936e39c --- /dev/null +++ b/tests/ui/type/type-check/point-at-inference-3.stderr @@ -0,0 +1,18 @@ +error[E0308]: mismatched types + --> $DIR/point-at-inference-3.rs:6:12 + | +LL | v.push(1u32); + | ---- ^^^^ expected `i32`, found `u32` + | | + | arguments to this method are incorrect + | +note: associated function defined here + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL +help: change the type of the numeric literal from `u32` to `i32` + | +LL | v.push(1i32); + | ~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type/type-check/point-at-inference.rs b/tests/ui/type/type-check/point-at-inference.rs new file mode 100644 index 000000000..5c46dd4ed --- /dev/null +++ b/tests/ui/type/type-check/point-at-inference.rs @@ -0,0 +1,12 @@ +fn bar(_: Vec<i32>) {} +fn baz(_: &impl std::any::Any) {} +fn main() { + let v = vec![1, 2, 3, 4, 5]; + let mut foo = vec![]; + baz(&foo); + for i in &v { + foo.push(i); + } + baz(&foo); + bar(foo); //~ ERROR E0308 +} diff --git a/tests/ui/type/type-check/point-at-inference.stderr b/tests/ui/type/type-check/point-at-inference.stderr new file mode 100644 index 000000000..2e17e5c5f --- /dev/null +++ b/tests/ui/type/type-check/point-at-inference.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/point-at-inference.rs:11:9 + | +LL | bar(foo); + | --- ^^^ expected `i32`, found `&{integer}` + | | + | arguments to this function are incorrect + | + = note: expected struct `Vec<i32>` + found struct `Vec<&{integer}>` +note: function defined here + --> $DIR/point-at-inference.rs:1:4 + | +LL | fn bar(_: Vec<i32>) {} + | ^^^ ----------- + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/type/type-check/unknown_type_for_closure.rs b/tests/ui/type/type-check/unknown_type_for_closure.rs index 167687c18..167687c18 100644 --- a/src/test/ui/type/type-check/unknown_type_for_closure.rs +++ b/tests/ui/type/type-check/unknown_type_for_closure.rs diff --git a/src/test/ui/type/type-check/unknown_type_for_closure.stderr b/tests/ui/type/type-check/unknown_type_for_closure.stderr index 9ae97f390..e5e29aabf 100644 --- a/src/test/ui/type/type-check/unknown_type_for_closure.stderr +++ b/tests/ui/type/type-check/unknown_type_for_closure.stderr @@ -12,8 +12,8 @@ LL | let x = |_| {}; | help: consider giving this closure parameter an explicit type | -LL | let x = |_: _| {}; - | +++ +LL | let x = |_: /* Type */| {}; + | ++++++++++++ error[E0282]: type annotations needed --> $DIR/unknown_type_for_closure.rs:10:14 |