Skip to content
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

Allow //~| comments to preceed //~v comments. #200

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

Jarcho
Copy link
Contributor

@Jarcho Jarcho commented Feb 20, 2024

Fixes an oversight from when //~v comments were added. Current implementation flips the order required which wouldn't be backwards compatible. Supporting stacking both above and below would be trivial if you'd prefer.

This should probably error when it's ambiguous which arrow to follow, though it currently binds above in such a case. e.g.

//~^ error
//~| error2 
//~v error3

@oli-obk
Copy link
Owner

oli-obk commented Feb 20, 2024

Oh god lol. That does make sense, yea.

I think we should also error on

//~^ error
//~v error3

And require a newline between for readability

@Jarcho
Copy link
Contributor Author

Jarcho commented Feb 20, 2024

Do you want to allow them underneath?

//~vv error1
//~| error2

It's trivial either way.

@Jarcho
Copy link
Contributor Author

Jarcho commented Feb 20, 2024

While we're on breaking changes, how about inline matching:

//~ error1
//~| error2

//~| error1
//~ error2

//~| error1
//~ error2
//~| error3

The first is currently accepted. Should it be? What about the other two?

@Jarcho Jarcho force-pushed the err_next_line_fix branch 2 times, most recently from fc8ab76 to ab77610 Compare February 20, 2024 06:57
@Jarcho
Copy link
Contributor Author

Jarcho commented Feb 20, 2024

Current status:

Allowed:

//~| error1
//~v error2

Disallowed (not backwards compatible):

//~vv error1
//~| error2

//~ error1
//~| error2

Disallowed (backwards compatible):

//~| error1
//~ error2

//~^ error1
//~v error2

//~^ error1
//~| error2
//~| ...
//~v errorN

@oli-obk
Copy link
Owner

oli-obk commented Feb 20, 2024

This lgtm, and the breaking change is acceptable. It was not intended to be supported

Please also add a test for

//~ error1
//~| error2

@Jarcho
Copy link
Contributor Author

Jarcho commented Feb 20, 2024

Done.

For chaining off //~ this has been supported for a while. It's probably unused, and it really isn't much better than using //~^ since it already takes multiple lines. Adding it back in would be easy though.

Disallow `//~|` commented to follow `//~v` and `//~` comments.
@oli-obk
Copy link
Owner

oli-obk commented Feb 20, 2024

It's probably unused

I just saw it in the rustc ui tests last week 😆 but we should just eliminate them. They look weird

@oli-obk oli-obk merged commit fc52b56 into oli-obk:main Feb 20, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants