@@ -2965,9 +2965,10 @@ impl<'a> Parser<'a> {
29652965
29662966 /// This checks if this is a conflict marker, depending of the parameter passed.
29672967 ///
2968- /// * `>>>>>`
2969- /// * `=====`
2970- /// * `<<<<<`
2968+ /// * `<<<<<<<`
2969+ /// * `|||||||`
2970+ /// * `=======`
2971+ /// * `>>>>>>>`
29712972 ///
29722973 pub ( super ) fn is_vcs_conflict_marker (
29732974 & mut self ,
@@ -2997,14 +2998,18 @@ impl<'a> Parser<'a> {
29972998 }
29982999
29993000 pub ( crate ) fn err_vcs_conflict_marker ( & mut self ) -> PResult < ' a , ( ) > {
3001+ // <<<<<<<
30003002 let Some ( start) = self . conflict_marker ( & TokenKind :: BinOp ( token:: Shl ) , & TokenKind :: Lt )
30013003 else {
30023004 return Ok ( ( ) ) ;
30033005 } ;
30043006 let mut spans = Vec :: with_capacity ( 3 ) ;
30053007 spans. push ( start) ;
3008+ // |||||||
30063009 let mut middlediff3 = None ;
3010+ // =======
30073011 let mut middle = None ;
3012+ // >>>>>>>
30083013 let mut end = None ;
30093014 loop {
30103015 if self . token . kind == TokenKind :: Eof {
@@ -3025,29 +3030,50 @@ impl<'a> Parser<'a> {
30253030 }
30263031 self . bump ( ) ;
30273032 }
3033+
30283034 let mut err = self . dcx ( ) . struct_span_err ( spans, "encountered diff marker" ) ;
3029- err. span_label ( start, "after this is the code before the merge" ) ;
3030- if let Some ( middle) = middlediff3 {
3031- err. span_label ( middle, "" ) ;
3032- }
3035+ match middlediff3 {
3036+ // We're using diff3
3037+ Some ( middlediff3) => {
3038+ err. span_label (
3039+ start,
3040+ "between this marker and `|||||||` is the code that we're merging into" ,
3041+ ) ;
3042+ err. span_label ( middlediff3, "between this marker and `=======` is the base code (what the two refs diverged from)" ) ;
3043+ }
3044+ None => {
3045+ err. span_label (
3046+ start,
3047+ "between this marker and `=======` is the code that we're merging into" ,
3048+ ) ;
3049+ }
3050+ } ;
3051+
30333052 if let Some ( middle) = middle {
3034- err. span_label ( middle, "" ) ;
3053+ err. span_label ( middle, "between this marker and `>>>>>>>` is the incoming code " ) ;
30353054 }
30363055 if let Some ( end) = end {
3037- err. span_label ( end, "above this are the incoming code changes " ) ;
3056+ err. span_label ( end, "this marker concludes the conflict region " ) ;
30383057 }
3039- err. help (
3040- "if you're having merge conflicts after pulling new code, the top section is the code \
3041- you already had and the bottom section is the remote code",
3058+ err. note (
3059+ "conflict markers indicate that a merge was started but could not be completed due \
3060+ to merge conflicts\n \
3061+ to resolve a conflict, keep only the code you want and then delete the lines \
3062+ containing conflict markers",
30423063 ) ;
30433064 err. help (
3044- "if you're in the middle of a rebase, the top section is the code being rebased onto \
3045- and the bottom section is the code coming from the current commit being rebased",
3065+ "if you're having merge conflicts after pulling new code:\n \
3066+ the top section is the code you already had and the bottom section is the remote code\n \
3067+ if you're in the middle of a rebase:\n \
3068+ the top section is the code being rebased onto and the bottom section is the code \
3069+ coming from the current commit being rebased",
30463070 ) ;
3071+
30473072 err. note (
3048- "for an explanation on these markers from the `git` documentation, visit \
3049- <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>",
3073+ "for an explanation on these markers from the `git` documentation: \n \
3074+ visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>",
30503075 ) ;
3076+
30513077 Err ( err)
30523078 }
30533079
0 commit comments