]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/object-lifetime-default-mybox.rs
23ddea4499a728c51b1fa08bb416cb6a0de71b2c
1 // Copyright 2015 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 a "pass-through" object-lifetime-default that produces errors.
19 struct MyBox
<T
:?Sized
> {
23 fn deref
<T
>(ss
: &T
) -> T
{
24 // produces the type of a deref without worrying about whether a
25 // move out would actually be legal
29 fn load0(ss
: &MyBox
<SomeTrait
>) -> MyBox
<SomeTrait
> {
30 deref(ss
) //~ ERROR cannot infer
33 fn load1
<'a
,'b
>(a
: &'a MyBox
<SomeTrait
>,
34 b
: &'b MyBox
<SomeTrait
>)
35 -> &'b MyBox
<SomeTrait
>
38 //~^ ERROR cannot infer
39 //~| ERROR mismatched types