summaryrefslogtreecommitdiffstats
path: root/tests/ui/mismatched_types
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/mismatched_types')
-rw-r--r--tests/ui/mismatched_types/abridged.stderr16
-rw-r--r--tests/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr4
-rw-r--r--tests/ui/mismatched_types/issue-106182.stderr2
-rw-r--r--tests/ui/mismatched_types/issue-38371-unfixable.stderr2
-rw-r--r--tests/ui/mismatched_types/issue-38371.stderr4
-rw-r--r--tests/ui/mismatched_types/issue-47706.stderr2
-rw-r--r--tests/ui/mismatched_types/issue-74918-missing-lifetime.stderr4
-rw-r--r--tests/ui/mismatched_types/non_zero_assigned_something.stderr4
-rw-r--r--tests/ui/mismatched_types/normalize-fn-sig.stderr3
-rw-r--r--tests/ui/mismatched_types/overloaded-calls-bad.stderr7
-rw-r--r--tests/ui/mismatched_types/ref-pat-suggestions.stderr18
-rw-r--r--tests/ui/mismatched_types/show_module.stderr8
-rw-r--r--tests/ui/mismatched_types/similar_paths.stderr8
-rw-r--r--tests/ui/mismatched_types/similar_paths_primitive.stderr6
-rw-r--r--tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr4
-rw-r--r--tests/ui/mismatched_types/suggest-removing-tuple-struct-field.stderr4
-rw-r--r--tests/ui/mismatched_types/wrap-suggestion-privacy.stderr6
17 files changed, 52 insertions, 50 deletions
diff --git a/tests/ui/mismatched_types/abridged.stderr b/tests/ui/mismatched_types/abridged.stderr
index ff1a836c9..6d2fb1ce9 100644
--- a/tests/ui/mismatched_types/abridged.stderr
+++ b/tests/ui/mismatched_types/abridged.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn a() -> Foo {
| --- expected `Foo` because of return type
LL | Some(Foo { bar: 1 })
- | ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Option`
+ | ^^^^^^^^^^^^^^^^^^^^ expected `Foo`, found `Option<Foo>`
|
= note: expected struct `Foo`
found enum `Option<Foo>`
@@ -15,7 +15,7 @@ error[E0308]: mismatched types
LL | fn a2() -> Foo {
| --- expected `Foo` because of return type
LL | Ok(Foo { bar: 1})
- | ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Result`
+ | ^^^^^^^^^^^^^^^^^ expected `Foo`, found `Result<Foo, _>`
|
= note: expected struct `Foo`
found enum `Result<Foo, _>`
@@ -26,7 +26,7 @@ error[E0308]: mismatched types
LL | fn b() -> Option<Foo> {
| ----------- expected `Option<Foo>` because of return type
LL | Foo { bar: 1 }
- | ^^^^^^^^^^^^^^ expected enum `Option`, found struct `Foo`
+ | ^^^^^^^^^^^^^^ expected `Option<Foo>`, found `Foo`
|
= note: expected enum `Option<Foo>`
found struct `Foo`
@@ -41,7 +41,7 @@ error[E0308]: mismatched types
LL | fn c() -> Result<Foo, Bar> {
| ---------------- expected `Result<Foo, Bar>` because of return type
LL | Foo { bar: 1 }
- | ^^^^^^^^^^^^^^ expected enum `Result`, found struct `Foo`
+ | ^^^^^^^^^^^^^^ expected `Result<Foo, Bar>`, found `Foo`
|
= note: expected enum `Result<Foo, Bar>`
found struct `Foo`
@@ -57,7 +57,7 @@ LL | fn d() -> X<X<String, String>, String> {
| ---------------------------- expected `X<X<String, String>, String>` because of return type
...
LL | x
- | ^ expected struct `String`, found integer
+ | ^ expected `X<X<String, String>, String>`, found `X<X<String, {integer}>, {integer}>`
|
= note: expected struct `X<X<_, String>, String>`
found struct `X<X<_, {integer}>, {integer}>`
@@ -69,7 +69,7 @@ LL | fn e() -> X<X<String, String>, String> {
| ---------------------------- expected `X<X<String, String>, String>` because of return type
...
LL | x
- | ^ expected struct `String`, found integer
+ | ^ expected `X<X<String, String>, String>`, found `X<X<String, {integer}>, String>`
|
= note: expected struct `X<X<_, String>, _>`
found struct `X<X<_, {integer}>, _>`
@@ -80,7 +80,7 @@ error[E0308]: mismatched types
LL | fn f() -> String {
| ------ expected `String` because of return type
LL | 1+2
- | ^^^ expected struct `String`, found integer
+ | ^^^ expected `String`, found integer
|
help: try using a conversion method
|
@@ -93,7 +93,7 @@ error[E0308]: mismatched types
LL | fn g() -> String {
| ------ expected `String` because of return type
LL | -2
- | ^^ expected struct `String`, found integer
+ | ^^ expected `String`, found integer
|
help: try using a conversion method
|
diff --git a/tests/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr b/tests/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr
index 2f814445b..54abb50d6 100644
--- a/tests/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr
+++ b/tests/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr
@@ -6,7 +6,7 @@ LL | | S
| | - expected because of this
LL | | } else {
LL | | Y
- | | ^ expected struct `S`, found struct `Y`
+ | | ^ expected `S`, found `Y`
LL | | }
| |_____- `if` and `else` have incompatible types
@@ -17,7 +17,7 @@ LL | / match true {
LL | | true => S,
| | - this is found to be of type `S`
LL | | false => Y,
- | | ^ expected struct `S`, found struct `Y`
+ | | ^ expected `S`, found `Y`
LL | | }
| |_____- `match` arms have incompatible types
diff --git a/tests/ui/mismatched_types/issue-106182.stderr b/tests/ui/mismatched_types/issue-106182.stderr
index ac3ab8e98..96ab3a029 100644
--- a/tests/ui/mismatched_types/issue-106182.stderr
+++ b/tests/ui/mismatched_types/issue-106182.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | match x {
| - this expression has type `&_S`
LL | _S(& (mut _y), _v) => {
- | ^^^^^^^^^^ expected `u32`, found reference
+ | ^^^^^^^^^^ expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
diff --git a/tests/ui/mismatched_types/issue-38371-unfixable.stderr b/tests/ui/mismatched_types/issue-38371-unfixable.stderr
index 3c5e765ab..318285598 100644
--- a/tests/ui/mismatched_types/issue-38371-unfixable.stderr
+++ b/tests/ui/mismatched_types/issue-38371-unfixable.stderr
@@ -10,7 +10,7 @@ error[E0308]: mismatched types
LL | fn bgh(&&bar: u32) {}
| ^^^^^ --- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
diff --git a/tests/ui/mismatched_types/issue-38371.stderr b/tests/ui/mismatched_types/issue-38371.stderr
index f43427f98..19335c446 100644
--- a/tests/ui/mismatched_types/issue-38371.stderr
+++ b/tests/ui/mismatched_types/issue-38371.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn foo(&_a: Foo) {}
| ^^^ --- expected due to this
| |
- | expected struct `Foo`, found reference
+ | expected `Foo`, found `&_`
|
= note: expected struct `Foo`
found reference `&_`
@@ -20,7 +20,7 @@ error[E0308]: mismatched types
LL | fn agh(&&_a: &u32) {}
| ^^^ ---- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
diff --git a/tests/ui/mismatched_types/issue-47706.stderr b/tests/ui/mismatched_types/issue-47706.stderr
index d9d408844..69d6ee5cb 100644
--- a/tests/ui/mismatched_types/issue-47706.stderr
+++ b/tests/ui/mismatched_types/issue-47706.stderr
@@ -27,7 +27,7 @@ note: required by a bound in `foo`
--> $DIR/issue-47706.rs:22:8
|
LL | fn foo<F>(f: F)
- | --- required by a bound in this
+ | --- required by a bound in this function
LL | where
LL | F: Fn(),
| ^^^^ required by this bound in `foo`
diff --git a/tests/ui/mismatched_types/issue-74918-missing-lifetime.stderr b/tests/ui/mismatched_types/issue-74918-missing-lifetime.stderr
index 9ddea1629..b52318230 100644
--- a/tests/ui/mismatched_types/issue-74918-missing-lifetime.stderr
+++ b/tests/ui/mismatched_types/issue-74918-missing-lifetime.stderr
@@ -16,9 +16,9 @@ LL | fn next(&mut self) -> Option<IteratorChunk<T, S>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'1, T, S>>`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
- = note: expected `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'static, T, S>>`
+ = note: expected `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'2, T, S>>`
|
- = note: expected signature `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'static, T, S>>`
+ = note: expected signature `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'2, T, S>>`
found signature `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'1, T, S>>`
= help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
= help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
diff --git a/tests/ui/mismatched_types/non_zero_assigned_something.stderr b/tests/ui/mismatched_types/non_zero_assigned_something.stderr
index d4b2c902f..57db71f88 100644
--- a/tests/ui/mismatched_types/non_zero_assigned_something.stderr
+++ b/tests/ui/mismatched_types/non_zero_assigned_something.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/non_zero_assigned_something.rs:2:35
|
LL | let _: std::num::NonZeroU64 = 1;
- | -------------------- ^ expected struct `NonZeroU64`, found integer
+ | -------------------- ^ expected `NonZeroU64`, found integer
| |
| expected due to this
|
@@ -15,7 +15,7 @@ error[E0308]: mismatched types
--> $DIR/non_zero_assigned_something.rs:6:43
|
LL | let _: Option<std::num::NonZeroU64> = 1;
- | ---------------------------- ^ expected enum `Option`, found integer
+ | ---------------------------- ^ expected `Option<NonZeroU64>`, found integer
| |
| expected due to this
|
diff --git a/tests/ui/mismatched_types/normalize-fn-sig.stderr b/tests/ui/mismatched_types/normalize-fn-sig.stderr
index 6c55f29c5..e3a064655 100644
--- a/tests/ui/mismatched_types/normalize-fn-sig.stderr
+++ b/tests/ui/mismatched_types/normalize-fn-sig.stderr
@@ -2,12 +2,13 @@ error[E0308]: mismatched types
--> $DIR/normalize-fn-sig.rs:14:22
|
LL | needs_i32_ref_fn(foo::<()>);
- | ---------------- ^^^^^^^^^ expected `&i32`, found `i32`
+ | ---------------- ^^^^^^^^^ expected fn pointer, found fn item
| |
| arguments to this function are incorrect
|
= note: expected fn pointer `fn(&'static i32, i32)`
found fn item `fn(i32, &'static i32) {foo::<()>}`
+ = note: when the arguments and return types match, functions can be coerced to function pointers
note: function defined here
--> $DIR/normalize-fn-sig.rs:11:4
|
diff --git a/tests/ui/mismatched_types/overloaded-calls-bad.stderr b/tests/ui/mismatched_types/overloaded-calls-bad.stderr
index 3a895acbd..cd483e7ad 100644
--- a/tests/ui/mismatched_types/overloaded-calls-bad.stderr
+++ b/tests/ui/mismatched_types/overloaded-calls-bad.stderr
@@ -32,7 +32,7 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/overloaded-calls-bad.rs:37:15
|
LL | let ans = s("burma", "shave");
- | ^ ------- ------- argument of type `&'static str` unexpected
+ | ^ ------- ------- unexpected argument of type `&'static str`
| |
| expected `isize`, found `&str`
|
@@ -43,8 +43,9 @@ LL | impl FnMut<(isize,)> for S {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: remove the extra argument
|
-LL | let ans = s(/* isize */);
- | ~~~~~~~~~~~~~
+LL - let ans = s("burma", "shave");
+LL + let ans = s(/* isize */);
+ |
error[E0308]: mismatched types
--> $DIR/overloaded-calls-bad.rs:40:7
diff --git a/tests/ui/mismatched_types/ref-pat-suggestions.stderr b/tests/ui/mismatched_types/ref-pat-suggestions.stderr
index 63eaa3930..62824004d 100644
--- a/tests/ui/mismatched_types/ref-pat-suggestions.stderr
+++ b/tests/ui/mismatched_types/ref-pat-suggestions.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn _f0(&_a: u32) {}
| ^^^ --- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
@@ -41,7 +41,7 @@ error[E0308]: mismatched types
LL | fn _f2(&&_a: &u32) {}
| ^^^ ---- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
@@ -57,7 +57,7 @@ error[E0308]: mismatched types
LL | fn _f3(&mut &_a: &mut u32) {}
| ^^^ -------- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
@@ -106,7 +106,7 @@ LL | let _: fn(u32) = |&_a| ();
| ^--
| ||
| |expected due to this
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
@@ -145,7 +145,7 @@ LL | let _: fn(&u32) = |&&_a| ();
| ^--
| ||
| |expected due to this
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
@@ -162,7 +162,7 @@ LL | let _: fn(&mut u32) = |&mut &_a| ();
| ^--
| ||
| |expected due to this
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
@@ -212,7 +212,7 @@ error[E0308]: mismatched types
LL | let _ = |&_a: u32| ();
| ^^^ --- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
@@ -249,7 +249,7 @@ error[E0308]: mismatched types
LL | let _ = |&&_a: &u32| ();
| ^^^ ---- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
@@ -265,7 +265,7 @@ error[E0308]: mismatched types
LL | let _ = |&mut &_a: &mut u32| ();
| ^^^ -------- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
diff --git a/tests/ui/mismatched_types/show_module.stderr b/tests/ui/mismatched_types/show_module.stderr
index 5e48e0955..4bbeaaab9 100644
--- a/tests/ui/mismatched_types/show_module.stderr
+++ b/tests/ui/mismatched_types/show_module.stderr
@@ -4,15 +4,15 @@ error[E0308]: mismatched types
LL | fn foo() -> Foo {
| --- expected `baz::Foo` because of return type
LL | meh::Foo
- | ^^^^^^^^ expected struct `baz::Foo`, found struct `meh::Foo`
+ | ^^^^^^^^ expected `baz::Foo`, found `meh::Foo`
|
- = note: struct `meh::Foo` and struct `baz::Foo` have similar names, but are actually distinct types
-note: struct `meh::Foo` is defined in module `crate::meh` of the current crate
+ = note: `meh::Foo` and `baz::Foo` have similar names, but are actually distinct types
+note: `meh::Foo` is defined in module `crate::meh` of the current crate
--> $DIR/show_module.rs:8:5
|
LL | pub struct Foo;
| ^^^^^^^^^^^^^^
-note: struct `baz::Foo` is defined in module `crate::blah::baz` of the current crate
+note: `baz::Foo` is defined in module `crate::blah::baz` of the current crate
--> $DIR/show_module.rs:3:9
|
LL | pub struct Foo;
diff --git a/tests/ui/mismatched_types/similar_paths.stderr b/tests/ui/mismatched_types/similar_paths.stderr
index 46a383325..3e44fb759 100644
--- a/tests/ui/mismatched_types/similar_paths.stderr
+++ b/tests/ui/mismatched_types/similar_paths.stderr
@@ -4,12 +4,12 @@ error[E0308]: mismatched types
LL | pub fn foo() -> Option<u8> {
| ---------- expected `Option<u8>` because of return type
LL | Some(42_u8)
- | ^^^^^^^^^^^ expected enum `Option`, found enum `std::option::Option`
+ | ^^^^^^^^^^^ expected `Option<u8>`, found `std::option::Option<u8>`
|
- = note: enum `std::option::Option` and enum `Option` have similar names, but are actually distinct types
-note: enum `std::option::Option` is defined in crate `core`
+ = note: `std::option::Option<u8>` and `Option<u8>` have similar names, but are actually distinct types
+note: `std::option::Option<u8>` is defined in crate `core`
--> $SRC_DIR/core/src/option.rs:LL:COL
-note: enum `Option` is defined in the current crate
+note: `Option<u8>` is defined in the current crate
--> $DIR/similar_paths.rs:1:1
|
LL | enum Option<T> {
diff --git a/tests/ui/mismatched_types/similar_paths_primitive.stderr b/tests/ui/mismatched_types/similar_paths_primitive.stderr
index 8a2f73945..80e78a4e4 100644
--- a/tests/ui/mismatched_types/similar_paths_primitive.stderr
+++ b/tests/ui/mismatched_types/similar_paths_primitive.stderr
@@ -2,13 +2,13 @@ error[E0308]: mismatched types
--> $DIR/similar_paths_primitive.rs:8:9
|
LL | foo(true);
- | --- ^^^^ expected struct `bool`, found `bool`
+ | --- ^^^^ expected `bool`, found a different `bool`
| |
| arguments to this function are incorrect
|
- = note: bool and struct `bool` have similar names, but are actually distinct types
+ = note: bool and `bool` have similar names, but are actually distinct types
= note: bool is a primitive defined by the language
-note: struct `bool` is defined in the current crate
+note: `bool` is defined in the current crate
--> $DIR/similar_paths_primitive.rs:3:1
|
LL | struct bool;
diff --git a/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr b/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr
index f58b9c3ec..40182a75a 100644
--- a/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr
+++ b/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr
@@ -6,7 +6,7 @@ LL | | S
| | - expected because of this
LL | | } else {
LL | | Y
- | | ^ expected struct `S`, found struct `Y`
+ | | ^ expected `S`, found `Y`
LL | | }
| |_____- `if` and `else` have incompatible types
|
@@ -28,7 +28,7 @@ LL | / match true {
LL | | true => S,
| | - this is found to be of type `S`
LL | | false => Y,
- | | ^ expected struct `S`, found struct `Y`
+ | | ^ expected `S`, found `Y`
LL | | }
| |_____- `match` arms have incompatible types
|
diff --git a/tests/ui/mismatched_types/suggest-removing-tuple-struct-field.stderr b/tests/ui/mismatched_types/suggest-removing-tuple-struct-field.stderr
index 35871afb5..c5d0eef10 100644
--- a/tests/ui/mismatched_types/suggest-removing-tuple-struct-field.stderr
+++ b/tests/ui/mismatched_types/suggest-removing-tuple-struct-field.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/suggest-removing-tuple-struct-field.rs:11:13
|
LL | some_fn(value.0);
- | ------- ^^^^^^^ expected struct `MyWrapper`, found `u32`
+ | ------- ^^^^^^^ expected `MyWrapper`, found `u32`
| |
| arguments to this function are incorrect
|
@@ -21,7 +21,7 @@ error[E0308]: mismatched types
--> $DIR/suggest-removing-tuple-struct-field.rs:12:13
|
LL | some_fn(my_wrapper!(123).0);
- | ------- ^^^^^^^^^^^^^^^^^^ expected struct `MyWrapper`, found `u32`
+ | ------- ^^^^^^^^^^^^^^^^^^ expected `MyWrapper`, found `u32`
| |
| arguments to this function are incorrect
|
diff --git a/tests/ui/mismatched_types/wrap-suggestion-privacy.stderr b/tests/ui/mismatched_types/wrap-suggestion-privacy.stderr
index fdd92cbfc..e20a0aa0e 100644
--- a/tests/ui/mismatched_types/wrap-suggestion-privacy.stderr
+++ b/tests/ui/mismatched_types/wrap-suggestion-privacy.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/wrap-suggestion-privacy.rs:12:19
|
LL | needs_wrapper(0);
- | ------------- ^ expected struct `Wrapper`, found integer
+ | ------------- ^ expected `Wrapper<i32>`, found integer
| |
| arguments to this function are incorrect
|
@@ -22,7 +22,7 @@ error[E0308]: mismatched types
--> $DIR/wrap-suggestion-privacy.rs:17:20
|
LL | needs_wrapping(0);
- | -------------- ^ expected struct `Wrapping`, found integer
+ | -------------- ^ expected `Wrapping<i32>`, found integer
| |
| arguments to this function are incorrect
|
@@ -42,7 +42,7 @@ error[E0308]: mismatched types
--> $DIR/wrap-suggestion-privacy.rs:22:17
|
LL | needs_ready(Some(0));
- | ----------- ^^^^^^^ expected struct `Ready`, found enum `Option`
+ | ----------- ^^^^^^^ expected `Ready<i32>`, found `Option<{integer}>`
| |
| arguments to this function are incorrect
|