Skip to content

ICE with validation disabled #754

Closed
rust-lang/rust
#61404
@RalfJung

Description

@RalfJung

The following test passes normally but ICEs when validation gets disabled:

use std::cell::*;

fn main() {
    let cell: RefCell<[i32; 3]> = RefCell::new([1, 2, 3]);
    {
        let mut cellref: RefMut<'_, [i32; 3]> = cell.borrow_mut();
        cellref[0] = 4;
        let mut coerced: RefMut<'_, [i32]> = cellref;
        coerced[2] = 5;
    }
    {
        let comp: &mut [i32] = &mut [4, 2, 5];
        let cellref: Ref<'_, [i32; 3]> = cell.borrow();
        assert_eq!(&*cellref, comp);
        let coerced: Ref<'_, [i32]> = cellref;
        assert_eq!(&*coerced, comp);
    }
}

We don't test -Zmiri-disable-validation very much. But we also cannot test every flag...

Metadata

Metadata

Assignees

Labels

A-interpreterArea: affects the core interpreterC-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions