Final pre-alpha stabilization of: iter, ops, slice, collections #20560

Closed
wants to merge 5 commits into
from

Conversation

Projects
None yet
5 participants
@aturon
Member

aturon commented Jan 5, 2015

Now that various language features have been rolled out and RFCs implemented, this PR takes a final stabilization pass over iter, ops, slice and collections.

Commit summaries copied below:

Final alpha stabilization of core::iter

This commit wraps up the adjustments to the iterator for recent language
changes.

  • Moves rposition from ExactSizeIterator to IteratorExt using a
    where clause, thereby removing the ExactSizeIterator: DoubleEndedIterator constraint.
  • Merges MutableDoubleEndedIterator into IteratorExt, renaming
    reverse_ to reverse_in_place.
  • Merges IteratorOrdExt, IteratorCloneExt and CloneIteratorExt
    into IteratorExt using where clauses.

Marks as #[stable]:

  • the iter module itself
  • FromIterator, Extend
  • Iterator, IteratorExt
  • map
  • filter
  • filter_map
  • skip_while
  • take_while
  • scan
  • flat_map
  • inspect
  • collect
  • fold
  • all
  • any
  • find
  • rposition
  • max, min
  • Various adapter types related to the above methods

Because of the trait merging, this is a:

[breaking-change]

Stabilize core::ops

This commit marks as stable those parts of core::ops that are in their
final planned form: Drop, all of the mathematical operators (Add,
Sub, etc), Deref/DerefMut. It leaves the Index*, Slice* and
Fn* traits unstable, as they are still undergoing active changes.

Final alpha stabilization of std::slice

Marks as #[stable]:

  • Various iterator structs for stable methods, e.g. Chunks and
    Windows.
  • The SliceExt trait itself.

Stabilize collection modules

The earlier collections stabilization did not cover the modules
themselves. This commit marks as stable those modules whose types have
been stabilized.

Stabilization of impls and fallout from stabilization

Stabilizes impls of now-stable traits.

@rust-highfive

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive Jan 5, 2015

Collaborator

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)

Collaborator

rust-highfive commented Jan 5, 2015

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)

@aturon

This comment has been minimized.

Show comment
Hide comment
Member

aturon commented Jan 5, 2015

@aturon

This comment has been minimized.

Show comment
Hide comment
@aturon

aturon Jan 5, 2015

Member

(We should probably wait to land this until we've had a chance to discuss Iterator again.)

Member

aturon commented Jan 5, 2015

(We should probably wait to land this until we've had a chance to discuss Iterator again.)

@@ -418,7 +418,7 @@ impl<T: Sync + Send> Clone for Weak<T> {
}
#[unsafe_destructor]
-#[experimental = "Weak pointers may not belong in this module."]
+#[stable]

This comment has been minimized.

@Gankro

Gankro Jan 5, 2015

Contributor

Any notes on this call?

@Gankro

Gankro Jan 5, 2015

Contributor

Any notes on this call?

This comment has been minimized.

@aturon

aturon Jan 5, 2015

Member

Don't read anything into the #[stable] here other than: if we have Weak, we'll keep the Drop impl.

@aturon

aturon Jan 5, 2015

Member

Don't read anything into the #[stable] here other than: if we have Weak, we'll keep the Drop impl.

src/libstd/collections/hash/map.rs
@@ -10,6 +10,8 @@
//
// ignore-lexer-test FIXME #15883
+#![stable]

This comment has been minimized.

@Gankro

Gankro Jan 5, 2015

Contributor

This is a bit odd, since these modules aren't actually publicly visible?

@Gankro

Gankro Jan 5, 2015

Contributor

This is a bit odd, since these modules aren't actually publicly visible?

This comment has been minimized.

@aturon

aturon Jan 5, 2015

Member

They're re-exported.

@aturon

aturon Jan 5, 2015

Member

They're re-exported.

This comment has been minimized.

@Gankro

Gankro Jan 5, 2015

Contributor

Well, we create a new module and pub use * in them, I'm not sure if that counts? e.g: https://github.com/rust-lang/rust/blob/master/src/libcollections/lib.rs#L77

@Gankro

Gankro Jan 5, 2015

Contributor

Well, we create a new module and pub use * in them, I'm not sure if that counts? e.g: https://github.com/rust-lang/rust/blob/master/src/libcollections/lib.rs#L77

@@ -309,7 +309,7 @@
//! }
//! ```
-#![experimental]
+#![stable]

This comment has been minimized.

@Gankro

Gankro Jan 5, 2015

Contributor

Should we not be marking some of the facade modules made in this file (and/or libcollections/lib.rs) as #stable?

@Gankro

Gankro Jan 5, 2015

Contributor

Should we not be marking some of the facade modules made in this file (and/or libcollections/lib.rs) as #stable?

This comment has been minimized.

@aturon

aturon Jan 5, 2015

Member

Ooops, you're right, the pub use self::hash_map::HashMap threw me off here. This PR does include stabilizations of the facades in libcollections/lib.rs, though.

@aturon

aturon Jan 5, 2015

Member

Ooops, you're right, the pub use self::hash_map::HashMap threw me off here. This PR does include stabilizations of the facades in libcollections/lib.rs, though.

@aturon

This comment has been minimized.

Show comment
Hide comment
@aturon

aturon Jan 5, 2015

Member

@Gankro pushed a revision marking the correct hash_map modules. I think the markers within libcollections were already OK. Double-check my work?

Member

aturon commented Jan 5, 2015

@Gankro pushed a revision marking the correct hash_map modules. I think the markers within libcollections were already OK. Double-check my work?

@aturon aturon referenced this pull request Jan 5, 2015

Closed

Stabilization metabug: 1.0-alpha #19260

140 of 142 tasks complete
fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
}
/// Conversion from an `Iterator`
-#[unstable = "may be replaced by a more general conversion trait"]
+#[stable]
pub trait FromIterator<A> {
/// Build a container with elements from an external iterator.
fn from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
}

This comment has been minimized.

@alexcrichton

alexcrichton Jan 5, 2015

Member

This seems slightly odd to still have a type parameter now that Item is an associated type, but I suppose T: Iterator doesn't tell you much and you need to write down the Item type somewhere.

Just confirming.

@alexcrichton

alexcrichton Jan 5, 2015

Member

This seems slightly odd to still have a type parameter now that Item is an associated type, but I suppose T: Iterator doesn't tell you much and you need to write down the Item type somewhere.

Just confirming.

This comment has been minimized.

@aturon

aturon Jan 5, 2015

Member

This is desired to allow types to be created (or extended) via iterators from multiple items. For example, String can be extended by char or &str iterators.

@aturon

aturon Jan 5, 2015

Member

This is desired to allow types to be created (or extended) via iterators from multiple items. For example, String can be extended by char or &str iterators.

+ /// If no element matches, None is returned.
+ #[inline]
+ #[stable]
+ fn rposition<P>(&mut self, mut predicate: P) -> Option<uint> where

This comment has been minimized.

@alexcrichton

alexcrichton Jan 5, 2015

Member

I'm personally not a huge fan of the where-by-itself (I like the next line), but oh well!

@alexcrichton

alexcrichton Jan 5, 2015

Member

I'm personally not a huge fan of the where-by-itself (I like the next line), but oh well!

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Jan 5, 2015

Member

This looks great to me, this is all really falling into place!

Member

alexcrichton commented Jan 5, 2015

This looks great to me, this is all really falling into place!

@Gankro

This comment has been minimized.

Show comment
Hide comment
@Gankro

Gankro Jan 5, 2015

Contributor

Also should we explicitly mark the other modules as unstable with a reason?

Contributor

Gankro commented Jan 5, 2015

Also should we explicitly mark the other modules as unstable with a reason?

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Jan 5, 2015

Member

This should also add #![stable] to the slice module itself.

Member

alexcrichton commented Jan 5, 2015

This should also add #![stable] to the slice module itself.

aturon added some commits Jan 4, 2015

Final alpha stabilization of core::iter
This commit wraps up the adjustments to the iterator for recent language
changes.

* Moves `rposition` from `ExactSizeIterator` to `IteratorExt` using a
  `where` clause, thereby removing the `ExactSizeIterator:
  DoubleEndedIterator` constraint.

* Merges `MutableDoubleEndedIterator` into `IteratorExt`, renaming
  `reverse_` to `reverse_in_place`.

* Merges `IteratorOrdExt`, `IteratorCloneExt` and `CloneIteratorExt`
  into `IteratorExt` using `where` clauses.

Marks as `#[stable]`:

* the `iter` module itself
* `FromIterator`, `Extend`
* `Iterator`, `IteratorExt`
* `map`
* `filter`
* `filter_map`
* `skip_while`
* `take_while`
* `scan`
* `flat_map`
* `inspect`
* `collect`
* `fold`
* `all`
* `any`
* `find`
* `rposition`
* `max`, `min`
* Various adapter types related to the above methods

Because of the trait merging, this is a:

[breaking-change]
Stabilize core::ops
This commit marks as stable those parts of `core::ops` that are in their
final planned form: `Drop`, all of the mathematical operators (`Add`,
`Sub`, etc), `Deref`/`DerefMut`. It leaves the `Index*`, `Slice*` and
`Fn*` traits unstable, as they are still undergoing active changes.
Final alpha stabilization of std::slice
Marks as `#[stable]`:

* Various iterator structs for stable methods, e.g. `Chunks` and
  `Windows`.
* The `SliceExt` trait itself.
Stabilize collection modules
The earlier collections stabilization did not cover the modules
themselves. This commit marks as stable those modules whose types have
been stabilized.
@aturon

This comment has been minimized.

Show comment
Hide comment
@aturon

aturon Jan 5, 2015

Member

@alexcrichton updated. After a bunch of discussion on the topic, I think we should move forward stabilizing Iterator as in this PR. r?

Member

aturon commented Jan 5, 2015

@alexcrichton updated. After a bunch of discussion on the topic, I think we should move forward stabilizing Iterator as in this PR. r?

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Jan 5, 2015

Member

Looks like rust-installer was reverted, but r=me otherwise

Member

alexcrichton commented Jan 5, 2015

Looks like rust-installer was reverted, but r=me otherwise

@aturon

This comment has been minimized.

Show comment
Hide comment
@aturon

aturon Jan 5, 2015

Member

I hate submodules 💢

Member

aturon commented Jan 5, 2015

I hate submodules 💢

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 6, 2015

rollup merge of #20560: aturon/stab-2-iter-ops-slice
Conflicts:
	src/libcollections/slice.rs
	src/libcore/iter.rs
	src/libstd/sync/mpsc/mod.rs
	src/libstd/sync/rwlock.rs
@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Jan 6, 2015

Member

Landed in #20610

Member

alexcrichton commented Jan 6, 2015

Landed in #20610

@ascherdavid ascherdavid referenced this pull request in davidascher/issue-handler Jan 10, 2015

Open

Implement the rust-style review flag #20

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