|
3 | 3 | //! similar to queries, but queries come with a lot of machinery for caching and incremental |
4 | 4 | //! compilation, whereas hooks are just plain function pointers without any of the query magic. |
5 | 5 |
|
6 | | -use std::marker::PhantomData; |
7 | | - |
8 | 6 | use rustc_hir::def_id::{DefId, DefPathHash}; |
9 | 7 | use rustc_session::StableCrateId; |
10 | 8 | use rustc_span::def_id::{CrateNum, LocalDefId}; |
11 | | -use rustc_span::{ExpnHash, ExpnId, Span}; |
| 9 | +use rustc_span::{ExpnHash, ExpnId}; |
12 | 10 |
|
| 11 | +use crate::mir; |
13 | 12 | use crate::query::on_disk_cache::{CacheEncoder, EncodedDepNodeIndex}; |
14 | 13 | use crate::ty::{Ty, TyCtxt}; |
15 | | -use crate::{mir, ty}; |
16 | 14 |
|
17 | 15 | macro_rules! declare_hooks { |
18 | 16 | ($($(#[$attr:meta])*hook $name:ident($($arg:ident: $K:ty),*) -> $V:ty;)*) => { |
@@ -117,29 +115,6 @@ declare_hooks! { |
117 | 115 | encoder: &mut CacheEncoder<'_, 'tcx>, |
118 | 116 | query_result_index: &mut EncodedDepNodeIndex |
119 | 117 | ) -> (); |
120 | | - |
121 | | - /// Tries to normalize an alias, ignoring any errors. |
122 | | - /// |
123 | | - /// Generalization with the new trait solver calls into this, |
124 | | - /// when generalizing outside of the trait solver in `hir_typeck`. |
125 | | - hook try_eagerly_normalize_alias( |
126 | | - type_erased_infcx: TypeErasedInfcx<'_, 'tcx>, |
127 | | - param_env: ty::ParamEnv<'tcx>, |
128 | | - span: Span, |
129 | | - alias: ty::AliasTy<'tcx> |
130 | | - ) -> Ty<'tcx>; |
131 | | -} |
132 | | - |
133 | | -/// The `try_eagerly_normalize_alias` hook passes an `Infcx` from where it's called (in `rustc_infer`) |
134 | | -/// to where it's provided (in `rustc_trait_selection`). |
135 | | -/// Both of those crates have that type available, but `rustc_middle` does not. |
136 | | -/// Instead we pass this type-erased `Infcx` and transmute on both sides. |
137 | | -/// |
138 | | -/// Has to be `repr(transparent)` so we can transmute a `&'a Infcx<'tcx>` to this struct. |
139 | | -#[repr(transparent)] |
140 | | -pub struct TypeErasedInfcx<'a, 'tcx> { |
141 | | - _infcx: *const (), |
142 | | - phantom: PhantomData<&'a mut &'tcx ()>, |
143 | 118 | } |
144 | 119 |
|
145 | 120 | #[cold] |
|
0 commit comments