|
1 | 1 | use crate::hir::CodegenFnAttrFlags;
|
| 2 | +use crate::hir::Mutability; |
2 | 3 | use crate::hir::Unsafety;
|
3 | 4 | use crate::hir::def::Namespace;
|
4 | 5 | use crate::hir::def_id::DefId;
|
5 | 6 | use crate::ty::{self, Ty, PolyFnSig, TypeFoldable, SubstsRef, TyCtxt};
|
6 | 7 | use crate::ty::print::{FmtPrinter, Printer};
|
7 | 8 | use crate::traits;
|
8 | 9 | use crate::middle::lang_items::DropInPlaceFnLangItem;
|
| 10 | +use rustc::middle::lang_items::PanicLocationLangItem; |
9 | 11 | use rustc_target::spec::abi::Abi;
|
10 | 12 | use rustc_macros::HashStable;
|
11 | 13 |
|
@@ -134,24 +136,15 @@ impl<'tcx> Instance<'tcx> {
|
134 | 136 | }
|
135 | 137 |
|
136 | 138 | /// Returns `&'static core::panic::Location`, for args of functions with #[track_caller].
|
137 |
| - pub fn track_caller_ty(_tcx: TyCtxt<'_>) -> Ty<'_> { |
138 |
| - #[cfg(bootstrap)] |
139 |
| - { bug!("#[track_caller] isn't supported during bootstrap (yet)."); } |
140 |
| - |
141 |
| - #[cfg(not(bootstrap))] |
142 |
| - { |
143 |
| - use crate::hir::Mutability; |
144 |
| - use rustc::middle::lang_items::PanicLocationLangItem; |
145 |
| - |
146 |
| - let panic_loc_item = _tcx.require_lang_item(PanicLocationLangItem, None); |
147 |
| - _tcx.mk_ref( |
148 |
| - _tcx.mk_region(ty::RegionKind::ReStatic), |
149 |
| - ty::TypeAndMut { |
150 |
| - mutbl: Mutability::MutImmutable, |
151 |
| - ty: _tcx.type_of(panic_loc_item), |
152 |
| - }, |
153 |
| - ) |
154 |
| - } |
| 139 | + pub fn track_caller_ty(tcx: TyCtxt<'_>) -> Ty<'_> { |
| 140 | + let panic_loc_item = tcx.require_lang_item(PanicLocationLangItem, None); |
| 141 | + tcx.mk_ref( |
| 142 | + tcx.mk_region(ty::RegionKind::ReStatic), |
| 143 | + ty::TypeAndMut { |
| 144 | + mutbl: Mutability::MutImmutable, |
| 145 | + ty: tcx.type_of(panic_loc_item), |
| 146 | + }, |
| 147 | + ) |
155 | 148 | }
|
156 | 149 | }
|
157 | 150 |
|
|
0 commit comments