mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Closures are recursively reachable
This commit is contained in:
parent
44701e070c
commit
5d26f58423
@ -157,6 +157,7 @@ impl<'tcx> ReachableContext<'tcx> {
|
||||
}
|
||||
hir::ImplItemKind::Type(_) => false,
|
||||
},
|
||||
Node::Expr(&hir::Expr { kind: hir::ExprKind::Closure(..), .. }) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,12 @@ pub static F: fn() = f;
|
||||
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 F: fn() = aux::F;
|
||||
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