aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/issue-3035.rs
blob: 3266d841dea0dd8507df2897fdbdd7c84e7b246e (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
#[lang = "sized"]
trait Sized {}

// ---- gccrs additions

#[lang = "clone"]
pub trait Clone: Sized {
    #[stable(feature = "rust1", since = "1.0.0")]
    #[must_use = "cloning is often expensive and is not expected to have side effects"]
    fn clone(&self) -> Self;

    #[inline]
    #[stable(feature = "rust1", since = "1.0.0")]
    fn clone_from(&mut self, source: &Self) {
        *self = source.clone()
    }
}

#[unstable(feature = "never_type", issue = "35121")]
impl Clone for ! {
    #[inline]
    fn clone(&self) -> Self {
        *self
    }
}