]>
git.proxmox.com Git - rustc.git/blob - src/test/run-pass/hrtb-type-outlives.rs
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.
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.
11 // Test what happens when a HR obligation is applied to an impl with
12 // "outlives" bounds. Currently we're pretty conservative here; this
13 // will probably improve in time.
16 fn foo(&self, x
: X
) { }
20 where T
: for<'a
> Foo
<&'a
isize>
24 ///////////////////////////////////////////////////////////////////////////
25 // Expressed as a where clause
27 struct SomeStruct
<X
> {
31 impl<'a
,X
> Foo
<&'a
isize> for SomeStruct
<X
>
37 want_foo
::<SomeStruct
<usize>>();
40 ///////////////////////////////////////////////////////////////////////////
41 // Expressed as shorthand
43 struct AnotherStruct
<X
> {
47 impl<'a
,X
:'a
> Foo
<&'a
isize> for AnotherStruct
<X
>
52 want_foo
::<AnotherStruct
<usize>>();