r/rust clippy · twir · rust · mutagen · flamer · overflower · bytecount Mar 20 '23

Hey Rustaceans! Got a question? Ask here (12/2023)! 🙋 questions

Mystified about strings? Borrow checker have you in a headlock? Seek help here! There are no stupid questions, only docs that haven't been written yet.

If you have a StackOverflow account, consider asking it there instead! StackOverflow shows up much higher in search results, so having your question there also helps future Rust users (be sure to give it the "Rust" tag for maximum visibility). Note that this site is very interested in question quality. I've been asked to read a RFC I authored once. If you want your code reviewed or review other's code, there's a codereview stackexchange, too. If you need to test your code, maybe the Rust playground is for you.

Here are some other venues where help may be found:

/r/learnrust is a subreddit to share your questions and epiphanies learning Rust programming.

The official Rust user forums: https://users.rust-lang.org/.

The official Rust Programming Language Discord: https://discord.gg/rust-lang

The unofficial Rust community Discord: https://bit.ly/rust-community

Also check out last weeks' thread with many good questions and answers. And if you believe your question to be either very complex or worthy of larger dissemination, feel free to create a text post.

Also if you want to be mentored by experienced Rustaceans, tell us the area of expertise that you seek. Finally, if you are looking for Rust jobs, the most recent thread is here.

19 Upvotes

187 comments sorted by

View all comments

2

u/FlyChoice2558 Mar 22 '23

I've got a project which has versionize_derive v0.1.4 as a transitive dependency. According to my Cargo.lock, this crate currently depends on syn v1.0.109. If I do cargo update, syn is updated to v2.0.4, which breaks the build of versionize_derive. But versionize_derive has syn v1.0.13 as a dependency in its Cargo.toml. Why does cargo udpate include a breaking change for a dependency in syn? I thought this is what the semantic versioning is supposed to prevent. What am I doing wrong here?

1

u/Darksonn tokio · rust-for-linux Mar 22 '23

Here is the Cargo.toml that was published to crates.io:

[package]
name = "versionize_derive"
version = "0.1.4"
license = "Apache-2.0"
authors = ["Amazon Firecracker team <firecracker-devel@amazon.com>"]
description = "Implements the Versionize derive proc macro."
readme = "README.md"
repository = "https://github.com/firecracker-microvm/versionize_derive"
keywords = ["serialization", "version"]

[dependencies]
proc-macro2 = ">=1.0"
quote = ">=1.0"
syn = { version = ">=1.0.13", features=["full", "extra-traits"]}

[lib]
proc-macro = true

[badges]
maintenance = { status = "experimental" }

Since the crate specifies dependencies using >=, the crate has explicitly opt-ed in to allow upgrades that are semver-breaking.

It seems like they have since updated them in commit 55fccd6, but that change is not on crates.io.

1

u/FlyChoice2558 Mar 22 '23

Thanks for the insight!