diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/mismatched_types/abridged.stderr | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/mismatched_types/abridged.stderr')
-rw-r--r-- | src/test/ui/mismatched_types/abridged.stderr | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/src/test/ui/mismatched_types/abridged.stderr b/src/test/ui/mismatched_types/abridged.stderr new file mode 100644 index 000000000..ff1a836c9 --- /dev/null +++ b/src/test/ui/mismatched_types/abridged.stderr @@ -0,0 +1,105 @@ +error[E0308]: mismatched types + --> $DIR/abridged.rs:16:5 + | +LL | fn a() -> Foo { + | --- expected `Foo` because of return type +LL | Some(Foo { bar: 1 }) + | ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Option` + | + = note: expected struct `Foo` + found enum `Option<Foo>` + +error[E0308]: mismatched types + --> $DIR/abridged.rs:20:5 + | +LL | fn a2() -> Foo { + | --- expected `Foo` because of return type +LL | Ok(Foo { bar: 1}) + | ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Result` + | + = note: expected struct `Foo` + found enum `Result<Foo, _>` + +error[E0308]: mismatched types + --> $DIR/abridged.rs:24:5 + | +LL | fn b() -> Option<Foo> { + | ----------- expected `Option<Foo>` because of return type +LL | Foo { bar: 1 } + | ^^^^^^^^^^^^^^ expected enum `Option`, found struct `Foo` + | + = note: expected enum `Option<Foo>` + found struct `Foo` +help: try wrapping the expression in `Some` + | +LL | Some(Foo { bar: 1 }) + | +++++ + + +error[E0308]: mismatched types + --> $DIR/abridged.rs:28:5 + | +LL | fn c() -> Result<Foo, Bar> { + | ---------------- expected `Result<Foo, Bar>` because of return type +LL | Foo { bar: 1 } + | ^^^^^^^^^^^^^^ expected enum `Result`, found struct `Foo` + | + = note: expected enum `Result<Foo, Bar>` + found struct `Foo` +help: try wrapping the expression in `Ok` + | +LL | Ok(Foo { bar: 1 }) + | +++ + + +error[E0308]: mismatched types + --> $DIR/abridged.rs:39:5 + | +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 + | + = note: expected struct `X<X<_, String>, String>` + found struct `X<X<_, {integer}>, {integer}>` + +error[E0308]: mismatched types + --> $DIR/abridged.rs:50:5 + | +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 + | + = note: expected struct `X<X<_, String>, _>` + found struct `X<X<_, {integer}>, _>` + +error[E0308]: mismatched types + --> $DIR/abridged.rs:54:5 + | +LL | fn f() -> String { + | ------ expected `String` because of return type +LL | 1+2 + | ^^^ expected struct `String`, found integer + | +help: try using a conversion method + | +LL | (1+2).to_string() + | + +++++++++++++ + +error[E0308]: mismatched types + --> $DIR/abridged.rs:59:5 + | +LL | fn g() -> String { + | ------ expected `String` because of return type +LL | -2 + | ^^ expected struct `String`, found integer + | +help: try using a conversion method + | +LL | (-2).to_string() + | + +++++++++++++ + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0308`. |