2018-08-30 12:18:55 +00:00
|
|
|
//@ run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(unused_variables)]
|
2015-02-05 04:04:10 +00:00
|
|
|
// Regression test for issue 7660
|
2014-02-18 20:55:18 +00:00
|
|
|
// rvalue lifetime too short when equivalent `match` works
|
|
|
|
|
2015-03-22 20:13:15 +00:00
|
|
|
//@ pretty-expanded FIXME #23616
|
|
|
|
|
2014-05-30 02:03:06 +00:00
|
|
|
use std::collections::HashMap;
|
2014-02-18 20:55:18 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
struct A(isize, isize);
|
2014-02-18 20:55:18 +00:00
|
|
|
|
|
|
|
pub fn main() {
|
2015-03-26 00:06:52 +00:00
|
|
|
let mut m: HashMap<isize, A> = HashMap::new();
|
2014-02-18 20:55:18 +00:00
|
|
|
m.insert(1, A(0, 0));
|
|
|
|
|
2015-03-22 01:15:47 +00:00
|
|
|
let A(ref _a, ref _b) = m[&1];
|
|
|
|
let (a, b) = match m[&1] { A(ref _a, ref _b) => (_a, _b) };
|
2014-02-18 20:55:18 +00:00
|
|
|
}
|