Skip to content
Permalink
Browse files

Add backticks to various diagnostics

  • Loading branch information
varkor committed Jan 5, 2020
1 parent 760ce94 commit 0c2cf07d6e37a0e957e731453916445140673002
Showing with 115 additions and 115 deletions.
  1. +10 −10 src/librustc/infer/error_reporting/mod.rs
  2. +1 −1 src/librustc_passes/entry.rs
  3. +1 −1 src/librustc_target/spec/wasm32_base.rs
  4. +2 −2 src/librustc_typeck/check/_match.rs
  5. +2 −2 src/libsyntax/feature_gate/check.rs
  6. +1 −1 src/test/ui/async-await/issue-66387-if-without-else.rs
  7. +1 −1 src/test/ui/async-await/issue-66387-if-without-else.stderr
  8. +1 −1 src/test/ui/bad/bad-expr-path.rs
  9. +1 −1 src/test/ui/bad/bad-expr-path.stderr
  10. +1 −1 src/test/ui/bad/bad-expr-path2.rs
  11. +1 −1 src/test/ui/bad/bad-expr-path2.stderr
  12. +1 −1 src/test/ui/bad/bad-main.rs
  13. +1 −1 src/test/ui/bad/bad-main.stderr
  14. +1 −1 src/test/ui/consts/control-flow/issue-50577.if_match.stderr
  15. +1 −1 src/test/ui/consts/control-flow/issue-50577.rs
  16. +1 −1 src/test/ui/consts/control-flow/issue-50577.stock.stderr
  17. +1 −1 src/test/ui/error-codes/E0138.stderr
  18. +1 −1 src/test/ui/extern/extern-main-fn.rs
  19. +1 −1 src/test/ui/extern/extern-main-fn.stderr
  20. +1 −1 src/test/ui/feature-gates/feature-gate-start.rs
  21. +1 −1 src/test/ui/feature-gates/feature-gate-start.stderr
  22. +8 −8 src/test/ui/if-else-type-mismatch.rs
  23. +14 −14 src/test/ui/if-else-type-mismatch.stderr
  24. +1 −1 src/test/ui/if/if-branch-types.rs
  25. +1 −1 src/test/ui/if/if-branch-types.stderr
  26. +2 −2 src/test/ui/if/if-let-arm-types.rs
  27. +2 −2 src/test/ui/if/if-let-arm-types.stderr
  28. +6 −6 src/test/ui/if/if-without-else-as-fn-expr.rs
  29. +6 −6 src/test/ui/if/if-without-else-as-fn-expr.stderr
  30. +1 −1 src/test/ui/if/if-without-else-result.rs
  31. +1 −1 src/test/ui/if/if-without-else-result.stderr
  32. +1 −1 src/test/ui/issues/issue-11319.rs
  33. +1 −1 src/test/ui/issues/issue-11319.stderr
  34. +1 −1 src/test/ui/issues/issue-17728.nll.stderr
  35. +1 −1 src/test/ui/issues/issue-17728.rs
  36. +1 −1 src/test/ui/issues/issue-17728.stderr
  37. +2 −2 src/test/ui/issues/issue-19991.rs
  38. +1 −1 src/test/ui/issues/issue-19991.stderr
  39. +1 −1 src/test/ui/issues/issue-24036.rs
  40. +1 −1 src/test/ui/issues/issue-24036.stderr
  41. +1 −1 src/test/ui/issues/issue-4201.rs
  42. +1 −1 src/test/ui/issues/issue-4201.stderr
  43. +1 −1 src/test/ui/issues/issue-9575.rs
  44. +1 −1 src/test/ui/issues/issue-9575.stderr
  45. +1 −1 src/test/ui/lub-glb/old-lub-glb-hr.rs
  46. +1 −1 src/test/ui/lub-glb/old-lub-glb-hr.stderr
  47. +1 −1 src/test/ui/lub-glb/old-lub-glb-object.rs
  48. +1 −1 src/test/ui/lub-glb/old-lub-glb-object.stderr
  49. +1 −1 src/test/ui/main-wrong-type.rs
  50. +1 −1 src/test/ui/main-wrong-type.stderr
  51. +1 −1 src/test/ui/match/match-arm-resolving-to-never.rs
  52. +1 −1 src/test/ui/match/match-arm-resolving-to-never.stderr
  53. +3 −3 src/test/ui/match/match-type-err-first-arm.rs
  54. +3 −3 src/test/ui/match/match-type-err-first-arm.stderr
  55. +1 −1 src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs
  56. +2 −2 src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr
  57. +2 −2 src/test/ui/regions/region-invariant-static-error-reporting.stderr
  58. +1 −1 src/test/ui/str/str-array-assignment.rs
  59. +1 −1 src/test/ui/str/str-array-assignment.stderr
  60. +1 −1 src/test/ui/suggestions/opaque-type-error.rs
  61. +2 −2 src/test/ui/suggestions/opaque-type-error.stderr
  62. +1 −1 src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs
  63. +1 −1 src/test/ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.stderr
  64. +1 −1 src/test/ui/wf/wf-unsafe-trait-obj-match.stderr
@@ -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",
@@ -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();
}
@@ -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!
@@ -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 {
@@ -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"
);
}
@@ -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.
@@ -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 {
@@ -1,6 +1,6 @@
mod m1 {}

fn main(arguments: Vec<String>) { //~ ERROR main function has wrong type
fn main(arguments: Vec<String>) { //~ 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
@@ -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<String>) {
@@ -2,7 +2,7 @@ mod m1 {
pub mod arguments {}
}

fn main(arguments: Vec<String>) { //~ ERROR main function has wrong type
fn main(arguments: Vec<String>) { //~ 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
@@ -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<String>) {
@@ -1 +1 @@
fn main(x: isize) { } //~ ERROR: main function has wrong type [E0580]
fn main(x: isize) { } //~ ERROR: `main` function has wrong type [E0580]
@@ -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) { }
@@ -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)
@@ -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`
@@ -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)
@@ -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
@@ -1 +1 @@
extern fn main() {} //~ ERROR: main function has wrong type [E0580]
extern fn main() {} //~ ERROR: `main` function has wrong type [E0580]
@@ -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() {}
@@ -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
@@ -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 }
@@ -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
}
@@ -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,17 +9,17 @@ 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 };
| ----- ^^^^^ expected `i32`, found `u32`
| |
| 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 {
@@ -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`
}
@@ -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 };
@@ -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
}
@@ -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

0 comments on commit 0c2cf07

Please sign in to comment.
You can’t perform that action at this time.