]> git.lizzy.rs Git - rust.git/blob - src/test/ui/coherence/coherence-impls-copy.rs
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / coherence / coherence-impls-copy.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![feature(optin_builtin_traits)]
12
13 use std::marker::Copy;
14
15 impl Copy for i32 {}
16 //~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `i32`:
17 //~| ERROR only traits defined in the current crate can be implemented for arbitrary types
18
19 enum TestE {
20   A
21 }
22
23 struct MyType;
24
25 struct NotSync;
26 impl !Sync for NotSync {}
27
28 impl Copy for TestE {}
29 impl Clone for TestE { fn clone(&self) -> Self { *self } }
30
31 impl Copy for MyType {}
32
33 impl Copy for &'static mut MyType {}
34 //~^ ERROR the trait `Copy` may not be implemented for this type
35 impl Clone for MyType { fn clone(&self) -> Self { *self } }
36
37 impl Copy for (MyType, MyType) {}
38 //~^ ERROR the trait `Copy` may not be implemented for this type
39 //~| ERROR only traits defined in the current crate can be implemented for arbitrary types
40
41 impl Copy for &'static NotSync {}
42 //~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&NotSync`:
43
44 impl Copy for [MyType] {}
45 //~^ ERROR the trait `Copy` may not be implemented for this type
46 //~| ERROR only traits defined in the current crate can be implemented for arbitrary types
47
48 impl Copy for &'static [NotSync] {}
49 //~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`:
50 //~| ERROR only traits defined in the current crate can be implemented for arbitrary types
51
52 fn main() {
53 }