Fixes #46983. Fixes bad error message when converting anonymous lifetime to 'static
This commit is contained in:
parent
ee43e6d6c9
commit
cad7b4f450
2 changed files with 13 additions and 12 deletions
|
@ -118,4 +118,17 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
|
|||
.emit();
|
||||
return Some(ErrorReported);
|
||||
}
|
||||
|
||||
// This method returns whether the given Region is Named
|
||||
pub(super) fn is_named_region(&self, region: ty::Region<'tcx>) -> bool {
|
||||
match *region {
|
||||
ty::ReStatic => true,
|
||||
ty::ReFree(ref free_region) => match free_region.bound_region {
|
||||
ty::BrNamed(..) => true,
|
||||
_ => false,
|
||||
},
|
||||
ty::ReEarlyBound(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,16 +198,4 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
false
|
||||
}
|
||||
|
||||
// This method returns whether the given Region is Named
|
||||
pub(super) fn is_named_region(&self, region: Region<'tcx>) -> bool {
|
||||
match *region {
|
||||
ty::ReFree(ref free_region) => match free_region.bound_region {
|
||||
ty::BrNamed(..) => true,
|
||||
_ => false,
|
||||
},
|
||||
ty::ReEarlyBound(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue