More test deduplication

This commit is contained in:
Georg Semmler 2019-01-03 13:25:49 +01:00
parent 2bc436e713
commit ae5c092682
No known key found for this signature in database
GPG Key ID: A87BCEE5205CE489
29 changed files with 38 additions and 446 deletions

View File

@ -1,5 +1,8 @@
// run-pass
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
// pretty-expanded FIXME #23616

View File

@ -1,5 +1,8 @@
// run-pass
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
// pretty-expanded FIXME #23616

View File

@ -1,6 +1,9 @@
// run-pass
#![allow(unused_imports)]
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
// pretty-expanded FIXME #23616

View File

@ -1,6 +1,9 @@
// run-pass
#![allow(dead_code)]
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
// pretty-expanded FIXME #23616

View File

@ -1,4 +1,7 @@
// run-pass
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
#![allow(non_camel_case_types)]

View File

@ -1,4 +1,7 @@
// run-pass
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
// aux-build:coherence_lib.rs

View File

@ -1,4 +1,7 @@
// run-pass
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
// aux-build:coherence_lib.rs

View File

@ -1,4 +1,7 @@
// run-pass
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(unused_imports)]
// pretty-expanded FIXME #23616

View File

@ -1,4 +1,7 @@
// run-pass
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
// pretty-expanded FIXME #23616

View File

@ -1,4 +1,7 @@
// run-pass
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
// check that trait matching can handle impls whose types are only
// constrained by a projection.

View File

@ -1,4 +1,8 @@
// run-pass
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
use std::fmt::Debug;
use std::default::Default;

View File

@ -1,4 +1,7 @@
// run-pass
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
// Test that we are able to introduce a negative constraint that
// `MyType: !MyTrait` along with other "fundamental" wrappers.

View File

@ -1,3 +1,4 @@
#![allow(dead_code)]
#![feature(re_rebalance_coherence)]
// run-pass

View File

@ -1,20 +0,0 @@
// 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.
#![crate_type = "rlib"]
#![feature(fundamental)]
pub trait MyCopy { }
impl MyCopy for i32 { }
pub struct MyStruct<T>(T);
#[fundamental]
pub struct MyFundamentalStruct<T>(T);

View File

@ -1,25 +0,0 @@
// 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

@ -1,25 +0,0 @@
// 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.
#![feature(re_rebalance_coherence)]
// run-pass
// aux-build:coherence_lib.rs
// pretty-expanded FIXME #23616
extern crate coherence_lib as lib;
use lib::Remote1;
pub struct BigInt;
impl Remote1<BigInt> for isize { }
fn main() { }

View File

@ -1,25 +0,0 @@
// 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.
#![feature(re_rebalance_coherence)]
// run-pass
// aux-build:coherence_lib.rs
// pretty-expanded FIXME #23616
extern crate coherence_lib as lib;
use lib::Remote1;
pub struct BigInt;
impl Remote1<BigInt> for Vec<isize> { }
fn main() { }

View File

@ -1,27 +0,0 @@
// 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.
// run-pass
#![allow(unused_imports)]
#![feature(re_rebalance_coherence)]
// aux-build:coherence_lib.rs
// pretty-expanded FIXME #23616
extern crate coherence_lib as lib;
use lib::Remote1;
pub trait Local {
fn foo(&self) { }
}
impl<T> Local for T { }
fn main() { }

View File

@ -1,25 +0,0 @@
// 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.
// run-pass
#![allow(dead_code)]
#![feature(re_rebalance_coherence)]
// aux-build:coherence_lib.rs
// pretty-expanded FIXME #23616
extern crate coherence_lib as lib;
use lib::Remote;
struct Foo<T>(T);
impl<T> Remote for Foo<T> { }
fn main() { }

View File

@ -1,25 +0,0 @@
// 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.
// run-pass
#![allow(dead_code)]
#![allow(non_camel_case_types)]
#![feature(re_rebalance_coherence)]
pub fn main() {
#[derive(Copy, Clone)]
enum x { foo }
impl ::std::cmp::PartialEq for x {
fn eq(&self, other: &x) -> bool {
(*self) as isize == (*other) as isize
}
fn ne(&self, other: &x) -> bool { !(*self).eq(other) }
}
}

View File

@ -1,25 +0,0 @@
// 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.
// run-pass
#![allow(dead_code)]
#![feature(re_rebalance_coherence)]
// aux-build:coherence_lib.rs
// pretty-expanded FIXME #23616
extern crate coherence_lib as lib;
use lib::Remote1;
struct Foo<T>(T);
impl<T,U> Remote1<U> for Foo<T> { }
fn main() { }

