Skip to content

Commit 6594799

Browse files
committed
add and unignore tests
1 parent 9dc3967 commit 6594799

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2017 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+
// revisions: ast mir
12+
//[mir]compile-flags: -Z borrowck=mir
13+
14+
fn cplusplus_mode_exceptionally_unsafe(x: &mut Option<&'static mut isize>) {
15+
let mut z = (0, 0);
16+
*x = Some(&mut z.1); //[ast]~ ERROR [E0597]
17+
//[mir]~^ ERROR [E0597]
18+
panic!("catch me for a dangling pointer!")
19+
}
20+
21+
fn main() {
22+
cplusplus_mode_exceptionally_unsafe(&mut None);
23+
}

src/test/mir-opt/nll/region-liveness-drop-no-may-dangle.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// including) the call to `use_x`. The `else` branch is not included.
1414

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

@@ -47,5 +46,5 @@ impl<T> Drop for Wrap<T> {
4746

4847
// END RUST SOURCE
4948
// START rustc.main.nll.0.mir
50-
// | '_#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]}
49+
// | '_#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]}
5150
// END rustc.main.nll.0.mir

0 commit comments

Comments
 (0)