diff options
| author | Michael Goulet <michael@errs.io> | 2022-08-04 03:05:57 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-08-04 03:05:57 +0000 |
| commit | 1f463ac40735529abd7343bb8a12a1888bb623df (patch) | |
| tree | 6cab261abee3cf75ce93db9cbe091e442b231a61 /src/test/ui/expr | |
| parent | c62a8ea9df90a14c8c48ccbaffa959ed6ca2a97e (diff) | |
Resolve vars before emitting coerce error
Diffstat (limited to 'src/test/ui/expr')
| -rw-r--r-- | src/test/ui/expr/if/if-branch-types.stderr | 5 | ||||
| -rw-r--r-- | src/test/ui/expr/if/if-else-type-mismatch.stderr | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/expr/if/if-branch-types.stderr b/src/test/ui/expr/if/if-branch-types.stderr index 14f02163a83..d2bba88211e 100644 --- a/src/test/ui/expr/if/if-branch-types.stderr +++ b/src/test/ui/expr/if/if-branch-types.stderr @@ -5,6 +5,11 @@ LL | let x = if true { 10i32 } else { 10u32 }; | ----- ^^^^^ expected `i32`, found `u32` | | | expected because of this + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | let x = if true { 10i32 } else { 10i32 }; + | ~~~ error: aborting due to previous error diff --git a/src/test/ui/expr/if/if-else-type-mismatch.stderr b/src/test/ui/expr/if/if-else-type-mismatch.stderr index 9fa190d6c9d..f1fffdb1e7e 100644 --- a/src/test/ui/expr/if/if-else-type-mismatch.stderr +++ b/src/test/ui/expr/if/if-else-type-mismatch.stderr @@ -10,6 +10,11 @@ LL | | 2u32 | | ^^^^ expected `i32`, found `u32` LL | | }; | |_____- `if` and `else` have incompatible types + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | 2i32 + | ~~~ error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:8:38 @@ -18,6 +23,11 @@ LL | let _ = if true { 42i32 } else { 42u32 }; | ----- ^^^^^ expected `i32`, found `u32` | | | expected because of this + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | let _ = if true { 42i32 } else { 42i32 }; + | ~~~ error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:13:9 |
