mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-10 05:53:10 +00:00
Add test for passing on ref expectations
This commit is contained in:
parent
3daca3eb4d
commit
13cb4a1b37
@ -615,10 +615,10 @@ impl ExprCollector {
|
|||||||
.map(|arm| MatchArm {
|
.map(|arm| MatchArm {
|
||||||
pats: arm.pats().map(|p| self.collect_pat(p)).collect(),
|
pats: arm.pats().map(|p| self.collect_pat(p)).collect(),
|
||||||
expr: self.collect_expr_opt(arm.expr()),
|
expr: self.collect_expr_opt(arm.expr()),
|
||||||
guard: arm.guard().map(|guard| {
|
guard: arm
|
||||||
let e = guard.expr().expect("every guard should have an expr");
|
.guard()
|
||||||
self.collect_expr(e)
|
.and_then(|guard| guard.expr())
|
||||||
}),
|
.map(|e| self.collect_expr(e)),
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
---
|
---
|
||||||
created: "2019-01-22T14:44:59.880187500+00:00"
|
created: "2019-01-30T20:08:05.185312835+00:00"
|
||||||
creator: insta@0.4.0
|
creator: insta@0.5.2
|
||||||
expression: "&result"
|
expression: "&result"
|
||||||
source: "crates\\ra_hir\\src\\ty\\tests.rs"
|
source: crates/ra_hir/src/ty/tests.rs
|
||||||
---
|
---
|
||||||
[9; 10) 'x': &str
|
[9; 10) 'x': &str
|
||||||
[18; 19) 'y': isize
|
[18; 19) 'y': isize
|
||||||
[28; 293) '{ ... []; }': ()
|
[28; 324) '{ ... 3]; }': ()
|
||||||
[38; 39) 'a': [&str]
|
[38; 39) 'a': [&str]
|
||||||
[42; 45) '[x]': [&str]
|
[42; 45) '[x]': [&str]
|
||||||
[43; 44) 'x': &str
|
[43; 44) 'x': &str
|
||||||
@ -56,4 +56,10 @@ source: "crates\\ra_hir\\src\\ty\\tests.rs"
|
|||||||
[260; 263) '"b"': &str
|
[260; 263) '"b"': &str
|
||||||
[275; 276) 'x': [u8]
|
[275; 276) 'x': [u8]
|
||||||
[288; 290) '[]': [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 b = [a, ["b"]];
|
||||||
let x: [u8; 0] = [];
|
let x: [u8; 0] = [];
|
||||||
|
let z: &[u8] = &[1, 2, 3];
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user