diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-07-21 20:54:28 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-07-24 18:58:12 -0700 |
| commit | caa564bea3d5f5a24d0797c4769184c1ea0abaff (patch) | |
| tree | f0f1b5d284efe24018586e85fb5b442e8b578283 /src/libcore/ptr.rs | |
| parent | 7f2e63ec3f6f03ac9273a9f166a4ce8deff48097 (diff) | |
| download | rust-caa564bea3d5f5a24d0797c4769184c1ea0abaff.tar.gz rust-caa564bea3d5f5a24d0797c4769184c1ea0abaff.zip | |
librustc: Stop desugaring `for` expressions and translate them directly.
This makes edge cases in which the `Iterator` trait was not in scope
and/or `Option` or its variants were not in scope work properly.
This breaks code that looks like:
struct MyStruct { ... }
impl MyStruct {
fn next(&mut self) -> Option<int> { ... }
}
for x in MyStruct { ... } { ... }
Change ad-hoc `next` methods like the above to implementations of the
`Iterator` trait. For example:
impl Iterator<int> for MyStruct {
fn next(&mut self) -> Option<int> { ... }
}
Closes #15392.
[breaking-change]
Diffstat (limited to 'src/libcore/ptr.rs')
| -rw-r--r-- | src/libcore/ptr.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index ed1d4d48110..4921802ba73 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -90,11 +90,14 @@ use mem; use clone::Clone; use intrinsics; -use iter::{range, Iterator}; +use iter::range; use option::{Some, None, Option}; use cmp::{PartialEq, Eq, PartialOrd, Equiv, Ordering, Less, Equal, Greater}; +#[cfg(stage0)] +use iter::Iterator; // NOTE(stage0): Remove after snapshot. + pub use intrinsics::copy_memory; pub use intrinsics::copy_nonoverlapping_memory; pub use intrinsics::set_memory; |
