Fixed bug with miri const evaluation where allocation is recursively borrowed.
This commit is contained in:
parent
349d53c2a9
commit
a2cd95fd9e
4 changed files with 3 additions and 7 deletions
|
|
@ -305,7 +305,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
|
|||
Some(alloc) => Ok(alloc),
|
||||
None => {
|
||||
// static alloc?
|
||||
match self.tcx.alloc_map.lock().get(id) {
|
||||
let alloc = self.tcx.alloc_map.lock().get(id);
|
||||
match alloc {
|
||||
Some(AllocType::Memory(mem)) => Ok(mem),
|
||||
Some(AllocType::Function(..)) => {
|
||||
Err(EvalErrorKind::DerefFunctionPointer.into())
|
||||
|
|
|
|||
|
|
@ -16,5 +16,6 @@ extern {
|
|||
|
||||
pub static BAZ: u32 = *&error_message_count;
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| tried to read foreign (extern) static
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,7 @@ extern crate pub_static_array as array;
|
|||
use array::ARRAY;
|
||||
|
||||
static X: &'static u8 = &ARRAY[0];
|
||||
//~^ ERROR: cannot refer to the interior of another static, use a constant
|
||||
|
||||
static Y: &'static u8 = &(&ARRAY)[0];
|
||||
//~^ ERROR: cannot refer to the interior of another static, use a constant
|
||||
|
||||
static Z: u8 = (&ARRAY)[0];
|
||||
//~^ ERROR: cannot refer to the interior of another static, use a constant
|
||||
//~^^ ERROR: cannot refer to other statics by value
|
||||
|
||||
pub fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue