mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-27 07:03:45 +00:00
Merge pull request #3496 from fkohlgrueber/macro-in-closure-in-if-cond
fix #3482 and add ui test for it
This commit is contained in:
commit
0fb30218d5
@ -70,7 +70,7 @@ impl<'a, 'tcx: 'a> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
|
|||||||
if let ExprKind::Closure(_, _, eid, _, _) = expr.node {
|
if let ExprKind::Closure(_, _, eid, _, _) = expr.node {
|
||||||
let body = self.cx.tcx.hir.body(eid);
|
let body = self.cx.tcx.hir.body(eid);
|
||||||
let ex = &body.value;
|
let ex = &body.value;
|
||||||
if matches!(ex.node, ExprKind::Block(_, _)) {
|
if matches!(ex.node, ExprKind::Block(_, _)) && !in_macro(body.value.span) {
|
||||||
self.found_block = Some(ex);
|
self.found_block = Some(ex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -98,3 +98,11 @@ fn condition_is_unsafe_block() {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn macro_in_closure() {
|
||||||
|
let option = Some(true);
|
||||||
|
|
||||||
|
if option.unwrap_or_else(|| unimplemented!()) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user