fn note_error_origin(&self, err: &mut DiagnosticBuilder<'tcx>, cause: &ObligationCause<'tcx>) {
match cause.code {
ObligationCauseCode::MatchExpressionArmPattern { span, ty } => {
- err.span_label(span, format!("this match expression evaluates to `{}`", ty));
+ err.span_label(span, format!("this match expression has type `{}`", ty));
}
ObligationCauseCode::MatchExpressionArm { arm_span, source } => match source {
hir::MatchSource::IfLetDesugar { .. } => {
--> $DIR/issue-13624.rs:22:9
|
LL | match enum_struct_variant {
- | ------------------- this match expression evaluates to `()`
+ | ------------------- this match expression has type `()`
LL | a::Enum::EnumStructVariant { x, y, z } => {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum`
|
--> $DIR/E0308-4.rs:4:9
|
LL | match x {
- | - this match expression evaluates to `u8`
+ | - this match expression has type `u8`
LL | 0u8..=3i8 => (), //~ ERROR E0308
| ^^^^^^^^^ expected u8, found i8
--> $DIR/issue-11844.rs:6:9
|
LL | match a {
- | - this match expression evaluates to `std::option::Option<std::boxed::Box<{integer}>>`
+ | - this match expression has type `std::option::Option<std::boxed::Box<{integer}>>`
LL | Ok(a) => //~ ERROR: mismatched types
| ^^^^^ expected enum `std::option::Option`, found enum `std::result::Result`
|
--> $DIR/issue-12552.rs:6:5
|
LL | match t {
- | - this match expression evaluates to `std::result::Result<_, {integer}>`
+ | - this match expression has type `std::result::Result<_, {integer}>`
LL | Some(k) => match k { //~ ERROR mismatched types
| ^^^^^^^ expected enum `std::result::Result`, found enum `std::option::Option`
|
--> $DIR/issue-13466.rs:8:9
|
LL | let _x: usize = match Some(1) {
- | ------- this match expression evaluates to `std::option::Option<{integer}>`
+ | ------- this match expression has type `std::option::Option<{integer}>`
LL | Ok(u) => u,
| ^^^^^ expected enum `std::option::Option`, found enum `std::result::Result`
|
--> $DIR/issue-13466.rs:14:9
|
LL | let _x: usize = match Some(1) {
- | ------- this match expression evaluates to `std::option::Option<{integer}>`
+ | ------- this match expression has type `std::option::Option<{integer}>`
...
LL | Err(e) => panic!(e)
| ^^^^^^ expected enum `std::option::Option`, found enum `std::result::Result`
--> $DIR/issue-15896.rs:11:11
|
LL | let u = match e {
- | - this match expression evaluates to `main::R`
+ | - this match expression has type `main::R`
LL | E::B(
LL | Tau{t: x},
| ^^^^^^^^^ expected enum `main::R`, found struct `main::Tau`
--> $DIR/issue-16401.rs:8:9
|
LL | match () {
- | -- this match expression evaluates to `()`
+ | -- this match expression has type `()`
LL | Slice { data: data, len: len } => (),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `Slice`
|
--> $DIR/issue-3680.rs:3:9
|
LL | match None {
- | ---- this match expression evaluates to `std::option::Option<_>`
+ | ---- this match expression has type `std::option::Option<_>`
LL | Err(_) => ()
| ^^^^^^ expected enum `std::option::Option`, found enum `std::result::Result`
|
--> $DIR/issue-5100.rs:33:9
|
LL | match (true, false) {
- | ------------- this match expression evaluates to `(bool, bool)`
+ | ------------- this match expression has type `(bool, bool)`
LL | box (true, false) => ()
| ^^^^^^^^^^^^^^^^^ expected tuple, found struct `std::boxed::Box`
|
--> $DIR/issue-5358-1.rs:6:9
|
LL | match S(Either::Left(5)) {
- | ------------------ this match expression evaluates to `S`
+ | ------------------ this match expression has type `S`
LL | Either::Right(_) => {}
| ^^^^^^^^^^^^^^^^ expected struct `S`, found enum `Either`
|
--> $DIR/issue-7092.rs:6:9
|
LL | match x {
- | - this match expression evaluates to `Whatever`
+ | - this match expression has type `Whatever`
LL | Some(field) =>
| ^^^^^^^^^^^ expected enum `Whatever`, found enum `std::option::Option`
|
--> $DIR/match-range-fail.rs:17:9
|
LL | match 5 {
- | - this match expression evaluates to `{integer}`
+ | - this match expression has type `{integer}`
LL | 'c' ..= 100 => { }
| ^^^^^^^^^^^ expected integer, found char
|
--> $DIR/match-struct.rs:6:9
|
LL | match (S { a: 1 }) {
- | ------------ this match expression evaluates to `S`
+ | ------------ this match expression has type `S`
LL | E::C(_) => (),
| ^^^^^^^ expected struct `S`, found enum `E`
|
LL | fn main() { let x: A = A::A(0); match x { B::B(y) => { } } } //~ ERROR mismatched types
| - ^^^^^^^ expected enum `A`, found enum `B`
| |
- | this match expression evaluates to `A`
+ | this match expression has type `A`
|
= note: expected type `A`
found type `B`
--> $DIR/E0409.rs:5:23
|
LL | match x {
- | - this match expression evaluates to `_`
+ | - this match expression has type `_`
LL | (0, ref y) | (y, 0) => {} //~ ERROR E0409
| ^ expected &{integer}, found integer
|
LL | fn main() { match Blah::A(1, 1, 2) { Blah::A(_, x, y) | Blah::B(x, y) => { } } }
| ---------------- ^ expected usize, found isize
| |
- | this match expression evaluates to `_`
+ | this match expression has type `_`
|
= note: expected type `usize`
found type `isize`
--> $DIR/pattern-error-continue.rs:22:9
|
LL | match 'c' {
- | --- this match expression evaluates to `char`
+ | --- this match expression has type `char`
LL | S { .. } => (),
| ^^^^^^^^ expected char, found struct `S`
|
--> $DIR/pattern-tyvar.rs:5:18
|
LL | match t {
- | - this match expression evaluates to `std::option::Option<std::vec::Vec<isize>>`
+ | - this match expression has type `std::option::Option<std::vec::Vec<isize>>`
LL | Bar::T1(_, Some::<isize>(x)) => { //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^ expected struct `std::vec::Vec`, found isize
|
--> $DIR/resolve-inconsistent-binding-mode.rs:7:32
|
LL | match x {
- | - this match expression evaluates to `_`
+ | - this match expression has type `_`
LL | Opts::A(ref i) | Opts::B(i) => {}
| ^ expected &isize, found isize
|
--> $DIR/resolve-inconsistent-binding-mode.rs:16:32
|
LL | match x {
- | - this match expression evaluates to `_`
+ | - this match expression has type `_`
LL | Opts::A(ref i) | Opts::B(i) => {}
| ^ expected &isize, found isize
|
--> $DIR/resolve-inconsistent-binding-mode.rs:25:36
|
LL | match x {
- | - this match expression evaluates to `_`
+ | - this match expression has type `_`
LL | Opts::A(ref mut i) | Opts::B(ref i) => {}
| ^^^^^ types differ in mutability
|
--> $DIR/structure-constructor-type-mismatch.rs:54:9
|
LL | match (Point { x: 1, y: 2 }) {
- | ---------------------- this match expression evaluates to `Point<{integer}>`
+ | ---------------------- this match expression has type `Point<{integer}>`
LL | PointF::<u32> { .. } => {} //~ ERROR wrong number of type arguments
| ^^^^^^^^^^^^^^^^^^^^ expected integer, found f32
|
--> $DIR/structure-constructor-type-mismatch.rs:59:9
|
LL | match (Point { x: 1, y: 2 }) {
- | ---------------------- this match expression evaluates to `Point<{integer}>`
+ | ---------------------- this match expression has type `Point<{integer}>`
LL | PointF { .. } => {} //~ ERROR mismatched types
| ^^^^^^^^^^^^^ expected integer, found f32
|
--> $DIR/structure-constructor-type-mismatch.rs:67:9
|
LL | match (Pair { x: 1, y: 2 }) {
- | --------------------- this match expression evaluates to `Pair<{integer}, {integer}>`
+ | --------------------- this match expression has type `Pair<{integer}, {integer}>`
LL | PairF::<u32> { .. } => {} //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^ expected integer, found f32
|