Skip to content

ref in function parameter patterns #8860

Closed
@ben0x539

Description

@ben0x539

The following program doesn't print "drop". Looks unsound to me.

struct S; 
impl Drop for S {
    fn drop(&self) {
        println("drop"); 
    } 
} 

fn f(ref _s: S) {}

fn main() { 
    let s = S;
    f(s);
}

In #5239, @nikomatsakis suggested that ref shouldn't be allowed in argument patterns at all, but then that bug got closed because the ICE/llvm asserts over there stopped occuring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.P-mediumMedium priority

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions