Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

matching is always considered a use of the place, even with _ patterns #27

Closed
rust-lang/rust
#82536
@nikomatsakis

Description

@nikomatsakis

In this example playground:

    let foo = [1, 2, 3];
    let c = || match foo { _ => () };

the match foo winds up registering a read of foo in the ExprUseVisitor. Note that the behavior here is different from let _ = foo. This is also somewhat inconsistent with the borrow checker, which considers match foo { _ => () } to not be a use (i.e., this code compiles, playground):

let mut x = 1;
let y = &x;
match x { _ => () }
drop(y);

Metadata

Metadata

Assignees

Labels

edge-casesThings we should remember when documenting

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions