# Why the example does not work?

**URL:** <https://users.rust-lang.org/t/why-the-example-does-not-work/48995>\
**Category:** uncategorized\
**Created:** [September 19, 2020, 3:22pm UTC](https://users.rust-lang.org/t/why-the-example-does-not-work/48995 "2020-09-19T15:22:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yushang](https://avatars.discourse-cdn.com/v4/letter/y/e480ec/32.png) [@yushang](https://users.rust-lang.org/u/yushang)\
**Post date:** [September 19, 2020, 3:22pm UTC](https://users.rust-lang.org/t/why-the-example-does-not-work/48995/1 "2020-09-19T15:22:30Z")

</div>

Hi dear all, I'm trying the code in this [doc](https://doc.rust-lang.org/reference/visibility-and-privacy.html), following is the shortened code

# main.rs

```
mod crate_helper_module {
}

pub mod submodule {
  use crate_helper_module;
}

fn main() {
}
```

It can be compiled with edition 2015, but failed with edition 2018

```
no `crate_helper_module` external crate
```

Why they are different ? Is there any doc about edition 2018 ? Many thanks!!!

---

<div class="post-metadata">

**Author:** ![mbrubeck](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/mbrubeck/32/648_2.png) [@mbrubeck](https://users.rust-lang.org/u/mbrubeck)\
**Post date:** [September 19, 2020, 3:26pm UTC](https://users.rust-lang.org/t/why-the-example-does-not-work/48995/2 "2020-09-19T15:26:06Z")

</div>

In Rust 2018, paths within the current crate are prefixed with `crate::` like this:

```rust
pub mod submodule {
  use crate::crate_helper_module;
}

```

> [@yushang](#):
>
> Is there any doc about edition 2018 ?

See the [Edition Guide](https://doc.rust-lang.org/nightly/edition-guide/rust-2018/index.html).

---

<div class="post-metadata">

**Author:** ![m51](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/m51/32/25834_2.png) [@m51](https://users.rust-lang.org/u/m51)\
**Post date:** [September 19, 2020, 3:26pm UTC](https://users.rust-lang.org/t/why-the-example-does-not-work/48995/3 "2020-09-19T15:26:10Z")

</div>

Also works:

```rust
mod crate_helper_module {
}

pub mod submodule {
  use super::crate_helper_module;
}

fn main() {
}

```

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/system/32/51372_2.png) [@system](https://users.rust-lang.org/u/system)\
**Post date:** [December 18, 2020, 3:26pm UTC](https://users.rust-lang.org/t/why-the-example-does-not-work/48995/4 "2020-12-18T15:26:12Z")

</div>

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.
