Koka / gettext-rs

GNU Gettext FFI binding for Rust
51 stars 25 forks source link

The Git version of "gettext-rs" uses the "split_once" string method, which is only stable since Rust 1.52.0 #78

Closed marin-m closed 2 years ago

marin-m commented 2 years ago

The commit 1e88733 from pull request #70 introduced an use of the split_once string method, which is part of stable Rust only since version 1.52.0, released three months ago. Using rustc 1.51.0, compiling the library produces the following output:

$ cargo test --target x86_64-pc-windows-gnu --release
   Compiling gettext-rs v0.7.0 (/home/marin/gettext-rs/gettext-rs)
error[E0658]: use of unstable library feature 'str_split_once': newly added
 --> gettext-rs/src/macros.rs:8:18
  |
8 |     match msgstr.split_once(pat) {
  |                  ^^^^^^^^^^
  |
  = note: see issue #74773 <https://github.com/rust-lang/rust/issues/74773> for more information

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
error: could not compile `gettext-rs`

To learn more, run the command again with --verbose.

May this call be replaced with something similar before the next release of gettext-rs in order to increase the compatibility of the library?

Minoru commented 2 years ago

Good point; thanks! I think we should figure out the minimal Rust version that we supported prior to https://github.com/Koka/gettext-rs/commit/1e88733e54490a5ac5540c6f980294c3ba8fc89f, and fix the code to keep supporting that.

We should also establish an MSRV policy; I filed #82 about that.

Minoru commented 2 years ago

macros.rs was removed by #87, so this shouldn't be relevant anymore. MSRV discussion is in #82 and the new macros API is discussed in #86, so I'm closing this issue.