From 26b6c3642622156035cfa5ced4db9b072407e999 Mon Sep 17 00:00:00 2001 From: Daniel Sockwell Date: Sun, 23 Dec 2018 09:54:56 -0500 Subject: [PATCH 1/6] Update syntax for 2018 Edition Under the 2018 Edition, the `crate::` namespace is required when `use` is employed to reference a structure created in the current module. Without `crate::` this example will not compile under the 2018 Edition; with this change, the example complies again. --- src/custom_types/enum/enum_use.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/custom_types/enum/enum_use.md b/src/custom_types/enum/enum_use.md index 01eb99cbc7..a6ac21a9b2 100644 --- a/src/custom_types/enum/enum_use.md +++ b/src/custom_types/enum/enum_use.md @@ -19,9 +19,9 @@ enum Work { fn main() { // Explicitly `use` each name so they are available without // manual scoping. - use Status::{Poor, Rich}; + use crate::Status::{Poor, Rich}; // Automatically `use` each name inside `Work`. - use Work::*; + use crate::Work::*; // Equivalent to `Status::Poor`. let status = Poor; From 4cab400b4d15b34756a76605be9ed90f0d0b801c Mon Sep 17 00:00:00 2001 From: Daniel Sockwell Date: Sun, 23 Dec 2018 10:19:53 -0500 Subject: [PATCH 2/6] Update linked list to 2018 Edition syntax --- src/custom_types/enum/testcase_linked_list.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/custom_types/enum/testcase_linked_list.md b/src/custom_types/enum/testcase_linked_list.md index 3c10ed61c2..3a400ccc08 100644 --- a/src/custom_types/enum/testcase_linked_list.md +++ b/src/custom_types/enum/testcase_linked_list.md @@ -3,7 +3,7 @@ A common use for `enums` is to create a linked-list: ```rust,editable -use List::*; +crate::use List::*; enum List { // Cons: Tuple struct that wraps an element and a pointer to the next node From 2ea8fb2b41dcf6ec7ca66059a2325fa722a3f606 Mon Sep 17 00:00:00 2001 From: Daniel Sockwell Date: Sun, 23 Dec 2018 14:15:43 -0500 Subject: [PATCH 3/6] Fix syntax error with use statement --- src/custom_types/enum/testcase_linked_list.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/custom_types/enum/testcase_linked_list.md b/src/custom_types/enum/testcase_linked_list.md index 3a400ccc08..61109d1596 100644 --- a/src/custom_types/enum/testcase_linked_list.md +++ b/src/custom_types/enum/testcase_linked_list.md @@ -3,7 +3,7 @@ A common use for `enums` is to create a linked-list: ```rust,editable -crate::use List::*; +use crate::List::*; enum List { // Cons: Tuple struct that wraps an element and a pointer to the next node From b919141218b27a90c78495b4bef7895c8bf4c121 Mon Sep 17 00:00:00 2001 From: Daniel Sockwell Date: Wed, 26 Dec 2018 11:06:56 -0500 Subject: [PATCH 4/6] Update visibility subchapter to 2018 syntax --- src/mod/visibility.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/visibility.md b/src/mod/visibility.md index 6345630108..5f436f57da 100644 --- a/src/mod/visibility.md +++ b/src/mod/visibility.md @@ -37,7 +37,7 @@ mod my_mod { // Functions declared using `pub(in path)` syntax are only visible // within the given path. `path` must be a parent or ancestor module - pub(in my_mod) fn public_function_in_my_mod() { + pub(in crate::my_mod) fn public_function_in_my_mod() { print!("called `my_mod::nested::public_function_in_my_mod()`, that\n > "); public_function_in_nested() } @@ -114,4 +114,4 @@ fn main() { //my_mod::private_nested::function(); // TODO ^ Try uncommenting this line } -``` \ No newline at end of file +``` From 45d1e66415a63a4e37b1967b34fea605a8f6a843 Mon Sep 17 00:00:00 2001 From: Daniel Sockwell Date: Wed, 26 Dec 2018 11:17:02 -0500 Subject: [PATCH 5/6] Update "use" subchapter to 2018 Edition syntax --- src/mod/super.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/super.md b/src/mod/super.md index c0088808be..038d4b1271 100644 --- a/src/mod/super.md +++ b/src/mod/super.md @@ -44,7 +44,7 @@ mod my { // This will bind to the `cool::function` in the *crate* scope. // In this case the crate scope is the outermost scope. { - use cool::function as root_function; + use crate::cool::function as root_function; root_function(); } } @@ -53,4 +53,4 @@ mod my { fn main() { my::indirect_call(); } -``` \ No newline at end of file +``` From da6b75014b391cbdf8f75d9f53607f727db64862 Mon Sep 17 00:00:00 2001 From: Daniel Sockwell Date: Wed, 26 Dec 2018 11:17:48 -0500 Subject: [PATCH 6/6] Update "use" subchapter to 2018 Edition syntax --- src/mod/use.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/use.md b/src/mod/use.md index 736aad6bd1..5f99138726 100644 --- a/src/mod/use.md +++ b/src/mod/use.md @@ -6,7 +6,7 @@ access. It is often used like this: ```rust,editable,ignore // extern crate deeply; // normally, this would exist and not be commented out! -use deeply::nested::{ +use crate::deeply::nested::{ my_first_function, my_second_function, AndATraitType @@ -43,7 +43,7 @@ fn main() { { // This is equivalent to `use deeply::nested::function as function`. // This `function()` will shadow the outer one. - use deeply::nested::function; + use crate::deeply::nested::function; function(); // `use` bindings have a local scope. In this case, the