shssoichiro / sqlformat-rs

SQL Formatter written in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

0.1.4 -> 0.1.5 breaking change

skeet70 opened this issue · comments

We depend on an downstream package (sqlx), which depends on you with 0.1.0 in their Cargo.toml. The patch update of this package from 0.1.4 -> 0.1.5 broke our builds pinned to sqlx 0.3.5 because of a rustc 1.45.0 feature used.

error[E0658]: use of unstable library feature 'str_strip': newly added
   --> ~/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlformat-0.1.5/src/tokenizer.rs:304:49
    |
304 |                 key: if let Some(value) = token.strip_prefix('$') {
    |                                                 ^^^^^^^^^^^^
    |
    = note: see issue #67302 <https://github.com/rust-lang/rust/issues/67302> for more information

Pinning to a specific stable (minor) version in your CI is a good way to catch this kind of thing and know that you need a major (rust minor) version bump to not break things downstream (or when to drop back to an old way of doing it when you accidentally use a newer feature).

This is still a debated topic in the Rust community--should a minor version of a library be guaranteed to not break compatibility with old Rust versions? Unfortunately there's no consensus. So, I'm also undecided as to the severity of this particular compatibility break. sqlformat 0.1.5 was published 3 months ago and this is the first I've seen of this issue. May I ask if there's a particular reason you're pinned to a Rust version older than 1.45?

We're not pinned, but trying to binary reproduce a build from months ago. I wasn't aware of a debate around patch versions not breaking Rust compatibility, I guess I should look into that! I can submit a PR to your CI that would catch this if you're undecided on the severity, it's not a large fix to prevent the problem.

If 0.1.0 worked on older Rustc versions then it probably makes sense to pin to that. I'm sure there's some alternative to this code that works on older rust, so I'll put in a fix and publish a 0.1.6.