The const_mut_refs feature gate allows the following in const context:
&mut arguments
- mutable (re)borrows and raw pointers (
&mut and addr_of_mut! expressions)
- dereferencing mutable references and raw pointers (
* expressions)
Remaining work
Open questions
The
const_mut_refsfeature gate allows the following in const context:&mutarguments&mutandaddr_of_mut!expressions)*expressions)Remaining work
static mut FOO: &'static mut i32 = &mut 42;is problematic, because LLVM currently duplicates the inner mutable reference when you dostatic mut BAR: &'static mut i32 = FOO;. It would probably suffice to give all nested allocations in a static names relative to their original static item. Named allocations are neither deduplicated nor duplicated.constrelies on types more than it should, given thattransmuteis available in consts. Fixed in const-eval interning: get rid of type-driven traversal #119044.&mut(and*mut) as well as&Cell(and*const Cell) in const #129195Open questions
index out of bounds: the len is 5 but the index is 5#122399, ICE: hir: index out of bounds: the len is 5 but the index is 5 rustc_codegen_gcc#473