]>
git.proxmox.com Git - rustc.git/blob - src/test/run-pass/dst-coerce-rc.rs
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 very simple custom DST coercion.
15 use std
::cell
::RefCell
;
23 fn get(&self) -> i32 {
29 let a
: Rc
<[i32; 3]> = Rc
::new([1, 2, 3]);
35 let a
: Rc
<i32> = Rc
::new(42);
36 let b
: Rc
<Baz
> = a
.clone();
37 assert_eq
!(b
.get(), 42);
41 let a
: Rc
<RefCell
<i32>> = Rc
::new(RefCell
::new(42));
42 let b
: Rc
<RefCell
<Baz
>> = a
.clone();
43 assert_eq
!(b
.borrow().get(), 42);