about summary refs log tree commit diff
path: root/tests/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs
blob: 1992baf8c7655934af9d3e777bed7fcc65cc0229 (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
//@ compile-flags: -Copt-level=0

#![crate_type = "lib"]

pub trait Trait: Sized {
    fn without_self() -> u32;
    fn without_self_default() -> u32 {
        0
    }

    fn with_default_impl(self) -> Self {
        self
    }
    fn with_default_impl_generic<T>(self, x: T) -> (Self, T) {
        (self, x)
    }

    fn without_default_impl(x: u32) -> (Self, u32);
    fn without_default_impl_generic<T>(x: T) -> (Self, T);
}

impl Trait for char {
    fn without_self() -> u32 {
        2
    }
    fn without_default_impl(x: u32) -> (Self, u32) {
        ('c', x)
    }
    fn without_default_impl_generic<T>(x: T) -> (Self, T) {
        ('c', x)
    }
}

impl Trait for u32 {
    fn without_self() -> u32 {
        1
    }
    fn without_default_impl(x: u32) -> (Self, u32) {
        (0, x)
    }
    fn without_default_impl_generic<T>(x: T) -> (Self, T) {
        (0, x)
    }
}