[llvm-dev] RFC: Decomposing deref(N) into deref(N) + nofree

Jacob Lifshay via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 12 11:12:57 PDT 2021


On Mon, Jul 12, 2021, 09:05 Philip Reames via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> // At first appearance, rust does not allow returning references.  So return// attributes are not relevant.  This seems like a major language hole, so this// should probably be checked with a language expert.
>
> I'll note that Rust totally allows returning references:
https://rust.godbolt.org/z/rcvdEPGW4

pub fn f(a: &mut [i32; 3]) -> &mut i32 {
    &mut a[2]
}

Jacob Lifshay

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210712/73324446/attachment.html>


More information about the llvm-dev mailing list