From 74e111caf6d9634917f77977a4e51e562498be87 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 19 Jan 2015 09:48:05 -0500 Subject: impl Iterator for &mut Iterator and Box closes #20953 closes #21361 --- src/test/run-pass/issue-20953.rs | 19 +++++++++++++++++++ src/test/run-pass/issue-21361.rs | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/test/run-pass/issue-20953.rs create mode 100644 src/test/run-pass/issue-21361.rs (limited to 'src/test') diff --git a/src/test/run-pass/issue-20953.rs b/src/test/run-pass/issue-20953.rs new file mode 100644 index 00000000000..647302bbc93 --- /dev/null +++ b/src/test/run-pass/issue-20953.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let mut shrinker: Box> = Box::new(vec![1].into_iter()); + println!("{:?}", shrinker.next()); + for v in shrinker { assert!(false); } + + let mut shrinker: &mut Iterator = &mut vec![1].into_iter(); + println!("{:?}", shrinker.next()); + for v in shrinker { assert!(false); } +} diff --git a/src/test/run-pass/issue-21361.rs b/src/test/run-pass/issue-21361.rs new file mode 100644 index 00000000000..bb20b3a3215 --- /dev/null +++ b/src/test/run-pass/issue-21361.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let v = vec![1, 2, 3]; + let boxed: Box> = Box::new(v.into_iter()); + assert_eq!(boxed.max(), Some(3)); + + let v = vec![1, 2, 3]; + let boxed: &mut Iterator = &mut v.into_iter(); + assert_eq!(boxed.max(), Some(3)); +} -- cgit 1.4.1-3-g733a5