about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Mansi <markm@cs.wisc.edu>2019-10-09 18:49:40 -0500
committerMark Mansi <markm@cs.wisc.edu>2019-10-27 08:49:42 -0500
commit0026e3ec3f7945aa99b5c1ba7c1bed1a5d6bacf3 (patch)
treea53bfb154bcb65ae213491a5aab4db5621f02296
parent19122ab98190053ad19e8baf153870c56c266f29 (diff)
downloadrust-0026e3ec3f7945aa99b5c1ba7c1bed1a5d6bacf3.tar.gz
rust-0026e3ec3f7945aa99b5c1ba7c1bed1a5d6bacf3.zip
hack around '_ named regions
-rw-r--r--src/librustc_mir/borrow_check/nll/region_infer/error_reporting/outlives_suggestion.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/outlives_suggestion.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/outlives_suggestion.rs
index 57f844f2924..62142efe505 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/outlives_suggestion.rs
+++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/outlives_suggestion.rs
@@ -67,8 +67,15 @@ impl OutlivesSuggestionBuilder {
             RegionNameSource::NamedEarlyBoundRegion(..)
             | RegionNameSource::NamedFreeRegion(..)
             | RegionNameSource::Static => {
-                debug!("Region {:?} is suggestable", name);
-                true
+                // FIXME: This is a bit hacky. We should ideally have a semantic way for checking
+                // if the name is `'_`...
+                if name.name().with(|name| name != "'_") {
+                    debug!("Region {:?} is suggestable", name);
+                    true
+                } else {
+                    debug!("Region {:?} is NOT suggestable", name);
+                    false
+                }
             }
 
             // Don't give suggestions for upvars, closure return types, or other unnamable