Fixed bug with miri const evaluation where allocation is recursively borrowed.

This commit is contained in:
Alexander Regueiro 2018-05-30 19:27:45 +01:00
parent 349d53c2a9
commit a2cd95fd9e
4 changed files with 3 additions and 7 deletions

View file

@ -1,11 +0,0 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub static ARRAY: [u8; 1] = [1];

View file

@ -16,5 +16,6 @@ extern {
pub static BAZ: u32 = *&error_message_count;
//~^ ERROR constant evaluation error
//~| tried to read foreign (extern) static
fn main() {}

View file

@ -1,27 +0,0 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// aux-build:pub_static_array.rs
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() {}