Auto merge of #26727 - remram44:coerceunsized-weak, r=eddyb

This is a simple addition, shouldn't change behavior.

Fixes #26704

I don't know if the coercion for `Rc` is tested, if it is this probably needs the same test with `Weak`.
This commit is contained in:
bors 2015-07-02 09:19:27 +00:00
commit c4b4f07592
3 changed files with 10 additions and 2 deletions

View file

@ -10,10 +10,10 @@
// Test a very simple custom DST coercion.
#![feature(core)]
#![feature(core, rc_weak)]
use std::cell::RefCell;
use std::rc::Rc;
use std::rc::{Rc, Weak};
trait Baz {
fn get(&self) -> i32;
@ -36,9 +36,13 @@ fn main() {
let b: Rc<Baz> = a.clone();
assert_eq!(b.get(), 42);
let c: Weak<i32> = a.downgrade();
let d: Weak<Baz> = c.clone();
let _c = b.clone();
let a: Rc<RefCell<i32>> = Rc::new(RefCell::new(42));
let b: Rc<RefCell<Baz>> = a.clone();
assert_eq!(b.borrow().get(), 42);
let c: Weak<RefCell<Baz>> = a.downgrade();
}