Skip to content

Commit 698ebe3

Browse files
committed
Tweak wording
1 parent 38fd5a9 commit 698ebe3

14 files changed

+94
-39
lines changed

compiler/rustc_parse/src/parser/diagnostics.rs

+15-4
Original file line numberDiff line numberDiff line change
@@ -2586,7 +2586,6 @@ impl<'a> Parser<'a> {
25862586
break;
25872587
}
25882588
if let Some(span) = self.diff_marker(&TokenKind::EqEq, &TokenKind::Eq) {
2589-
spans.push(span);
25902589
middle = Some(span);
25912590
}
25922591
if let Some(span) = self.diff_marker(&TokenKind::BinOp(token::Shr), &TokenKind::Gt) {
@@ -2597,13 +2596,25 @@ impl<'a> Parser<'a> {
25972596
self.bump();
25982597
}
25992598
let mut err = self.struct_span_err(spans, "encountered diff marker");
2600-
err.span_label(start, "start");
2599+
err.span_label(start, "after this is the code before the merge");
26012600
if let Some(middle) = middle {
2602-
err.span_label(middle, "middle");
2601+
err.span_label(middle, "");
26032602
}
26042603
if let Some(end) = end {
2605-
err.span_label(end, "end");
2604+
err.span_label(end, "above this are the incoming code changes");
26062605
}
2606+
err.help(
2607+
"if you're having merge conflicts after pulling new code, the top section is the code \
2608+
you already had and the bottom section is the remote code",
2609+
);
2610+
err.help(
2611+
"if you're in the middle of a rebase, the top section is the code being rebased onto \
2612+
and the bottom section is the code coming from the current commit being rebased",
2613+
);
2614+
err.note(
2615+
"for an explanation on these markers from the `git` documentation, visit \
2616+
<https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>",
2617+
);
26072618
err.emit();
26082619
FatalError.raise()
26092620
}

