-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-bugCategory: This is a bug.Category: This is a bug.
Description
I think I've encountered a bug, as was described in this stack overflow question. In particular, I would expect the syntax in the following code to be allowed:
#[derive(Clone, PartialEq, Debug)]
enum Foo {
Base,
Branch(Box<(Foo, Foo)>)
}
fn do_something(f: Foo) -> Foo {
match f {
Foo::Base => Foo::Base,
Foo::Branch(pair) => {
let (f1, f2) = *pair; // ... What do I do here?
if f2 == Foo::Base { f1 } else { f2 }
}
}
}
fn main() {
let foo = Foo::Base;
println!("Foo: {:?}", do_something(foo));
}
Instead, I need to do something like
let p = *pair;
let (f1, f2) = p;
Meta
I tried this on the latest nightly release of rustc
using the rust playground and it still doesn't work. I'm still somewhat new with rust so let me know if this isn't a bug!
Metadata
Metadata
Assignees
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-bugCategory: This is a bug.Category: This is a bug.