Skip to content

Commit 10a12c5

Browse files
authored
Rollup merge of rust-lang#67881 - varkor:scattering-of-backticks, r=Centril
Add backticks to various diagnostics
2 parents eae08b2 + 0c2cf07 commit 10a12c5

File tree

64 files changed

+115
-115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+115
-115
lines changed

src/librustc/infer/error_reporting/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
661661
},
662662
ObligationCauseCode::IfExpression(box IfExpressionCause { then, outer, semicolon }) => {
663663
err.span_label(then, "expected because of this");
664-
outer.map(|sp| err.span_label(sp, "if and else have incompatible types"));
664+
outer.map(|sp| err.span_label(sp, "`if` and `else` have incompatible types"));
665665
if let Some(sp) = semicolon {
666666
err.span_suggestion_short(
667667
sp,
@@ -1883,13 +1883,13 @@ impl<'tcx> ObligationCause<'tcx> {
18831883
hir::MatchSource::TryDesugar => {
18841884
"try expression alternatives have incompatible types"
18851885
}
1886-
_ => "match arms have incompatible types",
1886+
_ => "`match` arms have incompatible types",
18871887
})
18881888
}
1889-
IfExpression { .. } => Error0308("if and else have incompatible types"),
1890-
IfExpressionWithNoElse => Error0317("if may be missing an else clause"),
1891-
MainFunctionType => Error0580("main function has wrong type"),
1892-
StartFunctionType => Error0308("start function has wrong type"),
1889+
IfExpression { .. } => Error0308("`if` and `else` have incompatible types"),
1890+
IfExpressionWithNoElse => Error0317("`if` may be missing an `else` clause"),
1891+
MainFunctionType => Error0580("`main` function has wrong type"),
1892+
StartFunctionType => Error0308("`#[start]` function has wrong type"),
18931893
IntrinsicType => Error0308("intrinsic has wrong type"),
18941894
MethodReceiver => Error0308("mismatched `self` parameter type"),
18951895

@@ -1917,12 +1917,12 @@ impl<'tcx> ObligationCause<'tcx> {
19171917
ExprAssignable => "expression is assignable",
19181918
MatchExpressionArm(box MatchExpressionArmCause { source, .. }) => match source {
19191919
hir::MatchSource::IfLetDesugar { .. } => "`if let` arms have compatible types",
1920-
_ => "match arms have compatible types",
1920+
_ => "`match` arms have compatible types",
19211921
},
1922-
IfExpression { .. } => "if and else have incompatible types",
1923-
IfExpressionWithNoElse => "if missing an else returns ()",
1922+
IfExpression { .. } => "`if` and `else` have incompatible types",
1923+
IfExpressionWithNoElse => "`if` missing an `else` returns `()`",
19241924
MainFunctionType => "`main` function has the correct type",
1925-
StartFunctionType => "`start` function has the correct type",
1925+
StartFunctionType => "`#[start]` function has the correct type",
19261926
IntrinsicType => "intrinsic has the correct type",
19271927
MethodReceiver => "method receiver has the correct type",
19281928
_ => "types are compatible",

src/librustc_passes/entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn find_item(item: &Item<'_>, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
134134
ctxt.start_fn = Some((item.hir_id, item.span));
135135
} else {
136136
struct_span_err!(ctxt.session, item.span, E0138, "multiple `start` functions")
137-
.span_label(ctxt.start_fn.unwrap().1, "previous `start` function here")
137+
.span_label(ctxt.start_fn.unwrap().1, "previous `#[start]` function here")
138138
.span_label(item.span, "multiple `start` functions")
139139
.emit();
140140
}

src/librustc_target/spec/wasm32_base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn options() -> TargetOptions {
8181
dynamic_linking: true,
8282
only_cdylib: true,
8383

84-
// This means we'll just embed a `start` function in the wasm module
84+
// This means we'll just embed a `#[start]` function in the wasm module
8585
executables: true,
8686

8787
// relatively self-explanatory!

src/librustc_typeck/check/_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
298298
// LL || 10u32
299299
// || ^^^^^ expected `i32`, found `u32`
300300
// LL || };
301-
// ||_____- if and else have incompatible types
301+
// ||_____- `if` and `else` have incompatible types
302302
// ```
303303
Some(span)
304304
} else {
@@ -340,7 +340,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
340340
// by not pointing at the entire expression:
341341
// ```
342342
// 2 | let x = if true {
343-
// | ------- if and else have incompatible types
343+
// | ------- `if` and `else` have incompatible types
344344
// 3 | 3
345345
// | - expected because of this
346346
// 4 | } else {

src/libsyntax/feature_gate/check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
387387
&self,
388388
start,
389389
i.span,
390-
"a `#[start]` function is an experimental \
391-
feature whose signature may change \
390+
"`#[start]` functions are experimental \
391+
and their signature may change \
392392
over time"
393393
);
394394
}

src/test/ui/async-await/issue-66387-if-without-else.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// edition:2018
22
async fn f() -> i32 {
3-
if true { //~ ERROR if may be missing an else clause
3+
if true { //~ ERROR `if` may be missing an `else` clause
44
return 0;
55
}
66
// An `if` block without `else` causes the type table not to have a type for this expr.

src/test/ui/async-await/issue-66387-if-without-else.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0317]: if may be missing an else clause
1+
error[E0317]: `if` may be missing an `else` clause
22
--> $DIR/issue-66387-if-without-else.rs:3:5
33
|
44
LL | / if true {

src/test/ui/bad/bad-expr-path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
mod m1 {}
22

3-
fn main(arguments: Vec<String>) { //~ ERROR main function has wrong type
3+
fn main(arguments: Vec<String>) { //~ ERROR `main` function has wrong type
44
log(debug, m1::arguments);
55
//~^ ERROR cannot find function `log` in this scope
66
//~| ERROR cannot find value `debug` in this scope

src/test/ui/bad/bad-expr-path.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ error[E0425]: cannot find value `arguments` in module `m1`
1616
LL | log(debug, m1::arguments);
1717
| ^^^^^^^^^ not found in `m1`
1818

19-
error[E0580]: main function has wrong type
19+
error[E0580]: `main` function has wrong type
2020
--> $DIR/bad-expr-path.rs:3:1
2121
|
2222
LL | fn main(arguments: Vec<String>) {

src/test/ui/bad/bad-expr-path2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mod m1 {
22
pub mod arguments {}
33
}
44

5-
fn main(arguments: Vec<String>) { //~ ERROR main function has wrong type
5+
fn main(arguments: Vec<String>) { //~ ERROR `main` function has wrong type
66
log(debug, m1::arguments);
77
//~^ ERROR cannot find function `log` in this scope
88
//~| ERROR cannot find value `debug` in this scope

src/test/ui/bad/bad-expr-path2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ error[E0423]: expected value, found module `m1::arguments`
1616
LL | log(debug, m1::arguments);
1717
| ^^^^^^^^^^^^^ not a value
1818

19-
error[E0580]: main function has wrong type
19+
error[E0580]: `main` function has wrong type
2020
--> $DIR/bad-expr-path2.rs:5:1
2121
|
2222
LL | fn main(arguments: Vec<String>) {

src/test/ui/bad/bad-main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fn main(x: isize) { } //~ ERROR: main function has wrong type [E0580]
1+
fn main(x: isize) { } //~ ERROR: `main` function has wrong type [E0580]

src/test/ui/bad/bad-main.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0580]: main function has wrong type
1+
error[E0580]: `main` function has wrong type
22
--> $DIR/bad-main.rs:1:1
33
|
44
LL | fn main(x: isize) { }

src/test/ui/consts/control-flow/issue-50577.if_match.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0317]: if may be missing an else clause
1+
error[E0317]: `if` may be missing an `else` clause
22
--> $DIR/issue-50577.rs:7:16
33
|
44
LL | Drop = assert_eq!(1, 1)

src/test/ui/consts/control-flow/issue-50577.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
fn main() {
66
enum Foo {
77
Drop = assert_eq!(1, 1)
8-
//[stock,if_match]~^ ERROR if may be missing an else clause
8+
//[stock,if_match]~^ ERROR `if` may be missing an `else` clause
99
//[stock]~^^ ERROR `match` is not allowed in a `const`
1010
//[stock]~| ERROR `match` is not allowed in a `const`
1111
//[stock]~| ERROR `if` is not allowed in a `const`

src/test/ui/consts/control-flow/issue-50577.stock.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ LL | Drop = assert_eq!(1, 1)
2828
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
2929
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
3030

31-
error[E0317]: if may be missing an else clause
31+
error[E0317]: `if` may be missing an `else` clause
3232
--> $DIR/issue-50577.rs:7:16
3333
|
3434
LL | Drop = assert_eq!(1, 1)

src/test/ui/error-codes/E0138.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0138]: multiple `start` functions
22
--> $DIR/E0138.rs:7:1
33
|
44
LL | fn foo(argc: isize, argv: *const *const u8) -> isize { 0 }
5-
| ---------------------------------------------------------- previous `start` function here
5+
| ---------------------------------------------------------- previous `#[start]` function here
66
...
77
LL | fn f(argc: isize, argv: *const *const u8) -> isize { 0 }
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple `start` functions

src/test/ui/extern/extern-main-fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
extern fn main() {} //~ ERROR: main function has wrong type [E0580]
1+
extern fn main() {} //~ ERROR: `main` function has wrong type [E0580]

src/test/ui/extern/extern-main-fn.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0580]: main function has wrong type
1+
error[E0580]: `main` function has wrong type
22
--> $DIR/extern-main-fn.rs:1:1
33
|
44
LL | extern fn main() {}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#[start]
22
fn foo(_: isize, _: *const *const u8) -> isize { 0 }
3-
//~^ ERROR a `#[start]` function is an experimental feature
3+
//~^ ERROR `#[start]` functions are experimental

src/test/ui/feature-gates/feature-gate-start.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0658]: a `#[start]` function is an experimental feature whose signature may change over time
1+
error[E0658]: `#[start]` functions are experimental and their signature may change over time
22
--> $DIR/feature-gate-start.rs:2:1
33
|
44
LL | fn foo(_: isize, _: *const *const u8) -> isize { 0 }

src/test/ui/if-else-type-mismatch.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,43 @@ fn main() {
44
} else {
55
2u32
66
};
7-
//~^^ ERROR if and else have incompatible types
7+
//~^^ ERROR `if` and `else` have incompatible types
88
let _ = if true { 42i32 } else { 42u32 };
9-
//~^ ERROR if and else have incompatible types
9+
//~^ ERROR `if` and `else` have incompatible types
1010
let _ = if true {
1111
3u32;
1212
} else {
1313
4u32
1414
};
15-
//~^^ ERROR if and else have incompatible types
15+
//~^^ ERROR `if` and `else` have incompatible types
1616
let _ = if true {
1717
5u32
1818
} else {
1919
6u32;
2020
};
21-
//~^^ ERROR if and else have incompatible types
21+
//~^^ ERROR `if` and `else` have incompatible types
2222
let _ = if true {
2323
7i32;
2424
} else {
2525
8u32
2626
};
27-
//~^^ ERROR if and else have incompatible types
27+
//~^^ ERROR `if` and `else` have incompatible types
2828
let _ = if true {
2929
9i32
3030
} else {
3131
10u32;
3232
};
33-
//~^^ ERROR if and else have incompatible types
33+
//~^^ ERROR `if` and `else` have incompatible types
3434
let _ = if true {
3535

3636
} else {
3737
11u32
3838
};
39-
//~^^ ERROR if and else have incompatible types
39+
//~^^ ERROR `if` and `else` have incompatible types
4040
let _ = if true {
4141
12i32
4242
} else {
4343

4444
};
45-
//~^^^ ERROR if and else have incompatible types
45+
//~^^^ ERROR `if` and `else` have incompatible types
4646
}

src/test/ui/if-else-type-mismatch.stderr

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0308]: if and else have incompatible types
1+
error[E0308]: `if` and `else` have incompatible types
22
--> $DIR/if-else-type-mismatch.rs:5:9
33
|
44
LL | let _ = if true {
@@ -9,17 +9,17 @@ LL | | } else {
99
LL | | 2u32
1010
| | ^^^^ expected `i32`, found `u32`
1111
LL | | };
12-
| |_____- if and else have incompatible types
12+
| |_____- `if` and `else` have incompatible types
1313

14-
error[E0308]: if and else have incompatible types
14+
error[E0308]: `if` and `else` have incompatible types
1515
--> $DIR/if-else-type-mismatch.rs:8:38
1616
|
1717
LL | let _ = if true { 42i32 } else { 42u32 };
1818
| ----- ^^^^^ expected `i32`, found `u32`
1919
| |
2020
| expected because of this
2121

22-
error[E0308]: if and else have incompatible types
22+
error[E0308]: `if` and `else` have incompatible types
2323
--> $DIR/if-else-type-mismatch.rs:13:9
2424
|
2525
LL | let _ = if true {
@@ -33,9 +33,9 @@ LL | | } else {
3333
LL | | 4u32
3434
| | ^^^^ expected `()`, found `u32`
3535
LL | | };
36-
| |_____- if and else have incompatible types
36+
| |_____- `if` and `else` have incompatible types
3737

38-
error[E0308]: if and else have incompatible types
38+
error[E0308]: `if` and `else` have incompatible types
3939
--> $DIR/if-else-type-mismatch.rs:19:9
4040
|
4141
LL | let _ = if true {
@@ -49,9 +49,9 @@ LL | | 6u32;
4949
| | | help: consider removing this semicolon
5050
| | expected `u32`, found `()`
5151
LL | | };
52-
| |_____- if and else have incompatible types
52+
| |_____- `if` and `else` have incompatible types
5353

54-
error[E0308]: if and else have incompatible types
54+
error[E0308]: `if` and `else` have incompatible types
5555
--> $DIR/if-else-type-mismatch.rs:25:9
5656
|
5757
LL | let _ = if true {
@@ -62,9 +62,9 @@ LL | | } else {
6262
LL | | 8u32
6363
| | ^^^^ expected `()`, found `u32`
6464
LL | | };
65-
| |_____- if and else have incompatible types
65+
| |_____- `if` and `else` have incompatible types
6666

67-
error[E0308]: if and else have incompatible types
67+
error[E0308]: `if` and `else` have incompatible types
6868
--> $DIR/if-else-type-mismatch.rs:31:9
6969
|
7070
LL | let _ = if true {
@@ -75,9 +75,9 @@ LL | | } else {
7575
LL | | 10u32;
7676
| | ^^^^^^ expected `i32`, found `()`
7777
LL | | };
78-
| |_____- if and else have incompatible types
78+
| |_____- `if` and `else` have incompatible types
7979

80-
error[E0308]: if and else have incompatible types
80+
error[E0308]: `if` and `else` have incompatible types
8181
--> $DIR/if-else-type-mismatch.rs:37:9
8282
|
8383
LL | let _ = if true {
@@ -88,11 +88,11 @@ LL | | } else {
8888
LL | 11u32
8989
| ^^^^^ expected `()`, found `u32`
9090

91-
error[E0308]: if and else have incompatible types
91+
error[E0308]: `if` and `else` have incompatible types
9292
--> $DIR/if-else-type-mismatch.rs:42:12
9393
|
9494
LL | let _ = if true {
95-
| ------- if and else have incompatible types
95+
| ------- `if` and `else` have incompatible types
9696
LL | 12i32
9797
| ----- expected because of this
9898
LL | } else {

src/test/ui/if/if-branch-types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
22
let x = if true { 10i32 } else { 10u32 };
3-
//~^ ERROR if and else have incompatible types
3+
//~^ ERROR `if` and `else` have incompatible types
44
//~| expected `i32`, found `u32`
55
}

src/test/ui/if/if-branch-types.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0308]: if and else have incompatible types
1+
error[E0308]: `if` and `else` have incompatible types
22
--> $DIR/if-branch-types.rs:2:38
33
|
44
LL | let x = if true { 10i32 } else { 10u32 };

src/test/ui/if/if-let-arm-types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
fn main() {
22
if let Some(b) = None {
3-
//~^ NOTE if and else have incompatible types
3+
//~^ NOTE `if` and `else` have incompatible types
44
()
55
//~^ NOTE expected because of this
66
} else {
77
1
88
};
9-
//~^^ ERROR: if and else have incompatible types
9+
//~^^ ERROR: `if` and `else` have incompatible types
1010
//~| NOTE expected `()`, found integer
1111
}

src/test/ui/if/if-let-arm-types.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0308]: if and else have incompatible types
1+
error[E0308]: `if` and `else` have incompatible types
22
--> $DIR/if-let-arm-types.rs:7:9
33
|
44
LL | / if let Some(b) = None {
@@ -10,7 +10,7 @@ LL | | } else {
1010
LL | | 1
1111
| | ^ expected `()`, found integer
1212
LL | | };
13-
| |_____- if and else have incompatible types
13+
| |_____- `if` and `else` have incompatible types
1414

1515
error: aborting due to previous error
1616

0 commit comments

Comments
 (0)