summaryrefslogtreecommitdiffstats
path: root/tests/ui/typeck
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/typeck')
-rw-r--r--tests/ui/typeck/assign-non-lval-derefmut.stderr2
-rw-r--r--tests/ui/typeck/bad-type-in-vec-contains.rs7
-rw-r--r--tests/ui/typeck/bad-type-in-vec-contains.stderr19
-rw-r--r--tests/ui/typeck/bad-type-in-vec-push.rs20
-rw-r--r--tests/ui/typeck/bad-type-in-vec-push.stderr29
-rw-r--r--tests/ui/typeck/conversion-methods.stderr8
-rw-r--r--tests/ui/typeck/deref-multi.stderr2
-rw-r--r--tests/ui/typeck/explain_clone_autoref.rs2
-rw-r--r--tests/ui/typeck/explain_clone_autoref.stderr2
-rw-r--r--tests/ui/typeck/issue-100246.stderr2
-rw-r--r--tests/ui/typeck/issue-104513-ice.stderr2
-rw-r--r--tests/ui/typeck/issue-107087.rs18
-rw-r--r--tests/ui/typeck/issue-107087.stderr9
-rw-r--r--tests/ui/typeck/issue-107775.rs40
-rw-r--r--tests/ui/typeck/issue-107775.stderr16
-rw-r--r--tests/ui/typeck/issue-13853.stderr4
-rw-r--r--tests/ui/typeck/issue-31173.stderr15
-rw-r--r--tests/ui/typeck/issue-46112.stderr2
-rw-r--r--tests/ui/typeck/issue-50687-ice-on-borrow.stderr2
-rw-r--r--tests/ui/typeck/issue-53712.rs9
-rw-r--r--tests/ui/typeck/issue-53712.stderr11
-rw-r--r--tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr2
-rw-r--r--tests/ui/typeck/issue-67971.stderr2
-rw-r--r--tests/ui/typeck/issue-75883.rs4
-rw-r--r--tests/ui/typeck/issue-75883.stderr4
-rw-r--r--tests/ui/typeck/issue-7813.rs4
-rw-r--r--tests/ui/typeck/issue-7813.stderr14
-rw-r--r--tests/ui/typeck/issue-84160.stderr2
-rw-r--r--tests/ui/typeck/issue-84768.stderr4
-rw-r--r--tests/ui/typeck/issue-89856.fixed18
-rw-r--r--tests/ui/typeck/issue-89856.rs14
-rw-r--r--tests/ui/typeck/issue-89856.stderr54
-rw-r--r--tests/ui/typeck/issue-90027-async-fn-return-suggestion.rs21
-rw-r--r--tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr39
-rw-r--r--tests/ui/typeck/issue-91334.rs3
-rw-r--r--tests/ui/typeck/issue-91334.stderr47
-rw-r--r--tests/ui/typeck/issue-91450-inner-ty-error.stderr2
-rw-r--r--tests/ui/typeck/issue-92481.rs9
-rw-r--r--tests/ui/typeck/issue-92481.stderr61
-rw-r--r--tests/ui/typeck/issue-96530.stderr2
-rw-r--r--tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs6
-rw-r--r--tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr9
-rw-r--r--tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs24
-rw-r--r--tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr14
-rw-r--r--tests/ui/typeck/remove-extra-argument.stderr9
-rw-r--r--tests/ui/typeck/return_type_containing_closure.rs2
-rw-r--r--tests/ui/typeck/return_type_containing_closure.stderr2
-rw-r--r--tests/ui/typeck/struct-enum-wrong-args.stderr36
-rw-r--r--tests/ui/typeck/typeck-builtin-bound-type-parameters.rs12
-rw-r--r--tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr12
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_item.rs4
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_item.stderr34
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_lifetime_1.rs2
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr2
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_lifetime_2.rs2
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr2
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_mismatch.rs4
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_mismatch.stderr4
58 files changed, 513 insertions, 194 deletions
diff --git a/tests/ui/typeck/assign-non-lval-derefmut.stderr b/tests/ui/typeck/assign-non-lval-derefmut.stderr
index e394cf820..b26d16da0 100644
--- a/tests/ui/typeck/assign-non-lval-derefmut.stderr
+++ b/tests/ui/typeck/assign-non-lval-derefmut.stderr
@@ -30,7 +30,7 @@ error[E0308]: mismatched types
LL | let mut y = x.lock().unwrap();
| ----------------- expected due to this value
LL | y = 2;
- | ^ expected struct `MutexGuard`, found integer
+ | ^ expected `MutexGuard<'_, usize>`, found integer
|
= note: expected struct `MutexGuard<'_, usize>`
found type `{integer}`
diff --git a/tests/ui/typeck/bad-type-in-vec-contains.rs b/tests/ui/typeck/bad-type-in-vec-contains.rs
new file mode 100644
index 000000000..4433047b7
--- /dev/null
+++ b/tests/ui/typeck/bad-type-in-vec-contains.rs
@@ -0,0 +1,7 @@
+// The error message here still is pretty confusing.
+
+fn main() {
+ let primes = Vec::new();
+ primes.contains(3);
+ //~^ ERROR mismatched types
+}
diff --git a/tests/ui/typeck/bad-type-in-vec-contains.stderr b/tests/ui/typeck/bad-type-in-vec-contains.stderr
new file mode 100644
index 000000000..0e03388d2
--- /dev/null
+++ b/tests/ui/typeck/bad-type-in-vec-contains.stderr
@@ -0,0 +1,19 @@
+error[E0308]: mismatched types
+ --> $DIR/bad-type-in-vec-contains.rs:5:21
+ |
+LL | primes.contains(3);
+ | -------- ^
+ | | |
+ | | expected `&_`, found integer
+ | | help: consider borrowing here: `&3`
+ | arguments to this method are incorrect
+ | here the type of `primes` is inferred to be `[_]`
+ |
+ = note: expected reference `&_`
+ found type `{integer}`
+note: method defined here
+ --> $SRC_DIR/core/src/slice/mod.rs:LL:COL
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/bad-type-in-vec-push.rs b/tests/ui/typeck/bad-type-in-vec-push.rs
new file mode 100644
index 000000000..a807f030c
--- /dev/null
+++ b/tests/ui/typeck/bad-type-in-vec-push.rs
@@ -0,0 +1,20 @@
+// The error message here still is pretty confusing.
+
+fn main() {
+ let mut result = vec![1];
+ // The type of `result` is constrained to be `Vec<{integer}>` here.
+ // But the logic we use to find what expression constrains a type
+ // is not sophisticated enough to know this.
+
+ let mut vector = Vec::new();
+ vector.sort();
+ result.push(vector);
+ //~^ ERROR mismatched types
+ // So it thinks that the type of `result` is constrained here.
+}
+
+fn example2() {
+ let mut x = vec![1];
+ x.push("");
+ //~^ ERROR mismatched types
+}
diff --git a/tests/ui/typeck/bad-type-in-vec-push.stderr b/tests/ui/typeck/bad-type-in-vec-push.stderr
new file mode 100644
index 000000000..ae46050c9
--- /dev/null
+++ b/tests/ui/typeck/bad-type-in-vec-push.stderr
@@ -0,0 +1,29 @@
+error[E0308]: mismatched types
+ --> $DIR/bad-type-in-vec-push.rs:11:17
+ |
+LL | vector.sort();
+ | ------ here the type of `vector` is inferred to be `Vec<_>`
+LL | result.push(vector);
+ | ---- ^^^^^^ expected integer, found `Vec<_>`
+ | |
+ | arguments to this method are incorrect
+ |
+ = note: expected type `{integer}`
+ found struct `Vec<_>`
+note: method defined here
+ --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
+
+error[E0308]: mismatched types
+ --> $DIR/bad-type-in-vec-push.rs:18:12
+ |
+LL | x.push("");
+ | ---- ^^ expected integer, found `&str`
+ | |
+ | arguments to this method are incorrect
+ |
+note: method defined here
+ --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/conversion-methods.stderr b/tests/ui/typeck/conversion-methods.stderr
index 091502bdd..a9b5078cc 100644
--- a/tests/ui/typeck/conversion-methods.stderr
+++ b/tests/ui/typeck/conversion-methods.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—";
| ------ ^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
| | |
- | | expected struct `String`, found `&str`
+ | | expected `String`, found `&str`
| expected due to this
error[E0308]: mismatched types
@@ -13,7 +13,7 @@ error[E0308]: mismatched types
LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise");
| ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_path_buf()`
| | |
- | | expected struct `PathBuf`, found `&Path`
+ | | expected `PathBuf`, found `&Path`
| expected due to this
error[E0308]: mismatched types
@@ -22,14 +22,14 @@ error[E0308]: mismatched types
LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here
| ------ ^- help: try using a conversion method: `.to_string()`
| | |
- | | expected struct `String`, found integer
+ | | expected `String`, found integer
| expected due to this
error[E0308]: mismatched types
--> $DIR/conversion-methods.rs:12:47
|
LL | let _prove_piercing_earnest: Vec<usize> = &[1, 2, 3];
- | ---------- ^^^^^^^^^^ expected struct `Vec`, found `&[{integer}; 3]`
+ | ---------- ^^^^^^^^^^ expected `Vec<usize>`, found `&[{integer}; 3]`
| |
| expected due to this
|
diff --git a/tests/ui/typeck/deref-multi.stderr b/tests/ui/typeck/deref-multi.stderr
index bd6575c73..4346e273d 100644
--- a/tests/ui/typeck/deref-multi.stderr
+++ b/tests/ui/typeck/deref-multi.stderr
@@ -58,7 +58,7 @@ error[E0308]: mismatched types
LL | fn d(x: std::sync::Mutex<&i32>) -> i32 {
| --- expected `i32` because of return type
LL | x.lock().unwrap()
- | ^^^^^^^^^^^^^^^^^ expected `i32`, found struct `MutexGuard`
+ | ^^^^^^^^^^^^^^^^^ expected `i32`, found `MutexGuard<'_, &i32>`
|
= note: expected type `i32`
found struct `MutexGuard<'_, &i32>`
diff --git a/tests/ui/typeck/explain_clone_autoref.rs b/tests/ui/typeck/explain_clone_autoref.rs
index 9279e4c39..4d2157470 100644
--- a/tests/ui/typeck/explain_clone_autoref.rs
+++ b/tests/ui/typeck/explain_clone_autoref.rs
@@ -9,5 +9,5 @@ fn clone_thing(nc: &NotClone) -> NotClone {
nc.clone()
//~^ ERROR mismatched type
//~| NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
- //~| NOTE expected struct `NotClone`, found `&NotClone`
+ //~| NOTE expected `NotClone`, found `&NotClone`
}
diff --git a/tests/ui/typeck/explain_clone_autoref.stderr b/tests/ui/typeck/explain_clone_autoref.stderr
index ff36e18d2..4539da438 100644
--- a/tests/ui/typeck/explain_clone_autoref.stderr
+++ b/tests/ui/typeck/explain_clone_autoref.stderr
@@ -5,7 +5,7 @@ LL | fn clone_thing(nc: &NotClone) -> NotClone {
| -------- expected `NotClone` because of return type
LL |
LL | nc.clone()
- | ^^^^^^^^^^ expected struct `NotClone`, found `&NotClone`
+ | ^^^^^^^^^^ expected `NotClone`, found `&NotClone`
|
note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
--> $DIR/explain_clone_autoref.rs:9:5
diff --git a/tests/ui/typeck/issue-100246.stderr b/tests/ui/typeck/issue-100246.stderr
index 8b77de94e..428a07920 100644
--- a/tests/ui/typeck/issue-100246.stderr
+++ b/tests/ui/typeck/issue-100246.stderr
@@ -2,7 +2,7 @@ error[E0308]: `?` operator has incompatible types
--> $DIR/issue-100246.rs:28:24
|
LL | let other: Other = downcast()?;
- | ^^^^^^^^^^^ expected struct `Other`, found reference
+ | ^^^^^^^^^^^ expected `Other`, found `&_`
|
= note: `?` operator cannot convert from `&_` to `Other`
= note: expected struct `Other`
diff --git a/tests/ui/typeck/issue-104513-ice.stderr b/tests/ui/typeck/issue-104513-ice.stderr
index 42cfe38ae..09187d786 100644
--- a/tests/ui/typeck/issue-104513-ice.stderr
+++ b/tests/ui/typeck/issue-104513-ice.stderr
@@ -4,7 +4,7 @@ error[E0405]: cannot find trait `Oops` in this scope
LL | let _: S<impl Oops> = S;
| ^^^^ not found in this scope
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
+error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
--> $DIR/issue-104513-ice.rs:3:14
|
LL | let _: S<impl Oops> = S;
diff --git a/tests/ui/typeck/issue-107087.rs b/tests/ui/typeck/issue-107087.rs
new file mode 100644
index 000000000..135cdf19e
--- /dev/null
+++ b/tests/ui/typeck/issue-107087.rs
@@ -0,0 +1,18 @@
+struct A<T>(T);
+
+trait Foo {
+ type B;
+}
+
+impl Foo for A<u32> {
+ type B = i32;
+}
+
+impl Foo for A<i32> {
+ type B = i32;
+}
+
+fn main() {
+ A::B::<>::C
+ //~^ ERROR ambiguous associated type
+}
diff --git a/tests/ui/typeck/issue-107087.stderr b/tests/ui/typeck/issue-107087.stderr
new file mode 100644
index 000000000..70f193208
--- /dev/null
+++ b/tests/ui/typeck/issue-107087.stderr
@@ -0,0 +1,9 @@
+error[E0223]: ambiguous associated type
+ --> $DIR/issue-107087.rs:16:5
+ |
+LL | A::B::<>::C
+ | ^^^^^^^^ help: use the fully-qualified path: `<A<_> as Foo>::B`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0223`.
diff --git a/tests/ui/typeck/issue-107775.rs b/tests/ui/typeck/issue-107775.rs
new file mode 100644
index 000000000..6fbac2ee9
--- /dev/null
+++ b/tests/ui/typeck/issue-107775.rs
@@ -0,0 +1,40 @@
+// edition: 2021
+
+use std::collections::HashMap;
+use std::future::Future;
+use std::pin::Pin;
+
+pub trait Trait {
+ fn do_something<'async_trait>(byte: u8)
+ ->
+ Pin<Box<dyn Future<Output = ()> +
+ Send + 'async_trait>>;
+}
+
+pub struct Struct;
+
+impl Trait for Struct {
+ fn do_something<'async_trait>(byte: u8)
+ ->
+ Pin<Box<dyn Future<Output = ()> +
+ Send + 'async_trait>> {
+ Box::pin(
+
+ async move { let byte = byte; let _: () = {}; })
+ }
+}
+
+pub struct Map {
+ map: HashMap<u16, fn(u8) -> Pin<Box<dyn Future<Output = ()> + Send>>>,
+}
+
+impl Map {
+ pub fn new() -> Self {
+ let mut map = HashMap::new();
+ map.insert(1, Struct::do_something);
+ Self { map }
+ //~^ ERROR mismatched types
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/issue-107775.stderr b/tests/ui/typeck/issue-107775.stderr
new file mode 100644
index 000000000..9ee9c022c
--- /dev/null
+++ b/tests/ui/typeck/issue-107775.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-107775.rs:35:16
+ |
+LL | map.insert(1, Struct::do_something);
+ | - -------------------- this is of type `fn(u8) -> Pin<Box<dyn Future<Output = ()> + Send>> {<Struct as Trait>::do_something::<'_>}`, which causes `map` to be inferred as `HashMap<{integer}, fn(u8) -> Pin<Box<dyn Future<Output = ()> + Send>> {<Struct as Trait>::do_something::<'_>}>`
+ | |
+ | this is of type `{integer}`, which causes `map` to be inferred as `HashMap<{integer}, fn(u8) -> Pin<Box<dyn Future<Output = ()> + Send>> {<Struct as Trait>::do_something::<'_>}>`
+LL | Self { map }
+ | ^^^ expected `HashMap<u16, fn(u8) -> Pin<...>>`, found `HashMap<{integer}, ...>`
+ |
+ = note: expected struct `HashMap<u16, fn(_) -> Pin<Box<(dyn Future<Output = ()> + Send + 'static)>>>`
+ found struct `HashMap<{integer}, fn(_) -> Pin<Box<dyn Future<Output = ()> + Send>> {<Struct as Trait>::do_something::<'_>}>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-13853.stderr b/tests/ui/typeck/issue-13853.stderr
index 876ac2c67..11d34f5b9 100644
--- a/tests/ui/typeck/issue-13853.stderr
+++ b/tests/ui/typeck/issue-13853.stderr
@@ -5,7 +5,7 @@ LL | fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I
| - this type parameter - expected `I` because of return type
...
LL | self.iter()
- | ^^^^^^^^^^^ expected type parameter `I`, found struct `Iter`
+ | ^^^^^^^^^^^ expected type parameter `I`, found `Iter<'_, N>`
|
= note: expected type parameter `I`
found struct `std::slice::Iter<'_, N>`
@@ -22,7 +22,7 @@ error[E0308]: mismatched types
LL | iterate(graph);
| ------- ^^^^^
| | |
- | | expected reference, found struct `Vec`
+ | | expected `&_`, found `Vec<Stuff>`
| | help: consider borrowing here: `&graph`
| arguments to this function are incorrect
|
diff --git a/tests/ui/typeck/issue-31173.stderr b/tests/ui/typeck/issue-31173.stderr
index f3be99f9b..b622122f3 100644
--- a/tests/ui/typeck/issue-31173.stderr
+++ b/tests/ui/typeck/issue-31173.stderr
@@ -2,7 +2,7 @@ error[E0271]: expected `TakeWhile<&mut IntoIter<u8>, [closure@issue-31173.rs:7:2
--> $DIR/issue-31173.rs:11:10
|
LL | .cloned()
- | ^^^^^^ expected reference, found `u8`
+ | ^^^^^^ expected `&_`, found `u8`
|
= note: expected reference `&_`
found type `u8`
@@ -24,8 +24,17 @@ note: required by a bound in `cloned`
error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut IntoIter<u8>, [closure@issue-31173.rs:7:21]>>`, but its trait bounds were not satisfied
--> $DIR/issue-31173.rs:12:10
|
-LL | .collect();
- | ^^^^^^^ method cannot be called due to unsatisfied trait bounds
+LL | let temp: Vec<u8> = it
+ | _________________________-
+LL | | .take_while(|&x| {
+LL | | found_e = true;
+LL | | false
+LL | | })
+LL | | .cloned()
+LL | | .collect();
+ | | -^^^^^^^ method cannot be called due to unsatisfied trait bounds
+ | |_________|
+ |
--> $SRC_DIR/core/src/iter/adapters/take_while.rs:LL:COL
|
= note: doesn't satisfy `<_ as Iterator>::Item = &_`
diff --git a/tests/ui/typeck/issue-46112.stderr b/tests/ui/typeck/issue-46112.stderr
index 8f5ff51fb..26fc21dda 100644
--- a/tests/ui/typeck/issue-46112.stderr
+++ b/tests/ui/typeck/issue-46112.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-46112.rs:9:21
|
LL | fn main() { test(Ok(())); }
- | -- ^^ expected enum `Option`, found `()`
+ | -- ^^ expected `Option<()>`, found `()`
| |
| arguments to this enum variant are incorrect
|
diff --git a/tests/ui/typeck/issue-50687-ice-on-borrow.stderr b/tests/ui/typeck/issue-50687-ice-on-borrow.stderr
index e6a0edac4..9e48ccefd 100644
--- a/tests/ui/typeck/issue-50687-ice-on-borrow.stderr
+++ b/tests/ui/typeck/issue-50687-ice-on-borrow.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-50687-ice-on-borrow.rs:40:17
|
LL | let _: () = Borrow::borrow(&owned);
- | -- ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found reference
+ | -- ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `&_`
| |
| expected due to this
|
diff --git a/tests/ui/typeck/issue-53712.rs b/tests/ui/typeck/issue-53712.rs
new file mode 100644
index 000000000..2353904d7
--- /dev/null
+++ b/tests/ui/typeck/issue-53712.rs
@@ -0,0 +1,9 @@
+// issue #53712: make the error generated by using tuple indexing on an array more specific
+
+fn main() {
+ let arr = [10, 20, 30, 40, 50];
+ arr.0;
+ //~^ ERROR no field `0` on type `[{integer}; 5]` [E0609]
+ //~| HELP instead of using tuple indexing, use array indexing
+ //~| SUGGESTION arr[0]
+}
diff --git a/tests/ui/typeck/issue-53712.stderr b/tests/ui/typeck/issue-53712.stderr
new file mode 100644
index 000000000..db85919af
--- /dev/null
+++ b/tests/ui/typeck/issue-53712.stderr
@@ -0,0 +1,11 @@
+error[E0609]: no field `0` on type `[{integer}; 5]`
+ --> $DIR/issue-53712.rs:5:9
+ |
+LL | arr.0;
+ | ----^
+ | |
+ | help: instead of using tuple indexing, use array indexing: `arr[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr b/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr
index b92a6f2ec..dc4bc5b5f 100644
--- a/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr
+++ b/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn ice(x: Box<dyn Iterator<Item=()>>) {
| - help: try adding a return type: `-> (dyn Iterator<Item = ()> + 'static)`
LL | *x
- | ^^ expected `()`, found trait object `dyn Iterator`
+ | ^^ expected `()`, found `dyn Iterator`
|
= note: expected unit type `()`
found trait object `(dyn Iterator<Item = ()> + 'static)`
diff --git a/tests/ui/typeck/issue-67971.stderr b/tests/ui/typeck/issue-67971.stderr
index 5d07f9cc7..d50ed9cf1 100644
--- a/tests/ui/typeck/issue-67971.stderr
+++ b/tests/ui/typeck/issue-67971.stderr
@@ -8,7 +8,7 @@ error[E0308]: mismatched types
--> $DIR/issue-67971.rs:3:24
|
LL | fn foo(ctx: &mut S) -> String {
- | --- ^^^^^^ expected struct `String`, found `()`
+ | --- ^^^^^^ expected `String`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
diff --git a/tests/ui/typeck/issue-75883.rs b/tests/ui/typeck/issue-75883.rs
index 885acc482..c50ea0a08 100644
--- a/tests/ui/typeck/issue-75883.rs
+++ b/tests/ui/typeck/issue-75883.rs
@@ -4,7 +4,7 @@ pub struct UI {}
impl UI {
pub fn run() -> Result<_> {
- //~^ ERROR: this enum takes 2 generic arguments but 1 generic argument was supplied
+ //~^ ERROR: enum takes 2 generic arguments but 1 generic argument was supplied
//~| ERROR: the placeholder `_` is not allowed within types on item signatures for return types
let mut ui = UI {};
ui.interact();
@@ -13,7 +13,7 @@ impl UI {
}
pub fn interact(&mut self) -> Result<_> {
- //~^ ERROR: this enum takes 2 generic arguments but 1 generic argument was supplied
+ //~^ ERROR: enum takes 2 generic arguments but 1 generic argument was supplied
//~| ERROR: the placeholder `_` is not allowed within types on item signatures for return types
unimplemented!();
}
diff --git a/tests/ui/typeck/issue-75883.stderr b/tests/ui/typeck/issue-75883.stderr
index f5adcabe3..a1ed08406 100644
--- a/tests/ui/typeck/issue-75883.stderr
+++ b/tests/ui/typeck/issue-75883.stderr
@@ -1,4 +1,4 @@
-error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied
+error[E0107]: enum takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/issue-75883.rs:6:21
|
LL | pub fn run() -> Result<_> {
@@ -11,7 +11,7 @@ help: add missing generic argument
LL | pub fn run() -> Result<_, E> {
| +++
-error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied
+error[E0107]: enum takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/issue-75883.rs:15:35
|
LL | pub fn interact(&mut self) -> Result<_> {
diff --git a/tests/ui/typeck/issue-7813.rs b/tests/ui/typeck/issue-7813.rs
new file mode 100644
index 000000000..ce549bde6
--- /dev/null
+++ b/tests/ui/typeck/issue-7813.rs
@@ -0,0 +1,4 @@
+fn main() {
+ let v = &[]; //~ ERROR type annotations needed
+ let it = v.iter();
+}
diff --git a/tests/ui/typeck/issue-7813.stderr b/tests/ui/typeck/issue-7813.stderr
new file mode 100644
index 000000000..2a747f679
--- /dev/null
+++ b/tests/ui/typeck/issue-7813.stderr
@@ -0,0 +1,14 @@
+error[E0282]: type annotations needed for `&[_; 0]`
+ --> $DIR/issue-7813.rs:2:9
+ |
+LL | let v = &[];
+ | ^ --- type must be known at this point
+ |
+help: consider giving `v` an explicit type, where the placeholders `_` are specified
+ |
+LL | let v: &[_; 0] = &[];
+ | +++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/typeck/issue-84160.stderr b/tests/ui/typeck/issue-84160.stderr
index 24c188b3f..4d456ae84 100644
--- a/tests/ui/typeck/issue-84160.stderr
+++ b/tests/ui/typeck/issue-84160.stderr
@@ -5,7 +5,7 @@ LL | fn mismatched_types_with_reference(x: &u32) -> &u32 {
| ---- expected `&u32` because of return type
...
LL | return "test";
- | ^^^^^^ expected `u32`, found `str`
+ | ^^^^^^ expected `&u32`, found `&str`
|
= note: expected reference `&u32`
found reference `&'static str`
diff --git a/tests/ui/typeck/issue-84768.stderr b/tests/ui/typeck/issue-84768.stderr
index 09f3aee2d..3d2d53f5c 100644
--- a/tests/ui/typeck/issue-84768.stderr
+++ b/tests/ui/typeck/issue-84768.stderr
@@ -8,7 +8,7 @@ error[E0308]: mismatched types
--> $DIR/issue-84768.rs:7:42
|
LL | <F as FnOnce(&mut u8)>::call_once(f, 1)
- | --------------------------------- ^ expected tuple, found integer
+ | --------------------------------- ^ expected `(&mut u8,)`, found integer
| |
| arguments to this function are incorrect
|
@@ -21,7 +21,7 @@ LL | <F as FnOnce(&mut u8)>::call_once(f, 1)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-^
| |
| this argument influences the return type of `FnOnce`
-note: associated function defined here
+note: method defined here
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: aborting due to 2 previous errors
diff --git a/tests/ui/typeck/issue-89856.fixed b/tests/ui/typeck/issue-89856.fixed
new file mode 100644
index 000000000..3e1a006ef
--- /dev/null
+++ b/tests/ui/typeck/issue-89856.fixed
@@ -0,0 +1,18 @@
+// run-rustfix
+
+fn take_str_maybe(_: Option<&str>) { }
+fn main() {
+ let string = String::from("Hello, world");
+
+ let option: Option<String> = Some(string.clone());
+ take_str_maybe(option.as_deref());
+ //~^ ERROR: mismatched types [E0308]
+
+ let option_ref = Some(&string);
+ take_str_maybe(option_ref.map(|x| x.as_str()));
+ //~^ ERROR: mismatched types [E0308]
+
+ let option_ref_ref = option_ref.as_ref();
+ take_str_maybe(option_ref_ref.map(|x| x.as_str()));
+ //~^ ERROR: mismatched types [E0308]
+}
diff --git a/tests/ui/typeck/issue-89856.rs b/tests/ui/typeck/issue-89856.rs
index b021e349e..cfe6e19b3 100644
--- a/tests/ui/typeck/issue-89856.rs
+++ b/tests/ui/typeck/issue-89856.rs
@@ -1,8 +1,18 @@
-fn take_str_maybe(x: Option<&str>) -> Option<&str> { None }
+// run-rustfix
+fn take_str_maybe(_: Option<&str>) { }
fn main() {
let string = String::from("Hello, world");
- let option = Some(&string);
+
+ let option: Option<String> = Some(string.clone());
take_str_maybe(option);
//~^ ERROR: mismatched types [E0308]
+
+ let option_ref = Some(&string);
+ take_str_maybe(option_ref);
+ //~^ ERROR: mismatched types [E0308]
+
+ let option_ref_ref = option_ref.as_ref();
+ take_str_maybe(option_ref_ref);
+ //~^ ERROR: mismatched types [E0308]
}
diff --git a/tests/ui/typeck/issue-89856.stderr b/tests/ui/typeck/issue-89856.stderr
index 5fa1ae1a5..bd76f1724 100644
--- a/tests/ui/typeck/issue-89856.stderr
+++ b/tests/ui/typeck/issue-89856.stderr
@@ -1,23 +1,63 @@
error[E0308]: mismatched types
- --> $DIR/issue-89856.rs:6:20
+ --> $DIR/issue-89856.rs:8:20
|
LL | take_str_maybe(option);
- | -------------- ^^^^^^ expected `str`, found struct `String`
+ | -------------- ^^^^^^ expected `Option<&str>`, found `Option<String>`
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected enum `Option<&str>`
+ found enum `Option<String>`
+note: function defined here
+ --> $DIR/issue-89856.rs:3:4
+ |
+LL | fn take_str_maybe(_: Option<&str>) { }
+ | ^^^^^^^^^^^^^^ ---------------
+help: try converting the passed type into a `&str`
+ |
+LL | take_str_maybe(option.as_deref());
+ | +++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/issue-89856.rs:12:20
+ |
+LL | take_str_maybe(option_ref);
+ | -------------- ^^^^^^^^^^ expected `Option<&str>`, found `Option<&String>`
| |
| arguments to this function are incorrect
|
= note: expected enum `Option<&str>`
found enum `Option<&String>`
note: function defined here
- --> $DIR/issue-89856.rs:1:4
+ --> $DIR/issue-89856.rs:3:4
+ |
+LL | fn take_str_maybe(_: Option<&str>) { }
+ | ^^^^^^^^^^^^^^ ---------------
+help: try converting the passed type into a `&str`
+ |
+LL | take_str_maybe(option_ref.map(|x| x.as_str()));
+ | ++++++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/issue-89856.rs:16:20
+ |
+LL | take_str_maybe(option_ref_ref);
+ | -------------- ^^^^^^^^^^^^^^ expected `Option<&str>`, found `Option<&&String>`
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected enum `Option<&str>`
+ found enum `Option<&&String>`
+note: function defined here
+ --> $DIR/issue-89856.rs:3:4
|
-LL | fn take_str_maybe(x: Option<&str>) -> Option<&str> { None }
+LL | fn take_str_maybe(_: Option<&str>) { }
| ^^^^^^^^^^^^^^ ---------------
help: try converting the passed type into a `&str`
|
-LL | take_str_maybe(option.map(|x| &**x));
- | ++++++++++++++
+LL | take_str_maybe(option_ref_ref.map(|x| x.as_str()));
+ | ++++++++++++++++++++
-error: aborting due to previous error
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-90027-async-fn-return-suggestion.rs b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.rs
new file mode 100644
index 000000000..8ccb15ca4
--- /dev/null
+++ b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.rs
@@ -0,0 +1,21 @@
+// edition:2018
+
+async fn hello() { //~ HELP try adding a return type
+ 0
+ //~^ ERROR [E0308]
+}
+
+async fn world() -> () {
+ 0
+ //~^ ERROR [E0308]
+}
+
+async fn suggest_await_in_async_fn_return() {
+ hello()
+ //~^ ERROR mismatched types [E0308]
+ //~| HELP consider `await`ing on the `Future`
+ //~| HELP consider using a semicolon here
+ //~| SUGGESTION .await
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr
new file mode 100644
index 000000000..0d72ae118
--- /dev/null
+++ b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr
@@ -0,0 +1,39 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-90027-async-fn-return-suggestion.rs:4:5
+ |
+LL | async fn hello() {
+ | - help: try adding a return type: `-> i32`
+LL | 0
+ | ^ expected `()`, found integer
+
+error[E0308]: mismatched types
+ --> $DIR/issue-90027-async-fn-return-suggestion.rs:9:5
+ |
+LL | async fn world() -> () {
+ | -- expected `()` because of return type
+LL | 0
+ | ^ expected `()`, found integer
+
+error[E0308]: mismatched types
+ --> $DIR/issue-90027-async-fn-return-suggestion.rs:14:5
+ |
+LL | hello()
+ | ^^^^^^^ expected `()`, found future
+ |
+note: calling an async function returns a future
+ --> $DIR/issue-90027-async-fn-return-suggestion.rs:14:5
+ |
+LL | hello()
+ | ^^^^^^^
+help: consider `await`ing on the `Future`
+ |
+LL | hello().await
+ | ++++++
+help: consider using a semicolon here
+ |
+LL | hello();
+ | +
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-91334.rs b/tests/ui/typeck/issue-91334.rs
index bf9a5a626..29204276b 100644
--- a/tests/ui/typeck/issue-91334.rs
+++ b/tests/ui/typeck/issue-91334.rs
@@ -1,9 +1,6 @@
// Regression test for the ICE described in issue #91334.
// error-pattern: this file contains an unclosed delimiter
-// error-pattern: expected one of
-// error-pattern: mismatched closing delimiter
-// error-pattern: mismatched types
#![feature(generators)]
diff --git a/tests/ui/typeck/issue-91334.stderr b/tests/ui/typeck/issue-91334.stderr
index 8508f7a38..7cb30eea5 100644
--- a/tests/ui/typeck/issue-91334.stderr
+++ b/tests/ui/typeck/issue-91334.stderr
@@ -1,32 +1,5 @@
-error: this file contains an unclosed delimiter
- --> $DIR/issue-91334.rs:10:23
- |
-LL | fn f(){||yield(((){),
- | - - ^
- | | |
- | | unclosed delimiter
- | unclosed delimiter
-
-error: this file contains an unclosed delimiter
- --> $DIR/issue-91334.rs:10:23
- |
-LL | fn f(){||yield(((){),
- | - - ^
- | | |
- | | unclosed delimiter
- | unclosed delimiter
-
-error: expected one of `)`, `,`, `.`, `?`, or an operator, found `{`
- --> $DIR/issue-91334.rs:10:19
- |
-LL | fn f(){||yield(((){),
- | ^
- | |
- | expected one of `)`, `,`, `.`, `?`, or an operator
- | help: missing `,`
-
error: mismatched closing delimiter: `)`
- --> $DIR/issue-91334.rs:10:19
+ --> $DIR/issue-91334.rs:7:19
|
LL | fn f(){||yield(((){),
| - ^^ mismatched closing delimiter
@@ -34,17 +7,15 @@ LL | fn f(){||yield(((){),
| | unclosed delimiter
| closing delimiter possibly meant for this
-error[E0308]: mismatched types
- --> $DIR/issue-91334.rs:10:8
+error: this file contains an unclosed delimiter
+ --> $DIR/issue-91334.rs:7:23
|
LL | fn f(){||yield(((){),
- | -^^^^^^^^^^^^^^^ expected `()`, found generator
- | |
- | help: a return type might be missing here: `-> _`
- |
- = note: expected unit type `()`
- found generator `[generator@$DIR/issue-91334.rs:10:8: 10:10]`
+ | - - - ^
+ | | | |
+ | | | missing open `(` for this delimiter
+ | | unclosed delimiter
+ | unclosed delimiter
-error: aborting due to 5 previous errors
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-91450-inner-ty-error.stderr b/tests/ui/typeck/issue-91450-inner-ty-error.stderr
index 32f4c8f6f..7ca5446c2 100644
--- a/tests/ui/typeck/issue-91450-inner-ty-error.stderr
+++ b/tests/ui/typeck/issue-91450-inner-ty-error.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-91450-inner-ty-error.rs:4:13
|
LL | fn foo() -> Option<_> {}
- | --- ^^^^^^^^^ expected enum `Option`, found `()`
+ | --- ^^^^^^^^^ expected `Option<_>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
diff --git a/tests/ui/typeck/issue-92481.rs b/tests/ui/typeck/issue-92481.rs
index 0a6b1843d..f752400bb 100644
--- a/tests/ui/typeck/issue-92481.rs
+++ b/tests/ui/typeck/issue-92481.rs
@@ -2,13 +2,8 @@
#![crate_type="lib"]
-fn r({) {
- Ok { //~ ERROR mismatched types [E0308]
+fn r({) { //~ ERROR mismatched closing delimiter
+ Ok {
d..||_=m
}
}
-//~^^^^^ ERROR expected parameter name, found `{`
-//~| ERROR expected one of `,`, `:`, or `}`, found `..`
-//~^^^^^ ERROR cannot find value `d` in this scope [E0425]
-//~| ERROR cannot find value `m` in this scope [E0425]
-//~| ERROR variant `Result<_, _>::Ok` has no field named `d` [E0559]
diff --git a/tests/ui/typeck/issue-92481.stderr b/tests/ui/typeck/issue-92481.stderr
index cd778a649..d87d3277d 100644
--- a/tests/ui/typeck/issue-92481.stderr
+++ b/tests/ui/typeck/issue-92481.stderr
@@ -1,60 +1,11 @@
-error: expected parameter name, found `{`
+error: mismatched closing delimiter: `)`
--> $DIR/issue-92481.rs:5:6
|
LL | fn r({) {
- | ^ expected parameter name
+ | -^^ mismatched closing delimiter
+ | ||
+ | |unclosed delimiter
+ | closing delimiter possibly meant for this
-error: expected one of `,`, `:`, or `}`, found `..`
- --> $DIR/issue-92481.rs:5:6
- |
-LL | fn r({) {
- | ^ unclosed delimiter
-LL | Ok {
-LL | d..||_=m
- | -^
- | |
- | help: `}` may belong here
-
-error[E0425]: cannot find value `d` in this scope
- --> $DIR/issue-92481.rs:7:9
- |
-LL | d..||_=m
- | ^ not found in this scope
-
-error[E0425]: cannot find value `m` in this scope
- --> $DIR/issue-92481.rs:7:16
- |
-LL | d..||_=m
- | ^ not found in this scope
-
-error[E0559]: variant `Result<_, _>::Ok` has no field named `d`
- --> $DIR/issue-92481.rs:7:9
- |
-LL | d..||_=m
- | ^ field does not exist
- --> $SRC_DIR/core/src/result.rs:LL:COL
- |
- = note: `Result<_, _>::Ok` defined here
- |
-help: `Result<_, _>::Ok` is a tuple variant, use the appropriate syntax
- |
-LL | Result<_, _>::Ok(/* fields */)
- |
-
-error[E0308]: mismatched types
- --> $DIR/issue-92481.rs:6:5
- |
-LL | fn r({) {
- | - help: a return type might be missing here: `-> _`
-LL | / Ok {
-LL | | d..||_=m
-LL | | }
- | |_____^ expected `()`, found enum `Result`
- |
- = note: expected unit type `()`
- found enum `Result<_, _>`
-
-error: aborting due to 6 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0308, E0425, E0559.
-For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-96530.stderr b/tests/ui/typeck/issue-96530.stderr
index 4b4568b1d..3a67ef026 100644
--- a/tests/ui/typeck/issue-96530.stderr
+++ b/tests/ui/typeck/issue-96530.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-96530.rs:9:11
|
LL | ..man.clone()
- | ^^^^^^^^^^^ expected struct `Person`, found `&Person`
+ | ^^^^^^^^^^^ expected `Person`, found `&Person`
error: aborting due to previous error
diff --git a/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs
new file mode 100644
index 000000000..5ff567cd0
--- /dev/null
+++ b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs
@@ -0,0 +1,6 @@
+// compile-flags: -Ztrait-solver=next
+// known-bug: unknown
+
+fn main() {
+ (0u8 + 0u8) as char;
+}
diff --git a/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr
new file mode 100644
index 000000000..6b09ccd52
--- /dev/null
+++ b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr
@@ -0,0 +1,9 @@
+error[E0271]: type mismatch resolving `char == <u8 as Add>::Output`
+ --> $DIR/cast-checks-handling-projections.rs:5:5
+ |
+LL | (0u8 + 0u8) as char;
+ | ^^^^^^^^^^^ types differ
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0271`.
diff --git a/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs
new file mode 100644
index 000000000..019c6e81c
--- /dev/null
+++ b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs
@@ -0,0 +1,24 @@
+// compile-flags: -Ztrait-solver=next
+// known-bug: unknown
+
+trait Test {
+ type Assoc;
+}
+
+fn transform<T: Test>(x: T) -> T::Assoc {
+ todo!()
+}
+
+impl Test for i32 {
+ type Assoc = i32;
+}
+
+impl Test for String {
+ type Assoc = String;
+}
+
+fn main() {
+ let mut x = Default::default();
+ x = transform(x);
+ x = 1i32;
+}
diff --git a/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr
new file mode 100644
index 000000000..57cbc65a1
--- /dev/null
+++ b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr
@@ -0,0 +1,14 @@
+error[E0308]: mismatched types
+ --> $DIR/equating-projection-cyclically.rs:22:19
+ |
+LL | x = transform(x);
+ | ^ expected inferred type, found associated type
+ |
+ = note: expected type `_`
+ found associated type `<_ as Test>::Assoc`
+ = help: consider constraining the associated type `<_ as Test>::Assoc` to `_`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/remove-extra-argument.stderr b/tests/ui/typeck/remove-extra-argument.stderr
index b734bcd4e..72ddebab4 100644
--- a/tests/ui/typeck/remove-extra-argument.stderr
+++ b/tests/ui/typeck/remove-extra-argument.stderr
@@ -2,17 +2,16 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/remove-extra-argument.rs:6:5
|
LL | l(vec![], vec![])
- | ^ ------ argument of type `Vec<_>` unexpected
+ | ^ --------
+ | | |
+ | | unexpected argument of type `Vec<_>`
+ | help: remove the extra argument
|
note: function defined here
--> $DIR/remove-extra-argument.rs:3:4
|
LL | fn l(_a: Vec<u8>) {}
| ^ -----------
-help: remove the extra argument
- |
-LL | l(vec![])
- | ~~~~~~~~
error: aborting due to previous error
diff --git a/tests/ui/typeck/return_type_containing_closure.rs b/tests/ui/typeck/return_type_containing_closure.rs
index 29624e08a..8b826daee 100644
--- a/tests/ui/typeck/return_type_containing_closure.rs
+++ b/tests/ui/typeck/return_type_containing_closure.rs
@@ -2,7 +2,7 @@
fn foo() { //~ HELP a return type might be missing here
vec!['a'].iter().map(|c| c)
//~^ ERROR mismatched types [E0308]
- //~| NOTE expected `()`, found struct `Map`
+ //~| NOTE expected `()`, found `Map<Iter<'_, char>, ...>`
//~| NOTE expected unit type `()`
//~| HELP consider using a semicolon here
}
diff --git a/tests/ui/typeck/return_type_containing_closure.stderr b/tests/ui/typeck/return_type_containing_closure.stderr
index 101aee395..f9a240963 100644
--- a/tests/ui/typeck/return_type_containing_closure.stderr
+++ b/tests/ui/typeck/return_type_containing_closure.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/return_type_containing_closure.rs:3:5
|
LL | vec!['a'].iter().map(|c| c)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Map`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Map<Iter<'_, char>, ...>`
|
= note: expected unit type `()`
found struct `Map<std::slice::Iter<'_, char>, [closure@$DIR/return_type_containing_closure.rs:3:26: 3:29]>`
diff --git a/tests/ui/typeck/struct-enum-wrong-args.stderr b/tests/ui/typeck/struct-enum-wrong-args.stderr
index fbced928a..57cbd1d20 100644
--- a/tests/ui/typeck/struct-enum-wrong-args.stderr
+++ b/tests/ui/typeck/struct-enum-wrong-args.stderr
@@ -2,29 +2,29 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:6:13
|
LL | let _ = Some(3, 2);
- | ^^^^ - argument of type `{integer}` unexpected
+ | ^^^^ ---
+ | | |
+ | | unexpected argument of type `{integer}`
+ | help: remove the extra argument
|
note: tuple variant defined here
--> $SRC_DIR/core/src/option.rs:LL:COL
-help: remove the extra argument
- |
-LL | let _ = Some(3);
- | ~~~
error[E0061]: this enum variant takes 1 argument but 3 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:7:13
|
LL | let _ = Ok(3, 6, 2);
- | ^^ - - argument of type `{integer}` unexpected
+ | ^^ - - unexpected argument of type `{integer}`
| |
- | argument of type `{integer}` unexpected
+ | unexpected argument of type `{integer}`
|
note: tuple variant defined here
--> $SRC_DIR/core/src/result.rs:LL:COL
help: remove the extra arguments
|
-LL | let _ = Ok(3);
- | ~~~
+LL - let _ = Ok(3, 6, 2);
+LL + let _ = Ok(3);
+ |
error[E0061]: this enum variant takes 1 argument but 0 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:8:13
@@ -59,17 +59,16 @@ error[E0061]: this struct takes 1 argument but 2 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:10:13
|
LL | let _ = Wrapper(5, 2);
- | ^^^^^^^ - argument of type `{integer}` unexpected
+ | ^^^^^^^ ---
+ | | |
+ | | unexpected argument of type `{integer}`
+ | help: remove the extra argument
|
note: tuple struct defined here
--> $DIR/struct-enum-wrong-args.rs:2:8
|
LL | struct Wrapper(i32);
| ^^^^^^^
-help: remove the extra argument
- |
-LL | let _ = Wrapper(5);
- | ~~~
error[E0061]: this struct takes 2 arguments but 0 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:11:13
@@ -107,17 +106,16 @@ error[E0061]: this struct takes 2 arguments but 3 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:13:13
|
LL | let _ = DoubleWrapper(5, 2, 7);
- | ^^^^^^^^^^^^^ - argument of type `{integer}` unexpected
+ | ^^^^^^^^^^^^^ ---
+ | | |
+ | | unexpected argument of type `{integer}`
+ | help: remove the extra argument
|
note: tuple struct defined here
--> $DIR/struct-enum-wrong-args.rs:3:8
|
LL | struct DoubleWrapper(i32, i32);
| ^^^^^^^^^^^^^
-help: remove the extra argument
- |
-LL | let _ = DoubleWrapper(5, 2);
- | ~~~~~~
error: aborting due to 8 previous errors
diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.rs b/tests/ui/typeck/typeck-builtin-bound-type-parameters.rs
index c463a8ad0..7ff9199f6 100644
--- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.rs
+++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.rs
@@ -1,17 +1,17 @@
fn foo1<T:Copy<U>, U>(x: T) {}
-//~^ ERROR this trait takes 0 generic arguments but 1 generic argument was supplied
+//~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied
trait Trait: Copy<dyn Send> {}
-//~^ ERROR this trait takes 0 generic arguments but 1 generic argument was supplied
+//~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied
struct MyStruct1<T: Copy<T>>;
-//~^ ERROR this trait takes 0 generic arguments but 1 generic argument was supplied
+//~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied
struct MyStruct2<'a, T: Copy<'a>>;
-//~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
+//~^ ERROR trait takes 0 lifetime arguments but 1 lifetime argument was supplied
fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
-//~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
-//~| ERROR this trait takes 0 generic arguments but 1 generic argument was supplied
+//~^ ERROR trait takes 0 lifetime arguments but 1 lifetime argument was supplied
+//~| ERROR trait takes 0 generic arguments but 1 generic argument was supplied
fn main() { }
diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr
index 331540d1e..a71fd9536 100644
--- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr
+++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr
@@ -1,4 +1,4 @@
-error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:1:11
|
LL | fn foo1<T:Copy<U>, U>(x: T) {}
@@ -6,7 +6,7 @@ LL | fn foo1<T:Copy<U>, U>(x: T) {}
| |
| expected 0 generic arguments
-error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:4:14
|
LL | trait Trait: Copy<dyn Send> {}
@@ -14,7 +14,7 @@ LL | trait Trait: Copy<dyn Send> {}
| |
| expected 0 generic arguments
-error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:7:21
|
LL | struct MyStruct1<T: Copy<T>>;
@@ -22,7 +22,7 @@ LL | struct MyStruct1<T: Copy<T>>;
| |
| expected 0 generic arguments
-error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
+error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:10:25
|
LL | struct MyStruct2<'a, T: Copy<'a>>;
@@ -30,7 +30,7 @@ LL | struct MyStruct2<'a, T: Copy<'a>>;
| |
| expected 0 lifetime arguments
-error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
+error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:13:15
|
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
@@ -38,7 +38,7 @@ LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
| |
| expected 0 lifetime arguments
-error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:13:15
|
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
diff --git a/tests/ui/typeck/typeck_type_placeholder_item.rs b/tests/ui/typeck/typeck_type_placeholder_item.rs
index b96c52713..a450dbb82 100644
--- a/tests/ui/typeck/typeck_type_placeholder_item.rs
+++ b/tests/ui/typeck/typeck_type_placeholder_item.rs
@@ -227,4 +227,6 @@ fn evens_squared(n: usize) -> _ {
}
const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
-//~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants
+//~^ ERROR the trait bound
+//~| ERROR the trait bound
+//~| ERROR the placeholder
diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr
index bc02547c6..bc6c9fd07 100644
--- a/tests/ui/typeck/typeck_type_placeholder_item.stderr
+++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr
@@ -437,17 +437,37 @@ LL | fn evens_squared(n: usize) -> _ {
| not allowed in type signatures
| help: replace with an appropriate return type: `impl Iterator<Item = usize>`
-error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
- --> $DIR/typeck_type_placeholder_item.rs:229:10
+error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
+ --> $DIR/typeck_type_placeholder_item.rs:229:22
|
LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
- | ^ not allowed in type signatures
+ | ^^^^^^ `std::ops::Range<{integer}>` is not an iterator
+ |
+ = help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
+note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
+ --> $DIR/typeck_type_placeholder_item.rs:229:14
+ |
+LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
+ | ^^^^^^^
+
+error[E0277]: the trait bound `Filter<std::ops::Range<{integer}>, [closure@$DIR/typeck_type_placeholder_item.rs:229:29: 229:32]>: Iterator` is not satisfied
+ --> $DIR/typeck_type_placeholder_item.rs:229:45
|
-note: however, the inferred type `Map<Filter<Range<i32>, [closure@typeck_type_placeholder_item.rs:229:29]>, [closure@typeck_type_placeholder_item.rs:229:49]>` cannot be named
+LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
+ | ^^^ `Filter<std::ops::Range<{integer}>, [closure@$DIR/typeck_type_placeholder_item.rs:229:29: 229:32]>` is not an iterator
+ |
+ = help: the trait `~const Iterator` is not implemented for `Filter<std::ops::Range<{integer}>, [closure@$DIR/typeck_type_placeholder_item.rs:229:29: 229:32]>`
+note: the trait `Iterator` is implemented for `Filter<std::ops::Range<{integer}>, [closure@$DIR/typeck_type_placeholder_item.rs:229:29: 229:32]>`, but that implementation is not `const`
--> $DIR/typeck_type_placeholder_item.rs:229:14
|
LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
+ --> $DIR/typeck_type_placeholder_item.rs:229:10
+ |
+LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
+ | ^ not allowed in type signatures
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
--> $DIR/typeck_type_placeholder_item.rs:140:31
@@ -657,7 +677,7 @@ LL | const D: _ = 42;
| not allowed in type signatures
| help: replace with the correct type: `i32`
-error: aborting due to 71 previous errors
+error: aborting due to 73 previous errors
-Some errors have detailed explanations: E0121, E0282, E0403.
+Some errors have detailed explanations: E0121, E0277, E0282, E0403.
For more information about an error, try `rustc --explain E0121`.
diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.rs b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.rs
index 43e46c5b6..90b12ffdf 100644
--- a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.rs
+++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.rs
@@ -7,5 +7,5 @@ struct Foo<'a, T:'a> {
pub fn main() {
let c: Foo<_, _> = Foo { r: &5 };
- //~^ ERROR this struct takes 1 generic argument but 2 generic arguments were supplied
+ //~^ ERROR struct takes 1 generic argument but 2 generic arguments were supplied
}
diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr
index a89c6b85c..c4e4aed20 100644
--- a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr
+++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr
@@ -1,4 +1,4 @@
-error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied
+error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/typeck_type_placeholder_lifetime_1.rs:9:12
|
LL | let c: Foo<_, _> = Foo { r: &5 };
diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.rs b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.rs
index 178b8b122..e361312dd 100644
--- a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.rs
+++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.rs
@@ -7,5 +7,5 @@ struct Foo<'a, T:'a> {
pub fn main() {
let c: Foo<_, usize> = Foo { r: &5 };
- //~^ ERROR this struct takes 1 generic argument but 2 generic arguments were supplied
+ //~^ ERROR struct takes 1 generic argument but 2 generic arguments were supplied
}
diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr
index f30766bdf..302231777 100644
--- a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr
+++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr
@@ -1,4 +1,4 @@
-error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied
+error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/typeck_type_placeholder_lifetime_2.rs:9:12
|
LL | let c: Foo<_, usize> = Foo { r: &5 };
diff --git a/tests/ui/typeck/typeck_type_placeholder_mismatch.rs b/tests/ui/typeck/typeck_type_placeholder_mismatch.rs
index 2f9cfcf8d..718b6deed 100644
--- a/tests/ui/typeck/typeck_type_placeholder_mismatch.rs
+++ b/tests/ui/typeck/typeck_type_placeholder_mismatch.rs
@@ -14,7 +14,7 @@ fn test1() {
//~^ ERROR mismatched types
//~| expected struct `Foo<_>`
//~| found struct `Bar<usize>`
- //~| expected struct `Foo`, found struct `Bar`
+ //~| expected `Foo<_>`, found `Bar<usize>`
let y: Foo<usize> = x;
}
@@ -23,5 +23,5 @@ fn test2() {
//~^ ERROR mismatched types
//~| expected struct `Foo<_>`
//~| found struct `Bar<usize>`
- //~| expected struct `Foo`, found struct `Bar`
+ //~| expected `Foo<_>`, found `Bar<usize>`
}
diff --git a/tests/ui/typeck/typeck_type_placeholder_mismatch.stderr b/tests/ui/typeck/typeck_type_placeholder_mismatch.stderr
index 867412a24..bf8e0bbb5 100644
--- a/tests/ui/typeck/typeck_type_placeholder_mismatch.stderr
+++ b/tests/ui/typeck/typeck_type_placeholder_mismatch.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/typeck_type_placeholder_mismatch.rs:13:21
|
LL | let x: Foo<_> = Bar::<usize>(PhantomData);
- | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar`
+ | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Foo<_>`, found `Bar<usize>`
| |
| expected due to this
|
@@ -13,7 +13,7 @@ error[E0308]: mismatched types
--> $DIR/typeck_type_placeholder_mismatch.rs:22:21
|
LL | let x: Foo<_> = Bar::<usize>(PhantomData);
- | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar`
+ | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Foo<_>`, found `Bar<usize>`
| |
| expected due to this
|