]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/hrtb-type-outlives.rs
7bb74d6b03a33e97b4606a7082d9823aaef9075e
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 // In fact there is no good reason for this to be an error, but
38 // whatever, I'm mostly concerned it doesn't ICE right now:
39 want_foo
::<SomeStruct
<usize>>();
40 //~^ ERROR requirement `for<'a> usize : 'a` is not satisfied
43 ///////////////////////////////////////////////////////////////////////////
44 // Expressed as shorthand
46 struct AnotherStruct
<X
> {
50 impl<'a
,X
:'a
> Foo
<&'a
isize> for AnotherStruct
<X
>
55 want_foo
::<AnotherStruct
<usize>>();
56 //~^ ERROR requirement `for<'a> usize : 'a` is not satisfied