|
1 | 1 | use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags; |
2 | 2 | use crate::ty::print::{FmtPrinter, Printer}; |
3 | 3 | use crate::ty::{self, SubstsRef, Ty, TyCtxt, TypeFoldable}; |
4 | | -use rustc_data_structures::AtomicRef; |
5 | 4 | use rustc_hir::def::Namespace; |
6 | 5 | use rustc_hir::def_id::{CrateNum, DefId}; |
7 | 6 | use rustc_hir::lang_items::DropInPlaceFnLangItem; |
@@ -289,7 +288,9 @@ impl<'tcx> Instance<'tcx> { |
289 | 288 | def_id: DefId, |
290 | 289 | substs: SubstsRef<'tcx>, |
291 | 290 | ) -> Option<Instance<'tcx>> { |
292 | | - (*RESOLVE_INSTANCE)(tcx, param_env, def_id, substs) |
| 291 | + // All regions in the result of this query are erased, so it's |
| 292 | + // fine to erase all of the input regions. |
| 293 | + tcx.resolve_instance((tcx.erase_regions(¶m_env), def_id, tcx.erase_regions(&substs))) |
293 | 294 | } |
294 | 295 |
|
295 | 296 | pub fn resolve_for_fn_ptr( |
@@ -440,21 +441,3 @@ fn needs_fn_once_adapter_shim( |
440 | 441 | (ty::ClosureKind::FnMut, _) | (ty::ClosureKind::FnOnce, _) => Err(()), |
441 | 442 | } |
442 | 443 | } |
443 | | - |
444 | | -fn resolve_instance_default( |
445 | | - _tcx: TyCtxt<'tcx>, |
446 | | - _param_env: ty::ParamEnv<'tcx>, |
447 | | - _def_id: DefId, |
448 | | - _substs: SubstsRef<'tcx>, |
449 | | -) -> Option<Instance<'tcx>> { |
450 | | - unimplemented!() |
451 | | -} |
452 | | - |
453 | | -pub static RESOLVE_INSTANCE: AtomicRef< |
454 | | - for<'tcx> fn( |
455 | | - TyCtxt<'tcx>, |
456 | | - ty::ParamEnv<'tcx>, |
457 | | - DefId, |
458 | | - SubstsRef<'tcx>, |
459 | | - ) -> Option<Instance<'tcx>>, |
460 | | -> = AtomicRef::new(&(resolve_instance_default as _)); |
0 commit comments