Skip to content

Commit 73393df

Browse files
committed
---
yaml --- r: 40958 b: refs/heads/dist-snap c: 30fac74 h: refs/heads/master v: v3
1 parent f2ac104 commit 73393df

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
99
refs/heads/incoming: e90142e536c150df0d9b4b2f11352152177509b5
10-
refs/heads/dist-snap: cbddd5ed3417dbdf6849a0ffb579cc2b0284d447
10+
refs/heads/dist-snap: 30fac74bf3c370173d9c2cf1e023a6128488f5db
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/doc/tutorial.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ we have a file `hello.rs` containing this program:
128128

129129
~~~~
130130
fn main() {
131-
io::println("hello?");
131+
core::io::println("hello?");
132132
}
133133
~~~~
134134

@@ -142,8 +142,8 @@ error. If you introduce an error into the program (for example, by changing
142142
an error message like this:
143143

144144
~~~~ {.notrust}
145-
hello.rs:2:4: 2:16 error: unresolved name: io::print_with_unicorns
146-
hello.rs:2 io::print_with_unicorns("hello?");
145+
hello.rs:2:4: 2:16 error: unresolved name: core::io::print_with_unicorns
146+
hello.rs:2 core::io::print_with_unicorns("hello?");
147147
^~~~~~~~~~~~~~~~~~~~~~~
148148
~~~~
149149

@@ -180,20 +180,21 @@ JavaScript, C#, or PHP), Rust will feel familiar. Code is arranged
180180
in blocks delineated by curly braces; there are control structures
181181
for branching and looping, like the familiar `if` and `while`; function
182182
calls are written `myfunc(arg1, arg2)`; operators are written the same
183-
and mostly have the same precedence as in C; comments are again like C.
183+
and mostly have the same precedence as in C; comments are again like C;
184+
module names are separated with double-colon, `::`, as with C++.
184185

185186
The main surface difference to be aware of is that the condition at
186187
the head of control structures like `if` and `while` do not require
187188
parentheses, while their bodies *must* be wrapped in
188189
braces. Single-statement, unbraced bodies are not allowed.
189190

190191
~~~~
191-
# fn recalibrate_universe() -> bool { true }
192+
# mod universe { fn recalibrate() -> bool { true } }
192193
fn main() {
193194
/* A simple loop */
194195
loop {
195196
// A tricky calculation
196-
if recalibrate_universe() {
197+
if universe::recalibrate() {
197198
return;
198199
}
199200
}
@@ -209,16 +210,11 @@ let hi = "hi";
209210
let mut count = 0;
210211
211212
while count < 10 {
212-
io::println(hi);
213+
core::io::println(fmt!("count: %?", i));
213214
count += 1;
214215
}
215216
~~~~
216217

217-
The name of the function that prints a line of text, `io::println`, is
218-
qualified: it refers to the function named `println` that's defined in the
219-
module `io`. In Rust, a double colon separates parts of a
220-
qualified name. For more details, see the section on [crates](#crates).
221-
222218
Although Rust can almost always infer the types of local variables, you
223219
can specify a variable's type by following it with a colon, then the type
224220
name. Constants, an the other hand, always require a type annotation.

0 commit comments

Comments
 (0)