diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index 2426eb81678e1..7262994b8effa 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -83,7 +83,7 @@ pub(crate) fn lex_token_trees<'psess, 'src>( .filter_map(|unmatched_delim| make_unclosed_delims_error(unmatched_delim, psess)) .collect(); if let Err(errs) = res { - // Add unclosing delimiter or diff marker errors + // Add unclosing delimiter errors. buffer.extend(errs); } Err(buffer) diff --git a/compiler/rustc_parse/src/lexer/tokentrees.rs b/compiler/rustc_parse/src/lexer/tokentrees.rs index c6c9eb3b0b263..814b9f997bf16 100644 --- a/compiler/rustc_parse/src/lexer/tokentrees.rs +++ b/compiler/rustc_parse/src/lexer/tokentrees.rs @@ -108,8 +108,9 @@ impl<'psess, 'src> Lexer<'psess, 'src> { // We stop at any delimiter so we can try to recover if the user // uses an incorrect delimiter. let (open_spacing, tts, res) = self.lex_token_trees(/* is_delimited */ true); - if let Err(errs) = res { - return Err(self.unclosed_delim_err(tts, errs)); + if let Err(mut errs) = res { + self.unclosed_delim_err(tts, &mut errs); + return Err(errs); } // Expand to cover the entire delimited token tree. @@ -247,23 +248,14 @@ impl<'psess, 'src> Lexer<'psess, 'src> { this_spacing } - fn unclosed_delim_err( - &mut self, - tts: TokenStream, - mut errs: Vec>, - ) -> Vec> { - // If there are unclosed delims, see if there are diff markers and if so, point them - // out instead of complaining about the unclosed delims. + fn unclosed_delim_err(&mut self, tts: TokenStream, errs: &mut Vec>) { let mut parser = Parser::new(self.psess, tts, None); - let mut diff_errs = vec![]; // Suggest removing a `{` we think appears in an `if`/`while` condition. // We want to suggest removing a `{` only if we think we're in an `if`/`while` condition, // but we have no way of tracking this in the lexer itself, so we piggyback on the parser. let mut in_cond = false; while parser.token != token::Eof { - if let Err(diff_err) = parser.err_vcs_conflict_marker() { - diff_errs.push(diff_err); - } else if parser.is_keyword_ahead(0, &[kw::If, kw::While]) { + if parser.is_keyword_ahead(0, &[kw::If, kw::While]) { in_cond = true; } else if matches!( parser.token.kind, @@ -299,13 +291,6 @@ impl<'psess, 'src> Lexer<'psess, 'src> { } parser.bump(); } - if !diff_errs.is_empty() { - for err in errs { - err.cancel(); - } - return diff_errs; - } - errs } fn close_delim_err(&mut self, delim: Delimiter) -> PErr<'psess> { diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 34131e3af6e2c..e1d4168e2a6ad 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -16,7 +16,7 @@ use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; use rustc_errors::{ - Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, PErr, PResult, Subdiagnostic, + Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, PErr, PResult, Subdiagnostic, Suggestions, pluralize, }; use rustc_session::errors::ExprParenthesesNeeded; @@ -3029,120 +3029,6 @@ impl<'a> Parser<'a> { err } - /// This checks if this is a conflict marker, depending of the parameter passed. - /// - /// * `<<<<<<<` - /// * `|||||||` - /// * `=======` - /// * `>>>>>>>` - /// - pub(super) fn is_vcs_conflict_marker( - &mut self, - long_kind: &TokenKind, - short_kind: &TokenKind, - ) -> bool { - (0..3).all(|i| self.look_ahead(i, |tok| tok == long_kind)) - && self.look_ahead(3, |tok| tok == short_kind) - } - - fn conflict_marker(&mut self, long_kind: &TokenKind, short_kind: &TokenKind) -> Option { - if self.is_vcs_conflict_marker(long_kind, short_kind) { - let lo = self.token.span; - for _ in 0..4 { - self.bump(); - } - return Some(lo.to(self.prev_token.span)); - } - None - } - - pub(super) fn recover_vcs_conflict_marker(&mut self) { - if let Err(err) = self.err_vcs_conflict_marker() { - err.emit(); - FatalError.raise(); - } - } - - pub(crate) fn err_vcs_conflict_marker(&mut self) -> PResult<'a, ()> { - // <<<<<<< - let Some(start) = self.conflict_marker(&TokenKind::BinOp(token::Shl), &TokenKind::Lt) - else { - return Ok(()); - }; - let mut spans = Vec::with_capacity(3); - spans.push(start); - // ||||||| - let mut middlediff3 = None; - // ======= - let mut middle = None; - // >>>>>>> - let mut end = None; - loop { - if self.token == TokenKind::Eof { - break; - } - if let Some(span) = self.conflict_marker(&TokenKind::OrOr, &TokenKind::BinOp(token::Or)) - { - middlediff3 = Some(span); - } - if let Some(span) = self.conflict_marker(&TokenKind::EqEq, &TokenKind::Eq) { - middle = Some(span); - } - if let Some(span) = self.conflict_marker(&TokenKind::BinOp(token::Shr), &TokenKind::Gt) - { - spans.push(span); - end = Some(span); - break; - } - self.bump(); - } - - let mut err = self.dcx().struct_span_err(spans, "encountered diff marker"); - match middlediff3 { - // We're using diff3 - Some(middlediff3) => { - err.span_label( - start, - "between this marker and `|||||||` is the code that we're merging into", - ); - err.span_label(middlediff3, "between this marker and `=======` is the base code (what the two refs diverged from)"); - } - None => { - err.span_label( - start, - "between this marker and `=======` is the code that we're merging into", - ); - } - }; - - if let Some(middle) = middle { - err.span_label(middle, "between this marker and `>>>>>>>` is the incoming code"); - } - if let Some(end) = end { - err.span_label(end, "this marker concludes the conflict region"); - } - err.note( - "conflict markers indicate that a merge was started but could not be completed due \ - to merge conflicts\n\ - to resolve a conflict, keep only the code you want and then delete the lines \ - containing conflict markers", - ); - err.help( - "if you're having merge conflicts after pulling new code:\n\ - the top section is the code you already had and the bottom section is the remote code\n\ - if you're in the middle of a rebase:\n\ - the top section is the code being rebased onto and the bottom section is the code \ - coming from the current commit being rebased", - ); - - err.note( - "for an explanation on these markers from the `git` documentation:\n\ - visit ", - ); - - Err(err) - } - /// Parse and throw away a parenthesized comma separated /// sequence of patterns until `)` is reached. fn skip_pat_list(&mut self) -> PResult<'a, ()> { diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index eeb83a85e59bb..54845e64012da 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -3739,7 +3739,6 @@ impl<'a> Parser<'a> { /// Parses `ident (COLON expr)?`. fn parse_expr_field(&mut self) -> PResult<'a, ExprField> { let attrs = self.parse_outer_attributes()?; - self.recover_vcs_conflict_marker(); self.collect_tokens(None, attrs, ForceCollect::No, |this, attrs| { let lo = this.token.span; diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 58b4bf8980b1f..c80842e85e5ef 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -129,9 +129,7 @@ impl<'a> Parser<'a> { fn_parse_mode: FnParseMode, force_collect: ForceCollect, ) -> PResult<'a, Option> { - self.recover_vcs_conflict_marker(); let attrs = self.parse_outer_attributes()?; - self.recover_vcs_conflict_marker(); self.parse_item_common(attrs, true, false, fn_parse_mode, force_collect) } @@ -775,7 +773,6 @@ impl<'a> Parser<'a> { if self.recover_doc_comment_before_brace() { continue; } - self.recover_vcs_conflict_marker(); match parse_item(self) { Ok(None) => { let mut is_unnecessary_semicolon = !items.is_empty() @@ -1121,11 +1118,8 @@ impl<'a> Parser<'a> { /// USE_TREE_LIST = ∅ | (USE_TREE `,`)* USE_TREE [`,`] /// ``` fn parse_use_tree_list(&mut self) -> PResult<'a, ThinVec<(UseTree, ast::NodeId)>> { - self.parse_delim_comma_seq(Delimiter::Brace, |p| { - p.recover_vcs_conflict_marker(); - Ok((p.parse_use_tree()?, DUMMY_NODE_ID)) - }) - .map(|(r, _)| r) + self.parse_delim_comma_seq(Delimiter::Brace, |p| Ok((p.parse_use_tree()?, DUMMY_NODE_ID))) + .map(|(r, _)| r) } fn parse_rename(&mut self) -> PResult<'a, Option> { @@ -1564,9 +1558,7 @@ impl<'a> Parser<'a> { } fn parse_enum_variant(&mut self, span: Span) -> PResult<'a, Option> { - self.recover_vcs_conflict_marker(); let variant_attrs = self.parse_outer_attributes()?; - self.recover_vcs_conflict_marker(); let help = "enum variants can be `Variant`, `Variant = `, \ `Variant(Type, ..., TypeN)` or `Variant { fields: Types }`"; self.collect_tokens(None, variant_attrs, ForceCollect::No, |this, variant_attrs| { @@ -1808,34 +1800,11 @@ impl<'a> Parser<'a> { self.parse_paren_comma_seq(|p| { let attrs = p.parse_outer_attributes()?; p.collect_tokens(None, attrs, ForceCollect::No, |p, attrs| { - let mut snapshot = None; - if p.is_vcs_conflict_marker(&TokenKind::BinOp(token::Shl), &TokenKind::Lt) { - // Account for `<<<<<<<` diff markers. We can't proactively error here because - // that can be a valid type start, so we snapshot and reparse only we've - // encountered another parse error. - snapshot = Some(p.create_snapshot_for_diagnostic()); - } let lo = p.token.span; - let vis = match p.parse_visibility(FollowedByType::Yes) { - Ok(vis) => vis, - Err(err) => { - if let Some(ref mut snapshot) = snapshot { - snapshot.recover_vcs_conflict_marker(); - } - return Err(err); - } - }; + let vis = p.parse_visibility(FollowedByType::Yes)?; // Unsafe fields are not supported in tuple structs, as doing so would result in a // parsing ambiguity for `struct X(unsafe fn())`. - let ty = match p.parse_ty() { - Ok(ty) => ty, - Err(err) => { - if let Some(ref mut snapshot) = snapshot { - snapshot.recover_vcs_conflict_marker(); - } - return Err(err); - } - }; + let ty = p.parse_ty()?; let mut default = None; if p.token == token::Eq { let mut snapshot = p.create_snapshot_for_diagnostic(); @@ -1875,9 +1844,7 @@ impl<'a> Parser<'a> { /// Parses an element of a struct declaration. fn parse_field_def(&mut self, adt_ty: &str) -> PResult<'a, FieldDef> { - self.recover_vcs_conflict_marker(); let attrs = self.parse_outer_attributes()?; - self.recover_vcs_conflict_marker(); self.collect_tokens(None, attrs, ForceCollect::No, |this, attrs| { let lo = this.token.span; let vis = this.parse_visibility(FollowedByType::No)?; @@ -2830,7 +2797,6 @@ impl<'a> Parser<'a> { } let (mut params, _) = self.parse_paren_comma_seq(|p| { - p.recover_vcs_conflict_marker(); let snapshot = p.create_snapshot_for_diagnostic(); let param = p.parse_param_general(req_name, first_param).or_else(|e| { let guar = e.emit(); diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 5fa2e01fc863c..d7ad309becd13 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -5,7 +5,7 @@ use std::ops::Bound; use ast::Label; use rustc_ast as ast; use rustc_ast::ptr::P; -use rustc_ast::token::{self, Delimiter, TokenKind}; +use rustc_ast::token::{self, Delimiter}; use rustc_ast::util::classify::{self, TrailingBrace}; use rustc_ast::{ AttrStyle, AttrVec, Block, BlockCheckMode, DUMMY_NODE_ID, Expr, ExprKind, HasAttrs, Local, @@ -678,22 +678,12 @@ impl<'a> Parser<'a> { recover: AttemptLocalParseRecovery, ) -> PResult<'a, P> { let mut stmts = ThinVec::new(); - let mut snapshot = None; while !self.eat(&token::CloseDelim(Delimiter::Brace)) { if self.token == token::Eof { break; } - if self.is_vcs_conflict_marker(&TokenKind::BinOp(token::Shl), &TokenKind::Lt) { - // Account for `<<<<<<<` diff markers. We can't proactively error here because - // that can be a valid path start, so we snapshot and reparse only we've - // encountered another parse error. - snapshot = Some(self.create_snapshot_for_diagnostic()); - } let stmt = match self.parse_full_stmt(recover) { Err(mut err) if recover.yes() => { - if let Some(ref mut snapshot) = snapshot { - snapshot.recover_vcs_conflict_marker(); - } if self.token == token::Colon { // if a previous and next token of the current one is // integer literal (e.g. `1:42`), it's likely a range diff --git a/tests/ui/parser/diff-markers/enum-2.rs b/tests/ui/parser/diff-markers/enum-2.rs deleted file mode 100644 index 76ea980fc628d..0000000000000 --- a/tests/ui/parser/diff-markers/enum-2.rs +++ /dev/null @@ -1,11 +0,0 @@ -enum E { - Foo { -<<<<<<< HEAD //~ ERROR encountered diff marker - x: u8, -||||||| - z: (), -======= - y: i8, ->>>>>>> branch - } -} diff --git a/tests/ui/parser/diff-markers/enum-2.stderr b/tests/ui/parser/diff-markers/enum-2.stderr deleted file mode 100644 index b76cf5d5a01ee..0000000000000 --- a/tests/ui/parser/diff-markers/enum-2.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: encountered diff marker - --> $DIR/enum-2.rs:3:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `|||||||` is the code that we're merging into -LL | x: u8, -LL | ||||||| - | ------- between this marker and `=======` is the base code (what the two refs diverged from) -LL | z: (), -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -LL | y: i8, -LL | >>>>>>> branch - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error - diff --git a/tests/ui/parser/diff-markers/enum.rs b/tests/ui/parser/diff-markers/enum.rs deleted file mode 100644 index 45df6e3251d76..0000000000000 --- a/tests/ui/parser/diff-markers/enum.rs +++ /dev/null @@ -1,7 +0,0 @@ -enum E { -<<<<<<< HEAD //~ ERROR encountered diff marker - Foo(u8), -======= - Bar(i8), ->>>>>>> branch -} diff --git a/tests/ui/parser/diff-markers/enum.stderr b/tests/ui/parser/diff-markers/enum.stderr deleted file mode 100644 index 0ce473bc70232..0000000000000 --- a/tests/ui/parser/diff-markers/enum.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: encountered diff marker - --> $DIR/enum.rs:2:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `=======` is the code that we're merging into -LL | Foo(u8), -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -LL | Bar(i8), -LL | >>>>>>> branch - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error - diff --git a/tests/ui/parser/diff-markers/fn-arg.rs b/tests/ui/parser/diff-markers/fn-arg.rs deleted file mode 100644 index 86c355628ab67..0000000000000 --- a/tests/ui/parser/diff-markers/fn-arg.rs +++ /dev/null @@ -1,16 +0,0 @@ -trait T { - fn foo( -<<<<<<< HEAD //~ ERROR encountered diff marker - x: u8, -======= - x: i8, ->>>>>>> branch - ) {} -} - -struct S; -impl T for S {} - -fn main() { - S::foo(42); -} diff --git a/tests/ui/parser/diff-markers/fn-arg.stderr b/tests/ui/parser/diff-markers/fn-arg.stderr deleted file mode 100644 index 24521ffa62623..0000000000000 --- a/tests/ui/parser/diff-markers/fn-arg.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: encountered diff marker - --> $DIR/fn-arg.rs:3:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `=======` is the code that we're merging into -LL | x: u8, -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -LL | x: i8, -LL | >>>>>>> branch - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error - diff --git a/tests/ui/parser/diff-markers/item-with-attr.rs b/tests/ui/parser/diff-markers/item-with-attr.rs deleted file mode 100644 index 985907c08b28c..0000000000000 --- a/tests/ui/parser/diff-markers/item-with-attr.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[attribute] -<<<<<<< HEAD //~ ERROR encountered diff marker -fn foo() {} -======= -fn bar() {} ->>>>>>> branch - -fn main() { - foo(); -} diff --git a/tests/ui/parser/diff-markers/item-with-attr.stderr b/tests/ui/parser/diff-markers/item-with-attr.stderr deleted file mode 100644 index 432673cd5518b..0000000000000 --- a/tests/ui/parser/diff-markers/item-with-attr.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: encountered diff marker - --> $DIR/item-with-attr.rs:2:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `=======` is the code that we're merging into -LL | fn foo() {} -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -LL | fn bar() {} -LL | >>>>>>> branch - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error - diff --git a/tests/ui/parser/diff-markers/item.rs b/tests/ui/parser/diff-markers/item.rs deleted file mode 100644 index 4ed36b7b42bcd..0000000000000 --- a/tests/ui/parser/diff-markers/item.rs +++ /dev/null @@ -1,9 +0,0 @@ -<<<<<<< HEAD //~ ERROR encountered diff marker -fn foo() {} -======= -fn bar() {} ->>>>>>> branch - -fn main() { - foo(); -} diff --git a/tests/ui/parser/diff-markers/item.stderr b/tests/ui/parser/diff-markers/item.stderr deleted file mode 100644 index 180c74e5d6967..0000000000000 --- a/tests/ui/parser/diff-markers/item.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: encountered diff marker - --> $DIR/item.rs:1:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `=======` is the code that we're merging into -LL | fn foo() {} -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -LL | fn bar() {} -LL | >>>>>>> branch - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error - diff --git a/tests/ui/parser/diff-markers/statement.rs b/tests/ui/parser/diff-markers/statement.rs deleted file mode 100644 index e55d16d3bbb8e..0000000000000 --- a/tests/ui/parser/diff-markers/statement.rs +++ /dev/null @@ -1,15 +0,0 @@ -trait T { - fn foo() {} - fn bar() {} -} - -struct S; -impl T for S {} - -fn main() { -<<<<<<< HEAD //~ ERROR encountered diff marker - S::foo(); -======= - S::bar(); ->>>>>>> branch -} diff --git a/tests/ui/parser/diff-markers/statement.stderr b/tests/ui/parser/diff-markers/statement.stderr deleted file mode 100644 index 6dccce4a48eee..0000000000000 --- a/tests/ui/parser/diff-markers/statement.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: encountered diff marker - --> $DIR/statement.rs:10:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `=======` is the code that we're merging into -LL | S::foo(); -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -LL | S::bar(); -LL | >>>>>>> branch - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error - diff --git a/tests/ui/parser/diff-markers/struct-expr.rs b/tests/ui/parser/diff-markers/struct-expr.rs deleted file mode 100644 index 99d2fd662c69c..0000000000000 --- a/tests/ui/parser/diff-markers/struct-expr.rs +++ /dev/null @@ -1,12 +0,0 @@ -struct S { - x: u8, -} -fn main() { - let _ = S { -<<<<<<< HEAD //~ ERROR encountered diff marker - x: 42, -======= - x: 0, ->>>>>>> branch - } -} diff --git a/tests/ui/parser/diff-markers/struct-expr.stderr b/tests/ui/parser/diff-markers/struct-expr.stderr deleted file mode 100644 index 3733cdd349644..0000000000000 --- a/tests/ui/parser/diff-markers/struct-expr.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: encountered diff marker - --> $DIR/struct-expr.rs:6:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `=======` is the code that we're merging into -LL | x: 42, -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -LL | x: 0, -LL | >>>>>>> branch - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error - diff --git a/tests/ui/parser/diff-markers/struct.rs b/tests/ui/parser/diff-markers/struct.rs deleted file mode 100644 index d26464d47bcef..0000000000000 --- a/tests/ui/parser/diff-markers/struct.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct S { -<<<<<<< HEAD //~ ERROR encountered diff marker - x: u8, -======= - x: i8, ->>>>>>> branch -} diff --git a/tests/ui/parser/diff-markers/struct.stderr b/tests/ui/parser/diff-markers/struct.stderr deleted file mode 100644 index 44f8346613e68..0000000000000 --- a/tests/ui/parser/diff-markers/struct.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: encountered diff marker - --> $DIR/struct.rs:2:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `=======` is the code that we're merging into -LL | x: u8, -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -LL | x: i8, -LL | >>>>>>> branch - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error - diff --git a/tests/ui/parser/diff-markers/trait-item.rs b/tests/ui/parser/diff-markers/trait-item.rs deleted file mode 100644 index 3227c8212c96d..0000000000000 --- a/tests/ui/parser/diff-markers/trait-item.rs +++ /dev/null @@ -1,14 +0,0 @@ -trait T { -<<<<<<< HEAD //~ ERROR encountered diff marker - fn foo() {} -======= - fn bar() {} ->>>>>>> branch -} - -struct S; -impl T for S {} - -fn main() { - S::foo(); -} diff --git a/tests/ui/parser/diff-markers/trait-item.stderr b/tests/ui/parser/diff-markers/trait-item.stderr deleted file mode 100644 index 4361542c7743b..0000000000000 --- a/tests/ui/parser/diff-markers/trait-item.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: encountered diff marker - --> $DIR/trait-item.rs:2:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `=======` is the code that we're merging into -LL | fn foo() {} -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -LL | fn bar() {} -LL | >>>>>>> branch - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error - diff --git a/tests/ui/parser/diff-markers/tuple-struct.rs b/tests/ui/parser/diff-markers/tuple-struct.rs deleted file mode 100644 index 7eec35c968da3..0000000000000 --- a/tests/ui/parser/diff-markers/tuple-struct.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct S( -<<<<<<< HEAD //~ ERROR encountered diff marker - u8, -======= - i8, ->>>>>>> branch -); diff --git a/tests/ui/parser/diff-markers/tuple-struct.stderr b/tests/ui/parser/diff-markers/tuple-struct.stderr deleted file mode 100644 index 7fda24ba48532..0000000000000 --- a/tests/ui/parser/diff-markers/tuple-struct.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: encountered diff marker - --> $DIR/tuple-struct.rs:2:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `=======` is the code that we're merging into -LL | u8, -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -LL | i8, -LL | >>>>>>> branch - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error - diff --git a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs deleted file mode 100644 index da1774acea542..0000000000000 --- a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs +++ /dev/null @@ -1,9 +0,0 @@ -macro_rules! foo { -<<<<<<< HEAD - //~^ ERROR encountered diff marker - () { -======= - () { // ->>>>>>> 7a4f13c blah blah blah - } -} diff --git a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr deleted file mode 100644 index 927821ddfaedb..0000000000000 --- a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: encountered diff marker - --> $DIR/unclosed-delims-in-macro.rs:2:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `=======` is the code that we're merging into -... -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -LL | () { // -LL | >>>>>>> 7a4f13c blah blah blah - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error - diff --git a/tests/ui/parser/diff-markers/unclosed-delims.rs b/tests/ui/parser/diff-markers/unclosed-delims.rs deleted file mode 100644 index 7d400c3827bb6..0000000000000 --- a/tests/ui/parser/diff-markers/unclosed-delims.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod tests { - #[test] -<<<<<<< HEAD -//~^ ERROR encountered diff marker -//~| NOTE between this marker and `=======` - -//~| NOTE conflict markers indicate that -//~| HELP if you're having merge conflicts -//~| NOTE for an explanation on these markers - - fn test1() { -======= -//~^ NOTE between this marker and `>>>>>>>` - fn test2() { ->>>>>>> 7a4f13c blah blah blah -//~^ NOTE this marker concludes the conflict region - } -} diff --git a/tests/ui/parser/diff-markers/unclosed-delims.stderr b/tests/ui/parser/diff-markers/unclosed-delims.stderr deleted file mode 100644 index 1eab96442b4f2..0000000000000 --- a/tests/ui/parser/diff-markers/unclosed-delims.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: encountered diff marker - --> $DIR/unclosed-delims.rs:3:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `=======` is the code that we're merging into -... -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -... -LL | >>>>>>> 7a4f13c blah blah blah - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error - diff --git a/tests/ui/parser/diff-markers/use-statement.rs b/tests/ui/parser/diff-markers/use-statement.rs deleted file mode 100644 index 6306243a5141a..0000000000000 --- a/tests/ui/parser/diff-markers/use-statement.rs +++ /dev/null @@ -1,9 +0,0 @@ -use foo::{ -<<<<<<< HEAD //~ ERROR encountered diff marker - bar, -======= - baz, ->>>>>>> branch -}; - -fn main() {} diff --git a/tests/ui/parser/diff-markers/use-statement.stderr b/tests/ui/parser/diff-markers/use-statement.stderr deleted file mode 100644 index 3eac7bebb5af1..0000000000000 --- a/tests/ui/parser/diff-markers/use-statement.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: encountered diff marker - --> $DIR/use-statement.rs:2:1 - | -LL | <<<<<<< HEAD - | ^^^^^^^ between this marker and `=======` is the code that we're merging into -LL | bar, -LL | ======= - | ------- between this marker and `>>>>>>>` is the incoming code -LL | baz, -LL | >>>>>>> branch - | ^^^^^^^ this marker concludes the conflict region - | - = note: conflict markers indicate that a merge was started but could not be completed due to merge conflicts - to resolve a conflict, keep only the code you want and then delete the lines containing conflict markers - = 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 - 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 - = note: for an explanation on these markers from the `git` documentation: - visit - -error: aborting due to 1 previous error -