-
Notifications
You must be signed in to change notification settings - Fork 0
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
TOML parser fails with Rust quick fixes, leading to opaque errors. Includes solution. #9
Comments
Thanks for pointing this out. I will have to give some thought as to how to integrate this into verus-mode.el. For maintenance reasons, I do not wish to maintain a fork of Current simplest workaround is to just use double-quotes. I'm sure you're aware of this, but noting it here for anyone else who hits the same issue until we have a fix. Interestingly, this suggests an alternate strategy for implementation within verus-mode.el, where we can pre-transform the Again, will give some more thought before I implement the fix in the next release; thanks for bringing this to my attention. |
Quick note that I added an error message that should at least help users understand what is happening (until a proper fix is done), rather than get an inscrutable toml error: 42c5160 I don't have much bandwidth to attempt this change, but I think having had time to think, the approach I would like to go for is the alternate strategy I mentioned above:
|
Nice, this should save others significant time in debugging. However, single-quotes are valid in some contexts (e.g., within strings), so perhaps this should be a warning instead of an error? This is also something to consider when implementing the transformation from single-quotes to double-quotes. |
Good point; for now I am going to leave it as an error; the error itself is captured via a Thanks for pointing out that the quoting transformation needing to deal with this though. Hopefully I'll have a few spare cycles for this soon! |
Problem
The TOML parser used by verus-mode.el does not support single-quoted strings, which causes issues when using Rust's built-in quick fixes and code suggestions. These often generate TOML with single quotes, leading to an opaque error message (
Bad readable value
).Why This Matters
Steps to Reproduce
cfg(flag)
it does not recognize.Example problematic TOML:
Solution
I simply added support for single quote strings in the TOML library with these following changes:
First, I wrote a simple macro to generate a string reading function. A higher order function would also be a fine
alternative:
Added these to the
read-table
:Adjusted the
special-escape-characters
constant to include single quotes:This is the solution I am currently using, which works and passes the toml library's tests. My chain is quite minimal, so I have not performed a great deal of testing, however it does fix the issue.
The toml library has not seen much maintenance, and users have been annoyed by this, so I am not sure what the best way of integrating this fix is.
The text was updated successfully, but these errors were encountered: