mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 02:00:00 +03:00
Fixed bug with miri const evaluation where allocation is recursively borrowed.
This commit is contained in:
@@ -305,7 +305,8 @@ pub fn get(&self, id: AllocId) -> EvalResult<'tcx, &Allocation> {
|
||||
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 @@
|
||||
|
||||
pub static BAZ: u32 = *&error_message_count;
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| tried to read foreign (extern) static
|
||||
|
||||
fn main() {}
|
||||
|
||||
-6
@@ -15,13 +15,7 @@
|
||||
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() {}
|
||||
Reference in New Issue
Block a user