diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index e2b70abe6f0f5..69c5ea56ad626 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -661,7 +661,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { }, ObligationCauseCode::IfExpression(box IfExpressionCause { then, outer, semicolon }) => { err.span_label(then, "expected because of this"); - outer.map(|sp| err.span_label(sp, "if and else have incompatible types")); + outer.map(|sp| err.span_label(sp, "`if` and `else` have incompatible types")); if let Some(sp) = semicolon { err.span_suggestion_short( sp, @@ -1883,13 +1883,13 @@ impl<'tcx> ObligationCause<'tcx> { hir::MatchSource::TryDesugar => { "try expression alternatives have incompatible types" } - _ => "match arms have incompatible types", + _ => "`match` arms have incompatible types", }) } - IfExpression { .. } => Error0308("if and else have incompatible types"), - IfExpressionWithNoElse => Error0317("if may be missing an else clause"), - MainFunctionType => Error0580("main function has wrong type"), - StartFunctionType => Error0308("start function has wrong type"), + IfExpression { .. } => Error0308("`if` and `else` have incompatible types"), + IfExpressionWithNoElse => Error0317("`if` may be missing an `else` clause"), + MainFunctionType => Error0580("`main` function has wrong type"), + StartFunctionType => Error0308("`#[start]` function has wrong type"), IntrinsicType => Error0308("intrinsic has wrong type"), MethodReceiver => Error0308("mismatched `self` parameter type"), @@ -1917,12 +1917,12 @@ impl<'tcx> ObligationCause<'tcx> { ExprAssignable => "expression is assignable", MatchExpressionArm(box MatchExpressionArmCause { source, .. }) => match source { hir::MatchSource::IfLetDesugar { .. } => "`if let` arms have compatible types", - _ => "match arms have compatible types", + _ => "`match` arms have compatible types", }, - IfExpression { .. } => "if and else have incompatible types", - IfExpressionWithNoElse => "if missing an else returns ()", + IfExpression { .. } => "`if` and `else` have incompatible types", + IfExpressionWithNoElse => "`if` missing an `else` returns `()`", MainFunctionType => "`main` function has the correct type", - StartFunctionType => "`start` function has the correct type", + StartFunctionType => "`#[start]` function has the correct type", IntrinsicType => "intrinsic has the correct type", MethodReceiver => "method receiver has the correct type", _ => "types are compatible", diff --git a/src/librustc_passes/entry.rs b/src/librustc_passes/entry.rs index 3a7d1780d470d..910d752359908 100644 --- a/src/librustc_passes/entry.rs +++ b/src/librustc_passes/entry.rs @@ -134,7 +134,7 @@ fn find_item(item: &Item<'_>, ctxt: &mut EntryContext<'_, '_>, at_root: bool) { ctxt.start_fn = Some((item.hir_id, item.span)); } else { struct_span_err!(ctxt.session, item.span, E0138, "multiple `start` functions") - .span_label(ctxt.start_fn.unwrap().1, "previous `start` function here") + .span_label(ctxt.start_fn.unwrap().1, "previous `#[start]` function here") .span_label(item.span, "multiple `start` functions") .emit(); } diff --git a/src/librustc_target/spec/wasm32_base.rs b/src/librustc_target/spec/wasm32_base.rs index 77f5ff09244dd..47e80e8db19f6 100644 --- a/src/librustc_target/spec/wasm32_base.rs +++ b/src/librustc_target/spec/wasm32_base.rs @@ -81,7 +81,7 @@ pub fn options() -> TargetOptions { dynamic_linking: true, only_cdylib: true, - // This means we'll just embed a `start` function in the wasm module + // This means we'll just embed a `#[start]` function in the wasm module executables: true, // relatively self-explanatory! diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 4c0ef45cae5c5..1f0bc6a8e13c4 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -298,7 +298,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // LL || 10u32 // || ^^^^^ expected `i32`, found `u32` // LL || }; - // ||_____- if and else have incompatible types + // ||_____- `if` and `else` have incompatible types // ``` Some(span) } else { @@ -340,7 +340,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // by not pointing at the entire expression: // ``` // 2 | let x = if true { - // | ------- if and else have incompatible types + // | ------- `if` and `else` have incompatible types // 3 | 3 // | - expected because of this // 4 | } else { diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index 50712058874c4..0e94a72277751 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -387,8 +387,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { &self, start, i.span, - "a `#[start]` function is an experimental \ - feature whose signature may change \ + "`#[start]` functions are experimental \ + and their signature may change \ over time" ); } diff --git a/src/test/ui/async-await/issue-66387-if-without-else.rs b/src/test/ui/async-await/issue-66387-if-without-else.rs index aa5a8db61210d..3ab8220b4aff3 100644 --- a/src/test/ui/async-await/issue-66387-if-without-else.rs +++ b/src/test/ui/async-await/issue-66387-if-without-else.rs @@ -1,6 +1,6 @@ // edition:2018 async fn f() -> i32 { - if true { //~ ERROR if may be missing an else clause + if true { //~ ERROR `if` may be missing an `else` clause return 0; } // An `if` block without `else` causes the type table not to have a type for this expr. diff --git a/src/test/ui/async-await/issue-66387-if-without-else.stderr b/src/test/ui/async-await/issue-66387-if-without-else.stderr index 42e44472aca71..e8e2a48983c89 100644 --- a/src/test/ui/async-await/issue-66387-if-without-else.stderr +++ b/src/test/ui/async-await/issue-66387-if-without-else.stderr @@ -1,4 +1,4 @@ -error[E0317]: if may be missing an else clause +error[E0317]: `if` may be missing an `else` clause --> $DIR/issue-66387-if-without-else.rs:3:5 | LL | / if true { diff --git a/src/test/ui/bad/bad-expr-path.rs b/src/test/ui/bad/bad-expr-path.rs index 99ba93253d16f..31fc9cf2cb575 100644 --- a/src/test/ui/bad/bad-expr-path.rs +++ b/src/test/ui/bad/bad-expr-path.rs @@ -1,6 +1,6 @@ mod m1 {} -fn main(arguments: Vec) { //~ ERROR main function has wrong type +fn main(arguments: Vec) { //~ ERROR `main` function has wrong type log(debug, m1::arguments); //~^ ERROR cannot find function `log` in this scope //~| ERROR cannot find value `debug` in this scope diff --git a/src/test/ui/bad/bad-expr-path.stderr b/src/test/ui/bad/bad-expr-path.stderr index faba9911f866e..56bb6e2be88c4 100644 --- a/src/test/ui/bad/bad-expr-path.stderr +++ b/src/test/ui/bad/bad-expr-path.stderr @@ -16,7 +16,7 @@ error[E0425]: cannot find value `arguments` in module `m1` LL | log(debug, m1::arguments); | ^^^^^^^^^ not found in `m1` -error[E0580]: main function has wrong type +error[E0580]: `main` function has wrong type --> $DIR/bad-expr-path.rs:3:1 | LL | fn main(arguments: Vec) { diff --git a/src/test/ui/bad/bad-expr-path2.rs b/src/test/ui/bad/bad-expr-path2.rs index 43bd2908042a5..eb88edb9071ef 100644 --- a/src/test/ui/bad/bad-expr-path2.rs +++ b/src/test/ui/bad/bad-expr-path2.rs @@ -2,7 +2,7 @@ mod m1 { pub mod arguments {} } -fn main(arguments: Vec) { //~ ERROR main function has wrong type +fn main(arguments: Vec) { //~ ERROR `main` function has wrong type log(debug, m1::arguments); //~^ ERROR cannot find function `log` in this scope //~| ERROR cannot find value `debug` in this scope diff --git a/src/test/ui/bad/bad-expr-path2.stderr b/src/test/ui/bad/bad-expr-path2.stderr index 53b6d35e8f3a2..e217c45b267af 100644 --- a/src/test/ui/bad/bad-expr-path2.stderr +++ b/src/test/ui/bad/bad-expr-path2.stderr @@ -16,7 +16,7 @@ error[E0423]: expected value, found module `m1::arguments` LL | log(debug, m1::arguments); | ^^^^^^^^^^^^^ not a value -error[E0580]: main function has wrong type +error[E0580]: `main` function has wrong type --> $DIR/bad-expr-path2.rs:5:1 | LL | fn main(arguments: Vec) { diff --git a/src/test/ui/bad/bad-main.rs b/src/test/ui/bad/bad-main.rs index c9e2f02f071b2..7511599614247 100644 --- a/src/test/ui/bad/bad-main.rs +++ b/src/test/ui/bad/bad-main.rs @@ -1 +1 @@ -fn main(x: isize) { } //~ ERROR: main function has wrong type [E0580] +fn main(x: isize) { } //~ ERROR: `main` function has wrong type [E0580] diff --git a/src/test/ui/bad/bad-main.stderr b/src/test/ui/bad/bad-main.stderr index 1e57c2488e9ef..675b66d057838 100644 --- a/src/test/ui/bad/bad-main.stderr +++ b/src/test/ui/bad/bad-main.stderr @@ -1,4 +1,4 @@ -error[E0580]: main function has wrong type +error[E0580]: `main` function has wrong type --> $DIR/bad-main.rs:1:1 | LL | fn main(x: isize) { } diff --git a/src/test/ui/consts/control-flow/issue-50577.if_match.stderr b/src/test/ui/consts/control-flow/issue-50577.if_match.stderr index 79572c417024f..6771224e6cf5e 100644 --- a/src/test/ui/consts/control-flow/issue-50577.if_match.stderr +++ b/src/test/ui/consts/control-flow/issue-50577.if_match.stderr @@ -1,4 +1,4 @@ -error[E0317]: if may be missing an else clause +error[E0317]: `if` may be missing an `else` clause --> $DIR/issue-50577.rs:7:16 | LL | Drop = assert_eq!(1, 1) diff --git a/src/test/ui/consts/control-flow/issue-50577.rs b/src/test/ui/consts/control-flow/issue-50577.rs index 7906ec4dc68c7..9600f8b6aeeab 100644 --- a/src/test/ui/consts/control-flow/issue-50577.rs +++ b/src/test/ui/consts/control-flow/issue-50577.rs @@ -5,7 +5,7 @@ fn main() { enum Foo { Drop = assert_eq!(1, 1) - //[stock,if_match]~^ ERROR if may be missing an else clause + //[stock,if_match]~^ ERROR `if` may be missing an `else` clause //[stock]~^^ ERROR `match` is not allowed in a `const` //[stock]~| ERROR `match` is not allowed in a `const` //[stock]~| ERROR `if` is not allowed in a `const` diff --git a/src/test/ui/consts/control-flow/issue-50577.stock.stderr b/src/test/ui/consts/control-flow/issue-50577.stock.stderr index 13b50954292ea..7d637f5aa9671 100644 --- a/src/test/ui/consts/control-flow/issue-50577.stock.stderr +++ b/src/test/ui/consts/control-flow/issue-50577.stock.stderr @@ -28,7 +28,7 @@ LL | Drop = assert_eq!(1, 1) = help: add `#![feature(const_if_match)]` to the crate attributes to enable = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) -error[E0317]: if may be missing an else clause +error[E0317]: `if` may be missing an `else` clause --> $DIR/issue-50577.rs:7:16 | LL | Drop = assert_eq!(1, 1) diff --git a/src/test/ui/error-codes/E0138.stderr b/src/test/ui/error-codes/E0138.stderr index 445053a4a89e3..2dc6976fe0e9c 100644 --- a/src/test/ui/error-codes/E0138.stderr +++ b/src/test/ui/error-codes/E0138.stderr @@ -2,7 +2,7 @@ error[E0138]: multiple `start` functions --> $DIR/E0138.rs:7:1 | LL | fn foo(argc: isize, argv: *const *const u8) -> isize { 0 } - | ---------------------------------------------------------- previous `start` function here + | ---------------------------------------------------------- previous `#[start]` function here ... LL | fn f(argc: isize, argv: *const *const u8) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple `start` functions diff --git a/src/test/ui/extern/extern-main-fn.rs b/src/test/ui/extern/extern-main-fn.rs index dacebfbecf5d6..ddf2e136f03ce 100644 --- a/src/test/ui/extern/extern-main-fn.rs +++ b/src/test/ui/extern/extern-main-fn.rs @@ -1 +1 @@ -extern fn main() {} //~ ERROR: main function has wrong type [E0580] +extern fn main() {} //~ ERROR: `main` function has wrong type [E0580] diff --git a/src/test/ui/extern/extern-main-fn.stderr b/src/test/ui/extern/extern-main-fn.stderr index 6f6983d42832c..9c994985a3e0d 100644 --- a/src/test/ui/extern/extern-main-fn.stderr +++ b/src/test/ui/extern/extern-main-fn.stderr @@ -1,4 +1,4 @@ -error[E0580]: main function has wrong type +error[E0580]: `main` function has wrong type --> $DIR/extern-main-fn.rs:1:1 | LL | extern fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-start.rs b/src/test/ui/feature-gates/feature-gate-start.rs index 0bd4c7c85b74a..e617f1c47594d 100644 --- a/src/test/ui/feature-gates/feature-gate-start.rs +++ b/src/test/ui/feature-gates/feature-gate-start.rs @@ -1,3 +1,3 @@ #[start] fn foo(_: isize, _: *const *const u8) -> isize { 0 } -//~^ ERROR a `#[start]` function is an experimental feature +//~^ ERROR `#[start]` functions are experimental diff --git a/src/test/ui/feature-gates/feature-gate-start.stderr b/src/test/ui/feature-gates/feature-gate-start.stderr index c769ef8ee9272..f42e42ea0391f 100644 --- a/src/test/ui/feature-gates/feature-gate-start.stderr +++ b/src/test/ui/feature-gates/feature-gate-start.stderr @@ -1,4 +1,4 @@ -error[E0658]: a `#[start]` function is an experimental feature whose signature may change over time +error[E0658]: `#[start]` functions are experimental and their signature may change over time --> $DIR/feature-gate-start.rs:2:1 | LL | fn foo(_: isize, _: *const *const u8) -> isize { 0 } diff --git a/src/test/ui/if-else-type-mismatch.rs b/src/test/ui/if-else-type-mismatch.rs index 583c3d0b765cf..1a0a36df2ad63 100644 --- a/src/test/ui/if-else-type-mismatch.rs +++ b/src/test/ui/if-else-type-mismatch.rs @@ -4,43 +4,43 @@ fn main() { } else { 2u32 }; - //~^^ ERROR if and else have incompatible types + //~^^ ERROR `if` and `else` have incompatible types let _ = if true { 42i32 } else { 42u32 }; - //~^ ERROR if and else have incompatible types + //~^ ERROR `if` and `else` have incompatible types let _ = if true { 3u32; } else { 4u32 }; - //~^^ ERROR if and else have incompatible types + //~^^ ERROR `if` and `else` have incompatible types let _ = if true { 5u32 } else { 6u32; }; - //~^^ ERROR if and else have incompatible types + //~^^ ERROR `if` and `else` have incompatible types let _ = if true { 7i32; } else { 8u32 }; - //~^^ ERROR if and else have incompatible types + //~^^ ERROR `if` and `else` have incompatible types let _ = if true { 9i32 } else { 10u32; }; - //~^^ ERROR if and else have incompatible types + //~^^ ERROR `if` and `else` have incompatible types let _ = if true { } else { 11u32 }; - //~^^ ERROR if and else have incompatible types + //~^^ ERROR `if` and `else` have incompatible types let _ = if true { 12i32 } else { }; - //~^^^ ERROR if and else have incompatible types + //~^^^ ERROR `if` and `else` have incompatible types } diff --git a/src/test/ui/if-else-type-mismatch.stderr b/src/test/ui/if-else-type-mismatch.stderr index 14e8f87393ba1..9fa190d6c9df3 100644 --- a/src/test/ui/if-else-type-mismatch.stderr +++ b/src/test/ui/if-else-type-mismatch.stderr @@ -1,4 +1,4 @@ -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:5:9 | LL | let _ = if true { @@ -9,9 +9,9 @@ LL | | } else { LL | | 2u32 | | ^^^^ expected `i32`, found `u32` LL | | }; - | |_____- if and else have incompatible types + | |_____- `if` and `else` have incompatible types -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:8:38 | LL | let _ = if true { 42i32 } else { 42u32 }; @@ -19,7 +19,7 @@ LL | let _ = if true { 42i32 } else { 42u32 }; | | | expected because of this -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:13:9 | LL | let _ = if true { @@ -33,9 +33,9 @@ LL | | } else { LL | | 4u32 | | ^^^^ expected `()`, found `u32` LL | | }; - | |_____- if and else have incompatible types + | |_____- `if` and `else` have incompatible types -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:19:9 | LL | let _ = if true { @@ -49,9 +49,9 @@ LL | | 6u32; | | | help: consider removing this semicolon | | expected `u32`, found `()` LL | | }; - | |_____- if and else have incompatible types + | |_____- `if` and `else` have incompatible types -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:25:9 | LL | let _ = if true { @@ -62,9 +62,9 @@ LL | | } else { LL | | 8u32 | | ^^^^ expected `()`, found `u32` LL | | }; - | |_____- if and else have incompatible types + | |_____- `if` and `else` have incompatible types -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:31:9 | LL | let _ = if true { @@ -75,9 +75,9 @@ LL | | } else { LL | | 10u32; | | ^^^^^^ expected `i32`, found `()` LL | | }; - | |_____- if and else have incompatible types + | |_____- `if` and `else` have incompatible types -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:37:9 | LL | let _ = if true { @@ -88,11 +88,11 @@ LL | | } else { LL | 11u32 | ^^^^^ expected `()`, found `u32` -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:42:12 | LL | let _ = if true { - | ------- if and else have incompatible types + | ------- `if` and `else` have incompatible types LL | 12i32 | ----- expected because of this LL | } else { diff --git a/src/test/ui/if/if-branch-types.rs b/src/test/ui/if/if-branch-types.rs index 5c693194a76a1..c125ba30606c5 100644 --- a/src/test/ui/if/if-branch-types.rs +++ b/src/test/ui/if/if-branch-types.rs @@ -1,5 +1,5 @@ fn main() { let x = if true { 10i32 } else { 10u32 }; - //~^ ERROR if and else have incompatible types + //~^ ERROR `if` and `else` have incompatible types //~| expected `i32`, found `u32` } diff --git a/src/test/ui/if/if-branch-types.stderr b/src/test/ui/if/if-branch-types.stderr index b5eacf5860f8a..14f02163a8320 100644 --- a/src/test/ui/if/if-branch-types.stderr +++ b/src/test/ui/if/if-branch-types.stderr @@ -1,4 +1,4 @@ -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/if-branch-types.rs:2:38 | LL | let x = if true { 10i32 } else { 10u32 }; diff --git a/src/test/ui/if/if-let-arm-types.rs b/src/test/ui/if/if-let-arm-types.rs index cae4f0974c6c4..1e8260a017da2 100644 --- a/src/test/ui/if/if-let-arm-types.rs +++ b/src/test/ui/if/if-let-arm-types.rs @@ -1,11 +1,11 @@ fn main() { if let Some(b) = None { - //~^ NOTE if and else have incompatible types + //~^ NOTE `if` and `else` have incompatible types () //~^ NOTE expected because of this } else { 1 }; - //~^^ ERROR: if and else have incompatible types + //~^^ ERROR: `if` and `else` have incompatible types //~| NOTE expected `()`, found integer } diff --git a/src/test/ui/if/if-let-arm-types.stderr b/src/test/ui/if/if-let-arm-types.stderr index da93dfc999507..b40a0f479d318 100644 --- a/src/test/ui/if/if-let-arm-types.stderr +++ b/src/test/ui/if/if-let-arm-types.stderr @@ -1,4 +1,4 @@ -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/if-let-arm-types.rs:7:9 | LL | / if let Some(b) = None { @@ -10,7 +10,7 @@ LL | | } else { LL | | 1 | | ^ expected `()`, found integer LL | | }; - | |_____- if and else have incompatible types + | |_____- `if` and `else` have incompatible types error: aborting due to previous error diff --git a/src/test/ui/if/if-without-else-as-fn-expr.rs b/src/test/ui/if/if-without-else-as-fn-expr.rs index 826371be35f45..19fbfb27ba6e9 100644 --- a/src/test/ui/if/if-without-else-as-fn-expr.rs +++ b/src/test/ui/if/if-without-else-as-fn-expr.rs @@ -2,14 +2,14 @@ fn foo(bar: usize) -> usize { if bar % 5 == 0 { return 3; } - //~^^^ ERROR if may be missing an else clause + //~^^^ ERROR `if` may be missing an `else` clause } fn foo2(bar: usize) -> usize { let x: usize = if bar % 5 == 0 { return 3; }; - //~^^^ ERROR if may be missing an else clause + //~^^^ ERROR `if` may be missing an `else` clause x } @@ -17,21 +17,21 @@ fn foo3(bar: usize) -> usize { if bar % 5 == 0 { 3 } - //~^^^ ERROR if may be missing an else clause + //~^^^ ERROR `if` may be missing an `else` clause } fn foo_let(bar: usize) -> usize { if let 0 = 1 { return 3; } - //~^^^ ERROR if may be missing an else clause + //~^^^ ERROR `if` may be missing an `else` clause } fn foo2_let(bar: usize) -> usize { let x: usize = if let 0 = 1 { return 3; }; - //~^^^ ERROR if may be missing an else clause + //~^^^ ERROR `if` may be missing an `else` clause x } @@ -39,7 +39,7 @@ fn foo3_let(bar: usize) -> usize { if let 0 = 1 { 3 } - //~^^^ ERROR if may be missing an else clause + //~^^^ ERROR `if` may be missing an `else` clause } // FIXME(60254): deduplicate first error in favor of second. diff --git a/src/test/ui/if/if-without-else-as-fn-expr.stderr b/src/test/ui/if/if-without-else-as-fn-expr.stderr index 9c7e7002360db..4daf27493c19d 100644 --- a/src/test/ui/if/if-without-else-as-fn-expr.stderr +++ b/src/test/ui/if/if-without-else-as-fn-expr.stderr @@ -1,4 +1,4 @@ -error[E0317]: if may be missing an else clause +error[E0317]: `if` may be missing an `else` clause --> $DIR/if-without-else-as-fn-expr.rs:2:5 | LL | fn foo(bar: usize) -> usize { @@ -11,7 +11,7 @@ LL | | } = note: `if` expressions without `else` evaluate to `()` = help: consider adding an `else` block that evaluates to the expected type -error[E0317]: if may be missing an else clause +error[E0317]: `if` may be missing an `else` clause --> $DIR/if-without-else-as-fn-expr.rs:9:20 | LL | let x: usize = if bar % 5 == 0 { @@ -25,7 +25,7 @@ LL | | }; = note: `if` expressions without `else` evaluate to `()` = help: consider adding an `else` block that evaluates to the expected type -error[E0317]: if may be missing an else clause +error[E0317]: `if` may be missing an `else` clause --> $DIR/if-without-else-as-fn-expr.rs:17:5 | LL | fn foo3(bar: usize) -> usize { @@ -38,7 +38,7 @@ LL | | } = note: `if` expressions without `else` evaluate to `()` = help: consider adding an `else` block that evaluates to the expected type -error[E0317]: if may be missing an else clause +error[E0317]: `if` may be missing an `else` clause --> $DIR/if-without-else-as-fn-expr.rs:24:5 | LL | fn foo_let(bar: usize) -> usize { @@ -51,7 +51,7 @@ LL | | } = note: `if` expressions without `else` evaluate to `()` = help: consider adding an `else` block that evaluates to the expected type -error[E0317]: if may be missing an else clause +error[E0317]: `if` may be missing an `else` clause --> $DIR/if-without-else-as-fn-expr.rs:31:20 | LL | let x: usize = if let 0 = 1 { @@ -65,7 +65,7 @@ LL | | }; = note: `if` expressions without `else` evaluate to `()` = help: consider adding an `else` block that evaluates to the expected type -error[E0317]: if may be missing an else clause +error[E0317]: `if` may be missing an `else` clause --> $DIR/if-without-else-as-fn-expr.rs:39:5 | LL | fn foo3_let(bar: usize) -> usize { diff --git a/src/test/ui/if/if-without-else-result.rs b/src/test/ui/if/if-without-else-result.rs index e5fb7b26321e4..cf84a99e53fa1 100644 --- a/src/test/ui/if/if-without-else-result.rs +++ b/src/test/ui/if/if-without-else-result.rs @@ -1,6 +1,6 @@ fn main() { let a = if true { true }; - //~^ ERROR if may be missing an else clause [E0317] + //~^ ERROR `if` may be missing an `else` clause [E0317] //~| expected `()`, found `bool` println!("{}", a); } diff --git a/src/test/ui/if/if-without-else-result.stderr b/src/test/ui/if/if-without-else-result.stderr index 66a8185774e6a..821635d3768f3 100644 --- a/src/test/ui/if/if-without-else-result.stderr +++ b/src/test/ui/if/if-without-else-result.stderr @@ -1,4 +1,4 @@ -error[E0317]: if may be missing an else clause +error[E0317]: `if` may be missing an `else` clause --> $DIR/if-without-else-result.rs:2:13 | LL | let a = if true { true }; diff --git a/src/test/ui/issues/issue-11319.rs b/src/test/ui/issues/issue-11319.rs index 8c2bafe63bd69..ab69ab250ff05 100644 --- a/src/test/ui/issues/issue-11319.rs +++ b/src/test/ui/issues/issue-11319.rs @@ -6,7 +6,7 @@ fn main() { Some(2) => true, //~^ NOTE this is found to be of type `bool` None => (), - //~^ ERROR match arms have incompatible types + //~^ ERROR `match` arms have incompatible types //~| NOTE expected `bool`, found `()` _ => true } diff --git a/src/test/ui/issues/issue-11319.stderr b/src/test/ui/issues/issue-11319.stderr index 7663a32883cca..fc44205e81e6c 100644 --- a/src/test/ui/issues/issue-11319.stderr +++ b/src/test/ui/issues/issue-11319.stderr @@ -1,4 +1,4 @@ -error[E0308]: match arms have incompatible types +error[E0308]: `match` arms have incompatible types --> $DIR/issue-11319.rs:8:20 | LL | / match Some(10) { diff --git a/src/test/ui/issues/issue-17728.nll.stderr b/src/test/ui/issues/issue-17728.nll.stderr index ef193ad85bf65..d515cf451c410 100644 --- a/src/test/ui/issues/issue-17728.nll.stderr +++ b/src/test/ui/issues/issue-17728.nll.stderr @@ -1,4 +1,4 @@ -error[E0308]: match arms have incompatible types +error[E0308]: `match` arms have incompatible types --> $DIR/issue-17728.rs:109:14 | LL | / match to_parse { diff --git a/src/test/ui/issues/issue-17728.rs b/src/test/ui/issues/issue-17728.rs index 15cea1d609d53..bec52d87d2983 100644 --- a/src/test/ui/issues/issue-17728.rs +++ b/src/test/ui/issues/issue-17728.rs @@ -108,7 +108,7 @@ fn str_to_direction(to_parse: &str) -> RoomDirection { "down" => RoomDirection::Down, _ => None } - //~^^ ERROR match arms have incompatible types + //~^^ ERROR `match` arms have incompatible types } fn main() { diff --git a/src/test/ui/issues/issue-17728.stderr b/src/test/ui/issues/issue-17728.stderr index 527168dbe6cc2..2f9ae63aa4145 100644 --- a/src/test/ui/issues/issue-17728.stderr +++ b/src/test/ui/issues/issue-17728.stderr @@ -9,7 +9,7 @@ LL | fn attemptTraverse(&self, room: &Room, directionStr: &str) -> Result<&R LL | Some(entry) => Ok(entry), | ^^^^^^^^^ ...but data from `room` is returned here -error[E0308]: match arms have incompatible types +error[E0308]: `match` arms have incompatible types --> $DIR/issue-17728.rs:109:14 | LL | / match to_parse { diff --git a/src/test/ui/issues/issue-19991.rs b/src/test/ui/issues/issue-19991.rs index 62d5a6de760df..0f3f83001d3c6 100644 --- a/src/test/ui/issues/issue-19991.rs +++ b/src/test/ui/issues/issue-19991.rs @@ -1,8 +1,8 @@ // Test if the sugared if-let construct correctly prints "missing an else clause" when an else -// clause does not exist, instead of the unsympathetic "match arms have incompatible types" +// clause does not exist, instead of the unsympathetic "`match` arms have incompatible types" fn main() { - if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause + if let Some(homura) = Some("madoka") { //~ ERROR missing an `else` clause //~| expected `()`, found integer 765 }; diff --git a/src/test/ui/issues/issue-19991.stderr b/src/test/ui/issues/issue-19991.stderr index b78f4a6d29344..6e92be87a02e9 100644 --- a/src/test/ui/issues/issue-19991.stderr +++ b/src/test/ui/issues/issue-19991.stderr @@ -1,4 +1,4 @@ -error[E0317]: if may be missing an else clause +error[E0317]: `if` may be missing an `else` clause --> $DIR/issue-19991.rs:5:5 | LL | / if let Some(homura) = Some("madoka") { diff --git a/src/test/ui/issues/issue-24036.rs b/src/test/ui/issues/issue-24036.rs index 2f501b941b5a6..bd82f95c9ef66 100644 --- a/src/test/ui/issues/issue-24036.rs +++ b/src/test/ui/issues/issue-24036.rs @@ -10,7 +10,7 @@ fn closure_from_match() { 2 => |c| c - 1, _ => |c| c - 1 }; - //~^^^ ERROR match arms have incompatible types + //~^^^ ERROR `match` arms have incompatible types } fn main() { } diff --git a/src/test/ui/issues/issue-24036.stderr b/src/test/ui/issues/issue-24036.stderr index 04817f2596abd..b0e729a59eb22 100644 --- a/src/test/ui/issues/issue-24036.stderr +++ b/src/test/ui/issues/issue-24036.stderr @@ -9,7 +9,7 @@ LL | x = |c| c + 1; = note: no two closures, even if identical, have the same type = help: consider boxing your closure and/or using it as a trait object -error[E0308]: match arms have incompatible types +error[E0308]: `match` arms have incompatible types --> $DIR/issue-24036.rs:10:14 | LL | let x = match 1usize { diff --git a/src/test/ui/issues/issue-4201.rs b/src/test/ui/issues/issue-4201.rs index 2d655e4b7e743..1f292229fd6cd 100644 --- a/src/test/ui/issues/issue-4201.rs +++ b/src/test/ui/issues/issue-4201.rs @@ -2,7 +2,7 @@ fn main() { let a = if true { 0 } else if false { -//~^ ERROR if may be missing an else clause +//~^ ERROR `if` may be missing an `else` clause //~| expected `()`, found integer 1 }; diff --git a/src/test/ui/issues/issue-4201.stderr b/src/test/ui/issues/issue-4201.stderr index aacc426783d66..bc638ddf55be0 100644 --- a/src/test/ui/issues/issue-4201.stderr +++ b/src/test/ui/issues/issue-4201.stderr @@ -1,4 +1,4 @@ -error[E0317]: if may be missing an else clause +error[E0317]: `if` may be missing an `else` clause --> $DIR/issue-4201.rs:4:12 | LL | } else if false { diff --git a/src/test/ui/issues/issue-9575.rs b/src/test/ui/issues/issue-9575.rs index bac4ac1d208d2..06b252990b642 100644 --- a/src/test/ui/issues/issue-9575.rs +++ b/src/test/ui/issues/issue-9575.rs @@ -2,6 +2,6 @@ #[start] fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize { - //~^ start function has wrong type + //~^ `#[start]` function has wrong type 0 } diff --git a/src/test/ui/issues/issue-9575.stderr b/src/test/ui/issues/issue-9575.stderr index 3e3678a23f74c..5b8ce84a07168 100644 --- a/src/test/ui/issues/issue-9575.stderr +++ b/src/test/ui/issues/issue-9575.stderr @@ -1,4 +1,4 @@ -error[E0308]: start function has wrong type +error[E0308]: `#[start]` function has wrong type --> $DIR/issue-9575.rs:4:1 | LL | fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize { diff --git a/src/test/ui/lub-glb/old-lub-glb-hr.rs b/src/test/ui/lub-glb/old-lub-glb-hr.rs index 6bf1fd41d77be..bc7b787cd65ac 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr.rs +++ b/src/test/ui/lub-glb/old-lub-glb-hr.rs @@ -13,7 +13,7 @@ fn foo( ) { let z = match 22 { 0 => x, - _ => y, //~ ERROR match arms have incompatible types + _ => y, //~ ERROR `match` arms have incompatible types }; } diff --git a/src/test/ui/lub-glb/old-lub-glb-hr.stderr b/src/test/ui/lub-glb/old-lub-glb-hr.stderr index 1dce9df96df3f..6d5d51174699f 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-hr.stderr @@ -1,4 +1,4 @@ -error[E0308]: match arms have incompatible types +error[E0308]: `match` arms have incompatible types --> $DIR/old-lub-glb-hr.rs:16:14 | LL | let z = match 22 { diff --git a/src/test/ui/lub-glb/old-lub-glb-object.rs b/src/test/ui/lub-glb/old-lub-glb-object.rs index f303c07e6d79c..63bbae59991bc 100644 --- a/src/test/ui/lub-glb/old-lub-glb-object.rs +++ b/src/test/ui/lub-glb/old-lub-glb-object.rs @@ -9,7 +9,7 @@ fn foo( ) { let z = match 22 { 0 => x, - _ => y, //~ ERROR match arms have incompatible types + _ => y, //~ ERROR `match` arms have incompatible types }; } diff --git a/src/test/ui/lub-glb/old-lub-glb-object.stderr b/src/test/ui/lub-glb/old-lub-glb-object.stderr index 18de7a40ee179..65c797f6b19d7 100644 --- a/src/test/ui/lub-glb/old-lub-glb-object.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-object.stderr @@ -1,4 +1,4 @@ -error[E0308]: match arms have incompatible types +error[E0308]: `match` arms have incompatible types --> $DIR/old-lub-glb-object.rs:12:14 | LL | let z = match 22 { diff --git a/src/test/ui/main-wrong-type.rs b/src/test/ui/main-wrong-type.rs index dac4d4ac9aaf7..31deba72af4b3 100644 --- a/src/test/ui/main-wrong-type.rs +++ b/src/test/ui/main-wrong-type.rs @@ -4,5 +4,5 @@ struct S { } fn main(foo: S) { -//~^ ERROR: main function has wrong type [E0580] +//~^ ERROR: `main` function has wrong type [E0580] } diff --git a/src/test/ui/main-wrong-type.stderr b/src/test/ui/main-wrong-type.stderr index e75d4d7acfd5e..43efaf884e3a7 100644 --- a/src/test/ui/main-wrong-type.stderr +++ b/src/test/ui/main-wrong-type.stderr @@ -1,4 +1,4 @@ -error[E0580]: main function has wrong type +error[E0580]: `main` function has wrong type --> $DIR/main-wrong-type.rs:6:1 | LL | fn main(foo: S) { diff --git a/src/test/ui/match/match-arm-resolving-to-never.rs b/src/test/ui/match/match-arm-resolving-to-never.rs index 8f54023305e83..6ef249c05247e 100644 --- a/src/test/ui/match/match-arm-resolving-to-never.rs +++ b/src/test/ui/match/match-arm-resolving-to-never.rs @@ -14,6 +14,6 @@ fn main() { E::C => 3, E::D => 4, E::E => unimplemented!(""), - E::F => "", //~ ERROR match arms have incompatible types + E::F => "", //~ ERROR `match` arms have incompatible types }; } diff --git a/src/test/ui/match/match-arm-resolving-to-never.stderr b/src/test/ui/match/match-arm-resolving-to-never.stderr index 4482d5c6a791d..3a723de9f6b8a 100644 --- a/src/test/ui/match/match-arm-resolving-to-never.stderr +++ b/src/test/ui/match/match-arm-resolving-to-never.stderr @@ -1,4 +1,4 @@ -error[E0308]: match arms have incompatible types +error[E0308]: `match` arms have incompatible types --> $DIR/match-arm-resolving-to-never.rs:17:17 | LL | / match E::F { diff --git a/src/test/ui/match/match-type-err-first-arm.rs b/src/test/ui/match/match-type-err-first-arm.rs index d73c7e8402ff3..e9027eb24897f 100644 --- a/src/test/ui/match/match-type-err-first-arm.rs +++ b/src/test/ui/match/match-type-err-first-arm.rs @@ -16,7 +16,7 @@ fn test_func2(n: i32) -> i32 { let x = match n { //~ NOTE `match` arms have incompatible types 12 => 'b', //~ NOTE this is found to be of type `char` _ => 42, - //~^ ERROR match arms have incompatible types + //~^ ERROR `match` arms have incompatible types //~| NOTE expected `char`, found integer }; x @@ -32,7 +32,7 @@ fn test_func3(n: i32) -> i32 { 6 => 'b', //~^ NOTE this and all prior arms are found to be of type `char` _ => 42, - //~^ ERROR match arms have incompatible types + //~^ ERROR `match` arms have incompatible types //~| NOTE expected `char`, found integer }; x @@ -44,7 +44,7 @@ fn test_func4() { x //~ NOTE this is found to be of type `u32` }, None => {} - //~^ ERROR match arms have incompatible types + //~^ ERROR `match` arms have incompatible types //~| NOTE expected `u32`, found `()` }; } diff --git a/src/test/ui/match/match-type-err-first-arm.stderr b/src/test/ui/match/match-type-err-first-arm.stderr index 1b3d8c61c862b..fd489afa84db4 100644 --- a/src/test/ui/match/match-type-err-first-arm.stderr +++ b/src/test/ui/match/match-type-err-first-arm.stderr @@ -7,7 +7,7 @@ LL | match n { LL | 12 => 'b', | ^^^ expected `i32`, found `char` -error[E0308]: match arms have incompatible types +error[E0308]: `match` arms have incompatible types --> $DIR/match-type-err-first-arm.rs:18:14 | LL | let x = match n { @@ -21,7 +21,7 @@ LL | | LL | | }; | |_____- `match` arms have incompatible types -error[E0308]: match arms have incompatible types +error[E0308]: `match` arms have incompatible types --> $DIR/match-type-err-first-arm.rs:34:14 | LL | let x = match n { @@ -40,7 +40,7 @@ LL | | LL | | }; | |_____- `match` arms have incompatible types -error[E0308]: match arms have incompatible types +error[E0308]: `match` arms have incompatible types --> $DIR/match-type-err-first-arm.rs:46:17 | LL | / match Some(0u32) { diff --git a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs index 58109be447e07..a80e5df1a26a2 100644 --- a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs +++ b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs @@ -29,7 +29,7 @@ fn qux() -> impl std::fmt::Display { 0i32 } else { 1u32 - //~^ ERROR if and else have incompatible types + //~^ ERROR `if` and `else` have incompatible types } } diff --git a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr index d5ea2ba39a90e..27b86007451d8 100644 --- a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr +++ b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr @@ -34,7 +34,7 @@ LL | } else { LL | 1u32 | ^^^^ expected `i32`, found `u32` -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:31:9 | LL | / if false { @@ -45,7 +45,7 @@ LL | | 1u32 | | ^^^^ expected `i32`, found `u32` LL | | LL | | } - | |_____- if and else have incompatible types + | |_____- `if` and `else` have incompatible types error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:39:14 diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.stderr index 381bad4210f89..750cc3566e032 100644 --- a/src/test/ui/regions/region-invariant-static-error-reporting.stderr +++ b/src/test/ui/regions/region-invariant-static-error-reporting.stderr @@ -1,4 +1,4 @@ -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/region-invariant-static-error-reporting.rs:17:9 | LL | let bad = if x.is_some() { @@ -9,7 +9,7 @@ LL | | } else { LL | | mk_static() | | ^^^^^^^^^^^ lifetime mismatch LL | | }; - | |_____- if and else have incompatible types + | |_____- `if` and `else` have incompatible types | = note: expected struct `Invariant<'a>` found struct `Invariant<'static>` diff --git a/src/test/ui/str/str-array-assignment.rs b/src/test/ui/str/str-array-assignment.rs index 4a78ed53ae1a9..323eefb381af9 100644 --- a/src/test/ui/str/str-array-assignment.rs +++ b/src/test/ui/str/str-array-assignment.rs @@ -1,7 +1,7 @@ fn main() { let s = "abc"; let t = if true { s[..2] } else { s }; - //~^ ERROR if and else have incompatible types + //~^ ERROR `if` and `else` have incompatible types let u: &str = if true { s[..2] } else { s }; //~^ ERROR mismatched types let v = s[..2]; diff --git a/src/test/ui/str/str-array-assignment.stderr b/src/test/ui/str/str-array-assignment.stderr index a133c69eeefc8..cc767de3845d2 100644 --- a/src/test/ui/str/str-array-assignment.stderr +++ b/src/test/ui/str/str-array-assignment.stderr @@ -1,4 +1,4 @@ -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/str-array-assignment.rs:3:37 | LL | let t = if true { s[..2] } else { s }; diff --git a/src/test/ui/suggestions/opaque-type-error.rs b/src/test/ui/suggestions/opaque-type-error.rs index 979bb60d48c12..5e1147403143e 100644 --- a/src/test/ui/suggestions/opaque-type-error.rs +++ b/src/test/ui/suggestions/opaque-type-error.rs @@ -17,7 +17,7 @@ async fn thing() -> Result<(), ()> { if true { thing_one() } else { - thing_two() //~ ERROR if and else have incompatible types + thing_two() //~ ERROR `if` and `else` have incompatible types }.await } diff --git a/src/test/ui/suggestions/opaque-type-error.stderr b/src/test/ui/suggestions/opaque-type-error.stderr index e7bf84a41137a..1465b9e49ef1a 100644 --- a/src/test/ui/suggestions/opaque-type-error.stderr +++ b/src/test/ui/suggestions/opaque-type-error.stderr @@ -1,4 +1,4 @@ -error[E0308]: if and else have incompatible types +error[E0308]: `if` and `else` have incompatible types --> $DIR/opaque-type-error.rs:20:9 | LL | / if true { @@ -8,7 +8,7 @@ LL | | } else { LL | | thing_two() | | ^^^^^^^^^^^ expected opaque type, found a different opaque type LL | | }.await - | |_____- if and else have incompatible types + | |_____- `if` and `else` have incompatible types | = note: expected type `impl std::future::Future` (opaque type at <$DIR/opaque-type-error.rs:8:19>) found opaque type `impl std::future::Future` (opaque type at <$DIR/opaque-type-error.rs:12:19>) diff --git a/src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs b/src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs index e23c0d0a40a7e..c39ab954473cd 100644 --- a/src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs +++ b/src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs @@ -20,7 +20,7 @@ fn main() { // However, in #67273, we would delay the unification of this arm with the above // because we used the hitherto accumulated coercion as opposed to the "initial" type. 2 => i = 1, - //~^ ERROR match arms have incompatible types + //~^ ERROR `match` arms have incompatible types _ => (), } diff --git a/src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.stderr b/src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.stderr index 3547285542a9f..a431fe89c237c 100644 --- a/src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.stderr +++ b/src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.stderr @@ -1,4 +1,4 @@ -error[E0308]: match arms have incompatible types +error[E0308]: `match` arms have incompatible types --> $DIR/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs:22:14 | LL | / match i { diff --git a/src/test/ui/wf/wf-unsafe-trait-obj-match.stderr b/src/test/ui/wf/wf-unsafe-trait-obj-match.stderr index d5799ccc8348e..594fad4138505 100644 --- a/src/test/ui/wf/wf-unsafe-trait-obj-match.stderr +++ b/src/test/ui/wf/wf-unsafe-trait-obj-match.stderr @@ -1,4 +1,4 @@ -error[E0308]: match arms have incompatible types +error[E0308]: `match` arms have incompatible types --> $DIR/wf-unsafe-trait-obj-match.rs:23:17 | LL | / match opt() {