Skip to content

Commit e46a5da

Browse files
committed
---
yaml --- r: 272707 b: refs/heads/beta c: 356bf52 h: refs/heads/master i: 272705: a0319fb 272703: c775b32
1 parent 89c67a1 commit e46a5da

File tree

4 files changed

+26
-22
lines changed

4 files changed

+26
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 77be4ecc1795787eab4b51b9def35096546122ec
26+
refs/heads/beta: 356bf529eedaea523b4266057b2ce8a13435b737
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/test/run-fail/mir_dynamic_drops_1.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,23 @@ use std::io::{self, Write};
1414

1515

1616
/// Structure which will not allow to be dropped twice.
17-
struct Droppable(bool, u32);
18-
impl Drop for Droppable {
17+
struct Droppable<'a>(&'a mut bool, u32);
18+
impl<'a> Drop for Droppable<'a> {
1919
fn drop(&mut self) {
20-
if self.0 {
20+
if *self.0 {
2121
writeln!(io::stderr(), "{} dropped twice", self.1);
2222
::std::process::exit(1);
2323
}
2424
writeln!(io::stderr(), "drop {}", self.1);
25-
self.0 = true;
25+
*self.0 = true;
2626
}
2727
}
2828

2929
#[rustc_mir]
3030
fn mir(){
31-
let x = Droppable(false, 1);
32-
let y = Droppable(false, 2);
31+
let (mut xv, mut yv) = (false, false);
32+
let x = Droppable(&mut xv, 1);
33+
let y = Droppable(&mut yv, 2);
3334
let mut z = x;
3435
let k = y;
3536
z = k;

branches/beta/src/test/run-fail/mir_dynamic_drops_2.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,28 @@ use std::io::{self, Write};
1313

1414

1515
/// Structure which will not allow to be dropped twice.
16-
struct Droppable(bool, u32);
17-
impl Drop for Droppable {
16+
struct Droppable<'a>(&'a mut bool, u32);
17+
impl<'a> Drop for Droppable<'a> {
1818
fn drop(&mut self) {
19-
if self.0 {
19+
if *self.0 {
2020
writeln!(io::stderr(), "{} dropped twice", self.1);
2121
::std::process::exit(1);
2222
}
2323
writeln!(io::stderr(), "drop {}", self.1);
24-
self.0 = true;
24+
*self.0 = true;
2525
}
2626
}
2727

2828
#[rustc_mir]
29-
fn mir(d: Droppable){
29+
fn mir<'a>(d: Droppable<'a>){
3030
loop {
3131
let x = d;
3232
break;
3333
}
3434
}
3535

3636
fn main() {
37-
mir(Droppable(false, 1));
37+
let mut xv = false;
38+
mir(Droppable(&mut xv, 1));
3839
panic!();
3940
}

branches/beta/src/test/run-fail/mir_dynamic_drops_3.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,30 @@ use std::io::{self, Write};
1616

1717

1818
/// Structure which will not allow to be dropped twice.
19-
struct Droppable(bool, u32);
20-
impl Drop for Droppable {
19+
struct Droppable<'a>(&'a mut bool, u32);
20+
impl<'a> Drop for Droppable<'a> {
2121
fn drop(&mut self) {
22-
if self.0 {
22+
if *self.0 {
2323
writeln!(io::stderr(), "{} dropped twice", self.1);
2424
::std::process::exit(1);
2525
}
2626
writeln!(io::stderr(), "drop {}", self.1);
27-
self.0 = true;
27+
*self.0 = true;
2828
}
2929
}
3030

31-
fn may_panic() -> Droppable {
31+
fn may_panic<'a>() -> Droppable<'a> {
3232
panic!("unwind happens");
3333
}
3434

3535
#[rustc_mir]
36-
fn mir(d: Droppable){
37-
let y = Droppable(false, 2);
38-
let x = [Droppable(false, 1), y, d, may_panic()];
36+
fn mir<'a>(d: Droppable<'a>){
37+
let (mut a, mut b) = (false, false);
38+
let y = Droppable(&mut a, 2);
39+
let x = [Droppable(&mut b, 1), y, d, may_panic()];
3940
}
4041

4142
fn main() {
42-
mir(Droppable(false, 3));
43+
let mut c = false;
44+
mir(Droppable(&mut c, 3));
4345
}

0 commit comments

Comments
 (0)