From 03949f5b5caa330375bb33d7b91b5fc24bd8c92e Mon Sep 17 00:00:00 2001 From: GAJaloyan Date: Fri, 24 Mar 2017 17:47:23 +0100 Subject: [PATCH 1/2] issue #40793 Correcting the two mistakes in the README.md --- src/librustc_borrowck/borrowck/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_borrowck/borrowck/README.md b/src/librustc_borrowck/borrowck/README.md index 5cfbd59d33368..29b007a7499c3 100644 --- a/src/librustc_borrowck/borrowck/README.md +++ b/src/librustc_borrowck/borrowck/README.md @@ -347,7 +347,7 @@ ALIASABLE(*LV, MQ) // M-Deref-Unique ALIASABLE(LV, MQ) ``` -### Checking mutability of immutable pointer types +### Checking aliasability of immutable pointer types Immutable pointer types like `&T` are aliasable, and hence can only be borrowed immutably: @@ -357,7 +357,7 @@ ALIASABLE(*LV, imm) // M-Deref-Borrowed-Imm TYPE(LV) = &Ty ``` -### Checking mutability of mutable pointer types +### Checking aliasability of mutable pointer types `&mut T` can be frozen, so it is acceptable to borrow it as either imm or mut: From c80868e3b348f00d316ca411f9f3f2f3feb7e6a9 Mon Sep 17 00:00:00 2001 From: GAJaloyan Date: Mon, 27 Mar 2017 16:17:08 +0200 Subject: [PATCH 2/2] correcting another mistake in an example copy_pointer -> copy_borrowed_ptr --- src/librustc_borrowck/borrowck/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_borrowck/borrowck/README.md b/src/librustc_borrowck/borrowck/README.md index 29b007a7499c3..034b7cbadd9c6 100644 --- a/src/librustc_borrowck/borrowck/README.md +++ b/src/librustc_borrowck/borrowck/README.md @@ -633,7 +633,7 @@ Here is a concrete example of a bug this rule prevents: ```rust // Test region-reborrow-from-shorter-mut-ref.rs: -fn copy_pointer<'a,'b,T>(x: &'a mut &'b mut T) -> &'b mut T { +fn copy_borrowed_ptr<'a,'b,T>(x: &'a mut &'b mut T) -> &'b mut T { &mut **p // ERROR due to clause (1) } fn main() {