]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/stage0-clone-contravariant-lifetime.rs
Delete the outdated source layout README
[rust.git] / src / test / compile-fail / stage0-clone-contravariant-lifetime.rs
1 // Copyright 2014 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 // A zero-dependency test that covers some basic traits, default
12 // methods, etc.  When mucking about with basic type system stuff I
13 // often encounter problems in the iterator trait, so it's useful to
14 // have hanging around. -nmatsakis
15
16 // error-pattern: requires `start` lang_item
17
18 #![no_std]
19 #![feature(lang_items)]
20
21 #[lang = "sized"]
22 pub trait Sized for Sized? {
23     // Empty.
24 }
25
26 pub mod std {
27     pub mod clone {
28         pub trait Clone {
29             fn clone(&self) -> Self;
30         }
31     }
32 }
33
34 pub struct ContravariantLifetime<'a>;
35
36 impl <'a> ::std::clone::Clone for ContravariantLifetime<'a> {
37     #[inline]
38     fn clone(&self) -> ContravariantLifetime<'a> {
39         match *self { ContravariantLifetime => ContravariantLifetime, }
40     }
41 }
42
43 fn main() { }