Skip to content

Commit 673d97e

Browse files
committed
Added tests for rust-lang#47703
1 parent 4d2d3fc commit 673d97e

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

Diff for: src/test/run-pass/issue-47703-1.rs

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2012 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.
4+
//
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.
10+
11+
#![feature(nll)]
12+
13+
struct AtomicRefMut<'a> {
14+
value: &'a mut i32,
15+
borrow: AtomicBorrowRefMut,
16+
}
17+
18+
struct AtomicBorrowRefMut {
19+
}
20+
21+
impl Drop for AtomicBorrowRefMut {
22+
fn drop(&mut self) {
23+
}
24+
}
25+
26+
fn map(orig: AtomicRefMut) -> AtomicRefMut {
27+
AtomicRefMut {
28+
value: orig.value,
29+
borrow: orig.borrow,
30+
}
31+
}
32+
33+
fn main() {}

Diff for: src/test/run-pass/issue-47703.rs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2012 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.
4+
//
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.
10+
11+
#![feature(nll)]
12+
13+
struct MyStruct<'a> {
14+
field: &'a mut (),
15+
field2: WithDrop
16+
}
17+
18+
struct WithDrop;
19+
20+
impl Drop for WithDrop {
21+
fn drop(&mut self) {}
22+
}
23+
24+
impl<'a> MyStruct<'a> {
25+
fn consume(self) -> &'a mut () { self.field }
26+
}
27+
28+
fn main() {}

0 commit comments

Comments
 (0)