]>
git.proxmox.com Git - rustc.git/blob - src/test/codegen-units/generic-impl.rs
1 // Copyright 2012-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.
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.
11 // ignore-tidy-linelength
12 // compile-flags:-Zprint-trans-items=eager
21 fn id
<T
>(x
: T
) -> T { x }
25 fn new(x
: T
) -> Struct
<T
> {
32 fn get
<T2
>(self, x
: T2
) -> (T
, T2
) {
37 pub struct LifeTimeOnly
<'a
> {
41 impl<'a
> LifeTimeOnly
<'a
> {
43 //~ TRANS_ITEM fn generic_impl::{{impl}}[1]::foo[0]
45 //~ TRANS_ITEM fn generic_impl::{{impl}}[1]::bar[0]
46 pub fn bar(&'a
self) {}
47 //~ TRANS_ITEM fn generic_impl::{{impl}}[1]::baz[0]
48 pub fn baz
<'b
>(&'b
self) {}
50 pub fn non_instantiated
<T
>(&self) {}
54 //~ TRANS_ITEM fn generic_impl::main[0]
56 //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::new[0]<i32>
57 //~ TRANS_ITEM fn generic_impl::id[0]<i32>
58 //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::get[0]<i32, i16>
59 let _
= Struct
::new(0i32).get(0i16);
61 //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::new[0]<i64>
62 //~ TRANS_ITEM fn generic_impl::id[0]<i64>
63 //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::get[0]<i64, i16>
64 let _
= Struct
::new(0i64).get(0i16);
66 //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::new[0]<char>
67 //~ TRANS_ITEM fn generic_impl::id[0]<char>
68 //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::get[0]<char, i16>
69 let _
= Struct
::new('c'
).get(0i16);
71 //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::new[0]<&str>
72 //~ TRANS_ITEM fn generic_impl::id[0]<&str>
73 //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::get[0]<generic_impl::Struct[0]<&str>, i16>
74 let _
= Struct
::new(Struct
::new("str")).get(0i16);
76 //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::new[0]<generic_impl::Struct[0]<&str>>
77 //~ TRANS_ITEM fn generic_impl::id[0]<generic_impl::Struct[0]<&str>>
78 let _
= (Struct
::new(Struct
::new("str")).f
)(Struct
::new("str"));
81 //~ TRANS_ITEM drop-glue i8