rollup merge of #20416: nikomatsakis/coherence

Conflicts:
	src/test/run-pass/issue-15734.rs
	src/test/run-pass/issue-3743.rs
This commit is contained in:
Alex Crichton 2015-01-02 09:23:42 -08:00
commit 735c308aed
45 changed files with 709 additions and 176 deletions

View file

@ -0,0 +1,25 @@
// Copyright 2012 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.
#![crate_type="lib"]
pub trait Remote {
fn foo(&self) { }
}
pub trait Remote1<T> {
fn foo(&self, t: T) { }
}
pub trait Remote2<T, U> {
fn foo(&self, t: T, u: U) { }
}
pub struct Pair<T,U>(T,U);

View file

@ -0,0 +1,19 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote;
impl<T> Remote for int { }
//~^ ERROR cannot provide an extension implementation
fn main() { }

View file

@ -0,0 +1,21 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote1;
pub struct BigInt;
impl<T> Remote1<BigInt> for T { }
//~^ ERROR type parameter `T` must also appear
fn main() { }

View file

@ -0,0 +1,21 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote1;
struct Foo<T>(T);
impl<T,U> Remote1<U> for Foo<T> { }
//~^ ERROR type parameter `U` must also appear
fn main() { }

View file

@ -0,0 +1,18 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote;
impl<T> Remote for T { } //~ ERROR E0117
fn main() { }

View file

@ -0,0 +1,21 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote;
struct Foo;
impl<T> Remote for lib::Pair<T,Foo> { }
//~^ ERROR type parameter `T` must also appear
fn main() { }

View file

@ -0,0 +1,21 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::{Remote, Pair};
struct Local<T>(T);
impl<T,U> Remote for Pair<T,Local<U>> { }
//~^ ERROR type parameter `T` must also appear
fn main() { }

View file

@ -9,6 +9,8 @@
// except according to those terms.
#![feature(opt_out_copy)]
//~^ WARNING feature is deprecated
//~| WARNING feature is deprecated
// Test that when using the `opt-out-copy` feature we still consider
// destructors to be non-movable

View file

@ -0,0 +1,20 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote1;
pub struct BigInt;
impl Remote1<BigInt> for int { }
fn main() { }

View file

@ -0,0 +1,20 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote1;
pub struct BigInt;
impl Remote1<BigInt> for Vec<int> { }
fn main() { }

View file

@ -0,0 +1,22 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote1;
pub trait Local {
fn foo(&self) { }
}
impl<T> Local for T { }
fn main() { }

View file

@ -0,0 +1,20 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote;
struct Foo<T>(T);
impl<T> Remote for Foo<T> { }
fn main() { }

View file

@ -0,0 +1,20 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote1;
struct Foo<T>(T);
impl<T> Remote1<T> for Foo<T> { }
fn main() { }

View file

@ -0,0 +1,20 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote;
struct Local;
impl Remote for Vec<Local> { }
fn main() { }

View file

@ -0,0 +1,20 @@
// Copyright 2014 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.
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote;
struct Local<T>(T);
impl<T> Remote for Vec<Local<T>> { }
fn main() { }

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(old_orphan_check)]
extern crate serialize;
use serialize::{Encodable, Decodable};

View file

@ -11,6 +11,8 @@
// This briefly tests the capability of `Cell` and `RefCell` to implement the
// `Encodable` and `Decodable` traits via `#[deriving(Encodable, Decodable)]`
#![feature(old_orphan_check)]
extern crate serialize;
use std::cell::{Cell, RefCell};

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(old_orphan_check)]
extern crate serialize;
extern crate rand;

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(old_orphan_check)]
extern crate rbml;
extern crate serialize;

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(old_orphan_check)]
extern crate serialize;

View file

@ -8,6 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// If `Index` used an associated type for its output, this test would
// work more smoothly.
#![feature(old_orphan_check)]
use std::ops::Index;
struct Mat<T> { data: Vec<T>, cols: uint, }

View file

@ -8,6 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// If `Mul` used an associated type for its output, this test would
// work more smoothly.
#![feature(old_orphan_check)]
use std::ops::Mul;
struct Vec2 {

View file

@ -15,9 +15,9 @@
use std::ops::Fn;
use std::ops::Add;
struct G;
struct G<A>;
impl<'a, A: Add<int, int>> Fn<(A,), int> for G {
impl<'a, A: Add<int, int>> Fn<(A,), int> for G<A> {
extern "rust-call" fn call(&self, (arg,): (A,)) -> int {
arg.add(1)
}