From cad7b4f450e6584c4067c7a0947812625065d693 Mon Sep 17 00:00:00 2001 From: David Wood Date: Wed, 10 Jan 2018 17:13:07 +0000 Subject: [PATCH] Fixes #46983. Fixes bad error message when converting anonymous lifetime to `'static` --- .../nice_region_error/named_anon_conflict.rs | 13 +++++++++++++ .../infer/error_reporting/nice_region_error/util.rs | 12 ------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs index 9d0ddfd4be0..5617c772385 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs @@ -118,4 +118,17 @@ pub(super) fn try_report_named_anon_conflict(&self) -> Option { .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, + } + } } diff --git a/src/librustc/infer/error_reporting/nice_region_error/util.rs b/src/librustc/infer/error_reporting/nice_region_error/util.rs index f8b6f7d0afa..8aadec64554 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/util.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/util.rs @@ -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, - } - } }