summaryrefslogtreecommitdiffstats
path: root/third_party/rust/rental/tests/trait.rs
blob: 180e328ce1c35d01786070499223a299886153e2 (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
#[macro_use]
extern crate rental;


pub trait MyTrait { }


pub struct MyStruct { }


impl MyTrait for MyStruct { }


rental! {
    pub mod rentals {
		use ::MyTrait;

		#[rental]
		pub struct RentTrait {
			my_trait: Box<MyTrait + 'static>,
			my_suffix: &'my_trait (MyTrait + 'static),
		}
	}
}


#[test]
fn new() {
	let _tr = rentals::RentTrait::new(
		Box::new(MyStruct{}),
		|t| &*t,
	);
}