701: Minor type inference tweaks r=flodiebold a=marcusklaas

Pass down expectation for reference expressions and type the guard in match expressions.

I wasn't able to add a test for the former addition because the type variable previously introduced would always resolve to the right type in the things I tried!

Co-authored-by: Marcus Klaas de Vries <mail@marcusklaas.nl>
This commit is contained in:
bors[bot]
2019-01-30 20:51:47 +00:00
11 changed files with 163 additions and 63 deletions

View File

@@ -371,6 +371,7 @@ fn test(x: &str, y: isize) {
let b = [a, ["b"]];
let x: [u8; 0] = [];
let z: &[u8] = &[1, 2, 3];
}
"#,
);
@@ -426,7 +427,8 @@ fn test() {
match e {
E::A { x } => x,
E::B => 1,
E::B if foo => 1,
E::B => 10,
};
let ref d @ E::A { .. } = e;