2016-03-29 11:12:12 -05:00
|
|
|
#![crate_type="rlib"]
|
|
|
|
|
2016-09-29 02:24:14 -05:00
|
|
|
pub trait Foo {
|
2017-01-09 08:52:08 -06:00
|
|
|
fn generic_method<T>();
|
2016-09-29 02:24:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
pub struct Bar;
|
|
|
|
|
|
|
|
impl Foo for Bar {
|
2017-01-09 08:52:08 -06:00
|
|
|
fn generic_method<T>() {}
|
2016-09-29 02:24:14 -05:00
|
|
|
}
|
|
|
|
|
2017-01-09 08:52:08 -06:00
|
|
|
pub fn mono_function() {
|
|
|
|
Bar::generic_method::<Bar>();
|
2016-09-29 02:24:14 -05:00
|
|
|
}
|
|
|
|
|
2017-01-09 08:52:08 -06:00
|
|
|
pub fn mono_function_lifetime<'a>(x: &'a u64) -> u64 {
|
|
|
|
*x
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn generic_function<T>(t: T) -> T {
|
2016-03-29 11:12:12 -05:00
|
|
|
t
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn user() {
|
2017-01-09 08:52:08 -06:00
|
|
|
generic_function(0u32);
|
|
|
|
generic_function("abc");
|
2016-03-29 11:12:12 -05:00
|
|
|
let x = 2u64;
|
2017-01-09 08:52:08 -06:00
|
|
|
generic_function(&x);
|
|
|
|
let _ = mono_function_lifetime(&x);
|
2016-03-29 11:12:12 -05:00
|
|
|
}
|