Skip to content

Remove Array::uninitialized() #804

Description

@bluss

It now has a replacement. See previous issue #685

If 0.14.0 comes quickly after 0.13.1, probably start with just deprecating the method

Activity

  1. added this to the 0.14.0 milestone on Apr 18, 2020
  2. bluss commented on Apr 19, 2020

    @bluss
    MemberAuthor

    Possibly put maybe_uninit in its place (rename it)

  3. bluss commented on Jan 25, 2021

    @bluss
    MemberAuthor

    uninitialized is hard to use correctly. I haven't removed it yet because I think I have managed to put it on sound ground - it is technically possible to use it correctly. See issue #804 and issue #876 (we have just completed removing all internal usage of this method).

    Unfortunately ArrayBase::uninitialized:

    1. Has some usage by actual users - it's a basically popular and easy to use (github code search confirms)
    2. This usage is from casual inspection almost always technically incorrect

    The conclusion is that deprecation will have impact on users, but we need to do it, and need to make maybe_uninit easy to use.

  4. xd009642 commented on Jan 25, 2021

    @xd009642
    Contributor

    Now I'm wondering how incorrect my usage in ndarray-vision is 😅

  5. bluss commented on Jan 25, 2021

    @bluss
    MemberAuthor

    Our uninitialized was added before stronger rules crystallized. It had been said (earlier) that let x = std::mem::uninitialized(); *(&mut x) = 1.0; would probably be correct when the type was copy - however that as also been judged as incorrect now eventually (creating a reference to uninit), so there are not many easy ways to use it left - short of using the raw views (partly why they were introduced). Yes, your code breaks this rule (as did ours before the next version - and a few versions back, Rust std was also sometimes breaking this rule).

  6. bluss commented on Jan 25, 2021

    @bluss
    MemberAuthor

    See also #796 (A lot of progress has been made on that issue).

  7. bluss commented on Mar 15, 2021

    @bluss
    MemberAuthor

    Deprecated by #902, so this issue is now fixed. But it will be finally removed in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions