Skip to content

Deprecation of GenericArray in v0.14.8 causes big problem with aes create (and probably others) #158

Closed as not planned

Description

@lordmulder

The problem is that current latest version of aes requires generic-array v0.x and can not use version v1.x.

So we are forced to stick with generic-array v0.x, which is also re-exported from current latest cipher::generic-array.

But this will now suddenly trigger a deprecation warning!

For everybody following the general recommendation to build with -Dwarnings this will cause the build to fail 😥

See also:
RustCrypto/block-ciphers#509 (comment)

Regards.

Activity

  1. changed the title [-]Depreaction of `GenericArray` in v0.14.7 causes big problem with `aes` create (and probably others)[/-] [+]Depreaction of `GenericArray` in v0.14.8 causes big problem with `aes` create (and probably others)[/+] on Oct 13, 2025
  2. novacrazy commented on Oct 13, 2025

    @novacrazy
    Collaborator

    This is intended. 1.x has been available for two years now. 0.14 is indeed deprecated.

    Edit: See #158 (comment) for more info on this decision.

  3. newpavlov commented on Oct 13, 2025

    @newpavlov
    Contributor

    I believe this creates unnecessary friction for downstream users (same as yanking old versions, which was infamously done by the ring crate). Use of outdated crates can be found using separate tools (e.g. cargo outdated or deps.rs badges). Annoying users with unconditional deprecation warnings is a bad way to force updates which may be buried deep in their dependency tree.

    In RustCrypto we migrated from generic-array to hybrid-array, but haven't released new versions yet (not counting pre-releases), so users have no options but to continue to rely on generic-array v0.14 in the near future.

  4. bugadani commented on Oct 13, 2025

    @bugadani
  5. maxdexh commented on Oct 13, 2025

    @maxdexh

    Besides being rather rude to a number of users, the deprecation warning is actually a semver-breaking change:

    1. Minor version Y (x.Y.z | x > 0) MUST be incremented if new, backward compatible functionality is introduced to the public API. It MUST be incremented if any public API functionality is marked as deprecated.

    Your quote specifically includes x > 0 as a requirement for needing to bump Y in x.Y.z. In 0.x.Y, the last number is the minor release number, not the patch number. So this was fully semver compliant.

    Edit: Just to note, this is not a statement of whether I agree with the change, I personally would probably not have made this change, because of the linter's lack of configurability over deprecation warnings. Sadly there is no better option for library authors at the moment.

  6. maxdexh commented on Oct 13, 2025

    @maxdexh

    As a suggestion, maybe add a feature flag to disable the deprecation warnings?

  7. lordmulder commented on Oct 13, 2025

    @lordmulder
    Author

    The problem is, when there is a deprecation warning, then there should be a proper alternative that we can actually use to get rid of the deprecation warning and still achieve what we used to be able to achieve.

    Unfortunately, using the latest version of GenericArray v0.x gives a deprecation warning, but it is not possible to resolve this by using GenericArray v1.x instead, because essential crates, like aes (latest stable version!) can not work with it:

    error[E0308]: mismatched types
        |
     40 |     let cipher = Aes256::new(GenericArray::from_slice(&full_key));
        |                  ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&GenericArray<u8, UInt<..., ...>>`, found `&GenericArray<u8, _>`
        |                  |
        |                  arguments to this function are incorrect
        |
    note: two different versions of crate `generic_array` are being used; two types coming from two different versions of the same crate are different types even if they look the same
       --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\generic-array-1.3.3\src\lib.rs:470:1
    

    Pinning generic_array to version 0.14.7 in my Cargo.toml of my lib also is not a good idea, because the "main" application may also be using generic_array but would likely use the latest version (i.e. 0.14.8) which gives version requirement conflict!


    Also, please be aware that cipher::generic_array (in the latest stable version of cipher) re-exports the now deprecated GenericArray v0.x, probably giving this deprecation warning to everybody using cipher right now.


    As a suggestion, maybe add a feature flag to disable the deprecation warnings?

    IMHO, that sounds like overengineering.

    Please just let generic_array v0.x and v1.x exist "side-by-side". Only use deprecation for things that are deprecated within each branch (major version) and that actually can be "fixed" within the respective branch (major version).

    I think that would be the "semver" way of doing things.

    TTBOMK, users should never be forced to "upgrade" to a new major version of a library in order to resolve a deprecation warning. That is because, in "semver", different major versions of a library are essential totally different (non-compatible) libraries – and there may be good reason why you can't simply switch to a different library. It could break other things 😨

    Regards.

  8. Turbo87 commented on Oct 13, 2025

    @Turbo87

    but it is not possible to resolve this by using GenericArray v1.x instead, because essential crates, like aes (latest stable version!) can not work with it

    FWIW that is not a problem of this crate, but a problem of the aes crate which is still using the old version. I don't think we should blame the generic-array maintainers for that 😉

  9. lordmulder commented on Oct 13, 2025

    @lordmulder
    Author

    but it is not possible to resolve this by using GenericArray v1.x instead, because essential crates, like aes (latest stable version!) can not work with it

    FWIW that is not a problem of this crate, but a problem of the aes crate which is still using the old version. I don't think we should blame the generic-array maintainers for that 😉

    IMO, the whole point (or at least an important point) of "semver" is that you don't break things in retrospective.

    At the time when aes was created, generic_array v0.x was the "proper" thing to be used. And now you should not break that existing library, in retrospective, by suddenly changing the dependency in an incompatible way. For as long as existing libraries use generic_array v0.x, they are free to do so and that is perfectly fine. These libraries should not get a deprecation warning - unless there is a better replacement for the deprecated function or type within the v0.x branch of generic_array.

    Maye, at some time in the future, there will be a new major version of aes that uses generic_array v1.x. But even then, you can not expect everybody to "upgrade" to that new major version of aes immediately. Users may have a good reason to stick with the previous version major version of aes, which means they will still depend on generic_array v0.x. And rightfully so.

    I think depreaction should exclusively be used to mark functions and types for which there is a better alternative already available in the currently used version of the library. It should not be used to force people to upgrade to a new major version of the library, which (in "semver") is essentially a totally different library and therefore is expected to break all sorts of things...

    Regards.

  10. Turbo87 commented on Oct 13, 2025

    @Turbo87

    I agree on your definition of semver, but this library has not broken anything. A deprecation warning is a warning, not an error, and does not prevent you from compiling the library. If you use -D warnings to turn warnings into hard errors then that breakage is not caused by the library.

    That said, since the compiler can only be configured to warn or error for deprecations in general, but not for specific deprecations, this change is still causing quite a bit of friction, since there is not much the end-user can do about it.

    Then again, I can understand that the library author wants to nudge people into using a supported version of this crate. Especially since this crate is used in a lot of cryptographic libraries, it seems a bit unfortunate that they all still depend on the old, unsupported library version.

  11. novacrazy commented on Oct 13, 2025

    @novacrazy
    Collaborator

    If there were a more gentle approach that actually worked, I’d consider it, but RustCrypto in particular was one of the first to be aware of 1.0, personally. There were conversations on reddit and Discord over two years ago (some of which are lost now thanks to restructuring) when I was looking for feedback on the 1.0 PR, that dismissed 1.0 saying “hybrid-array” was almost complete even at the time and they’d not bother with anything else.

    There have been no improvements to 0.14 in over two years, and a massive player in the ecosystem has prevented almost all users from enjoying 1.x.

  12. newpavlov commented on Oct 13, 2025

    @newpavlov
    Contributor

    In RustCrypto we finished migration to hybrid-array more than a year ago, the crate releases got delayed for a number of reasons, but even if they were already released, users would still not "enjoy" generic-array v1.0, since they would use hybrid-array instead. I really doubt that RustCrypto crates somehow inhibit adoption rate of generic-array v1.0 in practice.

    Harassing users with the deprecation warning serves little to no purpose and will not result in any additional adoption from the RustCrypto side. If anything, such behavior only made me glad that we made the decision to drop the generic-array dependency from our crates.

    Keeping dependencies up-to-date in downstream crates is responsibility of the downstream crates, not of their upstream dependencies.

  13. lordmulder commented on Oct 13, 2025

    @lordmulder
    Author

    Then again, I can understand that the library author wants to nudge people into using a supported version of this crate. Especially since this crate is used in a lot of cryptographic libraries, it seems a bit unfortunate that they all still depend on the old, unsupported library version.

    But I think deprecation is simply the wrong tool here.

    If a function or type is deprecated in a certain version of the library, then there shall be a proper alternative/replacement in that same version of the library. Arbitrarily deprecating a type, just to "force" users into upgrading the library to a new major version, is not the purpose of deprecation (and is outright annoying) – especially if that type still exists, as non-depracated in, the new version!

    If the library as a whole is "end of life", then I think this should be a separate meta information.

  14. newpavlov commented on Oct 13, 2025

    @newpavlov
    Contributor

    If the library as a whole is "end of life", then I think this should be a separate meta information.

    RustSec could be used for such deprecated/unmaintained warnings. For example: https://rustsec.org/advisories/RUSTSEC-2016-0005.html Though I think previously mentioned cargo outdated and deps.rs are quite sufficient to notify maintainers about outdated dependencies.

  15. 3 remaining items

  16. Turbo87 commented on Oct 14, 2025

    @Turbo87

    That said, since the compiler can only be configured to warn or error for deprecations in general, but not for specific deprecations

    turns out I was wrong... 😅

    the openmls folks figured out that you can just slap #[allow(deprecated)] on all places where .as_slice() is used (see https://github.com/openmls/openmls/pull/1858/files). I would personally recommend #[expect(deprecated)] though, so that you'll know once you can remove the attribute again.

  17. changed the title [-]Depreaction of `GenericArray` in v0.14.8 causes big problem with `aes` create (and probably others)[/-] [+]Deprecation of `GenericArray` in v0.14.8 causes big problem with `aes` create (and probably others)[/+] on Oct 16, 2025
  18. novacrazy commented on Oct 16, 2025

    @novacrazy
    Collaborator

    It's been a few days and I've had more time to think about this.

    I accept a portion of responsibility for the slow adoption of generic-array 1.x, primarily due to the high MSRV that was in place until recently. I only learned about the rustversion crate a couple weeks ago, which has allowed me to reduce the MSRV back down to 1.65.0.

    However, regarding the statement here #158 (comment):

    Keeping dependencies up-to-date in downstream crates is responsibility of the downstream crates, not of their upstream dependencies.

    I have a vastly different opinion on this, and it's why I felt this was necessary. An ecosystem where maintainers take no responsibility for the downstream impact of their dependencies or changes leads to package rot, subtle bugs, and accumulating technical debt. My experience with cargo outdated reinforces this, especially on large workspaces, where there can be dozens of outdated crates that I simply can't do anything about. I've also seen both mine and others' PRs to upgrade deps remain inactive/ignored for years.

    If we strictly follow the principle of downstream responsibility, then the onus falls on the RustCrypto project to migrate from the deprecated generic-array 0.14.

    Now, moving forward, I should have done this years ago with 1.0, but I've introduced the compat-0_14 crate feature to help users move away from generic-array 0.14 on their own, rather than being forced to use an unsupported, legacy version due to upstream dependencies. I've also written a quick migration guide to 1.x in the README and crate docs. It's easy.

    Furthermore, I've gone ahead and added a hybrid-array-0_4 crate feature to easily interop between generic-array 1.x and hybrid-array 0.4, for when RustCrypto does eventually release new versions, it'll open up more options for users.

  19. lordmulder commented on Oct 17, 2025

    @lordmulder
    Author
  20. novacrazy commented on Oct 17, 2025

    @novacrazy
    Collaborator

    @lordmulder #158 (comment)

    GenericArray version 1.3.4 with feature compat-0_14 doesn't seem to work for me

    As stated in the migration guide in the README:

    use the to_0_14/from_0_14/as_0_14/as_0_14_mut methods on GenericArray to convert between versions, or use the From/AsRef/AsMut implementations.

    So Aes256::new(GenericArray::from_slice(&full_key).as_ref()) should work. If it doesn't, please open a new issue.

  21. lordmulder commented on Oct 17, 2025

    @lordmulder
    Author

    So Aes256::new(GenericArray::from_slice(&full_key).as_ref()) should work. If it doesn't, please open a new issue.

    This seems to work 👍

  22. MightyPork commented on Oct 31, 2025

    @MightyPork

    I solved this by adding generic-array = "=0.14.7" to my Cargo.toml. I'm not proud of it but unfortunately it's the only way I found to suppress the warning spam when using rust-crypto aes which has had a fixed version in RC for many months but is still not released as stable. Please correct me if there is a better way. It gets the job done though.

    Adding warnings like this makes me overlook real problems in the project for no good reason. I think this way of soft-breaking old versions is irresponsible towards end users who rely on the library transitively.

  23. Turbo87 commented on Oct 31, 2025

    @Turbo87

    Please correct me if there is a better way.

    @MightyPork see #158 (comment)

  24. fjarri commented on Nov 4, 2025

    @fjarri
    Contributor

    I want to chime in and say that publishing a 0.14.x version with everything deprecated was an extremely bad tone. I've never seen any crate doing this, and I hope I never will. Many libraries still depend on 0.14.x, and now I'm hit with these warnings I have no way of resolving besides pinning the version to 0.14.7. There are tools to detect crates that can be updated, don't do their job - major version bump is indication enough.

  25. added a commit that references this issue on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions