Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Custom name in [lib] in Cargo.toml causes cargo-semver-checks to be unable to find rustdoc json #432

Closed
Phantomical opened this issue Apr 20, 2023 · 4 comments · Fixed by #433
Labels
C-bug Category: doesn't meet expectations

Comments

@Phantomical
Copy link

Steps to reproduce the bug with the above code

This isn't quite a minimal example but it should be reproducible enough.

git clone https://github.com/phantomical/perf-event
cd perf-event
git checkout 47dc882dbfb44b86584540a6e4f2815caaf72c10
sed -i -e 's/version = "5.0.0"/version = "5.0.1"/' perf-event-open-sys/Cargo.toml
cargo semver-checks check-release -p perf-event-open-sys2

Actual Behaviour

cargo-semver-checks exits with the following error:

Error: Could not find expected rustdoc output for `perf-event-open-sys2`: /home/swlynch/projects/tmp/perf-event/target/semver-checks/local-perf_event_open_sys2-5_0_1/target/semver-checks/target/doc/perf_event_open_sys2.json

Expected Behaviour

It should run and check the code as expected.

Generated System Information

Software version

cargo-semver-checks 0.19.0

Operating system

Linux 5.10.0-19-amd64

Command-line

/home/swlynch/.cargo/bin/cargo-semver-checks semver-checks --bugreport 

cargo version

> cargo -V 
cargo 1.70.0-nightly (0e474cfd7 2023-03-31)

Compile time information

  • Profile: release
  • Target triple: x86_64-unknown-linux-gnu
  • Family: unix
  • OS: linux
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-unknown-linux-gnu

Build Configuration

No response

Additional Context

Putting

[lib]
name = "perf_event_open_sys"

in Cargo.toml causes the emitted json file to be called perf_event_open_sys.json instead of the perf_event_open_sys2.json that cargo-semver-checks is expecting.

@Phantomical Phantomical added the C-bug Category: doesn't meet expectations label Apr 20, 2023
@obi1kenobi
Copy link
Owner

Thanks for the report, and sorry for the inconvenience!

Something quite interesting is going on here, because we've seen this issue before and we've added a test case specifically for it: https://github.com/obi1kenobi/cargo-semver-checks/blob/main/test_rustdoc/renamed_lib/Cargo.toml

I'll have a look shortly.

@obi1kenobi
Copy link
Owner

I think I've gotten to the bottom of the problem and I have a prototype of the fix that should eliminate problems like this once and for all. Thanks to the kind folks who work on rustdoc, I have a way to replace the hit-or-miss heuristic we were using to find the rustdoc JSON file with something much better.

The fix will be in the next release at the beginning of next week, together with the massive overall speedup of the tool I wrote about a few months ago: https://predr.ag/blog/speeding-up-rust-semver-checking-by-over-2000x/

If you need it more urgently than that, I can try (though unfortunately not commit to) to make a patch release tomorrow morning as well. Let me know!

@Phantomical
Copy link
Author

That's awesome! Thank you! No rush on the release. It's not that urgent for me and ultimately I can still make it work for now by manually renaming the files :)

@obi1kenobi
Copy link
Owner

This was a bit of a marathon issue, but now it's sorted out and the project is better off for it :)

Thanks again for the bug report and quality repro!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: doesn't meet expectations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants