Commit Graph

30032 Commits

Author SHA1 Message Date
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
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
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
bors
7da94c1a00 auto merge of #15173 : Sawyer47/rust/de-to-string, r=alexcrichton 2014-06-25 17:06:17 +00:00
bors
7be7a8fb3a auto merge of #15121 : steveklabnik/rust/matching_docs, r=alexcrichton
Fixes #11113.
2014-06-25 15:21:26 +00:00
Steve Klabnik
1d574c1731 thanks @sfackler 2014-06-25 11:01:17 -04:00
Steve Klabnik
845ee09dfe fix feedback from @huonw 2014-06-25 11:00:34 -04:00
Steve Klabnik
338a84d45f Guide: install instructions 2014-06-25 11:00:33 -04:00
Steve Klabnik
53627dd1f2 Make an example more clear with sample code.
Fixes #11113.
2014-06-25 10:38:03 -04:00
bors
2f74325fcf auto merge of #15174 : alco/rust/patch-1, r=alexcrichton 2014-06-25 13:36:21 +00:00
Alexei Sholik
beff610102 Fix wrong type name: IoError<()> -> IoResult<()> 2014-06-25 12:12:28 +03:00
Alexei Sholik
f21b29560c Fix a typo in fmt.rs 2014-06-25 11:29:28 +03:00
bors
bab614f5fa auto merge of #15164 : pcwalton/rust/vector-cast-weirdness, r=alexcrichton
vector-reference-to-unsafe-pointer-to-element cast if the type to be
casted to is not fully specified.

This is a conservative change to fix the user-visible symptoms of the
issue. A more flexible treatment would delay cast checks to after
function typechecking.

This can break code that did:

    let x: *u8 = &([0, 0]) as *_;

Change this code to:

    let x: *u8 = &([0, 0]) as *u8;

Closes #14893.

[breaking-change]

r? @alexcrichton
2014-06-25 08:06:21 +00:00
Patrick Walton
315f2a7054 librustc: Don't try to perform the magical
vector-reference-to-unsafe-pointer-to-element cast if the type to be
casted to is not fully specified.

This is a conservative change to fix the user-visible symptoms of the
issue. A more flexible treatment would delay cast checks to after
function typechecking.

This can break code that did:

    let x: *u8 = &([0, 0]) as *_;

Change this code to:

    let x: *u8 = &([0, 0]) as *u8;

Closes #14893.

[breaking-change]
2014-06-24 23:27:41 -07:00
bors
9e103acaba auto merge of #15165 : zookoatleastauthoritycom/rust/14148-Optimize-out-exhortations-about-being-careful-2, r=huonw
Yes, it is important to be careful, but repeated emphasis about it is probably
not helpful — it starts to sound like you came for a tutorial but found a
finger-wagging lecture.

Even after I removed a few of these comments, there are still several left in
the text. That's probably fine! A couple of mentions of how this is dangerous
and you ought to be careful may be a good reminder to the reader.

After making the edits, I reflowed the paragraphs that I had touched, using
emacs's "M-x fill-paragraph", with fill-column equal to 70.
2014-06-25 06:21:20 +00:00
Patrick Walton
f6bfd2c65b librustc: Remove cross borrowing from mutable Boxes to &mut.
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]
2014-06-24 23:14:42 -07:00
Piotr Jawniak
b53acd5356 compiletest: Remove superfluous to_string calls 2014-06-25 07:35:54 +02:00
bors
7a93beef7f auto merge of #15160 : alexcrichton/rust/remove-f128, r=brson
The f128 type has very little support in the compiler and the feature is
basically unusable today. Supporting half-baked features in the compiler can be
detrimental to the long-term development of the compiler, and hence this feature
is being removed.
2014-06-25 04:31:19 +00:00
bors
91be86af09 auto merge of #15163 : alexcrichton/rust/rollup, r=alexcrichton 2014-06-25 02:02:00 +00:00
Alex Crichton
cdccecb24f Test fixes from the rollup
Closes #14482 (std: Bring back half of Add on String)
Closes #15026 (librustc: Remove the fallback to `int` from typechecking.)
Closes #15119 (Add more description to c_str::unwrap().)
Closes #15120 (Add tests for #12470 and #14285)
Closes #15122 (Remove the cheat sheet.)
Closes #15126 (rustc: Always include the morestack library)
Closes #15127 (Improve ambiguous pronoun.)
Closes #15130 (Fix #15129)
Closes #15131 (Add the Guide, add warning to tutorial.)
Closes #15134 (Xfailed tests for hygiene, etc.)
Closes #15135 (core: Add stability attributes to Clone)
Closes #15136 (Some minor improvements to core::bool)
Closes #15137 (std: Add stability attributes to primitive numeric modules)
Closes #15141 (Fix grammar in tutorial)
Closes #15143 (Remove few FIXMEs)
Closes #15145 (Avoid unnecessary temporary on assignments)
Closes #15147 (Small improvements for metaprogramming)
Closes #15153 (librustc: Check function argument patterns for legality of by-move)
Closes #15154 (test: Add a test for regions, traits, and variance.)
Closes #15159 (rustc: Don't register syntax crates twice)
Closes #13816 (Stabilize version output for rustc and rustdoc)
2014-06-24 18:57:01 -07:00
Zooko Wilcox-O'Hearn
e3050ffa52 Optimize out exhortations about being careful.
Yes, it is important to be careful, but repeated emphasis about it is probably
not helpful — it starts to sound like you came for a tutorial but found a
finger-wagging lecture.

