-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Make IncorrectDiagnostic match rustc by copying rustc's code. #6350
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
Conversation
a0236aa to
afb2166
Compare
|
LGTM, thanks! I think I should have looked at the |
|
I'm a little worried about copyright. I've left comments stating what code has been copied from rustc, but I didn't include the contents of either rust/LICENSE-MIT or rust/LICENSE-APACHE. It most likely wouldn't come back to bite us. I've also heard we copy rustc for proc-macro support, so if that's applicable, this should make us square on that front too. |
|
As long as rust-analyzer is also MIT/Apache, and changing the license of an open-source project is quite hard and unlikely, I believe there is no problem with copying some code when it makes sense. |
|
Alright, cool. |
|
bors r=popzxc Thanks @ArifRoktim and @popzxc ! |
This closes #6343 and closes #6345.
The old algorithm which used a
DetectedCaseenum, didn't match how rustc thinks of cases. Some inputs can be interpreted as more than 1 case depending on the situation. For example, to rustc:ABCD: Can be both camel case and upper snake caseX86_64: Can be both camel case and upper snake caseI could've made
detect_casereturn a collection ofDetectedCaseand then modified the other code as such, but I think using the same code rustc uses is simpler and a surefire way to achieve the same diagnostics as rustc.