File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -1577,6 +1577,7 @@ impl<T> ExactSizeIterator for IntoIter<T> {}
1577
1577
1578
1578
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1579
1579
impl < T > Drop for IntoIter < T > {
1580
+ #[ unsafe_destructor_blind_to_params]
1580
1581
fn drop ( & mut self ) {
1581
1582
// destroy the remaining elements
1582
1583
for _x in self { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // This test ensures that vec.into_iter does not overconstrain element lifetime.
12
+
13
+ pub fn main ( ) {
14
+ original_report ( ) ;
15
+ revision_1 ( ) ;
16
+ revision_2 ( ) ;
17
+ }
18
+
19
+ fn original_report ( ) {
20
+ drop ( vec ! [ & ( ) ] . into_iter ( ) )
21
+ }
22
+
23
+ fn revision_1 ( ) {
24
+ // below is what above `vec!` expands into at time of this writing.
25
+ drop ( <[ _ ] >:: into_vec ( :: std:: boxed:: Box :: new ( [ & ( ) ] ) ) . into_iter ( ) )
26
+ }
27
+
28
+ fn revision_2 ( ) {
29
+ drop ( ( match ( Vec :: new ( ) , & ( ) ) { ( mut v, b) => { v. push ( b) ; v } } ) . into_iter ( ) )
30
+ }
You can’t perform that action at this time.
0 commit comments