1 // Copyright 2012 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.
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.
13 #![allow(dead_assignment)]
14 #![allow(unused_variable)]
16 // Should pass region checking.
17 fn ok(f: |x: &uint|) {
18 // Here, g is a function that can accept a uint pointer with
19 // lifetime r, and f is a function that can accept a uint pointer
20 // with any lifetime. The assignment g = f should be OK (i.e.,
21 // f's type should be a subtype of g's type), because f can be
22 // used in any context that expects g's type. But this currently
24 let mut g: <'r>|y: &'r uint| = |x| { };
28 // This version is the same as above, except that here, g's type is
30 fn ok_inferred(f: |x: &uint|) {
31 let mut g: <'r>|x: &'r uint| = |_| {};