Skip to content

Remove re-exports of std::io::stdio::{print, println} in the prelude. #11416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/guide-conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ fn main() {

};
if result.is_err() {
println("parsing failed");
println!("parsing failed");
}
}

Expand Down
4 changes: 2 additions & 2 deletions doc/guide-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ let xs = [2u, 3, 5, 7, 11, 13, 17];

// print out all the elements in the vector
for x in xs.iter() {
println(x.to_str())
println!("{}", *x)
}

// print out all but the first 3 elements in the vector
for x in xs.iter().skip(3) {
println(x.to_str())
println!("{}", *x)
}
~~~

Expand Down
26 changes: 15 additions & 11 deletions doc/guide-pointers.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct Point {
fn main() {
let a = Point { x: 10, y: 20 };
do spawn {
println(a.x.to_str());
println!("{}", a.x);
}
}
~~~
Expand All @@ -239,7 +239,7 @@ struct Point {
fn main() {
let a = ~Point { x: 10, y: 20 };
do spawn {
println(a.x.to_str());
println!("{}", a.x);
}
}
~~~
Expand Down Expand Up @@ -270,18 +270,22 @@ struct Point {
fn main() {
let a = ~Point { x: 10, y: 20 };
let b = a;
println(b.x.to_str());
println(a.x.to_str());
println!("{}", b.x);
println!("{}", a.x);
}
~~~

You'll get this error:

~~~ {.notrust}
test.rs:10:12: 10:13 error: use of moved value: `a`
test.rs:10 println(a.x.to_str());
^
test.rs:8:8: 8:9 note: `a` moved here because it has type `~Point`, which is moved by default (use `ref` to override)
test.rs:10:20: 10:21 error: use of moved value: `a`
test.rs:10 println!("{}", a.x);
^
note: in expansion of format_args!
<std-macros>:158:27: 158:81 note: expansion site
<std-macros>:157:5: 159:6 note: in expansion of println!
test.rs:10:5: 10:25 note: expansion site
test.rs:8:9: 8:10 note: `a` moved here because it has type `~Point`, which is moved by default (use `ref` to override)
test.rs:8 let b = a;
^
~~~
Expand All @@ -297,8 +301,8 @@ struct Point {
fn main() {
let a = @Point { x: 10, y: 20 };
let b = a;
println(b.x.to_str());
println(a.x.to_str());
println!("{}", b.x);
println!("{}", a.x);
}
~~~

Expand Down Expand Up @@ -367,7 +371,7 @@ compile?

~~~rust{.xfail-test}
fn main() {
println(x.to_str());
println!("{}", x);
let x = 5;
}
~~~
Expand Down
2 changes: 1 addition & 1 deletion doc/guide-rustpkg.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Next, let's add a source file:
#[license = "MIT"];

pub fn world() {
println("Hello, world.");
println!("Hello, world.");
}
~~~

Expand Down
6 changes: 3 additions & 3 deletions doc/guide-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ closure in the new task.
# use std::task::spawn;

// Print something profound in a different task using a named function
fn print_message() { println("I am running in a different task!"); }
fn print_message() { println!("I am running in a different task!"); }
spawn(print_message);

// Print something more profound in a different task using a lambda expression
spawn(proc() println("I am also running in a different task!") );
spawn(proc() println!("I am also running in a different task!") );

// The canonical way to spawn is using `do` notation
do spawn {
println("I too am running in a different task!");
println!("I too am running in a different task!");
}
~~~~

Expand Down
4 changes: 2 additions & 2 deletions doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -2668,7 +2668,7 @@ An example:
let mut i = 0;

while i < 10 {
println("hello\n");
println!("hello");
i = i + 1;
}
~~~~
Expand Down Expand Up @@ -3267,7 +3267,7 @@ impl Printable for int {
}

fn print(a: @Printable) {
println(a.to_string());
println!("{}", a.to_string());
}

fn main() {
Expand Down
Loading