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