mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-20 03:27:30 +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,
|
hir::ImplItemKind::Type(_) => false,
|
||||||
},
|
},
|
||||||
|
Node::Expr(&hir::Expr { kind: hir::ExprKind::Closure(..), .. }) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,12 @@ pub static F: fn() = f;
|
|||||||
pub static G: fn() = G0;
|
pub static G: fn() = G0;
|
||||||
pub static H: &(dyn Fn() + Sync) = &h;
|
pub static H: &(dyn Fn() + Sync) = &h;
|
||||||
pub static I: fn() = Helper(j).mk();
|
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 X: u32 = 42;
|
||||||
static G0: fn() = g;
|
static G0: fn() = g;
|
||||||
|
@ -8,6 +8,7 @@ static F: fn() = aux::F;
|
|||||||
static G: fn() = aux::G;
|
static G: fn() = aux::G;
|
||||||
static H: &(dyn Fn() + Sync) = aux::H;
|
static H: &(dyn Fn() + Sync) = aux::H;
|
||||||
static I: fn() = aux::I;
|
static I: fn() = aux::I;
|
||||||
|
static K: fn() -> fn() = aux::K;
|
||||||
|
|
||||||
fn v() -> *const u32 {
|
fn v() -> *const u32 {
|
||||||
V
|
V
|
||||||
@ -19,4 +20,5 @@ fn main() {
|
|||||||
G();
|
G();
|
||||||
H();
|
H();
|
||||||
I();
|
I();
|
||||||
|
K()();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user