-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect Merge Conflict Text #36879
Comments
Perhaps it could use this diagnostic iff a Git repository is detected? |
Or do other merge tools use similar marks? |
Hm, I do seem to recall that |
Looks like it dates back to RCS, or even earlier. |
Alright, removed the "Git" part from this. |
Still, I think trying to detect a VCS (lazily and memoizedly) would be useful for giving the user more context. |
Why? Since the format is apparently not specific to one VCS, the compiler can just say "merge conflict" and perhaps drop the term "commit". The user (if they are in a position to resolve the merge conflict) will presumably know which VCS they are using. Not to mention that a merge conflict marker remains a merge conflict marker when it lives outside a VCS directory — for example, because the source code was downloaded from |
In my personal opinion a functionality like this does not belong in the rust compiler. The current error message already identifies one of the three locations, which I think should be enough. |
GCC returns the following error:
|
While I still think it could be useful, I've failed to think of any feature for which it would be necessary, save one: giving the user VCS-specific tips or URLs of documentation re resolving merge conflicts — and of course rustc could instead (in e.g. its I am and have been quite okay with a generic "merge conflict detected" message, although looking at GCC's above, I think I would prefer "merge conflict marker detected", as it doesn't necessarily mean there's an actual merge conflict. |
Duplicate of #32059. |
I saw a tweet about git merge conflict text in source code, and wondered what the Rust compiler does. As such, I created a play.rust-lang.org sample.
It currently detects more than two equals in a row, doesn't know what it means, and bails. Specifically, it looks like this:
I propose that when this happens, the compiler should look for the git merge conflict issues, and if it finds it, give a specific error message related to what is actually happening.
The error message could show the start and end of the merge sections, and actually give searchable text for what this strange textual artifact is for those who've never seen it before.
For an example of how it'd look:
The only con I can think of is that we're specifically caring about the semantics of one tool that isn't really related to Rust. But at the same time, git is widely used.
The text was updated successfully, but these errors were encountered: