about summary refs log tree commit diff
path: root/src/librustc/ich
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2018-10-01 17:46:04 +0200
committerDavid Wood <david@davidtw.co>2018-10-02 00:35:15 +0200
commit43b5d725d0b458e317c52ef200d323998fa0c20f (patch)
tree2173f9fa73cbc837395f77d52dd64251d6bff968 /src/librustc/ich
parentf55129d0037c112a80276ee1de0c2245ddc6462c (diff)
downloadrust-43b5d725d0b458e317c52ef200d323998fa0c20f.tar.gz
rust-43b5d725d0b458e317c52ef200d323998fa0c20f.zip
Improve implicit self mutability suggestions.
This commit adds an `ImplicitSelfKind` to the HIR and the MIR that keeps
track of whether a implicit self argument is immutable by-value, mutable
by-value, immutable reference or mutable reference so that the addition
of the `mut` keyword can be suggested for the immutable by-value case.
Diffstat (limited to 'src/librustc/ich')
-rw-r--r--src/librustc/ich/impls_hir.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs
index bc2eb5f442b..2097e4faf07 100644
--- a/src/librustc/ich/impls_hir.rs
+++ b/src/librustc/ich/impls_hir.rs
@@ -349,7 +349,7 @@ impl_stable_hash_for!(struct hir::FnDecl {
     inputs,
     output,
     variadic,
-    has_implicit_self
+    implicit_self
 });
 
 impl_stable_hash_for!(enum hir::FunctionRetTy {
@@ -357,6 +357,14 @@ impl_stable_hash_for!(enum hir::FunctionRetTy {
     Return(t)
 });
 
+impl_stable_hash_for!(enum hir::ImplicitSelfKind {
+    Imm,
+    Mut,
+    ImmRef,
+    MutRef,
+    None
+});
+
 impl_stable_hash_for!(struct hir::TraitRef {
     // Don't hash the ref_id. It is tracked via the thing it is used to access
     ref_id -> _,