1
Fork 0

Fixes #46983. Fixes bad error message when converting anonymous lifetime to 'static

This commit is contained in:
David Wood 2018-01-10 17:13:07 +00:00
parent ee43e6d6c9
commit cad7b4f450
No known key found for this signature in database
GPG key ID: 01760B4F9F53F154
2 changed files with 13 additions and 12 deletions

View file

@ -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,
}
}
}

View file

@ -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,
}
}
}