Adapt TypeFolder
implementors to return a Result
Co-authored-by: Alan Egerton <eggyal@gmail.com>
This commit is contained in:
parent
6e3fa20b00
commit
6dc3dae46f
24 changed files with 387 additions and 305 deletions
|
@ -860,11 +860,11 @@ impl<'a, 'tcx> TypeFolder<'tcx> for RegionReplacer<'a, 'tcx> {
|
|||
self.tcx
|
||||
}
|
||||
|
||||
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
|
||||
(match r {
|
||||
fn fold_region(&mut self, r: ty::Region<'tcx>) -> Result<ty::Region<'tcx>, Self::Error> {
|
||||
Ok((match r {
|
||||
ty::ReVar(vid) => self.vid_to_region.get(vid).cloned(),
|
||||
_ => None,
|
||||
})
|
||||
.unwrap_or_else(|| r.super_fold_with(self))
|
||||
.unwrap_or_else(|| r.super_fold_with(self).into_ok()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue