Skip to content

Commit 401fd58

Browse files
committed
tests: adjust tests/ui/auto-instantiate.rs
- Reformat the test. - Document test intention. - Move test under `tests/ui/inference/`.
1 parent 78ec5aa commit 401fd58

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

Diff for: tests/ui/auto-instantiate.rs

-13
This file was deleted.

Diff for: tests/ui/inference/auto-instantiate.rs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//! Check that type parameters in generic function arg position and in "nested" return type position
2+
//! can be inferred on an invocation of the generic function.
3+
//!
4+
//! See <https://github.com/rust-lang/rust/issues/45>.
5+
6+
//@ run-pass
7+
8+
#![allow(dead_code)]
9+
#[derive(Debug)]
10+
struct Pair<T, U> {
11+
a: T,
12+
b: U,
13+
}
14+
15+
struct Triple {
16+
x: isize,
17+
y: isize,
18+
z: isize,
19+
}
20+
21+
fn f<T, U>(x: T, y: U) -> Pair<T, U> {
22+
return Pair { a: x, b: y };
23+
}
24+
25+
pub fn main() {
26+
println!("{}", f(Triple {x: 3, y: 4, z: 5}, 4).a.x);
27+
println!("{}", f(5, 6).a);
28+
}

0 commit comments

Comments
 (0)