mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 01:05:39 +03:00
Remove InferCtxt::freshener.
I have always found this confusingly named, because it creates a new freshener rather than returning an existing one. We can remove it and just use `TypeFreshener::new()` at the two call sites, avoiding this confusion.
This commit is contained in:
@@ -638,7 +638,7 @@ pub fn typing_mode(&self) -> TypingMode<'tcx> {
|
||||
}
|
||||
|
||||
pub fn freshen<T: TypeFoldable<TyCtxt<'tcx>>>(&self, t: T) -> T {
|
||||
t.fold_with(&mut self.freshener())
|
||||
t.fold_with(&mut TypeFreshener::new(self))
|
||||
}
|
||||
|
||||
/// Returns the origin of the type variable identified by `vid`.
|
||||
@@ -658,10 +658,6 @@ pub fn const_var_origin(&self, vid: ConstVid) -> Option<ConstVariableOrigin> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn freshener<'b>(&'b self) -> TypeFreshener<'b, 'tcx> {
|
||||
freshen::TypeFreshener::new(self)
|
||||
}
|
||||
|
||||
pub fn unresolved_variables(&self) -> Vec<Ty<'tcx>> {
|
||||
let mut inner = self.inner.borrow_mut();
|
||||
let mut vars: Vec<Ty<'_>> = inner
|
||||
|
||||
@@ -195,7 +195,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
pub fn new(infcx: &'cx InferCtxt<'tcx>) -> SelectionContext<'cx, 'tcx> {
|
||||
SelectionContext {
|
||||
infcx,
|
||||
freshener: infcx.freshener(),
|
||||
freshener: TypeFreshener::new(infcx),
|
||||
intercrate_ambiguity_causes: None,
|
||||
query_mode: TraitQueryMode::Standard,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user