xd009642/tarpaulin

Tarpaulin is unable to build c-string literals

Closed this issue · 4 comments

Describe the bug

When running tarpaulin against code with a line of the form

const some_c_string: &CStr = c"foo";

I get this error

thread 'main' panicked at /build/cargo-tarpaulin-0.28.0-vendor.tar.gz/syn-1.0.109/src/lit.rs:1020:13:
Unrecognized literal: `c"foo"`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To Reproduce

Run tarpaulin against code containing c-string literals.

Expected behavior

Tarpaulin doesn't panicking when building code containing c-string literals.

It looks like this is caused by tarpaulin depending on syn v1, which predates the existence of c-string literals. Is there any plan to update to syn v2? Are you aware of what the main blockers would be towards that?

I've been working on it but frankly the syn API is pretty poor UX for this kind of stuff and the stages to migrate certain things weren't documented anywhere so it's been a bit slow. If you were interested it would be a case of doing off this and finishing off whichever parts don't yet compile from my WIP updates https://github.com/xd009642/tarpaulin/tree/dependabot/cargo/develop/syn-2.0.4

I think it's just macros which are the most painful part of the API because of the token stream abstraction 😢

Okay I now have a version of the syn2 branch where all the tests pass! You should be able to install from there and do some tests if you feel kind. Otherwise I'll run it on a number of projects tonight and make sure nothing's broken as it's a lot of big changes

I can confirm my code with c-string literals builds against dependabot/cargo/develop/syn-2.0.4. Thanks so much!

The release job is now scheduled in CI, a new version with this in should be out in a few minutes time!