Skip to content

Commit af41097

Browse files
committed
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.
2 parents eb4cb6d + 46753da commit af41097

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/librustc_trans/save/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,12 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
520520
let qualname = format!("::{}", self.analysis.ty_cx.map.path_to_string(item.id));
521521

522522
// If the variable is immutable, save the initialising expression.
523-
let value = match mt {
524-
ast::MutMutable => String::from_str("<mutable>"),
525-
ast::MutImmutable => self.span.snippet(expr.span),
523+
let (value, keyword) = match mt {
524+
ast::MutMutable => (String::from_str("<mutable>"), keywords::Mut),
525+
ast::MutImmutable => (self.span.snippet(expr.span), keywords::Static),
526526
};
527527

528-
let sub_span = self.span.sub_span_after_keyword(item.span, keywords::Static);
528+
let sub_span = self.span.sub_span_after_keyword(item.span, keyword);
529529
self.fmt.static_str(item.span,
530530
sub_span,
531531
item.id,

0 commit comments

Comments
 (0)