Commit Graph

30167 Commits

Author SHA1 Message Date
bors
8fe47bc3bb auto merge of #15183 : steveklabnik/rust/hello_cargo, r=huonw
Built on top of https://github.com/rust-lang/rust/pull/15181. e527192911 is the only new commit, you may want to review that separately.

I'm not sure if the car analogy is too glib.
2014-06-27 02:41:24 +00:00
Steve Klabnik
6bfbc35491 Add one more ignore.
Thanks @huonw
2014-06-26 21:57:46 -04:00
Steve Klabnik
aee263c6b0 Fix windows run instructions
Thank you, @stormbrew!
2014-06-26 20:49:27 -04:00
bors
deb6b04e91 auto merge of #15206 : omasanori/rust/use-reexported, r=alexcrichton
We use re-exported pathes (e.g. std::io::Command) and original ones
(e.g. std::io::process::Command) together in examples now. Using
re-exported ones consistently avoids confusion.
2014-06-27 00:21:24 +00:00
Luqman Aden
8b83355f14 README: Add instructions for building on windows. 2014-06-26 20:17:24 -04:00
bors
c0f231072b auto merge of #15190 : pcwalton/rust/proc-upvars, r=alexcrichton
Since procs do not have lifetime bounds, we must do this to maintain
safety.

This can break code that incorrectly captured references in procedure
types. Change such code to not do this, perhaps with a trait object
instead.

Closes #14036.

[breaking-change]

r? @alexcrichton
2014-06-26 22:21:23 +00:00
Patrick Walton
9a9908405d librustc: Ensure that proc upvars have static lifetime.
Since procs do not have lifetime bounds, we must do this to maintain
safety.

This can break code that incorrectly captured references in procedure
types. Change such code to not do this, perhaps with a trait object
instead.

A better solution would be to add higher-rank lifetime support to procs.
However, this would be a lot of work for a feature we want to remove in
favor of unboxed closures. The corresponding "real fix" is #15067.

Closes #14036.

[breaking-change]
2014-06-26 15:16:03 -07:00
OGINO Masanori
dfef422024 std::io: Use re-exported pathes in examples.
We use re-exported pathes (e.g. std::io::Command) and original ones
(e.g. std::io::process::Command) together in examples now. Using
re-exported ones consistently avoids confusion.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-06-27 07:10:33 +09:00
Steve Klabnik
e4b87077fb C macros, not C++ templates.
@cmr rightfully points out that C macros are worse, and share the
same name.
2014-06-26 16:58:20 -04:00
Steve Klabnik
15bcb2f9c6 Fix missing word and some grammar
Thanks @chris-morgan and @P1start! ❤️
2014-06-26 15:46:36 -04:00
bors
4c33a14cc5 auto merge of #14886 : alexcrichton/rust/rt-improvements, r=brson
Most of the comments are available on the Task structure itself, but this commit
is aimed at making FFI-style usage of Rust tasks a little nicer.

Primarily, this commit enables re-use of tasks across multiple invocations. The
method `run` will no longer unconditionally destroy the task itself. Rather, the
task will be internally re-usable if the closure specified did not fail. Once a
task has failed once it is considered poisoned and it can never be used again.

Along the way I tried to document shortcomings of the current method of tearing
down a task, opening a few issues as well. For now none of the behavior is a
showstopper, but it's useful to acknowledge it. Also along the way I attempted
to remove as much `unsafe` code as possible, opting for safer abstractions.
2014-06-26 19:46:25 +00:00
Steve Klabnik
546b202e0e Note that macros != templates
Good call, @chris-morgan and @cmr!
2014-06-26 15:44:29 -04:00
Steve Klabnik
8cd906811a Clarify which curly is being referred to
Thanks @chris-morgan
2014-06-26 15:41:46 -04:00
Steve Klabnik
efc2d4a476 TIL PATHEXT
Thanks @chris-morgan ❤️
2014-06-26 15:40:52 -04:00
Alex Crichton
7d756e44a9 rustrt: Reorganize task usage
Most of the comments are available on the Task structure itself, but this commit
is aimed at making FFI-style usage of Rust tasks a little nicer.

