mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
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
@ -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 {
|
fn is_binding(cx: &LateContext<'_, '_>, pat_id: HirId) -> bool {
|
||||||
let var_ty = cx.tables.node_type(pat_id);
|
let var_ty = cx.tables.node_type_opt(pat_id);
|
||||||
match var_ty.kind {
|
if let Some(var_ty) = var_ty {
|
||||||
ty::Adt(..) => false,
|
match var_ty.kind {
|
||||||
_ => true,
|
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…
Reference in New Issue
Block a user