Skip to content

Commit 657b161

Browse files
author
Jorge Aparicio
committed
Add tests for issues #11384 and #12909
Closes #11384 Closes #12909
1 parent 1c3ddd2 commit 657b161

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

Diff for: src/test/run-pass/issue-11384.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2014 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+
trait Common {}
12+
13+
impl<'t, T> Common for (T, &'t T) {}
14+
15+
impl<'t, T> Common for (&'t T, T) {}
16+
17+
fn main() {}

Diff for: src/test/run-pass/issue-12909.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2014 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+
use std::collections::HashMap;
12+
13+
fn copy<T: Copy>(&x: &T) -> T {
14+
x
15+
}
16+
17+
fn main() {
18+
let arr = [(1i, 1u), (2, 2), (3, 3)];
19+
20+
let v1: Vec<&_> = arr.iter().collect();
21+
let v2: Vec<_> = arr.iter().map(copy).collect();
22+
23+
let m1: HashMap<_, _> = arr.iter().map(copy).collect();
24+
let m2: HashMap<int, _> = arr.iter().map(copy).collect();
25+
let m3: HashMap<_, uint> = arr.iter().map(copy).collect();
26+
}

0 commit comments

Comments
 (0)