Closures are recursively reachable
This commit is contained in:
parent
44701e070c
commit
5d26f58423
@ -157,6 +157,7 @@ fn is_recursively_reachable_local(&self, def_id: DefId) -> bool {
|
||||
}
|
||||
hir::ImplItemKind::Type(_) => false,
|
||||
},
|
||||
Node::Expr(&hir::Expr { kind: hir::ExprKind::Closure(..), .. }) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,12 @@
|
||||
pub static G: fn() = G0;
|
||||
pub static H: &(dyn Fn() + Sync) = &h;
|
||||
pub static I: fn() = Helper(j).mk();
|
||||
pub static K: fn() -> fn() = {
|
||||
#[inline(never)]
|
||||
fn k() {}
|
||||
#[inline(always)]
|
||||
|| -> fn() { k }
|
||||
};
|
||||
|
||||
static X: u32 = 42;
|
||||
static G0: fn() = g;
|
||||
|
@ -8,6 +8,7 @@
|
||||
static G: fn() = aux::G;
|
||||
static H: &(dyn Fn() + Sync) = aux::H;
|
||||
static I: fn() = aux::I;
|
||||
static K: fn() -> fn() = aux::K;
|
||||
|
||||
fn v() -> *const u32 {
|
||||
V
|
||||
@ -19,4 +20,5 @@ fn main() {
|
||||
G();
|
||||
H();
|
||||
I();
|
||||
K()();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user