about summary refs log tree commit diff
path: root/src/libsyntax_pos
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-04-11 23:36:13 +0000
committerbors <bors@rust-lang.org>2019-04-11 23:36:13 +0000
commitcd8b4373623c5a0f05559f67be217c48bfb8bcab (patch)
tree397b0ddc692ed7f02e71b76193e5d24781c30cb0 /src/libsyntax_pos
parent3de0106789468b211bcc3a25c09c0cf07119186d (diff)
parent5ea959dc8bfdf0dd62fd8ac611ba4e9e8d75c69d (diff)
downloadrust-cd8b4373623c5a0f05559f67be217c48bfb8bcab.tar.gz
rust-cd8b4373623c5a0f05559f67be217c48bfb8bcab.zip
Auto merge of #59227 - Zoxc:fix-get, r=eddyb
Fix lifetime on LocalInternedString::get function

cc @eddyb @nnethercote
Diffstat (limited to 'src/libsyntax_pos')
-rw-r--r--src/libsyntax_pos/symbol.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs
index f61aa4284d2..393f52e7de5 100644
--- a/src/libsyntax_pos/symbol.rs
+++ b/src/libsyntax_pos/symbol.rs
@@ -524,7 +524,11 @@ impl LocalInternedString {
         }
     }
 
-    pub fn get(&self) -> &'static str {
+    pub fn get(&self) -> &str {
+        // This returns a valid string since we ensure that `self` outlives the interner
+        // by creating the interner on a thread which outlives threads which can access it.
+        // This type cannot move to a thread which outlives the interner since it does
+        // not implement Send.
         self.string
     }
 }