Skip to content

Commit

Permalink
add and unignore tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arielb1 committed Dec 3, 2017
1 parent 9dc3967 commit 6594799
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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.

// revisions: ast mir
//[mir]compile-flags: -Z borrowck=mir

fn cplusplus_mode_exceptionally_unsafe(x: &mut Option<&'static mut isize>) {
let mut z = (0, 0);
*x = Some(&mut z.1); //[ast]~ ERROR [E0597]
//[mir]~^ ERROR [E0597]
panic!("catch me for a dangling pointer!")
}

fn main() {
cplusplus_mode_exceptionally_unsafe(&mut None);
}
3 changes: 1 addition & 2 deletions src/test/mir-opt/nll/region-liveness-drop-no-may-dangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// including) the call to `use_x`. The `else` branch is not included.

// ignore-tidy-linelength
// ignore-test #46267
// compile-flags:-Znll -Zverbose
// ^^^^^^^^^ force compiler to dump more region information

Expand Down Expand Up @@ -47,5 +46,5 @@ impl<T> Drop for Wrap<T> {

// END RUST SOURCE
// START rustc.main.nll.0.mir
// | '_#5r: {bb1[3], bb1[4], bb1[5], bb2[0], bb2[1], bb2[2], bb3[0], bb4[0], bb4[1], bb4[2], bb6[0], bb7[0], bb7[1], bb8[0]}
// | '_#5r: {bb2[3], bb2[4], bb2[5], bb3[0], bb3[1], bb3[2], bb4[0], bb5[0], bb5[1], bb5[2], bb6[0], bb7[0], bb7[1], bb8[0]}
// END rustc.main.nll.0.mir

0 comments on commit 6594799

Please sign in to comment.