mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Auto merge of #8913 - InfRandomness:ICE-#8748, r=giraffate
Fix #8748 Thank you for making Clippy better! changelog: Fix ICE #8748 in shadow.rs
This commit is contained in:
commit
588e1982d3
@ -160,9 +160,13 @@ impl<'tcx> LateLintPass<'tcx> for Shadow {
|
|||||||
|
|
||||||
fn is_shadow(cx: &LateContext<'_>, owner: LocalDefId, first: ItemLocalId, second: ItemLocalId) -> bool {
|
fn is_shadow(cx: &LateContext<'_>, owner: LocalDefId, first: ItemLocalId, second: ItemLocalId) -> bool {
|
||||||
let scope_tree = cx.tcx.region_scope_tree(owner.to_def_id());
|
let scope_tree = cx.tcx.region_scope_tree(owner.to_def_id());
|
||||||
let first_scope = scope_tree.var_scope(first).unwrap();
|
if let Some(first_scope) = scope_tree.var_scope(first) {
|
||||||
let second_scope = scope_tree.var_scope(second).unwrap();
|
if let Some(second_scope) = scope_tree.var_scope(second) {
|
||||||
scope_tree.is_subscope_of(second_scope, first_scope)
|
return scope_tree.is_subscope_of(second_scope, first_scope);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lint_shadow(cx: &LateContext<'_>, pat: &Pat<'_>, shadowed: HirId, span: Span) {
|
fn lint_shadow(cx: &LateContext<'_>, pat: &Pat<'_>, shadowed: HirId, span: Span) {
|
||||||
|
@ -88,4 +88,11 @@ pub async fn foo2(_a: i32, _b: i64) {
|
|||||||
let _b = _a;
|
let _b = _a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn ice_8748() {
|
||||||
|
let _ = [0; {
|
||||||
|
let x = 1;
|
||||||
|
if let Some(x) = Some(1) { x } else { 1 }
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
Loading…
Reference in New Issue
Block a user