Add test for passing on ref expectations
This commit is contained in:
parent
3daca3eb4d
commit
13cb4a1b37
3 changed files with 15 additions and 8 deletions
|
@ -615,10 +615,10 @@ impl ExprCollector {
|
|||
.map(|arm| MatchArm {
|
||||
pats: arm.pats().map(|p| self.collect_pat(p)).collect(),
|
||||
expr: self.collect_expr_opt(arm.expr()),
|
||||
guard: arm.guard().map(|guard| {
|
||||
let e = guard.expr().expect("every guard should have an expr");
|
||||
self.collect_expr(e)
|
||||
}),
|
||||
guard: arm
|
||||
.guard()
|
||||
.and_then(|guard| guard.expr())
|
||||
.map(|e| self.collect_expr(e)),
|
||||
})
|
||||
.collect()
|
||||
} else {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
created: "2019-01-22T14:44:59.880187500+00:00"
|
||||
creator: insta@0.4.0
|
||||
created: "2019-01-30T20:08:05.185312835+00:00"
|
||||
creator: insta@0.5.2
|
||||
expression: "&result"
|
||||
source: "crates\\ra_hir\\src\\ty\\tests.rs"
|
||||
source: crates/ra_hir/src/ty/tests.rs
|
||||
---
|
||||
[9; 10) 'x': &str
|
||||
[18; 19) 'y': isize
|
||||
[28; 293) '{ ... []; }': ()
|
||||
[28; 324) '{ ... 3]; }': ()
|
||||
[38; 39) 'a': [&str]
|
||||
[42; 45) '[x]': [&str]
|
||||
[43; 44) 'x': &str
|
||||
|
@ -56,4 +56,10 @@ source: "crates\\ra_hir\\src\\ty\\tests.rs"
|
|||
[260; 263) '"b"': &str
|
||||
[275; 276) 'x': [u8]
|
||||
[288; 290) '[]': [u8]
|
||||
[300; 301) 'z': &[u8]
|
||||
[311; 321) '&[1, 2, 3]': &[u8]
|
||||
[312; 321) '[1, 2, 3]': [u8]
|
||||
[313; 314) '1': u8
|
||||
[316; 317) '2': u8
|
||||
[319; 320) '3': u8
|
||||
|
||||
|
|
|
@ -366,6 +366,7 @@ fn test(x: &str, y: isize) {
|
|||
|
||||
let b = [a, ["b"]];
|
||||
let x: [u8; 0] = [];
|
||||
let z: &[u8] = &[1, 2, 3];
|
||||
}
|
||||
"#,
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue