about summary refs log tree commit diff
path: root/src/test/ui/coherence/coherence-impls-copy.rs
blob: 97133bc33ce0deb46f2c3778b34f2cbf639bd39f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// revisions: old re

#![cfg_attr(re, feature(re_rebalance_coherence))]
#![feature(optin_builtin_traits)]

use std::marker::Copy;

impl Copy for i32 {}
//[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
}

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 {}
//[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) {}
//[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 {}
//[old]~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&NotSync`:
//[re]~^^  ERROR E0119
impl Copy for [MyType] {}
//[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] {}
//[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() {
}