View File

@ -1,25 +0,0 @@
// 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.
// run-pass
#![allow(dead_code)]
#![feature(re_rebalance_coherence)]
// aux-build:coherence_lib.rs
// pretty-expanded FIXME #23616
extern crate coherence_lib as lib;
use lib::Remote1;
struct Foo<T>(T);
impl<T> Remote1<T> for Foo<T> { }
fn main() { }

View File

@ -1,35 +0,0 @@
// 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.
// run-pass
#![allow(unused_imports)]
#![feature(re_rebalance_coherence)]
// pretty-expanded FIXME #23616
use std::fmt::Debug;
use std::default::Default;
// Test that an impl for homogeneous pairs does not conflict with a
// heterogeneous pair.
trait MyTrait {
fn get(&self) -> usize;
}
impl<T> MyTrait for (T,T) {
fn get(&self) -> usize { 0 }
}
impl MyTrait for (usize,isize) {
fn get(&self) -> usize { 0 }
}
fn main() {
}

View File

@ -1,24 +0,0 @@
// 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.
// run-pass
#![allow(dead_code)]
// pretty-expanded FIXME #23616
#![feature(optin_builtin_traits)]
#![feature(re_rebalance_coherence)]
use std::marker::Send;
struct TestType;
impl !Send for TestType {}
fn main() {}

View File

@ -1,34 +0,0 @@
// 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.
#![feature(re_rebalance_coherence)]
// run-pass
// check that trait matching can handle impls whose types are only
// constrained by a projection.
trait IsU32 {}
impl IsU32 for u32 {}
trait Mirror { type Image: ?Sized; }
impl<T: ?Sized> Mirror for T { type Image = T; }
trait Bar {}
impl<U: Mirror, V: Mirror<Image=L>, L: Mirror<Image=U>> Bar for V
where U::Image: IsU32 {}
trait Foo { fn name() -> &'static str; }
impl Foo for u64 { fn name() -> &'static str { "u64" } }
impl<T: Bar> Foo for T { fn name() -> &'static str { "Bar" }}
fn main() {
assert_eq!(<u64 as Foo>::name(), "u64");
assert_eq!(<u32 as Foo>::name(), "Bar");
}

View File

@ -1,51 +0,0 @@
// 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.
#![feature(re_rebalance_coherence)]
// run-pass
// Test that two distinct impls which match subtypes of one another
// yield coherence errors (or not) depending on the variance.
trait Contravariant {
fn foo(&self) { }
}
impl Contravariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
}
impl Contravariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
}
///////////////////////////////////////////////////////////////////////////
trait Covariant {
fn foo(&self) { }
}
impl Covariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
}
impl Covariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
}
///////////////////////////////////////////////////////////////////////////
trait Invariant {
fn foo(&self) { }
}
impl Invariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
}
impl Invariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
}
fn main() { }

View File

@ -1,49 +0,0 @@
// 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.
#![feature(re_rebalance_coherence)]
// run-pass
use std::fmt::Debug;
use std::default::Default;
trait MyTrait {
fn get(&self) -> Self;
}
impl<T> MyTrait for T
where T : Default
{
fn get(&self) -> T {
Default::default()
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
struct MyType {
dummy: usize
}
impl MyTrait for MyType {
fn get(&self) -> MyType { (*self).clone() }
}
fn test_eq<M>(m: M, n: M)
where M : MyTrait + Debug + PartialEq
{
assert_eq!(m.get(), n);
}
pub fn main() {
test_eq(0_usize, 0_usize);
let value = MyType { dummy: 256 + 22 };
test_eq(value, value);
}

View File

@ -1,31 +0,0 @@
// 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.
// run-pass
#![allow(dead_code)]
#![feature(re_rebalance_coherence)]
// Test that we are able to introduce a negative constraint that
// `MyType: !MyTrait` along with other "fundamental" wrappers.
// aux-build:coherence_copy_like_lib.rs
extern crate coherence_copy_like_lib as lib;
struct MyType { x: i32 }
trait MyTrait { }
impl<T: lib::MyCopy> MyTrait for T { }
impl MyTrait for MyType { }
impl<'a> MyTrait for &'a MyType { }
impl MyTrait for Box<MyType> { }
impl<'a> MyTrait for &'a Box<MyType> { }
fn main() { }