2017-08-14 14:10:05 +03:00
|
|
|
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2017-11-26 10:39:16 -08:00
|
|
|
// ignore-wasm32-bare compiled with panic=abort by default
|
|
|
|
|
2017-08-14 14:10:05 +03:00
|
|
|
#![feature(box_syntax)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = box S::new();
|
|
|
|
drop(x);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
impl S {
|
|
|
|
fn new() -> Self { S }
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for S {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
println!("splat!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// END RUST SOURCE
|
2017-11-04 14:27:08 +03:00
|
|
|
// START rustc.main.ElaborateDrops.before.mir
|
2017-08-14 14:10:05 +03:00
|
|
|
// let mut _0: ();
|
2017-10-09 23:14:13 -04:00
|
|
|
// scope 1 {
|
2018-05-29 13:54:24 +03:00
|
|
|
// }
|
|
|
|
// scope 2 {
|
2017-10-09 23:14:13 -04:00
|
|
|
// let _1: std::boxed::Box<S>;
|
|
|
|
// }
|
2017-08-14 14:10:05 +03:00
|
|
|
// let mut _2: std::boxed::Box<S>;
|
|
|
|
// let mut _3: ();
|
|
|
|
// let mut _4: std::boxed::Box<S>;
|
|
|
|
//
|
|
|
|
// bb0: {
|
|
|
|
// StorageLive(_1);
|
|
|
|
// StorageLive(_2);
|
|
|
|
// _2 = Box(S);
|
2017-11-28 01:45:16 +02:00
|
|
|
// (*_2) = const S::new() -> [return: bb2, unwind: bb3];
|
2017-08-14 14:10:05 +03:00
|
|
|
// }
|
|
|
|
//
|
|
|
|
// bb1: {
|
2017-11-28 01:45:16 +02:00
|
|
|
// resume;
|
2017-08-14 14:10:05 +03:00
|
|
|
// }
|
|
|
|
//
|
|
|
|
// bb2: {
|
2017-11-28 01:45:16 +02:00
|
|
|
// _1 = move _2;
|
|
|
|
// drop(_2) -> bb4;
|
2017-08-14 14:10:05 +03:00
|
|
|
// }
|
|
|
|
//
|
|
|
|
// bb3: {
|
2017-11-28 01:45:16 +02:00
|
|
|
// drop(_2) -> bb1;
|
2017-08-14 14:10:05 +03:00
|
|
|
// }
|
|
|
|
//
|
|
|
|
// bb4: {
|
|
|
|
// StorageDead(_2);
|
|
|
|
// StorageLive(_4);
|
2017-11-17 18:22:44 +02:00
|
|
|
// _4 = move _1;
|
|
|
|
// _3 = const std::mem::drop(move _4) -> [return: bb5, unwind: bb7];
|
2017-08-14 14:10:05 +03:00
|
|
|
// }
|
|
|
|
//
|
|
|
|
// bb5: {
|
|
|
|
// drop(_4) -> [return: bb8, unwind: bb6];
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// bb6: {
|
2017-11-28 01:45:16 +02:00
|
|
|
// drop(_1) -> bb1;
|
2017-08-14 14:10:05 +03:00
|
|
|
// }
|
|
|
|
//
|
|
|
|
// bb7: {
|
|
|
|
// drop(_4) -> bb6;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// bb8: {
|
|
|
|
// StorageDead(_4);
|
|
|
|
// _0 = ();
|
|
|
|
// drop(_1) -> bb9;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// bb9: {
|
|
|
|
// StorageDead(_1);
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// }
|
2017-11-04 14:27:08 +03:00
|
|
|
// END rustc.main.ElaborateDrops.before.mir
|