From: Scott Olson Date: Mon, 9 May 2016 01:30:17 +0000 (-0600) Subject: Move StructWrappedNullablePointer-using test to bugs dir. X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=d825ef1bf11c1b4005e6fc2c7cd135695f84104b;p=rust.git Move StructWrappedNullablePointer-using test to bugs dir. --- diff --git a/tests/compile-fail/bugs/struct_wrapped_nullable_pointer.rs b/tests/compile-fail/bugs/struct_wrapped_nullable_pointer.rs new file mode 100644 index 00000000000..880ca42d455 --- /dev/null +++ b/tests/compile-fail/bugs/struct_wrapped_nullable_pointer.rs @@ -0,0 +1,23 @@ +#![feature(custom_attribute, box_syntax)] +#![allow(dead_code, unused_attributes)] + +// error-pattern:can't handle destination layout StructWrappedNullablePointer + +use std::cell::RefCell; +use std::rc::Rc; + +struct Loop(Rc>>); + +#[miri_run] +fn rc_reference_cycle() -> Loop { + let a = Rc::new(RefCell::new(None)); + let b = a.clone(); + *a.borrow_mut() = Some(Loop(b)); + Loop(a) +} + +#[miri_run] +fn main() { + let x = rc_reference_cycle().0; + assert!(x.borrow().is_some()); +} diff --git a/tests/run-pass/std.rs b/tests/run-pass/std.rs index 1d4dc8befef..b5bb7c7dbdb 100644 --- a/tests/run-pass/std.rs +++ b/tests/run-pass/std.rs @@ -1,7 +1,7 @@ #![feature(custom_attribute, box_syntax)] #![allow(dead_code, unused_attributes)] -use std::cell::{Cell, RefCell}; +use std::cell::Cell; use std::rc::Rc; use std::sync::Arc; @@ -29,16 +29,6 @@ fn arc() -> Arc { a } -struct Loop(Rc>>); - -#[miri_run] -fn rc_reference_cycle() -> Loop { - let a = Rc::new(RefCell::new(None)); - let b = a.clone(); - *a.borrow_mut() = Some(Loop(b)); - Loop(a) -} - #[miri_run] fn true_assert() { assert_eq!(1, 1); @@ -46,8 +36,6 @@ fn true_assert() { #[miri_run] fn main() { - //let x = rc_reference_cycle().0; - //assert!(x.borrow().is_some()); assert_eq!(*arc(), 42); assert_eq!(rc_cell().get(), 84); }