Lonami/grammers

locate_locale dependencies

tingfeng-key opened this issue · 5 comments

It will have warning prompt on Windows

warning: the following packages contain code that will be rejected by a future version of Rust: winapi v0.2.8
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 2`

Do we remove this dependency? I found out that grammers only use it on android, however the implementation of locate_locale on android is:

use std::env;

fn env(name: &str) -> String {
	if let Ok(loc) = env::var(name) {
		loc.split(".").next().unwrap().into()
	} else {
		String::new()
	}
}

pub fn system() -> String {
    env("LC_ALL")
}

pub fn user() -> String {
    env("LANG")
} 

grammers uses it on everything except Android (perhaps missed the not):

#[cfg(not(target_os = "android"))]

We could probably submit a PR to the crate in question to bump the winapi version, or pin ours.

I have submitted a pull request on locate-locale to resolve this issue (if the author of the repository can merge, the author's github activity has been unresponsive for a while

Seems your PR was merged but a release is yet to be made.

Yes, I received the notification yesterday, the author may be busy and forgot to post

Here's the future incompatibilities report it produced:

cargo report future-incompatibilities --id 162
The following warnings were discovered during the build. These warnings are an
indication that the packages contain code that will become an error in a
future release of Rust. These warnings typically cover changes to close
soundness problems, unintended or undocumented behavior, or critical problems
that cannot be fixed in a backwards-compatible fashion, and are not expected
to be in wide use.

Each warning should contain a link for more information on what the warning
means and how to resolve it.


To solve this problem, you can try the following approaches:


- Some affected dependencies have newer versions available.
You may want to consider updating them to a newer version to see if the issue has been fixed.

winapi v0.2.8 has the following newer versions available: 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8, 0.3.9


- If the issue is not solved by updating the dependencies, a fix has to be
implemented by those dependencies. You can help with that by notifying the
maintainers of this problem (e.g. by creating a bug report) or by proposing a
fix to the maintainers (e.g. by creating a pull request):

  - winapi@0.2.8
  - Repository: https://github.com/retep998/winapi-rs
  - Detailed warning command: `cargo report future-incompatibilities --id 162 --package winapi@0.2.8`

- If waiting for an upstream fix is not an option, you can use the `[patch]`
section in `Cargo.toml` to use your own version of the dependency. For more
information, see:
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section

The package `winapi v0.2.8` currently triggers the following future incompatibility lints:
> warning: `Debug` can't be derived on this `#[repr(packed)]` struct that does not derive `Copy`
>    --> C:\Users\L\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.2.8\src\macros.rs:263:29
>     |
> 263 |           #[repr(C)] #[derive(Debug)] $(#[$attrs])*
>     |                               ^^^^^
>     |
>    ::: C:\Users\L\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.2.8\src\mmreg.rs:290:1
>     |
> 290 | / STRUCT!{#[repr(packed)] struct WAVEFORMATEX {
> 291 | |     wFormatTag: ::WORD,
> 292 | |     nChannels: ::WORD,
> 293 | |     nSamplesPerSec: ::DWORD,
> ...   |
> 297 | |     cbSize: ::WORD,
> 298 | | }}
>     | |__- in this macro invocation
>     |
>     = note: `#[allow(unaligned_references)]` on by default
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
>     = note: this warning originates in the derive macro `Debug` which comes from the expansion of the macro `STRUCT` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: `Debug` can't be derived on this `#[repr(packed)]` struct that does not derive `Copy`
>    --> C:\Users\L\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.2.8\src\macros.rs:263:29
>     |
> 263 |           #[repr(C)] #[derive(Debug)] $(#[$attrs])*
>     |                               ^^^^^
>     |
>    ::: C:\Users\L\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.2.8\src\mmreg.rs:299:1
>     |
> 299 | / STRUCT!{#[repr(packed)] struct WAVEFORMATEXTENSIBLE {
> 300 | |     Format: ::WAVEFORMATEX,
> 301 | |     Samples: ::WORD,
> 302 | |     dwChannelMask: ::DWORD,
> 303 | |     SubFormat: ::GUID,
> 304 | | }}
>     | |__- in this macro invocation
>     |
>     = note: `#[allow(unaligned_references)]` on by default
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
>     = note: this warning originates in the derive macro `Debug` which comes from the expansion of the macro `STRUCT` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: `Debug` can't be derived on this `#[repr(packed)]` struct that does not derive `Copy`
>    --> C:\Users\L\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.2.8\src\macros.rs:263:29
>     |
> 263 |           #[repr(C)] #[derive(Debug)] $(#[$attrs])*
>     |                               ^^^^^
>     |
>    ::: C:\Users\L\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.2.8\src\usbspec.rs:26:1
>     |
> 26  | / STRUCT!{#[repr(packed)] struct USB_CONFIGURATION_DESCRIPTOR {
> 27  | |     bLength: ::UCHAR,
> 28  | |     bDescriptorType: ::UCHAR,
> 29  | |     wTotalLength: ::USHORT,
> ...   |
> 34  | |     MaxPower: ::UCHAR,
> 35  | | }}
>     | |__- in this macro invocation
>     |
>     = note: `#[allow(unaligned_references)]` on by default
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
>     = note: this warning originates in the derive macro `Debug` which comes from the expansion of the macro `STRUCT` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> warning: `Debug` can't be derived on this `#[repr(packed)]` struct that does not derive `Copy`
>    --> C:\Users\L\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.2.8\src\macros.rs:263:29
>     |
> 263 |           #[repr(C)] #[derive(Debug)] $(#[$attrs])*
>     |                               ^^^^^
>     |
>    ::: C:\Users\L\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.2.8\src\winusb.rs:8:1
>     |
> 8   | / STRUCT!{#[repr(packed)] struct WINUSB_SETUP_PACKET {
> 9   | |     RequestType: ::UCHAR,
> 10  | |     Request: ::UCHAR,
> 11  | |     Value: ::USHORT,
> 12  | |     Index: ::USHORT,
> 13  | |     Length: ::USHORT,
> 14  | | }}
>     | |__- in this macro invocation
>     |
>     = note: `#[allow(unaligned_references)]` on by default
>     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>     = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
>     = note: this warning originates in the derive macro `Debug` which comes from the expansion of the macro `STRUCT` (in Nightly builds, run with -Z macro-backtrace for more info)
>