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; diff --git a/src/custom_types/enum/testcase_linked_list.md b/src/custom_types/enum/testcase_linked_list.md index 3c10ed61c2..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 -use List::*; +use crate::List::*; enum List { // Cons: Tuple struct that wraps an element and a pointer to the next node 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 +``` 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 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 +```