Primarily, this commit enables re-use of tasks across multiple invocations. The
method `run` will no longer unconditionally destroy the task itself. Rather, the
task will be internally re-usable if the closure specified did not fail. Once a
task has failed once it is considered poisoned and it can never be used again.

Along the way I tried to document shortcomings of the current method of tearing
down a task, opening a few issues as well. For now none of the behavior is a
showstopper, but it's useful to acknowledge it. Also along the way I attempted
to remove as much `unsafe` code as possible, opting for safer abstractions.
2014-06-26 12:40:27 -07:00
Steve Klabnik
c73f17486a Move note about $ up
Thanks @chris-morgan ❤️
2014-06-26 15:39:30 -04:00
Steve Klabnik
af4a6c30aa Fixing link to subreddit.
Thanks @chris-morgan ❤️
2014-06-26 15:37:57 -04:00
Steve Klabnik
49a9959d8c StackOverflow -> Stack Overflow
Thanks @chris-morgan
2014-06-26 15:36:57 -04:00
Steve Klabnik
08f533481d Fix IRC linkage.
Death to `here`!

Thanks @chris-morgan ❤️
2014-06-26 15:35:56 -04:00
Steve Klabnik
00ae648496 staticly -> statically
What's funny about this one is that spellcheck caught it, but for
some reason didn't give me the right suggestion, so I assumed that it
wasn't in my dictionary. Oh well.

Thanks @P1start! ❤️
2014-06-26 15:34:15 -04:00
Steve Klabnik
8fd69c4009 all/some
How could I forsake `rustdoc`? 😅

Thanks @huonw.
2014-06-26 15:32:35 -04:00
Steve Klabnik
98fd2abe0a tha -> than
Thanks @huonw ❤️
2014-06-26 15:31:41 -04:00
Steve Klabnik
fb594484e6 Fix capitalization of Issue.
@chris-morgan and @huonw pointed out that even though the feature
is a proper noun, we're using it in a more generic sense here.
2014-06-26 15:30:44 -04:00
Steve Klabnik
39549bebf0 Add a note that this requires git. 2014-06-26 15:30:06 -04:00
Steve Klabnik
a548e8185a Guide: Hello, cargo 2014-06-26 15:23:05 -04:00
bors
b20f968ed2 auto merge of #15197 : omasanori/rust/doc-fix, r=alexcrichton 2014-06-26 17:16:26 +00:00
bors
fa63b8c813 auto merge of #15192 : mrec/rust/json-nan, r=alexcrichton
The JSON spec requires that these special values be serialized as "null"; the current serialization breaks any conformant JSON parser. So encoding needs to output "null",  `to_json` on floating-point types can return `Null` as well as `Number` values, and reading a `Null` value when specifically expecting a number should be interpreted as NaN. There's no way to round-trip Infinity through JSON.

This is my first attempt at both writing Rust and opening pull requests, so please dial your derp detector up to eleven when reviewing. A `rustc --test lib.rs` in `libserialize` passes all tests; a `make check` of the whole tree fails with the error below, but it doesn't look obviously related and the docs say that `make check` is known to be flaky on Windows.

    ---- [compile-fail] compile-fail/svh-change-significant-cfg.rs stdout ----
            task '[compile-fail] compile-fail/svh-change-significant-cfg.rs' failed at 'called `Result::
    unwrap()` on an `Err` value: couldn't create file (end of file (unknown error); path=i686-pc-mingw32
    \test\compile-fail\svh-a-base.err; mode=truncate; access=write)', C:\msys\home\Mike\rust\src\libcore
    \result.rs:545

Incidentally, it may just be my lack of familiarity with the language and its idioms, but the duplication between `Encoder`/`PrettyEncoder` had a distinct code smell to it. The size of the file (~3500 lines) also made it a bit hard to navigate. Has there been any discussion of refactoring and/or breaking it up? I couldn't find anything in Issues except the ancient #9028.
2014-06-26 14:32:30 +00:00
bors
fc502e2345 auto merge of #15194 : Sawyer47/rust/to-string-cleanup, r=alexcrichton
This commit removes superfluous to_string calls from various places
2014-06-26 12:46:25 +00:00
OGINO Masanori
c3c195bd48 Fix a typo and a small syntactic error.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-06-26 21:43:47 +09:00
bors
389fae2ca8 auto merge of #15181 : steveklabnik/rust/hello_world, r=brson
This is built on top of https://github.com/rust-lang/rust/pull/15162 . cccae83d92 is the only new commit, you may want to look at that rather than the whole diff.

Writing our first Rust program together. This is the most crucial step, so I go to a fairly deep level of detail. Future sections will move more quickly.
2014-06-26 07:11:23 +00:00
Piotr Jawniak
f8e06c4965 Remove unnecessary to_string calls
This commit removes superfluous to_string calls from various places
2014-06-26 08:56:49 +02:00
bors
99519cc8e6 auto merge of #15162 : steveklabnik/rust/install_instructions, r=brson
This has my voice *very strongly*. I'm not sure if it's too much. I'd find it okay if I had to tone it back, and I don't want it to be _too strong_, but clinical docs are boring.
2014-06-26 04:21:27 +00:00
bors
edb4e599ab auto merge of #15184 : jbclements/rust/for-loop-hygiene-etc, r=jbclements
It turns out that bindings introduced by 'for' loops were not treated hygienically. The fix for this is to make the 'for' expansion more like a macro; rather than expanding sub-pieces and then assembling them, we need to rewrite the for and then call expand again on the whole thing.

This PR includes a test and the fix.

It also contains a number of other things:
- unit tests for other forms of hygiene (currently ignored)
- a fix for the isaac.rs macro that (it turned out) was relying on capturing
- other miscellaneous cleanup and comments
2014-06-26 02:21:28 +00:00
John Clements
e880c42920 more loops to be ignored by pretty-rpass 2014-06-25 19:15:34 -07:00
mrec
e1a9899a3a json: Fix handling of NaN/Infinity
The JSON spec requires that these special values be serialized as null; the current serialization breaks any conformant JSON parser. So encoding needs to output "null",  to_json on floating-point types can return Null as well as Number, and reading null when specifically expecting a number should be interpreted as NaN. There's no way to round-trip Infinity.
2014-06-26 02:26:41 +01:00
John Clements
d8d48e4aae work around 15189 in test cases 2014-06-25 17:08:47 -07:00
John Clements
eead9e6190 make macros hygienic 2014-06-25 14:36:16 -07:00
John Clements
43c7bbe735 added compile-fail test for 15167 2014-06-25 14:36:15 -07:00
John Clements
1e329bf050 don't expand subexprs of for loop, just re-expand whole thing.
Fixes #15167
2014-06-25 14:36:05 -07:00
John Clements
d2adb7cf81 remove misleading and unnecessary underscores 2014-06-25 14:16:13 -07:00
John Clements
26b5347310 remove unneccessary pubs, shorten names 2014-06-25 14:16:12 -07:00
John Clements
8402793774 remove unneeded visit_ty methods 2014-06-25 14:16:12 -07:00
John Clements
bc837fdadf add unit test for match var hygiene 2014-06-25 14:16:12 -07:00
John Clements
19e1d834ff enrich and rename crate_idents test case 2014-06-25 14:16:12 -07:00
John Clements
9215d7e5b7 comments only 2014-06-25 14:16:12 -07:00
John Clements
bcdcaea572 revive old commented-out test cases as ignored test cases for hygiene 2014-06-25 14:15:40 -07:00
John Clements
c8558f2300 tidy macro just a bit 2014-06-25 14:14:27 -07:00
Steve Klabnik
a8ddab4f25 Add extra ignore directives. 2014-06-25 16:12:40 -04:00
Alex Crichton
2823be08b7 Register new snapshots
This change starts denying `*T` in the parser. All code using `*T` should ensure
that the FFI call does indeed take `const T*` on the other side before renaming
the type to `*const T`.

Otherwise, all code can rename `*T` to `*const T`.

[breaking-change]
2014-06-25 12:47:56 -07:00
bors
9f8149e185 auto merge of #15171 : pcwalton/rust/remove-cross-borrowing, r=brson
This will break code like:

    fn f(x: &mut int) {}

    let mut a = box 1i;
    f(a);

Change it to:

    fn f(x: &mut int) {}

    let mut a = box 1i;
    f(&mut *a);

RFC 33; issue #10504.

[breaking-change]

r? @brson
2014-06-25 18:51:21 +00:00