-
Notifications
You must be signed in to change notification settings - Fork 35
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
kcl-libs/derive-docs breakage with upcoming Rust 1.77 #1339
Comments
Has this been fixed? I don't see any change that would have fixed it, but maybe I'm overlooking something. |
Oh shit sorry I just assumed it was working because im on latest rust? did they not release? |
I guess 1.77 is not out yet |
That's right, 1.76 was just released, 1.77 is about six weeks away. |
I think this fixed it #1487 |
#1487 fixes the current problem. It's still something of a bandaid fix, as the quoted paragraph describes, but it's better than nothing. |
TIL there’s another way to do this without string matching wow such sadness for everywhere I have use this.. okay I’ll in the future I’ll be better |
fixed half of the string matching while fixing another bug, I promise we will get there :) https://github.com/KittyCAD/modeling-app/pull/1701/files#diff-58bfb285fa12f8cddd416ae2f26a3a5eed6085073660924c44dd554030e74270 |
If you compile kcl-libs with the Rust nightly that will be coming out in the next day or two, you will compile errors like this:
The problem is in the
stdlib
attribute proc macro in derive-docs, which has this code insrc/lib.rs
:The problem is this uses
to_string
on a token stream and then does substring matching on the result, which assumes that the output ofto_string
has a particular form. But the only guarantee onto_string
is that the result should be parseable Rust. The whitespace within the output may change.In the upcoming Nightly, the return type changes from this:
to this:
And the space inserted between the
>
and,
breaks the substring matching, becausetrim_end_matches('>')
fails due to the trailing space.This should be fixable with minor changes to the substring matching. But substring matching really shouldn't be used in general because it's fragile in the face of these kinds of changes. Looking at individual
TokenTree
s within theTokenStream
is a more reliable way of doing things, either directly (e.g. see this PR) or possibly usingsyn
.The text was updated successfully, but these errors were encountered: