Skip to content

Commit d64af4a

Browse files
committed
Rebase and address comments
1 parent e0655a0 commit d64af4a

File tree

7 files changed

+16
-17
lines changed

7 files changed

+16
-17
lines changed

src/librustc_errors/emitter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Emitter for EmitterWriter {
4343
sugg.msg.split_whitespace().count() < 10 &&
4444
// don't display multiline suggestions as labels
4545
sugg.substitutes[0].find('\n').is_none() {
46-
let msg = format!("{} `{}`", sugg.msg, sugg.substitutes[0]);
46+
let msg = format!("help: {} `{}`", sugg.msg, sugg.substitutes[0]);
4747
primary_span.push_span_label(sugg.msp.primary_spans()[0], msg);
4848
} else {
4949
children.push(SubDiagnostic {

src/librustc_typeck/check/op.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
245245
if let Some(missing_trait) = missing_trait {
246246
if missing_trait == "std::ops::Add" &&
247247
self.check_str_addition(expr, lhs_expr, lhs_ty,
248-
rhs_expr, rhs_ty_var, &mut err) {
248+
rhs_ty, &mut err) {
249249
// This has nothing here because it means we did string
250250
// concatenation (e.g. "Hello " + "World!"). This means
251251
// we don't want the note in the else clause to be emitted
@@ -269,7 +269,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
269269
expr: &'gcx hir::Expr,
270270
lhs_expr: &'gcx hir::Expr,
271271
lhs_ty: Ty<'tcx>,
272-
rhs_expr: &'gcx hir::Expr,
273272
rhs_ty: Ty<'tcx>,
274273
mut err: &mut errors::DiagnosticBuilder) -> bool {
275274
// If this function returns true it means a note was printed, so we don't need

src/test/ui/did_you_mean/E0178.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo`
22
--> $DIR/E0178.rs:14:8
33
|
44
14 | w: &'a Foo + Copy,
5-
| ^^^^^^^^^^^^^^ try adding parentheses: `&'a (Foo + Copy)`
5+
| ^^^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + Copy)`
66

77
error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo`
88
--> $DIR/E0178.rs:15:8
99
|
1010
15 | x: &'a Foo + 'a,
11-
| ^^^^^^^^^^^^ try adding parentheses: `&'a (Foo + 'a)`
11+
| ^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + 'a)`
1212

1313
error[E0178]: expected a path on the left-hand side of `+`, not `&'a mut Foo`
1414
--> $DIR/E0178.rs:16:8
1515
|
1616
16 | y: &'a mut Foo + 'a,
17-
| ^^^^^^^^^^^^^^^^ try adding parentheses: `&'a mut (Foo + 'a)`
17+
| ^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'a mut (Foo + 'a)`
1818

1919
error[E0178]: expected a path on the left-hand side of `+`, not `fn() -> Foo`
2020
--> $DIR/E0178.rs:17:8

src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&Copy`
22
--> $DIR/trait-object-reference-without-parens-suggestion.rs:12:12
33
|
44
12 | let _: &Copy + 'static;
5-
| ^^^^^^^^^^^^^^^ try adding parentheses: `&(Copy + 'static)`
5+
| ^^^^^^^^^^^^^^^ help: try adding parentheses: `&(Copy + 'static)`
66

77
error[E0178]: expected a path on the left-hand side of `+`, not `&'static Copy`
88
--> $DIR/trait-object-reference-without-parens-suggestion.rs:13:12
99
|
1010
13 | let _: &'static Copy + 'static;
11-
| ^^^^^^^^^^^^^^^^^^^^^^^ try adding parentheses: `&'static (Copy + 'static)`
11+
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'static (Copy + 'static)`
1212

1313
error[E0038]: the trait `std::marker::Copy` cannot be made into an object
1414
--> $DIR/trait-object-reference-without-parens-suggestion.rs:12:12

src/test/ui/pub/pub-restricted.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: incorrect visibility restriction
22
--> $DIR/pub-restricted.rs:15:6
33
|
44
15 | pub (a) fn afn() {}
5-
| ^ make this visible only to module `a` with `in`: `in a`
5+
| ^ help: make this visible only to module `a` with `in`: `in a`
66
|
77
= help: some possible visibility restrictions are:
88
`pub(crate)`: visible only on the current crate
@@ -13,7 +13,7 @@ error: incorrect visibility restriction
1313
--> $DIR/pub-restricted.rs:16:6
1414
|
1515
16 | pub (b) fn bfn() {}
16-
| ^ make this visible only to module `b` with `in`: `in b`
16+
| ^ help: make this visible only to module `b` with `in`: `in b`
1717
|
1818
= help: some possible visibility restrictions are:
1919
`pub(crate)`: visible only on the current crate
@@ -24,7 +24,7 @@ error: incorrect visibility restriction
2424
--> $DIR/pub-restricted.rs:32:14
2525
|
2626
32 | pub (a) invalid: usize,
27-
| ^ make this visible only to module `a` with `in`: `in a`
27+
| ^ help: make this visible only to module `a` with `in`: `in a`
2828
|
2929
= help: some possible visibility restrictions are:
3030
`pub(crate)`: visible only on the current crate
@@ -35,7 +35,7 @@ error: incorrect visibility restriction
3535
--> $DIR/pub-restricted.rs:41:6
3636
|
3737
41 | pub (xyz) fn xyz() {}
38-
| ^^^ make this visible only to module `xyz` with `in`: `in xyz`
38+
| ^^^ help: make this visible only to module `xyz` with `in`: `in xyz`
3939
|
4040
= help: some possible visibility restrictions are:
4141
`pub(crate)`: visible only on the current crate

src/test/ui/span/suggestion-non-ascii.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: cannot index a value of type `({integer},)`
22
--> $DIR/suggestion-non-ascii.rs:14:21
33
|
44
14 | println!("☃{}", tup[0]);
5-
| ^^^^^^ to access tuple elements, use `tup.0`
5+
| ^^^^^^ help: to access tuple elements, use `tup.0`
66

77
error: aborting due to previous error
88

src/test/ui/suggestions/tuple-float-index.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ error: unexpected token: `1.1`
22
--> $DIR/tuple-float-index.rs:14:17
33
|
44
14 | (1, (2, 3)).1.1;
5-
| ^^^ unexpected token
6-
|
7-
help: try parenthesizing the first index
8-
| ((1, (2, 3)).1).1;
5+
| ------------^^^
6+
| | |
7+
| | unexpected token
8+
| help: try parenthesizing the first index `((1, (2, 3)).1).1`
99

1010
error: aborting due to previous error
1111

0 commit comments

Comments
 (0)