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 @@ pub(super) fn try_report_named_anon_conflict(&self) -> Option<ErrorReported> {
.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 @@ pub(super) fn is_bound_region_in_impl_item(
}
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,
}
}
}