Skip to content

Commit a0319fb

Browse files
committed
---
yaml --- r: 272705 b: refs/heads/beta c: fbd8171 h: refs/heads/master i: 272703: c775b32
1 parent e7b02e6 commit a0319fb

File tree

4 files changed

+124
-1
lines changed

4 files changed

+124
-1
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: ba26efb60c9e11ab058a1c31b9816147c55ab417
26+
refs/heads/beta: fbd817115525b8f11ffe0a301e17341684771369
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2016 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+
#![feature(rustc_attrs)]
11+
// error-pattern:drop 1
12+
// error-pattern:drop 2
13+
use std::io::{self, Write};
14+
15+
16+
/// Structure which will not allow to be dropped twice.
17+
struct Droppable(bool, u32);
18+
impl Drop for Droppable {
19+
fn drop(&mut self) {
20+
if self.0 {
21+
writeln!(io::stderr(), "{} dropped twice", self.1);
22+
::std::process::exit(1);
23+
}
24+
writeln!(io::stderr(), "drop {}", self.1);
25+
self.0 = true;
26+
}
27+
}
28+
29+
#[rustc_mir]
30+
fn mir(){
31+
let x = Droppable(false, 1);
32+
let y = Droppable(false, 2);
33+
let mut z = x;
34+
let k = y;
35+
z = k;
36+
}
37+
38+
fn main() {
39+
mir();
40+
panic!();
41+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2016 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+
#![feature(rustc_attrs)]
11+
// error-pattern:drop 1
12+
use std::io::{self, Write};
13+
14+
15+
/// Structure which will not allow to be dropped twice.
16+
struct Droppable(bool, u32);
17+
impl Drop for Droppable {
18+
fn drop(&mut self) {
19+
if self.0 {
20+
writeln!(io::stderr(), "{} dropped twice", self.1);
21+
::std::process::exit(1);
22+
}
23+
writeln!(io::stderr(), "drop {}", self.1);
24+
self.0 = true;
25+
}
26+
}
27+
28+
#[rustc_mir]
29+
fn mir(d: Droppable){
30+
loop {
31+
let x = d;
32+
break;
33+
}
34+
}
35+
36+
fn main() {
37+
mir(Droppable(false, 1));
38+
panic!();
39+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright 2016 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+
#![feature(rustc_attrs)]
11+
// error-pattern:unwind happens
12+
// error-pattern:drop 3
13+
// error-pattern:drop 2
14+
// error-pattern:drop 1
15+
use std::io::{self, Write};
16+
17+
18+
/// Structure which will not allow to be dropped twice.
19+
struct Droppable(bool, u32);
20+
impl Drop for Droppable {
21+
fn drop(&mut self) {
22+
if self.0 {
23+
writeln!(io::stderr(), "{} dropped twice", self.1);
24+
::std::process::exit(1);
25+
}
26+
writeln!(io::stderr(), "drop {}", self.1);
27+
self.0 = true;
28+
}
29+
}
30+
31+
fn may_panic() -> Droppable {
32+
panic!("unwind happens");
33+
}
34+
35+
#[rustc_mir]
36+
fn mir(d: Droppable){
37+
let y = Droppable(false, 2);
38+
let x = [Droppable(false, 1), y, d, may_panic()];
39+
}
40+
41+
fn main() {
42+
mir(Droppable(false, 3));
43+
}

0 commit comments

Comments
 (0)