Auto merge of #22851 - FlaPer87:oibit-send-and-friends, r=nikomatsakis

Fixes #22828
Fixes #22629

r? @nikomatsakis
This commit is contained in:
bors 2015-02-28 11:02:32 +00:00
commit 6f8d831406
4 changed files with 114 additions and 63 deletions

View file

@ -0,0 +1,20 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test transitive analysis for associated types. Collected types
// should be normalized and new obligations generated.
use std::borrow::{ToOwned, Cow};
fn assert_send<T: Send>(_: T) {}
fn main() {
assert_send(Cow::Borrowed("foo"));
}

View file

@ -0,0 +1,29 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test transitive analysis for associated types. Collected types
// should be normalized and new obligations generated.
trait Foo {
type A;
fn foo(&self) {}
}
impl Foo for usize {
type A = usize;
}
struct Bar<T: Foo> { inner: T::A }
fn is_send<T: Send>() {}
fn main() {
is_send::<Bar<usize>>();
}