Skip to content

Commit 281ca13

Browse files
committed
Use the default providers in rustc_interface instead of adding our own
This avoids duplicating the same struct twice.
1 parent e117b47 commit 281ca13

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/librustdoc/core.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_interface::interface;
1616
use rustc_middle::hir::map::Map;
1717
use rustc_middle::middle::cstore::CrateStore;
1818
use rustc_middle::middle::privacy::AccessLevels;
19-
use rustc_middle::ty::{self, Ty, TyCtxt};
19+
use rustc_middle::ty::{Ty, TyCtxt};
2020
use rustc_resolve as resolve;
2121
use rustc_session::config::{self, CrateType, ErrorOutputType};
2222
use rustc_session::lint;
@@ -391,12 +391,6 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
391391
};
392392
// In case typeck does end up being called, don't ICE in case there were name resolution errors
393393
providers.typeck_tables_of = move |tcx, def_id| {
394-
thread_local!(static DEFAULT_TYPECK: for<'tcx> fn(TyCtxt<'tcx>, LocalDefId) -> &'tcx ty::TypeckTables<'tcx> = {
395-
let mut providers = ty::query::Providers::default();
396-
rustc_typeck::provide(&mut providers);
397-
providers.typeck_tables_of
398-
});
399-
400394
// Closures' tables come from their outermost function,
401395
// as they are part of the same "inference environment".
402396
// This avoids emitting errors for the parent twice (see similar code in `typeck_tables_of_with_fallback`)
@@ -409,7 +403,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
409403
let body = hir.body(hir.body_owned_by(hir.as_local_hir_id(def_id)));
410404
debug!("visiting body for {:?}", def_id);
411405
EmitIgnoredResolutionErrors::new(tcx).visit_body(body);
412-
DEFAULT_TYPECK.with(|typeck| typeck(tcx, def_id))
406+
(rustc_interface::DEFAULT_QUERY_PROVIDERS.typeck_tables_of)(tcx, def_id)
413407
};
414408
}),
415409
registry: rustc_driver::diagnostics_registry(),

0 commit comments

Comments
 (0)