Skip to content

Commit a506b7c

Browse files
committed
mention dash-to-underscore behavior
1 parent 2cebf36 commit a506b7c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/doc/trpl/crates-and-modules.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ the `phrases` crate. We can then use `phrases`’ modules in this one. As we
263263
mentioned earlier, you can use double colons to refer to sub-modules and the
264264
functions inside of them.
265265

266+
(Note: when importing a crate that has dashes in its name "like-this", which is
267+
not a valid Rust identifier, it will be converted by changing the dashes to
268+
underscores, so you would write `extern crate like_this;`.)
269+
266270
Also, Cargo assumes that `src/main.rs` is the crate root of a binary crate,
267271
rather than a library crate. Our package now has two crates: `src/lib.rs` and
268272
`src/main.rs`. This pattern is quite common for executable crates: most

0 commit comments

Comments
 (0)