rust/src/test/compile-fail/issue-1896.rs
Niko Matsakis b0ed151539 Cleanup how we handle proto in types, remove unsound subtyping
Fixes #1896 which was never truly fixed, just masked.
The given tests would have failed had they used `~fn()` and
not `@fn()`.  They now result in compilation errors.

Fixes #2978.

Necessary first step for #2202, #2263.
2012-11-06 08:56:29 -08:00

9 lines
224 B
Rust

type t<T> = { f: fn() -> T };
fn f<T>(_x: t<T>) {}
fn main() {
let x: t<()> = { f: { || () } }; //~ ERROR expected & closure, found @ closure
//~^ ERROR in field `f`, expected & closure, found @ closure
f(x);
}