diff --git a/compiler/rustc_interface/src/callbacks.rs b/compiler/rustc_interface/src/callbacks.rs index 4a1da0f50cc2..e85f53058831 100644 --- a/compiler/rustc_interface/src/callbacks.rs +++ b/compiler/rustc_interface/src/callbacks.rs @@ -42,7 +42,7 @@ fn track_diagnostic(diagnostic: DiagInner, f: &mut dyn FnMut(DiagInner) -> R) icx.tcx.dep_graph.record_diagnostic(icx.tcx, &diagnostic); // Diagnostics are tracked, we can ignore the dependency. - let icx = tls::ImplicitCtxt { task_deps: TaskDepsRef::Ignore, ..icx.clone() }; + let icx = tls::ImplicitCtxt { task_deps: TaskDepsRef::Ignore, ..*icx }; tls::enter_context(&icx, move || (*f)(diagnostic)) } else { // In any other case, invoke diagnostics anyway. diff --git a/compiler/rustc_middle/src/dep_graph/mod.rs b/compiler/rustc_middle/src/dep_graph/mod.rs index 1bd9a1692db0..9787a998d637 100644 --- a/compiler/rustc_middle/src/dep_graph/mod.rs +++ b/compiler/rustc_middle/src/dep_graph/mod.rs @@ -63,7 +63,7 @@ fn with_deps(task_deps: TaskDepsRef<'_>, op: OP) -> R OP: FnOnce() -> R, { ty::tls::with_context(|icx| { - let icx = ty::tls::ImplicitCtxt { task_deps, ..icx.clone() }; + let icx = ty::tls::ImplicitCtxt { task_deps, ..*icx }; ty::tls::enter_context(&icx, op) }) } diff --git a/compiler/rustc_middle/src/ty/context/tls.rs b/compiler/rustc_middle/src/ty/context/tls.rs index 6e89719f265a..d1561c37172c 100644 --- a/compiler/rustc_middle/src/ty/context/tls.rs +++ b/compiler/rustc_middle/src/ty/context/tls.rs @@ -9,7 +9,6 @@ /// executing a new query. Whenever there's a `TyCtxt` value available /// you should also have access to an `ImplicitCtxt` through the functions /// in this module. -#[derive(Clone)] pub struct ImplicitCtxt<'a, 'tcx> { /// The current `TyCtxt`. pub tcx: TyCtxt<'tcx>, diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 51dcd704d833..f9b75359c7ce 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -81,7 +81,7 @@ pub(crate) fn start_query( let icx = ImplicitCtxt { query: Some(job_id), query_depth: icx.query_depth + if depth_limit { 1 } else { 0 }, - ..icx.clone() + ..*icx }; // Use the `ImplicitCtxt` while we execute the query.