Skip to content

Conversation

@marvin-hansen
Copy link
Contributor

@marvin-hansen marvin-hansen commented Mar 16, 2025

This PR resolves issue #562

For once, the affected Build file has been updated to use the vendored Tokio crate alias without a version number
so in case the vendoring script ever downloads a different version the build should still succeed as long as the newer
crate version remains API compatible.

Then, the root cause has been eliminated by pinning the crate dependency to an exact version so that
Bazel should download exactly the pinned version.

The issue was caused by a very unlucky version convention in crate.spec in which

'version = "1.43.0",'

does not actually pin the version. Instead, it sets a lower version bound akin to "no lower than this version",
which causes all sorts of problems. Instead, the correct form to pin a crate version is to use an equal sign prefix:

'version = "=1.43.0",

Complicating things further, the vendor script generates two aliases, one with a version and one without a version for each vendored crate.

As none of this is obvious let alone intuitive, I have updated the Readme to explain the intricate details
of the rules_rust vendoring behavior so that the reader can make an informed decision about vendoring, version pining,
and aliasing.

Housekeeping:
Bumped up Bazel version to latest 8.1.1 for all Rust examples via the .bazelversion file.

…#562

Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Copy link
Member

@meteorcloudy meteorcloudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@meteorcloudy meteorcloudy merged commit 568db75 into bazelbuild:main Mar 17, 2025
2 checks passed
@meteorcloudy
Copy link
Member

I guess we could revert #559

@sgowroji

@marvin-hansen marvin-hansen deleted the fix-562 branch March 17, 2025 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants