Skip to content

Commit f7b3e39

Browse files
committed
Simplify tls::enter_context.
1 parent ef934d9 commit f7b3e39

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

compiler/rustc_interface/src/callbacks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn track_diagnostic(diagnostic: &mut Diagnostic, f: &mut dyn FnMut(&mut Diagnost
3838

3939
// Diagnostics are tracked, we can ignore the dependency.
4040
let icx = tls::ImplicitCtxt { task_deps: TaskDepsRef::Ignore, ..icx.clone() };
41-
return tls::enter_context(&icx, move |_| (*f)(diagnostic));
41+
return tls::enter_context(&icx, move || (*f)(diagnostic));
4242
}
4343

4444
// In any other case, invoke diagnostics anyway.

compiler/rustc_interface/src/passes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ impl<'tcx> QueryContext<'tcx> {
748748
F: FnOnce(TyCtxt<'tcx>) -> R,
749749
{
750750
let icx = ty::tls::ImplicitCtxt::new(self.gcx);
751-
ty::tls::enter_context(&icx, |_| f(icx.tcx))
751+
ty::tls::enter_context(&icx, || f(icx.tcx))
752752
}
753753
}
754754

compiler/rustc_middle/src/dep_graph/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl rustc_query_system::dep_graph::DepKind for DepKind {
5555
ty::tls::with_context(|icx| {
5656
let icx = ty::tls::ImplicitCtxt { task_deps, ..icx.clone() };
5757

58-
ty::tls::enter_context(&icx, |_| op())
58+
ty::tls::enter_context(&icx, op)
5959
})
6060
}
6161

compiler/rustc_middle/src/ty/context/tls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ unsafe fn downcast<'a, 'tcx>(context: *const ()) -> &'a ImplicitCtxt<'a, 'tcx> {
110110
#[inline]
111111
pub fn enter_context<'a, 'tcx, F, R>(context: &ImplicitCtxt<'a, 'tcx>, f: F) -> R
112112
where
113-
F: FnOnce(&ImplicitCtxt<'a, 'tcx>) -> R,
113+
F: FnOnce() -> R,
114114
{
115-
tlv::with_tlv(erase(context), || f(&context))
115+
tlv::with_tlv(erase(context), f)
116116
}
117117

118118
/// Allows access to the current `ImplicitCtxt` in a closure if one is available.

compiler/rustc_query_impl/src/plumbing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl QueryContext for QueryCtxt<'_> {
124124
};
125125

126126
// Use the `ImplicitCtxt` while we execute the query.
127-
tls::enter_context(&new_icx, |_| {
127+
tls::enter_context(&new_icx, || {
128128
rustc_data_structures::stack::ensure_sufficient_stack(compute)
129129
})
130130
})

0 commit comments

Comments
 (0)