Auto merge of #5297 - JohnTitor:shadow, r=phansch
Use `node_type_opt` over `node_type` Fix ICE reported in rust-lang/rust#69873. changelog: Fix ICE in checking bindings
This commit is contained in:
commit
3aa8da3e07
2 changed files with 14 additions and 4 deletions
|
@ -154,10 +154,14 @@ fn check_local<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, local: &'tcx Local<'_>, bin
|
|||
}
|
||||
|
||||
fn is_binding(cx: &LateContext<'_, '_>, pat_id: HirId) -> bool {
|
||||
let var_ty = cx.tables.node_type(pat_id);
|
||||
match var_ty.kind {
|
||||
ty::Adt(..) => false,
|
||||
_ => true,
|
||||
let var_ty = cx.tables.node_type_opt(pat_id);
|
||||
if let Some(var_ty) = var_ty {
|
||||
match var_ty.kind {
|
||||
ty::Adt(..) => false,
|
||||
_ => true,
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
6
tests/ui/crashes/shadow.rs
Normal file
6
tests/ui/crashes/shadow.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
fn main() {
|
||||
let x: [i32; {
|
||||
let u = 2;
|
||||
4
|
||||
}] = [2; { 4 }];
|
||||
}
|
Loading…
Add table
Reference in a new issue