PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/src/test/compile-fail/object-lifetime-default-from-rptr-box-error.rs

https://github.com/paulstansifer/rust
Rust | 31 lines | 12 code | 7 blank | 12 comment | 0 complexity | cecb47bab3201ea068b18ec9b2780152 MD5 | raw file
Possible License(s): 0BSD, Apache-2.0, MIT, AGPL-1.0
  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.
  4. //
  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.
  10. // Test that the lifetime from the enclosing `&` is "inherited"
  11. // through the `Box` struct.
  12. // pretty-expanded FIXME #23616
  13. #![allow(dead_code)]
  14. trait Test {
  15. fn foo(&self) { }
  16. }
  17. struct SomeStruct<'a> {
  18. t: &'a Box<Test>,
  19. }
  20. fn c<'a>(t: &'a Box<Test+'a>, mut ss: SomeStruct<'a>) {
  21. ss.t = t; //~ ERROR mismatched types
  22. }
  23. fn main() {
  24. }