2012-12-10 17:32:48 -08:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2014-10-09 15:17:22 -04:00
|
|
|
fn of<'a,T>() -> |T|:'a { panic!(); }
|
|
|
|
fn subtype<T>(x: |T|) { panic!(); }
|
2012-05-31 17:41:01 -07:00
|
|
|
|
2013-03-25 13:21:04 -07:00
|
|
|
fn test_fn<'x,'y,'z,T>(_x: &'x T, _y: &'y T, _z: &'z T) {
|
2012-10-19 06:01:01 -07:00
|
|
|
// Here, x, y, and z are free. Other letters
|
|
|
|
// are bound. Note that the arrangement
|
|
|
|
// subtype::<T1>(of::<T2>()) will typecheck
|
|
|
|
// iff T1 <: T2.
|
2012-05-31 17:41:01 -07:00
|
|
|
|
2014-11-07 06:53:45 -05:00
|
|
|
subtype::< for<'a>|&'a T|>(
|
|
|
|
of::< for<'a>|&'a T|>());
|
2012-10-19 06:01:01 -07:00
|
|
|
|
2014-11-07 06:53:45 -05:00
|
|
|
subtype::< for<'a>|&'a T|>(
|
|
|
|
of::< for<'b>|&'b T|>());
|
2012-10-19 06:01:01 -07:00
|
|
|
|
2014-11-07 06:53:45 -05:00
|
|
|
subtype::< for<'b>|&'b T|>(
|
2013-11-19 16:34:19 -08:00
|
|
|
of::<|&'x T|>());
|
2012-10-19 06:01:01 -07:00
|
|
|
|
2013-11-19 16:34:19 -08:00
|
|
|
subtype::<|&'x T|>(
|
2014-11-07 06:53:45 -05:00
|
|
|
of::< for<'b>|&'b T|>()); //~ ERROR mismatched types
|
2012-10-19 06:01:01 -07:00
|
|
|
|
2014-11-07 06:53:45 -05:00
|
|
|
subtype::< for<'a,'b>|&'a T, &'b T|>(
|
|
|
|
of::< for<'a>|&'a T, &'a T|>());
|
2012-05-31 17:41:01 -07:00
|
|
|
|
2014-11-07 06:53:45 -05:00
|
|
|
subtype::< for<'a>|&'a T, &'a T|>(
|
|
|
|
of::< for<'a,'b>|&'a T, &'b T|>()); //~ ERROR mismatched types
|
2012-10-19 06:01:01 -07:00
|
|
|
|
2014-11-07 06:53:45 -05:00
|
|
|
subtype::< for<'a,'b>|&'a T, &'b T|>(
|
2013-11-19 16:34:19 -08:00
|
|
|
of::<|&'x T, &'y T|>());
|
2012-10-19 06:01:01 -07:00
|
|
|
|
2013-11-19 16:34:19 -08:00
|
|
|
subtype::<|&'x T, &'y T|>(
|
2014-11-07 06:53:45 -05:00
|
|
|
of::< for<'a,'b>|&'a T, &'b T|>()); //~ ERROR mismatched types
|
2012-10-19 06:01:01 -07:00
|
|
|
}
|
2012-05-31 17:41:01 -07:00
|
|
|
|
2013-01-31 17:51:01 -08:00
|
|
|
fn main() {}
|