Skip to content

Rename LayoutErr to LayoutError #73

@exrook

Description

@exrook

We should rename LayoutErr to LayoutError in core::alloc. See prior discussion here: #57 (comment)

Since LayoutErr is stable, we can provide a type alias

pub type LayoutErr = LayoutError

I've implemented this change here, rust-lang/rust@master...exrook:rename-layouterr. Some things that are still unclear to me are:

  1. Should LayoutErr be deprecated
  2. Should LayoutError be behind a feature flag at first

If LayoutErr is deprecated or marked for deprecation in a later version, it can no longer be used in std because of #[deny(deprecated,deprecated_in_future)] being in effect. I don't think it makes sense to have LayoutError replace LayoutErr in std, but then be behind a feature flag, only usable on nightly. This is mainly a usability issue because crates can of course continue to use LayoutErr despite the stdlib rustdocs showing LayoutError.

Option 1

Is it possible to make LayoutError immediately stable, then deprecate LayoutErr in the same or a later release? The following would then be possible:

#[stable(feature = "alloc_layout", since = "1.28.0")]
#[rustc_deprecated(since = "1.48.0", reason = "use LayoutError instead", suggestion = "LayoutError")]
pub type LayoutErr = LayoutError;

#[stable(feature = "alloc_layout_error", since = "1.48.0")]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct LayoutError {
    private: (),
}

Option 2

I think this would make more sense than trying to do a staged approach of adding LayoutError as unstable, then marking it stable, then deprecating the LayoutErr type alias.

Stage 1 - release 1.N

#[stable(feature = "alloc_layout", since = "1.28.0")]
pub type LayoutErr = LayoutError;

#[unstable(feature = "alloc_layout_error", issue = "32838")]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct LayoutError {
    private: (),
}

Stage 2 - release 1.N+1

#[stable(feature = "alloc_layout", since = "1.28.0")]
pub type LayoutErr = LayoutError;

#[stable(feature = "alloc_layout_error", since = "1.49.0")]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct LayoutError {
    private: (),
}

Stage 3 - release 1.N+2

#[stable(feature = "alloc_layout", since = "1.28.0")]
#[rustc_deprecated(since = "1.51.0", reason = "use LayoutError instead", suggestion = "LayoutError")]
pub type LayoutErr = LayoutError;

#[stable(feature = "alloc_layout_error", since = "1.49.0")]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct LayoutError {
    private: (),
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions