Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std: Second-pass stabilization of mem/default #19902

Merged
merged 2 commits into from
Dec 17, 2014

Conversation

alexcrichton
Copy link
Member

This commit stabilizes the mem and default modules of std.

This commit takes a second pass through the `std::mem` module for stabilization.
The only remaining non-stable items in this module were `forget`, `transmute`,
`copy_lifetime`, and `copy_lifetime_mut`.

The `forget` and `transmute` intrinsics themselves were marked `#[stable]` to
propgate into the `core::mem` module so they would be marked stable.

The `copy_lifetime` functions were left `unstable`, but `Sized?` annotations
were added to the parameters to allow more general use with DSTs.

The `size_of_val`, `min_align_of_val`, and `align_of_val` functions would like
to grow `Sized?` bounds, but this is a backwards compatible change that
currently ICEs the compiler, so this change was not made at this time.

Finally, the module itself was declared `#![stable]` in this pass.
This commit performs a second pass stabilization of the `std::default` module.
The module was already marked `#[stable]`, and the inheritance of `#[stable]`
was removed since this attribute was applied. This commit adds the `#[stable]`
attribute to the trait definition and one method name, along with all
implementations found in the standard distribution.
@alexcrichton alexcrichton changed the title std: Second-pass stabilization of mem std: Second-pass stabilization of mem/default Dec 16, 2014
@alexcrichton
Copy link
Member Author

Threw in an easy commit for default as well.

@@ -1044,8 +1044,9 @@ impl<'a, T, Sized? U: AsSlice<T>> AsSlice<T> for &'a mut U {
fn as_slice<'a>(&'a self) -> &'a [T] { AsSlice::as_slice(*self) }
}

#[unstable = "waiting for DST"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seemed suspicious to me, @aturon do you remember why this was here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect there was some question whether Default should be implemented for [T] instead/as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that doesn't actually make sense, of course :-)

@aturon
Copy link
Member

aturon commented Dec 16, 2014

This looks fine to me. I think we've since come around to the utility of copy_lifetime (at least, I believe @nikomatsakis has argued for it), but we can always stabilize it later.

bors added a commit that referenced this pull request Dec 16, 2014
std: Second-pass stabilization of `mem`/`default`

Reviewed-by: aturon
bors referenced this pull request Dec 16, 2014
This creates an enormous amount of spew.
@nikomatsakis
Copy link
Contributor

I am a strong believer in something like copy_lifetime, though I'm not sure just what that ought to be. Virtually every single time I look at transmutes I have found bugs that would have been caught by copy_lifetime (not to mention code that is clarified).

@alexcrichton
Copy link
Member Author

It's certainly a pretty harmless function to stabilize, I figured for now we could let feedback drive whether we stabilize it because I saw very few usages in the standard distribution at least.

brson added a commit that referenced this pull request Dec 16, 2014
This commit stabilizes the `mem` and `default` modules of std.
bors added a commit that referenced this pull request Dec 17, 2014
std: Second-pass stabilization of `mem`/`default`

Reviewed-by: aturon
bors referenced this pull request Dec 17, 2014
Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the iterators of `VecMap` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Dec 17, 2014
This commit stabilizes the `mem` and `default` modules of std.
@bors bors merged commit 9021f61 into rust-lang:master Dec 17, 2014
@alexcrichton alexcrichton deleted the second-pass-mem branch December 17, 2014 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants