2018-10-23 06:09:17 -05:00
|
|
|
// FIXME: Without retagging, optimization kills finding this problem
|
|
|
|
// compile-flags: -Zmir-opt-level=0
|
|
|
|
|
2017-08-10 15:56:12 -05:00
|
|
|
#![allow(unused_variables)]
|
|
|
|
|
|
|
|
mod safe {
|
|
|
|
use std::slice::from_raw_parts_mut;
|
|
|
|
|
|
|
|
pub fn as_mut_slice<T>(self_: &Vec<T>) -> &mut [T] {
|
|
|
|
unsafe {
|
2018-10-18 05:04:41 -05:00
|
|
|
from_raw_parts_mut(self_.as_ptr() as *mut T, self_.len())
|
2017-08-10 15:56:12 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let v = vec![0,1,2];
|
2018-10-17 09:55:59 -05:00
|
|
|
let v1 = safe::as_mut_slice(&v);
|
|
|
|
let v2 = safe::as_mut_slice(&v);
|
2018-10-23 08:59:50 -05:00
|
|
|
v1[1] = 5; //~ ERROR Mut reference with non-reactivatable tag
|
2018-10-18 05:04:41 -05:00
|
|
|
v1[1] = 6;
|
2017-08-10 15:56:12 -05:00
|
|
|
}
|