Even after I removed a few of these comments, there are still several left in
the text. That's probably fine! A couple of mentions of how this is dangerous
and you ought to be careful may be a good reminder to the reader.

After making the edits, I reflowed the paragraphs that I had touched, using
emacs's "M-x fill-paragraph", with fill-column equal to 70.
2014-06-25 01:25:10 +00:00
Robert Buonpastore
d6a4c431f4 Stabilize version output for rustc and rustdoc 2014-06-24 17:24:34 -07:00
Alex Crichton
fb296b8011 rustc: Don't register syntax crates twice
We only need to register them once, and once they're registered twice warnings
will start being spewed or worse may happen!

Closes #14330
2014-06-24 17:24:19 -07:00
Patrick Walton
86dda1b6f3 test: Add a test for regions, traits, and variance.
Closes #12470.
2014-06-24 17:23:44 -07:00
Patrick Walton
75146fd59c librustc: Check function argument patterns for legality of by-move
bindings.

This will break code that incorrectly did things like:

    fn f(a @ box b: Box<String>) {}

Fix such code to not rely on undefined behavior.

Closes #12534.

[breaking-change]
2014-06-24 17:23:41 -07:00
Keegan McAllister
5ccf056a02 Make parse_expr_res public 2014-06-24 17:23:21 -07:00
Keegan McAllister
26b2fa052f Allow splicing more things in quotes 2014-06-24 17:23:21 -07:00
Keegan McAllister
4e26e2d8ca Use macros to implement syntax::ext::quote::ToSource
This code deserves a bigger refactor, but here's a local improvement.
2014-06-24 17:23:21 -07:00
Björn Steinbrink
a0ec902e23 Avoid unnecessary temporary on assignments
We only need the temporary when the type needs to be dropped, for other
types, we can use trans_into to directly place the value into the
destination.
2014-06-24 17:23:19 -07:00
Piotr Jawniak
e4e3550ff6 Remove few FIXMEs
This commit removes FIXMEs of few closed issues.

Closes #13992
2014-06-24 17:23:16 -07:00
Michael Zhou
58078005cf Fix grammar in tutorial
"as this document" should be "than this document"
2014-06-24 17:23:12 -07:00
Brian Anderson
808b848eaf std: Add stability attributes to primitive numeric modules
The following are unstable:

- core::int, i8, i16, i32, i64
- core::uint, u8, u16, u32, u64
- core::int::{BITS, BYTES, MIN, MAX}, etc.
- std::int, i8, i16, i32, i64
- std::uint, u8, u16, u32, u64

The following are experimental:
- std::from_str::FromStr and impls - may need to return Result instead of Option
- std::int::parse_bytes, etc. - ditto
- std::num::FromStrRadix and impls - ditto
- std::num::from_str_radix - ditto

The following are deprecated:
- std::num::ToStrRadix and imples - Wrapper around fmt::radix. Wrong name (Str vs String)

See https://github.com/rust-lang/rust/wiki/Meeting-API-review-2014-06-23#uint
2014-06-24 17:23:05 -07:00
Brian Anderson
250e2362de Move core::bool tests to run-pass
These are closer to language tests than library.
2014-06-24 17:22:59 -07:00
Brian Anderson
4203dcb351 core: Remove bool::to_bit
This is an unused one-liner.
2014-06-24 17:22:59 -07:00
Brian Anderson
adbd5d7a42 core: Add stability attributes to Clone
The following are tagged 'unstable'

- core::clone
- Clone
- Clone::clone
- impl Clone for Arc
- impl Clone for arc::Weak
- impl Clone for Rc
- impl Clone for rc::Weak
- impl Clone for Vec
- impl Clone for Cell
- impl Clone for RefCell
- impl Clone for small tuples

The following are tagged 'experimental'

- Clone::clone_from - may not provide enough utility
- impls for various extern "Rust" fns - may not handle lifetimes correctly

See https://github.com/rust-lang/rust/wiki/Meeting-API-review-2014-06-23#clone
2014-06-24 17:22:57 -07:00