From 9909ccb4f4a25314f0b831d56c8447345d8fa396 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sun, 11 Oct 2020 18:27:38 +0200 Subject: Fix `mut self` not emitting mutable binding on `self` use --- crates/hir_def/src/body/lower.rs | 5 ++++- crates/ide/src/syntax_highlighting/test_data/highlighting.html | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 2d91bb21f..01e72690a 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs @@ -107,7 +107,10 @@ impl ExprCollector<'_> { let param_pat = self.alloc_pat( Pat::Bind { name: name![self], - mode: BindingAnnotation::Unannotated, + mode: BindingAnnotation::new( + self_param.mut_token().is_some() && self_param.amp_token().is_none(), + false, + ), subpat: None, }, Either::Right(ptr), diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index 1d8a3c404..3d54e4824 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html @@ -62,7 +62,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd impl Foo { fn baz(mut self, f: Foo) -> i32 { - f.baz(self) + f.baz(self) } fn qux(&mut self) { -- cgit v1.2.3