compiler/rustc_parse/src/parser/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ impl<'a> Parser<'a> {
15831583
p.collect_tokens_trailing_token(attrs, ForceCollect::No, |p, attrs| {
15841584
let mut snapshot = None;
15851585
if p.is_diff_marker(&TokenKind::BinOp(token::Shl), &TokenKind::Lt) {
1586-
// Account for `<<<<<<<` diff markers. We can't proactivelly error here because
1586+
// Account for `<<<<<<<` diff markers. We can't proactively error here because
15871587
// that can be a valid type start, so we snapshot and reparse only we've
15881588
// encountered another parse error.
15891589
snapshot = Some(p.create_snapshot_for_diagnostic());

compiler/rustc_parse/src/parser/stmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ impl<'a> Parser<'a> {
537537
break;
538538
}
539539
if self.is_diff_marker(&TokenKind::BinOp(token::Shl), &TokenKind::Lt) {
540-
// Account for `<<<<<<<` diff markers. We can't proactivelly error here because
540+
// Account for `<<<<<<<` diff markers. We can't proactively error here because
541541
// that can be a valid path start, so we snapshot and reparse only we've
542542
// encountered another parse error.
543543
snapshot = Some(self.create_snapshot_for_diagnostic());

src/test/ui/parser/diff-markers/enum-2.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ error: encountered diff marker
22
--> $DIR/enum-2.rs:3:1
33
|
44
LL | <<<<<<< HEAD
5-
| ^^^^^^^ start
5+
| ^^^^^^^ after this is the code before the merge
66
LL | x: u8,
77
LL | =======
8-
| ^^^^^^^ middle
8+
| -------
99
LL | x: i8,
1010
LL | >>>>>>> branch
11-
| ^^^^^^^ end
11+
| ^^^^^^^ above this are the incoming code changes
12+
|
13+
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
14+
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
15+
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
1216

1317
error: aborting due to previous error
1418

src/test/ui/parser/diff-markers/enum.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ error: encountered diff marker
22
--> $DIR/enum.rs:2:1
33
|
44
LL | <<<<<<< HEAD
5-
| ^^^^^^^ start
5+
| ^^^^^^^ after this is the code before the merge
66
LL | Foo(u8),
77
LL | =======
8-
| ^^^^^^^ middle
8+
| -------
99
LL | Bar(i8),
1010
LL | >>>>>>> branch
11-
| ^^^^^^^ end
11+
| ^^^^^^^ above this are the incoming code changes
12+
|
13+
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
14+
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
15+
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
1216

1317
error: aborting due to previous error
1418

src/test/ui/parser/diff-markers/fn-arg.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ error: encountered diff marker
22
--> $DIR/fn-arg.rs:3:1
33
|
44
LL | <<<<<<< HEAD
5-
| ^^^^^^^ start
5+
| ^^^^^^^ after this is the code before the merge
66
LL | x: u8,
77
LL | =======
8-
| ^^^^^^^ middle
8+
| -------
99
LL | x: i8,
1010
LL | >>>>>>> branch
11-
| ^^^^^^^ end
11+
| ^^^^^^^ above this are the incoming code changes
12+
|
13+
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
14+
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
15+
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
1216

1317
error: aborting due to previous error
1418

src/test/ui/parser/diff-markers/item-with-attr.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ error: encountered diff marker
22
--> $DIR/item-with-attr.rs:2:1
33
|
44
LL | <<<<<<< HEAD
5-
| ^^^^^^^ start
5+
| ^^^^^^^ after this is the code before the merge
66
LL | fn foo() {}
77
LL | =======
8-
| ^^^^^^^ middle
8+
| -------
99
LL | fn bar() {}
1010
LL | >>>>>>> branch
11-
| ^^^^^^^ end
11+
| ^^^^^^^ above this are the incoming code changes
12+
|
13+
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
14+
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
15+
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
1216

1317
error: aborting due to previous error
1418

src/test/ui/parser/diff-markers/item.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ error: encountered diff marker
22
--> $DIR/item.rs:1:1
33
|
44
LL | <<<<<<< HEAD
5-
| ^^^^^^^ start
5+
| ^^^^^^^ after this is the code before the merge
66
LL | fn foo() {}
77
LL | =======
8-
| ^^^^^^^ middle
8+
| -------
99
LL | fn bar() {}
1010
LL | >>>>>>> branch
11-
| ^^^^^^^ end
11+
| ^^^^^^^ above this are the incoming code changes
12+
|
13+
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
14+
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
15+
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
1216

1317
error: aborting due to previous error
1418

src/test/ui/parser/diff-markers/statement.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ error: encountered diff marker
22
--> $DIR/statement.rs:10:1
33
|
44
LL | <<<<<<< HEAD
5-
| ^^^^^^^ start
5+
| ^^^^^^^ after this is the code before the merge
66
LL | S::foo();
77
LL | =======
8-
| ^^^^^^^ middle
8+
| -------
99
LL | S::bar();
1010
LL | >>>>>>> branch
11-
| ^^^^^^^ end
11+
| ^^^^^^^ above this are the incoming code changes
12+
|
13+
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
14+
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
15+
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
1216

1317
error: aborting due to previous error
1418

src/test/ui/parser/diff-markers/struct-expr.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ error: encountered diff marker
22
--> $DIR/struct-expr.rs:6:1
33
|
44
LL | <<<<<<< HEAD
5-
| ^^^^^^^ start
5+
| ^^^^^^^ after this is the code before the merge
66
LL | x: 42,
77
LL | =======
8-
| ^^^^^^^ middle
8+
| -------
99
LL | x: 0,
1010
LL | >>>>>>> branch
11-
| ^^^^^^^ end
11+
| ^^^^^^^ above this are the incoming code changes
12+
|
13+
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
14+
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
15+
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
1216

1317
error: aborting due to previous error
1418

src/test/ui/parser/diff-markers/struct.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ error: encountered diff marker
22
--> $DIR/struct.rs:2:1
33
|
44
LL | <<<<<<< HEAD
5-
| ^^^^^^^ start
5+
| ^^^^^^^ after this is the code before the merge
66
LL | x: u8,
77
LL | =======
8-
| ^^^^^^^ middle
8+
| -------
99
LL | x: i8,
1010
LL | >>>>>>> branch
11-
| ^^^^^^^ end
11+
| ^^^^^^^ above this are the incoming code changes
12+
|
13+
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
14+
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
15+
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
1216

1317
error: aborting due to previous error
1418

src/test/ui/parser/diff-markers/trait-item.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ error: encountered diff marker
22
--> $DIR/trait-item.rs:2:1
33
|
44
LL | <<<<<<< HEAD
5-
| ^^^^^^^ start
5+
| ^^^^^^^ after this is the code before the merge
66
LL | fn foo() {}
77
LL | =======
8-
| ^^^^^^^ middle
8+
| -------
99
LL | fn bar() {}
1010
LL | >>>>>>> branch
11-
| ^^^^^^^ end
11+
| ^^^^^^^ above this are the incoming code changes
12+
|
13+
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
14+
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
15+
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
1216

1317
error: aborting due to previous error
1418

src/test/ui/parser/diff-markers/tuple-struct.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ error: encountered diff marker
22
--> $DIR/tuple-struct.rs:2:1
33
|
44
LL | <<<<<<< HEAD
5-
| ^^^^^^^ start
5+
| ^^^^^^^ after this is the code before the merge
66
LL | u8,
77
LL | =======
8-
| ^^^^^^^ middle
8+
| -------
99
LL | i8,
1010
LL | >>>>>>> branch
11-
| ^^^^^^^ end
11+
| ^^^^^^^ above this are the incoming code changes
12+
|
13+
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
14+
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
15+
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
1216

1317
error: aborting due to previous error
1418

src/test/ui/parser/diff-markers/use-statement.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ error: encountered diff marker
22
--> $DIR/use-statement.rs:2:1
33
|
44
LL | <<<<<<< HEAD
5-
| ^^^^^^^ start
5+
| ^^^^^^^ after this is the code before the merge
66
LL | bar,
77
LL | =======
8-
| ^^^^^^^ middle
8+
| -------
99
LL | baz,
1010
LL | >>>>>>> branch
11-
| ^^^^^^^ end
11+
| ^^^^^^^ above this are the incoming code changes
12+
|
13+
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
14+
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
15+
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
1216

1317
error: aborting due to previous error
1418

0 commit comments

Comments
 (0)