about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-05-13 13:54:48 +0000
committerbors <bors@rust-lang.org>2015-05-13 13:54:48 +0000
commitaf41097b4906fdbd395b74f7de17f84f1666fe7a (patch)
tree828dd64c3da2101cb67117fce3ce0d26d95aae50
parenteb4cb6d16d142a4e810d1f1df0bab26542caa155 (diff)
parent46753dacb1f0ab26ea4fdfa8fe1661066ce81dd2 (diff)
downloadrust-af41097b4906fdbd395b74f7de17f84f1666fe7a.tar.gz
rust-af41097b4906fdbd395b74f7de17f84f1666fe7a.zip
Auto merge of #25333 - GSam:master, r=nrc
As it is, save-analysis appears to return the span for the 'mut' in a declaration 'static mut identifier...' instead of the identifier. This minor change appears to fix the problem, by skipping the mut when it is present. 
-rw-r--r--src/librustc_trans/save/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_trans/save/mod.rs b/src/librustc_trans/save/mod.rs
index d80086da203..89cda6d785f 100644
--- a/src/librustc_trans/save/mod.rs
+++ b/src/librustc_trans/save/mod.rs
@@ -520,12 +520,12 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
         let qualname = format!("::{}", self.analysis.ty_cx.map.path_to_string(item.id));
 
         // If the variable is immutable, save the initialising expression.
-        let value = match mt {
-            ast::MutMutable => String::from_str("<mutable>"),
-            ast::MutImmutable => self.span.snippet(expr.span),
+        let (value, keyword) = match mt {
+            ast::MutMutable => (String::from_str("<mutable>"), keywords::Mut),
+            ast::MutImmutable => (self.span.snippet(expr.span), keywords::Static),
         };
 
-        let sub_span = self.span.sub_span_after_keyword(item.span, keywords::Static);
+        let sub_span = self.span.sub_span_after_keyword(item.span, keyword);
         self.fmt.static_str(item.span,
                             sub_span,
                             item.id,