Unify tests

Implement compile tests as variants of existing tests
This commit is contained in:
Georg Semmler 2018-12-29 00:11:13 +01:00
parent 2888d5631c
commit 464b4dcb2b
No known key found for this signature in database
GPG Key ID: A87BCEE5205CE489
164 changed files with 395 additions and 2718 deletions

View File

@ -1,9 +1,13 @@
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate coherence_lib as lib;
use lib::Remote1;
impl<T> Remote1<T> for isize { }
//~^ ERROR E0210
//[old]~^ ERROR E0210
//[re]~^^ ERROR E0210
fn main() { }

View File

@ -1,4 +1,7 @@
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate coherence_lib as lib;
use lib::Remote1;
@ -6,6 +9,7 @@ use lib::Remote1;
pub struct BigInt;
impl<T> Remote1<BigInt> for T { }
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type
//[re]~^^ ERROR E0210
fn main() { }

View File

@ -1,3 +1,7 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
use std::fmt::Debug;
use std::default::Default;
@ -21,7 +25,10 @@ impl<T:Even> MyTrait for T {
fn get(&self) -> usize { 0 }
}
impl<T:Odd> MyTrait for T { //~ ERROR E0119
impl<T:Odd> MyTrait for T {
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn get(&self) -> usize { 0 }
}

View File

@ -1,3 +1,7 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
use std::fmt::Debug;
use std::default::Default;
@ -17,7 +21,9 @@ impl<T:Even> MyTrait for T {
fn get(&self) -> usize { 0 }
}
impl<T:Odd> MyTrait for T { //~ ERROR E0119
impl<T:Odd> MyTrait for T {
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn get(&self) -> usize { 0 }
}

View File

@ -1,4 +1,7 @@
// aux-build:go_trait.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate go_trait;
@ -12,7 +15,9 @@ impl Go for MyThingy {
fn go(&self, arg: isize) { }
}
impl GoMut for MyThingy { //~ ERROR conflicting implementations
impl GoMut for MyThingy {
//[old]~^ ERROR conflicting implementations
//[re]~^^ ERROR E0119
fn go_mut(&mut self, arg: isize) { }
}

View File

@ -1,3 +1,7 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
use std::fmt::Debug;
use std::default::Default;
@ -19,7 +23,9 @@ struct MyType {
dummy: usize
}
impl MyTrait<MyType> for MyType { //~ ERROR E0119
impl MyTrait<MyType> for MyType {
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn get(&self) -> usize { (*self).clone() }
}

View File

@ -1,6 +1,10 @@
// Test that a blank impl for all T:PartialEq conflicts with an impl for some
// specific T when T:PartialEq.
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
trait OtherTrait {
fn noop(&self);
}
@ -17,7 +21,9 @@ struct MyType {
dummy: usize
}
impl MyTrait for MyType { //~ ERROR E0119
impl MyTrait for MyType {
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn get(&self) -> usize { self.dummy }
}

View File

@ -1,3 +1,7 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
use std::fmt::Debug;
use std::default::Default;
@ -16,7 +20,9 @@ struct MyType {
dummy: usize
}
impl MyTrait for MyType { //~ ERROR E0119
impl MyTrait for MyType {
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn get(&self) -> usize { self.dummy }
}

View File

@ -1,3 +1,6 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![feature(optin_builtin_traits)]
#![feature(overlapping_marker_traits)]
@ -8,11 +11,13 @@ struct TestType<T>(::std::marker::PhantomData<T>);
unsafe impl<T: MyTrait+'static> Send for TestType<T> {}
impl<T: MyTrait> !Send for TestType<T> {}
//~^ ERROR conflicting implementations of trait `std::marker::Send`
//[old]~^ ERROR conflicting implementations of trait `std::marker::Send`
//[re]~^^ ERROR E0119
unsafe impl<T:'static> Send for TestType<T> {}
impl !Send for TestType<i32> {}
//~^ ERROR conflicting implementations of trait `std::marker::Send`
//[old]~^ ERROR conflicting implementations of trait `std::marker::Send`
//[re]~^^ ERROR E0119
fn main() {}

View File

@ -1,7 +1,7 @@
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
--> $DIR/coherence-cow.rs:16:1
--> $DIR/coherence-cow.rs:28:1
|
LL | impl<T> Remote for Pair<T,Cover<T>> { } //[a]~ ERROR E0210
LL | impl<T> Remote for Pair<T,Cover<T>> { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter

View File

@ -1,7 +1,7 @@
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
--> $DIR/coherence-cow.rs:19:1
--> $DIR/coherence-cow.rs:33:1
|
LL | impl<T> Remote for Pair<Cover<T>,T> { } //[b]~ ERROR E0210
LL | impl<T> Remote for Pair<Cover<T>,T> { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter

View File

@ -1,5 +1,5 @@
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
--> $DIR/coherence-cow.rs:22:1
--> $DIR/coherence-cow.rs:38:1
|
LL | impl<T,U> Remote for Pair<Cover<T>,U> { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type

View File

@ -1,4 +1,6 @@
// revisions: a b c
// revisions: a b c re_a re_b re_c
#![cfg_attr(any(re_a, re_b, re_c), feature(re_rebalance_coherence))]
// aux-build:coherence_lib.rs
@ -12,14 +14,19 @@ use lib::{Remote,Pair};
pub struct Cover<T>(T);
#[cfg(a)]
impl<T> Remote for Pair<T,Cover<T>> { } //[a]~ ERROR E0210
#[cfg(any(a, re_a))]
impl<T> Remote for Pair<T,Cover<T>> { }
//[a]~^ ERROR E0210
//[re_a]~^^ ERROR E0117
#[cfg(b)]
impl<T> Remote for Pair<Cover<T>,T> { } //[b]~ ERROR E0210
#[cfg(any(b, re_b))]
impl<T> Remote for Pair<Cover<T>,T> { }
//[b]~^ ERROR E0210
//[re_b]~^^ ERROR E0117
#[cfg(c)]
#[cfg(any(c, re_c))]
impl<T,U> Remote for Pair<Cover<T>,U> { }
//[c]~^ ERROR type parameter `T` must be used as the type parameter for some local type
//[re_c]~^^ ERROR E0117
fn main() { }

View File

@ -2,12 +2,18 @@
// generalizes the one upstream
// aux-build:trait_impl_conflict.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate trait_impl_conflict;
use trait_impl_conflict::Foo;
impl<A> Foo for A {
//~^ ERROR type parameter `A` must be used as the type parameter for some local type
//~| ERROR conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`
//[old]~^ ERROR type parameter `A` must be used as the type parameter for some local type
//[old]~| ERROR conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`
//[re]~^^^ ERROR E0119
//[re]~| ERROR E0210
}
fn main() {

View File

@ -1,3 +1,6 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![feature(optin_builtin_traits)]
auto trait MySafeTrait {}
@ -5,11 +8,13 @@ auto trait MySafeTrait {}
struct Foo;
unsafe impl MySafeTrait for Foo {}
//~^ ERROR implementing the trait `MySafeTrait` is not unsafe
//[old]~^ ERROR implementing the trait `MySafeTrait` is not unsafe
//[re]~^^ ERROR E0199
unsafe auto trait MyUnsafeTrait {}
impl MyUnsafeTrait for Foo {}
//~^ ERROR the trait `MyUnsafeTrait` requires an `unsafe impl` declaration
//[old]~^ ERROR the trait `MyUnsafeTrait` requires an `unsafe impl` declaration
//[re]~^^ ERROR E0200
fn main() {}

View File

@ -1,12 +1,18 @@
// check that error types in coherence do not cause error cascades.
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
trait Foo {}
impl Foo for i8 {}
impl Foo for i16 {}
impl Foo for i32 {}
impl Foo for i64 {}
impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope
impl Foo for DoesNotExist {}
//[old]~^ ERROR cannot find type `DoesNotExist` in this scope
//[re]~^^ ERROR E0412
impl Foo for u8 {}
impl Foo for u16 {}
impl Foo for u32 {}

View File

@ -1,9 +1,15 @@
// Test that we give suitable error messages when the user attempts to
// impl a trait `Trait` for its own object type.
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
// If the trait is not object-safe, we give a more tailored message
// because we're such schnuckels:
trait NotObjectSafe { fn eq(&self, other: Self); }
impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038
impl NotObjectSafe for NotObjectSafe { }
//[old]~^ ERROR E0038
//[re]~^^ ERROR E0038
fn main() { }

View File

@ -1,14 +1,24 @@
// Test that we give suitable error messages when the user attempts to
// impl a trait `Trait` for its own object type.
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
trait Foo { fn dummy(&self) { } }
trait Bar: Foo { }
trait Baz: Bar { }
// Supertraits of Baz are not legal:
impl Foo for Baz { } //~ ERROR E0371
impl Bar for Baz { } //~ ERROR E0371
impl Baz for Baz { } //~ ERROR E0371
impl Foo for Baz { }
//[old]~^ ERROR E0371
//[re]~^^ ERROR E0371
impl Bar for Baz { }
//[old]~^ ERROR E0371
//[re]~^^ ERROR E0371
impl Baz for Baz { }
//[old]~^ ERROR E0371
//[re]~^^ ERROR E0371
// But other random traits are:
trait Other { }

View File

@ -1,11 +1,15 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![feature(optin_builtin_traits)]
use std::marker::Copy;
impl Copy for i32 {}
//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `i32`:
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
//[old]~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `i32`:
//[old]~| ERROR only traits defined in the current crate can be implemented for arbitrary types
//[re]~^^^ ERROR E0119
//[re]~| ERROR E0117
enum TestE {
A
}
@ -21,23 +25,27 @@ impl Clone for TestE { fn clone(&self) -> Self { *self } }
impl Copy for MyType {}
impl Copy for &'static mut MyType {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//[old]~^ ERROR the trait `Copy` may not be implemented for this type
//[re]~^^ ERROR E0206
impl Clone for MyType { fn clone(&self) -> Self { *self } }
impl Copy for (MyType, MyType) {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
//[old]~^ ERROR the trait `Copy` may not be implemented for this type
//[old]~| ERROR only traits defined in the current crate can be implemented for arbitrary types
//[re]~^^^ ERROR E0206
//[re]~| ERROR E0117
impl Copy for &'static NotSync {}
//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&NotSync`:
//[old]~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&NotSync`:
//[re]~^^ ERROR E0119
impl Copy for [MyType] {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
//[old]~^ ERROR the trait `Copy` may not be implemented for this type
//[old]~| ERROR only traits defined in the current crate can be implemented for arbitrary types
//[re]~^^^ ERROR E0206
//[re]~| ERROR E0117
impl Copy for &'static [NotSync] {}
//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`:
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
//[old]~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`:
//[old]~| ERROR only traits defined in the current crate can be implemented for arbitrary types
//[re]~^^^ ERROR E0119
//[re]~| ERROR E0117
fn main() {
}

View File

@ -1,3 +1,6 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![feature(optin_builtin_traits)]
#![feature(overlapping_marker_traits)]
@ -15,16 +18,20 @@ impl !Sync for NotSync {}
unsafe impl Send for TestE {}
unsafe impl Send for MyType {}
unsafe impl Send for (MyType, MyType) {}
//~^ ERROR E0117
//[old]~^ ERROR E0117
//[re]~^^ ERROR E0117
unsafe impl Send for &'static NotSync {}
//~^ ERROR E0321
//[old]~^ ERROR E0321
//[re]~^^ ERROR E0321
unsafe impl Send for [MyType] {}
//~^ ERROR E0117
//[old]~^ ERROR E0117
//[re]~^^ ERROR E0117
unsafe impl Send for &'static [NotSync] {}
//~^ ERROR E0117
//[old]~^ ERROR E0117
//[re]~^^ ERROR E0117
fn main() {
}

View File

@ -1,3 +1,6 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![feature(optin_builtin_traits)]
use std::marker::Copy;
@ -11,26 +14,41 @@ struct MyType;
struct NotSync;
impl !Sync for NotSync {}
impl Sized for TestE {} //~ ERROR E0322
//~^ impl of 'Sized' not allowed
impl Sized for TestE {}
//[old]~^ ERROR E0322
//[old]~| impl of 'Sized' not allowed
//[re]~^^^ ERROR E0322
impl Sized for MyType {} //~ ERROR E0322
//~^ impl of 'Sized' not allowed
impl Sized for MyType {}
//[old]~^ ERROR E0322
//[old]~| impl of 'Sized' not allowed
//[re]~^^^ ERROR E0322
impl Sized for (MyType, MyType) {} //~ ERROR E0322
//~^ impl of 'Sized' not allowed
//~| ERROR E0117
impl Sized for (MyType, MyType) {}
//[old]~^ ERROR E0322
//[old]~| impl of 'Sized' not allowed
//[old]~| ERROR E0117
//[re]~^^^^ ERROR E0322
//[re]~| ERROR E0117
impl Sized for &'static NotSync {} //~ ERROR E0322
//~^ impl of 'Sized' not allowed
impl Sized for &'static NotSync {}
//[old]~^ ERROR E0322
//[old]~| impl of 'Sized' not allowed
//[re]~^^^ ERROR E0322
impl Sized for [MyType] {} //~ ERROR E0322
//~^ impl of 'Sized' not allowed
//~| ERROR E0117
impl Sized for [MyType] {}
//[old]~^ ERROR E0322
//[old]~| impl of 'Sized' not allowed
//[old]~| ERROR E0117
//[re]~^^^^ ERROR E0322
//[re]~| ERROR E0117
impl Sized for &'static [NotSync] {} //~ ERROR E0322
//~^ impl of 'Sized' not allowed
//~| ERROR E0117
impl Sized for &'static [NotSync] {}
//[old]~^ ERROR E0322
//[old]~| impl of 'Sized' not allowed
//[old]~| ERROR E0117
//[re]~^^^^ ERROR E0322
//[re]~| ERROR E0117
fn main() {
}

View File

@ -4,10 +4,14 @@
//
// No we expect to run into a more user-friendly cycle error instead.
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![feature(specialization)]
trait Trait<T> { type Assoc; }
//~^ cycle detected
//[old]~^ cycle detected
//[re]~^^ ERROR E0391
impl<T> Trait<T> for Vec<T> {
type Assoc = ();

View File

@ -1,9 +1,14 @@
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate coherence_lib as lib;
use lib::Remote;
impl<T> Remote for T { }
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type
//[re]~^^ ERROR E0210
fn main() { }

View File

@ -1,3 +1,6 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![feature(optin_builtin_traits)]
use std::marker::Send;
@ -5,6 +8,7 @@ use std::marker::Send;
struct TestType;
unsafe impl !Send for TestType {}
//~^ ERROR negative impls cannot be unsafe
//[old]~^ ERROR negative impls cannot be unsafe
//[re]~^^ ERROR E0198
fn main() {}

View File

@ -1,8 +1,14 @@
// Test that you cannot *directly* dispatch on lifetime requirements
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
trait MyTrait { fn foo() {} }
impl<T> MyTrait for T {}
impl<T: 'static> MyTrait for T {} //~ ERROR E0119
impl<T: 'static> MyTrait for T {}
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn main() {}

View File

@ -1,5 +1,7 @@
// aux-build:coherence_orphan_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![feature(optin_builtin_traits)]
extern crate coherence_orphan_lib as lib;
@ -9,13 +11,15 @@ use lib::TheTrait;
struct TheType;
impl TheTrait<usize> for isize { }
//~^ ERROR E0117
//[old]~^ ERROR E0117
//[re]~^^ ERROR E0117
impl TheTrait<TheType> for isize { }
impl TheTrait<isize> for TheType { }
impl !Send for Vec<isize> { }
//~^ ERROR E0117
//[old]~^ ERROR E0117
//[re]~^^ ERROR E0117
fn main() { }

View File

@ -6,6 +6,10 @@
//
// Seems pretty basic, but then there was issue #24241. :)
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
trait From<U> {
fn foo() {}
}
@ -13,7 +17,9 @@ trait From<U> {
impl <T> From<T> for T {
}
impl <T11, U11> From<(U11,)> for (T11,) { //~ ERROR E0119
impl <T11, U11> From<(U11,)> for (T11,) {
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
}
fn main() { }

View File

@ -1,17 +1,23 @@
// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even
// though no impls are found.
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
struct Sweet<X>(X);
pub trait Sugar {}
pub trait Fruit {}
impl<T:Sugar> Sweet<T> { fn dummy(&self) { } }
//~^ ERROR E0592
//[old]~^ ERROR E0592
//[re]~^^ ERROR E0592
impl<T:Fruit> Sweet<T> { fn dummy(&self) { } }
trait Bar<X> {}
struct A<T, X>(T, X);
impl<X, T> A<T, X> where T: Bar<X> { fn f(&self) {} }
//~^ ERROR E0592
//[old]~^ ERROR E0592
//[re]~^^ ERROR E0592
impl<X> A<i32, X> { fn f(&self) {} }
fn main() {}

View File

@ -1,17 +1,23 @@
// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even
// though no impls are found.
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
pub trait Sugar {}
pub trait Fruit {}
pub trait Sweet {}
impl<T:Sugar> Sweet for T { }
impl<T:Fruit> Sweet for T { }
//~^ ERROR E0119
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
pub trait Foo<X> {}
pub trait Bar<X> {}
impl<X, T> Foo<X> for T where T: Bar<X> {}
impl<X> Foo<X> for i32 {}
//~^ ERROR E0119
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn main() { }

View File

@ -2,12 +2,17 @@
// though we see no impl of `Sugar` for `Box`. Therefore, an overlap
// error is reported for the following pair of impls (#23516).
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
pub trait Sugar {}
struct Cake<X>(X);
impl<T:Sugar> Cake<T> { fn dummy(&self) { } }
//~^ ERROR E0592
//[old]~^ ERROR E0592
//[re]~^^ ERROR E0592
impl<U:Sugar> Cake<Box<U>> { fn dummy(&self) { } }
fn main() { }

View File

@ -2,10 +2,15 @@
// though we see no impl of `Sugar` for `Box`. Therefore, an overlap
// error is reported for the following pair of impls (#23516).
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
pub trait Sugar { fn dummy(&self) { } }
pub trait Sweet { fn dummy(&self) { } }
impl<T:Sugar> Sweet for T { }
impl<U:Sugar> Sweet for Box<U> { }
//~^ ERROR E0119
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn main() { }

View File

@ -1,22 +1,37 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
trait Foo { fn foo() {} }
impl<T> Foo for T {}
impl<U> Foo for U {} //~ ERROR conflicting implementations of trait `Foo`:
impl<U> Foo for U {}
//[old]~^ ERROR conflicting implementations of trait `Foo`:
//[re]~^^ ERROR E0119
trait Bar { fn bar() {} }
impl<T> Bar for (T, u8) {}
impl<T> Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`:
impl<T> Bar for (u8, T) {}
//[old]~^ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`:
//[re]~^^ ERROR E0119
trait Baz<T> { fn baz() {} }
impl<T> Baz<u8> for T {}
impl<T> Baz<T> for u8 {} //~ ERROR conflicting implementations of trait `Baz<u8>` for type `u8`:
impl<T> Baz<T> for u8 {}
//[old]~^ ERROR conflicting implementations of trait `Baz<u8>` for type `u8`:
//[re]~^^ ERROR E0119
trait Quux<U, V> { fn quux() {} }
impl<T, U, V> Quux<U, V> for T {}
impl<T, U> Quux<U, U> for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`:
impl<T, V> Quux<T, V> for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`:
impl<T, U> Quux<U, U> for T {}
//[old]~^ ERROR conflicting implementations of trait `Quux<_, _>`:
//[re]~^^ ERROR E0119
impl<T, V> Quux<T, V> for T {}
//[old]~^ ERROR conflicting implementations of trait `Quux<_, _>`:
//[re]~^^ ERROR E0119
fn main() {}

View File

@ -2,6 +2,10 @@
// though the upstream crate doesn't implement it for now.
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate coherence_lib;
@ -9,7 +13,8 @@ use coherence_lib::Remote;
struct A<X>(X);
impl<T> A<T> where T: Remote { fn dummy(&self) { } }
//~^ ERROR E0592
//[old]~^ ERROR E0592
//[re]~^^ ERROR E0592
impl A<i16> { fn dummy(&self) { } }
fn main() {}

View File

@ -2,6 +2,10 @@
// though the upstream crate doesn't implement it for now.
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate coherence_lib;
@ -10,6 +14,7 @@ use coherence_lib::Remote;
trait Foo {}
impl<T> Foo for T where T: Remote {}
impl Foo for i16 {}
//~^ ERROR E0119
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn main() {}

View File

@ -1,4 +1,7 @@
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate coherence_lib as lib;
use lib::Remote;
@ -6,6 +9,7 @@ use lib::Remote;
struct Foo;
impl<T> Remote for lib::Pair<T,Foo> { }
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type
//[re]~^^ ERROR E0117
fn main() { }

View File

@ -2,6 +2,10 @@
// list of type parameters, not the self type.
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate coherence_lib as lib;
use lib::{Remote1, Pair};
@ -9,6 +13,7 @@ use lib::{Remote1, Pair};
pub struct Local<T>(T);
impl<T, U> Remote1<Pair<T, Local<U>>> for i32 { }
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type
//[re]~^^ ERROR E0117
fn main() { }

View File

@ -1,4 +1,7 @@
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate coherence_lib as lib;
use lib::{Remote, Pair};
@ -6,6 +9,7 @@ use lib::{Remote, Pair};
struct Local<T>(T);
impl<T,U> Remote for Pair<T,Local<U>> { }
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type
//[re]~^^ ERROR E0117
fn main() { }

View File

@ -1,3 +1,6 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![feature(rustc_attrs)]
// Here we expect a coherence conflict because, even though `i32` does
@ -13,6 +16,8 @@ pub trait Bar {
impl Foo<i32> for i32 { }
impl<A:Iterator> Foo<A::Item> for A { } //~ ERROR E0119
impl<A:Iterator> Foo<A::Item> for A { }
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn main() {}

View File

@ -1,12 +1,18 @@
// Coherence error results because we do not know whether `T: Foo<P>` or not
// for the second impl.
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
use std::marker::PhantomData;
pub trait Foo<P> { fn foo() {} }
impl <P, T: Foo<P>> Foo<P> for Option<T> {}
impl<T, U> Foo<T> for Option<U> { } //~ ERROR E0119
impl<T, U> Foo<T> for Option<U> { }
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn main() {}

View File

@ -1,3 +1,7 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
use std::marker::PhantomData;
pub trait Foo<P> { fn foo() {} }
@ -8,7 +12,9 @@ pub trait Bar {
impl Foo<i32> for i32 { }
impl<A:Bar> Foo<A::Output> for A { } //~ ERROR E0119
impl<A:Bar> Foo<A::Output> for A { }
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
impl Bar for i32 {
type Output = i32;

View File

@ -1,5 +1,8 @@
// compile-pass
// skip-codegen
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
// Here we do not get a coherence conflict because `Baz: Iterator`
// does not hold and (due to the orphan rules), we can rely on that.

View File

@ -1,5 +1,8 @@
// compile-pass
// skip-codegen
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
pub trait Foo<P> {}
pub trait Bar {

View File

@ -1,3 +1,7 @@
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
use std::fmt::Debug;
use std::default::Default;
@ -12,7 +16,9 @@ impl<T> MyTrait for (T,T) {
fn get(&self) -> usize { 0 }
}
impl<A,B> MyTrait for (A,B) { //~ ERROR E0119
impl<A,B> MyTrait for (A,B) {
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn get(&self) -> usize { self.dummy }
}

View File

@ -2,12 +2,17 @@
// *non-fundamental* remote type like `Vec` is not considered local.
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate coherence_lib as lib;
use lib::Remote;
struct Local<T>(T);
impl<T> Remote for Vec<Local<T>> { } //~ ERROR E0210
impl<T> Remote for Vec<Local<T>> { }
//[old]~^ ERROR E0210
//[re]~^^ ERROR E0117
fn main() { }

View File

@ -2,12 +2,17 @@
// *non-fundamental* remote type like `Vec` is not considered local.
// aux-build:coherence_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate coherence_lib as lib;
use lib::Remote;
struct Local;
impl Remote for Vec<Local> { } //~ ERROR E0117
impl Remote for Vec<Local> { }
//[old]~^ ERROR E0117
//[re]~^^ ERROR E0117
fn main() { }

View File

@ -4,6 +4,9 @@
// aux-build:coherence_copy_like_lib.rs
// compile-pass
// skip-codgen
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
extern crate coherence_copy_like_lib as lib;

View File

@ -4,6 +4,9 @@
// aux-build:coherence_copy_like_lib.rs
// compile-pass
// skip-codegen
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
extern crate coherence_copy_like_lib as lib;

View File

@ -2,7 +2,9 @@
// `MyType: !MyTrait` along with other "fundamental" wrappers.
// aux-build:coherence_copy_like_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate coherence_copy_like_lib as lib;
@ -14,7 +16,9 @@ trait MyTrait { fn foo() {} }
impl<T: lib::MyCopy> MyTrait for T { }
// Tuples are not fundamental.
impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } //~ ERROR E0119
impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { }
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn main() { }

View File

@ -1,4 +1,7 @@
// aux-build:coherence_copy_like_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
// Test that we are able to introduce a negative constraint that
// `MyType: !MyTrait` along with other "fundamental" wrappers.
@ -16,6 +19,8 @@ impl<T: lib::MyCopy> MyTrait for T { }
// MyStruct<MyType>: !MyTrait
//
// which we cannot approve.
impl MyTrait for lib::MyStruct<MyType> { } //~ ERROR E0119
impl MyTrait for lib::MyStruct<MyType> { }
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn main() { }

View File

@ -2,6 +2,9 @@
// `MyType: !MyTrait` along with other "fundamental" wrappers.
// aux-build:coherence_copy_like_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
extern crate coherence_copy_like_lib as lib;
@ -15,6 +18,8 @@ impl<T: lib::MyCopy> MyTrait for T { }
// (MyType,): !MyTrait
//
// which we cannot approve.
impl MyTrait for (MyType,) { } //~ ERROR E0119
impl MyTrait for (MyType,) { }
//[old]~^ ERROR E0119
//[re]~^^ ERROR E0119
fn main() { }

View File

@ -1,6 +1,10 @@
// Tests that methods that implement a trait cannot be invoked
// unless the trait is imported.
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
mod Lib {
pub trait TheTrait {
fn the_fn(&self);
@ -28,7 +32,9 @@ mod NoImport {
use Lib::TheStruct;
fn call_the_fn(s: &TheStruct) {
s.the_fn(); //~ ERROR no method named `the_fn` found
s.the_fn();
//[old]~^ ERROR no method named `the_fn` found
//[re]~^^ ERROR E0599
}
}

View File

@ -1,4 +1,7 @@
// aux-build:coherence_inherent_cc_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
// Tests that methods that implement a trait cannot be invoked
// unless the trait is imported.
@ -20,7 +23,9 @@ mod NoImport {
use coherence_inherent_cc_lib::TheStruct;
fn call_the_fn(s: &TheStruct) {
s.the_fn(); //~ ERROR no method named `the_fn` found
s.the_fn();
//[old]~^ ERROR no method named `the_fn` found
//[re]~^^ ERROR E0599
}
}

View File

@ -4,6 +4,9 @@
// aux-build:coherence_copy_like_lib.rs
// compile-pass
// skip-codegen
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
extern crate coherence_copy_like_lib as lib;

View File

@ -2,8 +2,9 @@
// `MyType: !MyTrait` along with other "fundamental" wrappers.
// aux-build:coherence_copy_like_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
extern crate coherence_copy_like_lib as lib;
@ -13,7 +14,9 @@ struct MyType { x: i32 }
// These are all legal because they are all fundamental types:
// MyStruct is not fundamental.
impl lib::MyCopy for lib::MyStruct<MyType> { } //~ ERROR E0117
impl lib::MyCopy for lib::MyStruct<MyType> { }
//[old]~^ ERROR E0117
//[re]~^^ ERROR E0117
fn main() { }

View File

@ -2,8 +2,9 @@
// `MyType: !MyTrait` along with other "fundamental" wrappers.
// aux-build:coherence_copy_like_lib.rs
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
extern crate coherence_copy_like_lib as lib;
@ -13,7 +14,9 @@ struct MyType { x: i32 }
// These are all legal because they are all fundamental types:
// Tuples are not fundamental, so this is not a local impl.
impl lib::MyCopy for (MyType,) { } //~ ERROR E0117
impl lib::MyCopy for (MyType,) { }
//[old]~^ ERROR E0117
//[re]~^^ ERROR E0117
fn main() { }

View File

@ -4,6 +4,9 @@
// aux-build:coherence_copy_like_lib.rs
// compile-pass
// skip-codegen
// revisions: old re
#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
extern crate coherence_copy_like_lib as lib;

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,21 +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.
// See coherence_inherent_cc.rs
pub trait TheTrait {
fn the_fn(&self);
}
pub struct TheStruct;
impl TheTrait for TheStruct {
fn the_fn(&self) {}
}

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,13 +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.
pub trait TheTrait<T> {
fn the_fn(&self);
}

View File

@ -1,53 +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(specialization)]
// Common code used for tests that model the Fn/FnMut/FnOnce hierarchy.
pub trait Go {
fn go(&self, arg: isize);
}
pub fn go<G:Go>(this: &G, arg: isize) {
this.go(arg)
}
pub trait GoMut {
fn go_mut(&mut self, arg: isize);
}
pub fn go_mut<G:GoMut>(this: &mut G, arg: isize) {
this.go_mut(arg)
}
pub trait GoOnce {
fn go_once(self, arg: isize);
}
pub fn go_once<G:GoOnce>(this: G, arg: isize) {
this.go_once(arg)
}
impl<G> GoMut for G
where G : Go
{
default fn go_mut(&mut self, arg: isize) {
go(&*self, arg)
}
}
impl<G> GoOnce for G
where G : GoMut
{
default fn go_once(mut self, arg: isize) {
go_mut(&mut self, arg)
}
}

View File

@ -1,16 +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.
pub trait Foo {
fn foo() {}
}
impl Foo for isize {
}

View File

@ -1,21 +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.
// aux-build:coherence_lib.rs
#![feature(re_rebalance_coherence)]
extern crate coherence_lib as lib;
use lib::Remote1;
impl<T> Remote1<T> for isize { }
//~^ ERROR E0210
fn main() { }

View File

@ -1,11 +0,0 @@
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
--> $DIR/coherence-all-remote.rs:18:1
|
LL | impl<T> Remote1<T> for isize { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter
error: aborting due to previous error
For more information about this error, try `rustc --explain E0210`.

View File

@ -1,23 +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)]
// 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 be used as the type parameter for some local type
fn main() { }

View File

@ -1,11 +0,0 @@
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
--> $DIR/coherence-bigint-param.rs:20:1
|
LL | impl<T> Remote1<BigInt> for T { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter
error: aborting due to previous error
For more information about this error, try `rustc --explain E0210`.

View File

@ -1,40 +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)]
use std::fmt::Debug;
use std::default::Default;
// Test that two blanket impls conflict (at least without negative
// bounds). After all, some other crate could implement Even or Odd
// for the same type (though this crate doesn't).
trait MyTrait {
fn get(&self) -> usize;
}
trait Even { }
trait Odd { }
impl Even for isize { }
impl Odd for usize { }
impl<T:Even> MyTrait for T {
fn get(&self) -> usize { 0 }
}
impl<T:Odd> MyTrait for T { //~ ERROR E0119
fn get(&self) -> usize { 0 }
}
fn main() { }

View File

@ -1,12 +0,0 @@
error[E0119]: conflicting implementations of trait `MyTrait`:
--> $DIR/coherence-blanket-conflicts-with-blanket-implemented.rs:36:1
|
LL | impl<T:Even> MyTrait for T {
| -------------------------- first implementation here
...
LL | impl<T:Odd> MyTrait for T { //~ ERROR E0119
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,36 +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)]
use std::fmt::Debug;
use std::default::Default;
// Test that two blanket impls conflict (at least without negative
// bounds). After all, some other crate could implement Even or Odd
// for the same type (though this crate doesn't implement them at all).
trait MyTrait {
fn get(&self) -> usize;
}
trait Even {}
trait Odd {}
impl<T:Even> MyTrait for T {
fn get(&self) -> usize { 0 }
}
impl<T:Odd> MyTrait for T { //~ ERROR E0119
fn get(&self) -> usize { 0 }
}
fn main() { }

View File

@ -1,12 +0,0 @@
error[E0119]: conflicting implementations of trait `MyTrait`:
--> $DIR/coherence-blanket-conflicts-with-blanket-unimplemented.rs:32:1
|
LL | impl<T:Even> MyTrait for T {
| -------------------------- first implementation here
...
LL | impl<T:Odd> MyTrait for T { //~ ERROR E0119
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,31 +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)]
// aux-build:go_trait.rs
extern crate go_trait;
use go_trait::{Go,GoMut};
use std::fmt::Debug;
use std::default::Default;
struct MyThingy;
impl Go for MyThingy {
fn go(&self, arg: isize) { }
}
impl GoMut for MyThingy { //~ ERROR conflicting implementations
fn go_mut(&mut self, arg: isize) { }
}
fn main() { }

View File

@ -1,13 +0,0 @@
error[E0119]: conflicting implementations of trait `go_trait::GoMut` for type `MyThingy`:
--> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:27:1
|
LL | impl GoMut for MyThingy { //~ ERROR conflicting implementations
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `go_trait`:
- impl<G> go_trait::GoMut for G
where G: go_trait::Go;
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,38 +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)]
use std::fmt::Debug;
use std::default::Default;
// Test that a blank impl for all T conflicts with an impl for some
// specific T, even when there are multiple type parameters involved.
trait MyTrait<T> {
fn get(&self) -> T;
}
impl<T> MyTrait<T> for T {
fn get(&self) -> T {
panic!()
}
}
#[derive(Clone)]
struct MyType {
dummy: usize
}
impl MyTrait<MyType> for MyType { //~ ERROR E0119
fn get(&self) -> usize { (*self).clone() }
}
fn main() { }

View File

@ -1,12 +0,0 @@
error[E0119]: conflicting implementations of trait `MyTrait<MyType>` for type `MyType`:
--> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:34:1
|
LL | impl<T> MyTrait<T> for T {
| ------------------------ first implementation here
...
LL | impl MyTrait<MyType> for MyType { //~ ERROR E0119
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,40 +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)]
// Test that a blank impl for all T:PartialEq conflicts with an impl for some
// specific T when T:PartialEq.
trait OtherTrait {
fn noop(&self);
}
trait MyTrait {
fn get(&self) -> usize;
}
impl<T:OtherTrait> MyTrait for T {
fn get(&self) -> usize { 0 }
}
struct MyType {
dummy: usize
}
impl MyTrait for MyType { //~ ERROR E0119
fn get(&self) -> usize { self.dummy }
}
impl OtherTrait for MyType {
fn noop(&self) { }
}
fn main() { }

View File

@ -1,12 +0,0 @@
error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`:
--> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:32:1
|
LL | impl<T:OtherTrait> MyTrait for T {
| -------------------------------- first implementation here
...
LL | impl MyTrait for MyType { //~ ERROR E0119
| ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.

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.
#![feature(re_rebalance_coherence)]
use std::fmt::Debug;
use std::default::Default;
// Test that a blank impl for all T conflicts with an impl for some
// specific T.
trait MyTrait {
fn get(&self) -> usize;
}
impl<T> MyTrait for T {
fn get(&self) -> usize { 0 }
}
struct MyType {
dummy: usize
}
impl MyTrait for MyType { //~ ERROR E0119
fn get(&self) -> usize { self.dummy }
}
fn main() { }

View File

@ -1,12 +0,0 @@
error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`:
--> $DIR/coherence-blanket-conflicts-with-specific.rs:31:1
|
LL | impl<T> MyTrait for T {
| --------------------- first implementation here
...
LL | impl MyTrait for MyType { //~ ERROR E0119
| ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,29 +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(optin_builtin_traits)]
#![feature(overlapping_marker_traits)]
#![feature(re_rebalance_coherence)]
trait MyTrait {}
struct TestType<T>(::std::marker::PhantomData<T>);
unsafe impl<T: MyTrait+'static> Send for TestType<T> {}
impl<T: MyTrait> !Send for TestType<T> {}
//~^ ERROR conflicting implementations of trait `std::marker::Send`
unsafe impl<T:'static> Send for TestType<T> {}
impl !Send for TestType<i32> {}
//~^ ERROR conflicting implementations of trait `std::marker::Send`
fn main() {}

View File

@ -1,21 +0,0 @@
error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<_>`:
--> $DIR/coherence-conflicting-negative-trait-impl.rs:21:1
|
LL | unsafe impl<T: MyTrait+'static> Send for TestType<T> {}
| ---------------------------------------------------- first implementation here
LL |
LL | impl<T: MyTrait> !Send for TestType<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>`
error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<i32>`:
--> $DIR/coherence-conflicting-negative-trait-impl.rs:26:1
|
LL | unsafe impl<T:'static> Send for TestType<T> {}
| ------------------------------------------- first implementation here
LL |
LL | impl !Send for TestType<i32> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<i32>`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,12 +0,0 @@
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-cow.rs:28:1
|
LL | impl<T> Remote for Pair<T,Cover<T>> { } //[a]~ ERROR E0117
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error: aborting due to previous error
For more information about this error, try `rustc --explain E0117`.

View File

@ -1,12 +0,0 @@
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-cow.rs:31:1
|
LL | impl<T> Remote for Pair<Cover<T>,T> { } //[b]~ ERROR E0117
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error: aborting due to previous error
For more information about this error, try `rustc --explain E0117`.

View File

@ -1,12 +0,0 @@
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-cow.rs:34:1
|
LL | impl<T,U> Remote for Pair<Cover<T>,U> { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error: aborting due to previous error
For more information about this error, try `rustc --explain E0117`.

View File

@ -1,37 +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)]
// revisions: a b c
// aux-build:coherence_lib.rs
// Test that the `Pair` type reports an error if it contains type
// parameters, even when they are covered by local types. This test
// was originally intended to test the opposite, but the rules changed
// with RFC 1023 and this became illegal.
extern crate coherence_lib as lib;
use lib::{Remote,Pair};
pub struct Cover<T>(T);
#[cfg(a)]
impl<T> Remote for Pair<T,Cover<T>> { } //[a]~ ERROR E0117
#[cfg(b)]
impl<T> Remote for Pair<Cover<T>,T> { } //[b]~ ERROR E0117
#[cfg(c)]
impl<T,U> Remote for Pair<Cover<T>,U> { }
//[c]~^ ERROR E0117
fn main() { }

View File

@ -1,26 +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)]
// The error here is strictly due to orphan rules; the impl here
// generalizes the one upstream
// aux-build:trait_impl_conflict.rs
extern crate trait_impl_conflict;
use trait_impl_conflict::Foo;
impl<A> Foo for A {
//~^ ERROR type parameter `A` must be used as the type parameter for some local type
//~| ERROR conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`
}
fn main() {
}

View File

@ -1,21 +0,0 @@
error[E0119]: conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`:
--> $DIR/coherence-cross-crate-conflict.rs:20:1
|
LL | impl<A> Foo for A {
| ^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `trait_impl_conflict`:
- impl trait_impl_conflict::Foo for isize;
error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g., `MyStruct<A>`)
--> $DIR/coherence-cross-crate-conflict.rs:20:1
|
LL | impl<A> Foo for A {
| ^^^^^^^^^^^^^^^^^ type parameter `A` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter
error: aborting due to 2 previous errors
Some errors occurred: E0119, E0210.
For more information about an error, try `rustc --explain E0119`.

View File

@ -1,26 +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(optin_builtin_traits)]
#![feature(re_rebalance_coherence)]
auto trait MySafeTrait {}
struct Foo;
unsafe impl MySafeTrait for Foo {}
//~^ ERROR implementing the trait `MySafeTrait` is not unsafe
unsafe auto trait MyUnsafeTrait {}
impl MyUnsafeTrait for Foo {}
//~^ ERROR the trait `MyUnsafeTrait` requires an `unsafe impl` declaration
fn main() {}

View File

@ -1,16 +0,0 @@
error[E0199]: implementing the trait `MySafeTrait` is not unsafe
--> $DIR/coherence-default-trait-impl.rs:18:1
|
LL | unsafe impl MySafeTrait for Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0200]: the trait `MyUnsafeTrait` requires an `unsafe impl` declaration
--> $DIR/coherence-default-trait-impl.rs:23:1
|
LL | impl MyUnsafeTrait for Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
Some errors occurred: E0199, E0200.
For more information about an error, try `rustc --explain E0199`.

View File

@ -1,27 +0,0 @@
// Copyright 2016 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)]
// check that error types in coherence do not cause error cascades.
trait Foo {}
impl Foo for i8 {}
impl Foo for i16 {}
impl Foo for i32 {}
impl Foo for i64 {}
impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope
impl Foo for u8 {}
impl Foo for u16 {}
impl Foo for u32 {}
impl Foo for u64 {}
fn main() {}

View File

@ -1,9 +0,0 @@
error[E0412]: cannot find type `DoesNotExist` in this scope
--> $DIR/coherence-error-suppression.rs:21:14
|
LL | impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope
| ^^^^^^^^^^^^ not found in this scope
error: aborting due to previous error
For more information about this error, try `rustc --explain E0412`.

View File

@ -1,21 +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)]
// Test that we give suitable error messages when the user attempts to
// impl a trait `Trait` for its own object type.
// If the trait is not object-safe, we give a more tailored message
// because we're such schnuckels:
trait NotObjectSafe { fn eq(&self, other: Self); }
impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038
fn main() { }

View File

@ -1,11 +0,0 @@
error[E0038]: the trait `NotObjectSafe` cannot be made into an object
--> $DIR/coherence-impl-trait-for-trait-object-safe.rs:19:6
|
LL | impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038
| ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object
|
= note: method `eq` references the `Self` type in its arguments or return type
error: aborting due to previous error
For more information about this error, try `rustc --explain E0038`.

View File

@ -1,29 +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)]
// Test that we give suitable error messages when the user attempts to
// impl a trait `Trait` for its own object type.
trait Foo { fn dummy(&self) { } }
trait Bar: Foo { }
trait Baz: Bar { }
// Supertraits of Baz are not legal:
impl Foo for Baz { } //~ ERROR E0371
impl Bar for Baz { } //~ ERROR E0371
impl Baz for Baz { } //~ ERROR E0371
// But other random traits are:
trait Other { }
impl Other for Baz { } // OK, Other not a supertrait of Baz
fn main() { }

View File

@ -1,21 +0,0 @@
error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo`
--> $DIR/coherence-impl-trait-for-trait.rs:21:1
|
LL | impl Foo for Baz { } //~ ERROR E0371
| ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo`
error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar`
--> $DIR/coherence-impl-trait-for-trait.rs:22:1
|
LL | impl Bar for Baz { } //~ ERROR E0371
| ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar`
error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz`
--> $DIR/coherence-impl-trait-for-trait.rs:23:1
|
LL | impl Baz for Baz { } //~ ERROR E0371
| ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0371`.

View File

@ -1,54 +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(optin_builtin_traits)]
#![feature(re_rebalance_coherence)]
use std::marker::Copy;
impl Copy for i32 {}
//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `i32`:
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
enum TestE {
A
}
struct MyType;
struct NotSync;
impl !Sync for NotSync {}
impl Copy for TestE {}
impl Clone for TestE { fn clone(&self) -> Self { *self } }
impl Copy for MyType {}
impl Copy for &'static mut MyType {}
//~^ ERROR the trait `Copy` may not be implemented for this type
impl Clone for MyType { fn clone(&self) -> Self { *self } }
impl Copy for (MyType, MyType) {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
impl Copy for &'static NotSync {}
//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&NotSync`:
impl Copy for [MyType] {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
impl Copy for &'static [NotSync] {}
//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`:
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
fn main() {
}

View File

@ -1,87 +0,0 @@
error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `i32`:
--> $DIR/coherence-impls-copy.rs:16:1
|
LL | impl Copy for i32 {}
| ^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl std::marker::Copy for i32;
error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&NotSync`:
--> $DIR/coherence-impls-copy.rs:42:1
|
LL | impl Copy for &'static NotSync {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T> std::marker::Copy for &T
where T: ?Sized;
error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`:
--> $DIR/coherence-impls-copy.rs:49:1
|
LL | impl Copy for &'static [NotSync] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T> std::marker::Copy for &T
where T: ?Sized;
error[E0206]: the trait `Copy` may not be implemented for this type
--> $DIR/coherence-impls-copy.rs:34:15
|
LL | impl Copy for &'static mut MyType {}
| ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration
error[E0206]: the trait `Copy` may not be implemented for this type
--> $DIR/coherence-impls-copy.rs:38:15
|
LL | impl Copy for (MyType, MyType) {}
| ^^^^^^^^^^^^^^^^ type is not a structure or enumeration
error[E0206]: the trait `Copy` may not be implemented for this type
--> $DIR/coherence-impls-copy.rs:45:15
|
LL | impl Copy for [MyType] {}
| ^^^^^^^^ type is not a structure or enumeration
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-impls-copy.rs:16:1
|
LL | impl Copy for i32 {}
| ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-impls-copy.rs:38:1
|
LL | impl Copy for (MyType, MyType) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-impls-copy.rs:45:1
|
LL | impl Copy for [MyType] {}
| ^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-impls-copy.rs:49:1
|
LL | impl Copy for &'static [NotSync] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error: aborting due to 10 previous errors
Some errors occurred: E0117, E0119, E0206.
For more information about an error, try `rustc --explain E0117`.

View File

@ -1,41 +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(optin_builtin_traits)]
#![feature(overlapping_marker_traits)]
#![feature(re_rebalance_coherence)]
use std::marker::Copy;
enum TestE {
A
}
struct MyType;
struct NotSync;
impl !Sync for NotSync {}
unsafe impl Send for TestE {}
unsafe impl Send for MyType {}
unsafe impl Send for (MyType, MyType) {}
//~^ ERROR E0117
unsafe impl Send for &'static NotSync {}
//~^ ERROR E0321
unsafe impl Send for [MyType] {}
//~^ ERROR E0117
unsafe impl Send for &'static [NotSync] {}
//~^ ERROR E0117
fn main() {
}

View File

@ -1,37 +0,0 @@
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-impls-send.rs:28:1
|
LL | unsafe impl Send for (MyType, MyType) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static NotSync`
--> $DIR/coherence-impls-send.rs:31:1
|
LL | unsafe impl Send for &'static NotSync {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-impls-send.rs:34:1
|
LL | unsafe impl Send for [MyType] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-impls-send.rs:37:1
|
LL | unsafe impl Send for &'static [NotSync] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error: aborting due to 4 previous errors
Some errors occurred: E0117, E0321.
For more information about an error, try `rustc --explain E0117`.

View File

@ -1,47 +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(optin_builtin_traits)]
#![feature(re_rebalance_coherence)]
use std::marker::Copy;
enum TestE {
A
}
struct MyType;
struct NotSync;
impl !Sync for NotSync {}
impl Sized for TestE {} //~ ERROR E0322
//~^ impl of 'Sized' not allowed
impl Sized for MyType {} //~ ERROR E0322
//~^ impl of 'Sized' not allowed
impl Sized for (MyType, MyType) {} //~ ERROR E0322
//~^ impl of 'Sized' not allowed
//~| ERROR E0117
impl Sized for &'static NotSync {} //~ ERROR E0322
//~^ impl of 'Sized' not allowed
impl Sized for [MyType] {} //~ ERROR E0322
//~^ impl of 'Sized' not allowed
//~| ERROR E0117
impl Sized for &'static [NotSync] {} //~ ERROR E0322
//~^ impl of 'Sized' not allowed
//~| ERROR E0117
fn main() {
}

View File

@ -1,67 +0,0 @@
error[E0322]: explicit impls for the `Sized` trait are not permitted
--> $DIR/coherence-impls-sized.rs:25:1
|
LL | impl Sized for TestE {} //~ ERROR E0322
| ^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed
error[E0322]: explicit impls for the `Sized` trait are not permitted
--> $DIR/coherence-impls-sized.rs:28:1
|
LL | impl Sized for MyType {} //~ ERROR E0322
| ^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed
error[E0322]: explicit impls for the `Sized` trait are not permitted
--> $DIR/coherence-impls-sized.rs:31:1
|
LL | impl Sized for (MyType, MyType) {} //~ ERROR E0322
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed
error[E0322]: explicit impls for the `Sized` trait are not permitted
--> $DIR/coherence-impls-sized.rs:35:1
|
LL | impl Sized for &'static NotSync {} //~ ERROR E0322
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed
error[E0322]: explicit impls for the `Sized` trait are not permitted
--> $DIR/coherence-impls-sized.rs:38:1
|
LL | impl Sized for [MyType] {} //~ ERROR E0322
| ^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed
error[E0322]: explicit impls for the `Sized` trait are not permitted
--> $DIR/coherence-impls-sized.rs:42:1
|
LL | impl Sized for &'static [NotSync] {} //~ ERROR E0322
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-impls-sized.rs:31:1
|
LL | impl Sized for (MyType, MyType) {} //~ ERROR E0322
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-impls-sized.rs:38:1
|
LL | impl Sized for [MyType] {} //~ ERROR E0322
| ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence-impls-sized.rs:42:1
|
LL | impl Sized for &'static [NotSync] {} //~ ERROR E0322
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
|
= note: the impl does not reference any types defined in this crate
= note: define and implement a trait or new type instead
error: aborting due to 9 previous errors
Some errors occurred: E0117, E0322.
For more information about an error, try `rustc --explain E0117`.

Some files were not shown because too many files have changed in this diff Show More