]> git.proxmox.com Git - rustc.git/blame - src/test/ui/span/dropck_misc_variants.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / span / dropck_misc_variants.rs
CommitLineData
c1a9b12d
SL
1// check that dropck does the right thing with misc. Ty variants
2
3use std::fmt;
4struct NoisyDrop<T: fmt::Debug>(T);
5impl<T: fmt::Debug> Drop for NoisyDrop<T> {
6 fn drop(&mut self) {
7 let _ = vec!["0wned"];
8 println!("dropping {:?}", self.0)
9 }
10}
11
12trait Associator {
13 type As;
14}
15impl<T: fmt::Debug> Associator for T {
16 type As = NoisyDrop<T>;
17}
18struct Wrap<A: Associator>(<A as Associator>::As);
19
20fn projection() {
21 let (_w, bomb);
22 bomb = vec![""];
23 _w = Wrap::<&[&str]>(NoisyDrop(&bomb));
c1a9b12d 24}
ff7c6d11 25//~^^ ERROR `bomb` does not live long enough
c1a9b12d
SL
26
27fn closure() {
28 let (_w,v);
29 v = vec![""];
30 _w = {
31 let u = NoisyDrop(&v);
ff7c6d11 32 //~^ ERROR `v` does not live long enough
c1a9b12d
SL
33 move || u.0.len()
34 };
35}
36
37fn main() { closure(); projection() }