|
1 | 1 | use crate::traits::query::evaluate_obligation::InferCtxtExt as _; |
2 | | -use crate::traits::query::outlives_bounds::InferCtxtExt as _; |
3 | 2 | use crate::traits::{self, TraitEngine, TraitEngineExt}; |
4 | 3 |
|
5 | | -use rustc_data_structures::stable_set::FxHashSet; |
6 | | -use rustc_hir as hir; |
7 | 4 | use rustc_hir::def_id::DefId; |
8 | 5 | use rustc_hir::lang_items::LangItem; |
9 | | -use rustc_infer::infer::outlives::env::OutlivesEnvironment; |
10 | 6 | use rustc_infer::traits::ObligationCause; |
11 | 7 | use rustc_middle::arena::ArenaAllocatable; |
12 | 8 | use rustc_middle::infer::canonical::{Canonical, CanonicalizedQueryResponse, QueryResponse}; |
@@ -180,48 +176,3 @@ impl<'tcx> InferCtxtBuilderExt<'tcx> for InferCtxtBuilder<'tcx> { |
180 | 176 | ) |
181 | 177 | } |
182 | 178 | } |
183 | | - |
184 | | -pub trait OutlivesEnvironmentExt<'tcx> { |
185 | | - fn add_implied_bounds( |
186 | | - &mut self, |
187 | | - infcx: &InferCtxt<'a, 'tcx>, |
188 | | - fn_sig_tys: FxHashSet<Ty<'tcx>>, |
189 | | - body_id: hir::HirId, |
190 | | - span: Span, |
191 | | - ); |
192 | | -} |
193 | | - |
194 | | -impl<'tcx> OutlivesEnvironmentExt<'tcx> for OutlivesEnvironment<'tcx> { |
195 | | - /// This method adds "implied bounds" into the outlives environment. |
196 | | - /// Implied bounds are outlives relationships that we can deduce |
197 | | - /// on the basis that certain types must be well-formed -- these are |
198 | | - /// either the types that appear in the function signature or else |
199 | | - /// the input types to an impl. For example, if you have a function |
200 | | - /// like |
201 | | - /// |
202 | | - /// ``` |
203 | | - /// fn foo<'a, 'b, T>(x: &'a &'b [T]) { } |
204 | | - /// ``` |
205 | | - /// |
206 | | - /// we can assume in the caller's body that `'b: 'a` and that `T: |
207 | | - /// 'b` (and hence, transitively, that `T: 'a`). This method would |
208 | | - /// add those assumptions into the outlives-environment. |
209 | | - /// |
210 | | - /// Tests: `src/test/ui/regions/regions-free-region-ordering-*.rs` |
211 | | - fn add_implied_bounds( |
212 | | - &mut self, |
213 | | - infcx: &InferCtxt<'a, 'tcx>, |
214 | | - fn_sig_tys: FxHashSet<Ty<'tcx>>, |
215 | | - body_id: hir::HirId, |
216 | | - span: Span, |
217 | | - ) { |
218 | | - debug!("add_implied_bounds()"); |
219 | | - |
220 | | - for ty in fn_sig_tys { |
221 | | - let ty = infcx.resolve_vars_if_possible(ty); |
222 | | - debug!("add_implied_bounds: ty = {}", ty); |
223 | | - let implied_bounds = infcx.implied_outlives_bounds(self.param_env, body_id, ty, span); |
224 | | - self.add_outlives_bounds(Some(infcx), implied_bounds) |
225 | | - } |
226 | | - } |
227 | | -} |
0 commit comments