cargo-geiger icon indicating copy to clipboard operation
cargo-geiger copied to clipboard

Fix build and update to syn v2

Open mleonhard opened this issue 1 year ago • 2 comments

This PR fixes https://github.com/geiger-rs/cargo-geiger/issues/517 . Here's what it does

  • Rolls back dependabot changes which broke the build
  • Update integration_tests__test9_package_with_git_deps.stdout.snap to match a package version in Cargo.lock
  • Migrate from syn v1 to v2 to support new C-style string literals. This fixes the panic: Unrecognized literal: c"".
  • Since Rust 1.77 changed the cargo metadata package-ID format (https://github.com/rust-lang/cargo/pull/12914), cargo-geiger built with a Rust 1.77 toolchain always fails with:
    thread 'scan::scan_tests::list_files_used_but_not_scanned_test::case_1' panicked at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/krates-0.11.0/src/builder.rs:919:36:
    called `Option::unwrap()` on a `None` value
    
    We work around this by specifying the Rust 1.76 toolchain. The proper fix requires upgrading the cargo_metadata crate to v0.18. This will require major changes to cargo-geiger's code.

Problems in this PR:

  • Some tests are failing.

mleonhard avatar Apr 19 '24 07:04 mleonhard

This PR keeps growing and growing as I fix more tests. I would love to hear suggestions for splitting it up. It would also be great if there was a way to get syn v2 to parse the same way as v1 so expression counts would match.

mleonhard avatar Apr 19 '24 07:04 mleonhard

We're re-writing much of the core incl. to break the cargo-reliance so messy PR is ok for now to fix the techdebt np.

Thanks so much for doing this :rocket:

pinkforest avatar Apr 19 '24 07:04 pinkforest

I updated the PR so the tests pass under latest stable Rust 1.85.0. It's ready for review.

mleonhard avatar Mar 09 '25 06:03 mleonhard

I used rustfmt to fix the formatting.

mleonhard avatar Mar 12 '25 19:03 mleonhard

Any news when it can land?

eirnym avatar Mar 24 '25 05:03 eirnym

Bump, +1, we really need c-literal support.

boozook avatar Mar 24 '25 10:03 boozook

@pinkforest Would you be interested in reviewing this PR, or is there another person I can ask?

mleonhard avatar Apr 06 '25 18:04 mleonhard

@pinkforest could you give any hints when new release will land with this fix?

eirnym avatar Apr 10 '25 09:04 eirnym

0.12 is out 🎉 thanks everyone

pinkforest avatar Apr 11 '25 01:04 pinkforest