Skip to content

Commit 244fdf4

Browse files
committed
---
yaml --- r: 15336 b: refs/heads/try c: fc7fc90 h: refs/heads/master v: v3
1 parent b30a524 commit 244fdf4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: b91c9f803d3b87be3c6b7480ef9abbd9611c717c
5+
refs/heads/try: fc7fc90adfc9576507e730ab54f35d1073ab2a4f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/doc/tutorial.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,6 +1686,7 @@ purpose, you create a `.rc` crate file, which references any number of
16861686

16871687
~~~~ {.ignore}
16881688
#[link(name = "farm", vers = "2.5", author = "mjh")];
1689+
#[crate_type = "lib"];
16891690
mod cow;
16901691
mod chicken;
16911692
mod horse;
@@ -1694,7 +1695,9 @@ mod horse;
16941695
Compiling this file will cause `rustc` to look for files named
16951696
`cow.rs`, `chicken.rs`, `horse.rs` in the same directory as the `.rc`
16961697
file, compile them all together, and, depending on the presence of the
1697-
`--lib` switch, output a shared library or an executable.
1698+
`crate_type = "lib"` attribute, output a shared library or an executable.
1699+
(If the line `#[crate_type = "lib"];` was omitted, `rustc` would create an
1700+
executable.)
16981701

16991702
The `#[link(...)]` part provides meta information about the module,
17001703
which other crates can use to load the right module. More about that
@@ -1717,9 +1720,9 @@ content to the `poultry` module itself.
17171720

17181721
## Using other crates
17191722

1720-
Having compiled a crate with `--lib`, you can use it in another crate
1721-
with a `use` directive. We've already seen `use std` in several of the
1722-
examples, which loads in the [standard library][std].
1723+
Having compiled a crate that contains the `#[crate_type = "lib"]` attribute,
1724+
you can use it in another crate with a `use` directive. We've already seen
1725+
`use std` in several of the examples, which loads in the [standard library][std].
17231726

17241727
[std]: http://doc.rust-lang.org/doc/std/index/General.html
17251728

0 commit comments

Comments
 (0)