Commit Graph

30767 Commits

Author SHA1 Message Date
John Clements
06b64345d6 preserve context in parsing of self varref 2014-07-08 15:14:46 -07:00
John Clements
728b269199 remove unused fn, make SELF_KEYWORD_NAME public 2014-07-08 15:14:46 -07:00
John Clements
29b3f29820 test harness cleanup 2014-07-08 15:14:46 -07:00
John Clements
9f94f823b0 change if/else to match 2014-07-08 15:14:45 -07:00
John Clements
f3fa836939 added test for method arg hygiene 2014-07-08 15:14:45 -07:00
Steve Klabnik
17bb4af8fe Guide: Standard input 2014-07-08 17:49:19 -04:00
bors
8bb34a3146 auto merge of #15493 : brson/rust/tostr, r=pcwalton
This updates https://github.com/rust-lang/rust/pull/15075.

Rename `ToStr::to_str` to `ToString::to_string`. The naive renaming ends up with two `to_string` functions defined on strings in the prelude (the other defined via `collections::str::StrAllocating`). To remedy this I removed `StrAllocating::to_string`, making all conversions from `&str` to `String` go through `Show`. This has a measurable impact on the speed of this conversion, but the sense I get from others is that it's best to go ahead and unify `to_string` and address performance for all `to_string` conversions in `core::fmt`. `String::from_str(...)` still works as a manual fast-path.

Note that the patch was done with a script, and ended up renaming a number of other `*_to_str` functions, particularly inside of rustc. All the ones I saw looked correct, and I didn't notice any additional API breakage.

Closes #15046.
2014-07-08 20:06:40 +00:00
Richo Healey
12c334a77b std: Rename the ToStr trait to ToString, and to_str to to_string.
[breaking-change]
2014-07-08 13:01:43 -07:00
Adrien Tétar
b7ef0cf742 webfonts: check-in licenses 2014-07-08 21:55:37 +02:00
Steve Klabnik
636aff144a Guide: looping 2014-07-08 15:25:27 -04:00
Adrien Tétar
3b0b7b6b91 webfonts: serve Source Code Pro locally
So that we have freestanding docs.
2014-07-08 20:31:26 +02:00
Adrien Tétar
4d5f4ff5e9 webfonts: proper fix 2014-07-08 20:29:36 +02:00
Steve Klabnik
daea9f4ad9 Guide: match 2014-07-08 12:16:58 -04:00
Steve Klabnik
654a19b091 Guide: comments 2014-07-08 12:07:11 -04:00
bors
35e2134621 auto merge of #15521 : nick29581/rust/type, r=pcwalton
closes #13367

[breaking-change] Use `Sized?` to indicate a dynamically sized type parameter or trait (used to be `type`). E.g.,

```
trait Tr for Sized? {}

fn foo<Sized? X: Share>(x: X) {}
```
2014-07-08 16:01:41 +00:00
Steve Klabnik
11c64f162f Guide: complex data types 2014-07-08 12:00:47 -04:00
bors
bfe4ddfdea auto merge of #15518 : alexcrichton/rust/fix-some-crate-names, r=sfackler
The output file was only being renamed based off #[crate_name], not #[crate_id]
or --crate-name. Both of these behaviors have been restored now.
2014-07-08 13:31:41 +00:00
Alex Crichton
2c26a00f91 rustc: Fix naming output files with --crate-name
The output file was only being renamed based off #[crate_name], not #[crate_id]
or --crate-name. Both of these behaviors have been restored now.
2014-07-08 06:27:37 -07:00
Nick Cameron
a0cfda53c4 Change DST syntax: type -> Sized?
closes #13367

[breaking-change] Use `Sized?` to indicate a dynamically sized type parameter or trait (used to be `type`). E.g.,

```
trait Tr for Sized? {}

fn foo<Sized? X: Share>(x: X) {}
```
2014-07-08 22:44:31 +12:00
bors
e2e237afc1 auto merge of #15516 : brson/rust/tidy, r=alexcrichton
Tidy takes like forever to run. How many times have I wished I didn't have to sit through tidy before seeing my tests fail?
2014-07-08 09:56:41 +00:00
Kevin Ballard
9dc667d472 Remove rust_colorcolumn, set textwidth to 99
The latest change to aturon/rust-guidelines states that lines must not
exceed 99 characters. This gets rid of the 80/100 split, so we don't
need to customize colorcolumn amymore.
2014-07-07 22:22:25 -07:00
Kevin Ballard
94cfd1b4ad Set softtabstop, textwidth, and optionally colorcolumn
Setting softtabstop makes <Del> delete 4 spaces as if it were a tab.

Setting textwidth allows comments to be wrapped automatically. It's set
at 80, which is the recommended line length for Rust programs. There are
suggestions that it should be 79, but our current style guide says 80 so
that's what we're matching.

A new setting g:rust_colorcolumn sets colorcolumn as well, to +1,101.
This indicates both the textwidth and the second stricter line length of
100 that our style guide lists.
2014-07-07 22:18:27 -07:00
Kevin Ballard
c6492040b2 Define a new setting g:rust_fold
g:rust_fold allows folding to be enabled. This lets the user turn on
folding without having to define autocommands.
2014-07-07 22:18:27 -07:00
bors
6959931498 auto merge of #15508 : jakub-/rust/struct-pattern-witness, r=alexcrichton 2014-07-08 04:21:40 +00:00
bors
6f46621b33 auto merge of #15443 : pcwalton/rust/module-and-type-with-same-name, r=nick29581
This will break code that looks like:

    struct Foo {
        ...
    }

    mod Foo {
        ...
    }

Change this code to:

    struct Foo {
        ...
    }

    impl Foo {
        ...
    }

Or rename the module.

Closes #15205.

[breaking-change]

r? @nick29581
2014-07-08 02:36:43 +00:00
Brian Anderson
8121c39a3e mk: Run tidy after tests in 'make check'
Tidy takes like forever to run.
2014-07-07 18:02:59 -07:00
bors
a3257804df auto merge of #15406 : luqmana/rust/nop, r=pcwalton
Extend the null ptr optimization to work with slices, closures, procs, & trait objects by using the internal pointers as the discriminant.

This decreases the size of `Option<&[int]>` (and similar) by one word.
2014-07-08 00:31:42 +00:00
bors
00cdd639a9 auto merge of #15394 : pcwalton/rust/new-index-traits, r=nick29581
This will break code that used the old `Index` trait. Change this code
to use the new `Index` traits. For reference, here are their signatures:

    pub trait Index<Index,Result> {
        fn index<'a>(&'a self, index: &Index) -> &'a Result;
    }
    pub trait IndexMut<Index,Result> {
        fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Result;
    }

Closes #6515.

[breaking-change]

r? @nick29581
2014-07-07 22:46:41 +00:00
Luqman Aden
fa8da9d6b3 librustc: Update debuginfo. 2014-07-07 14:57:51 -07:00
bors
c175ed4425 auto merge of #15440 : pcwalton/rust/struct-aliases, r=brson
Closes #4508.

r? @nick29581
2014-07-07 21:01:42 +00:00
Jakub Wieczorek
947942e42c Improve non-exhaustive pattern witnesses for structs with multiple fields 2014-07-07 22:00:34 +02:00
kwantam
5d4238b6fc Add libunicode; move unicode functions from core
- created new crate, libunicode, below libstd
- split Char trait into Char (libcore) and UnicodeChar (libunicode)
  - Unicode-aware functions now live in libunicode
    - is_alphabetic, is_XID_start, is_XID_continue, is_lowercase,
      is_uppercase, is_whitespace, is_alphanumeric, is_control,
      is_digit, to_uppercase, to_lowercase
  - added width method in UnicodeChar trait
    - determines printed width of character in columns, or None if it is
      a non-NULL control character
    - takes a boolean argument indicating whether the present context is
      CJK or not (characters with 'A'mbiguous widths are double-wide in
      CJK contexts, single-wide otherwise)
- split StrSlice into StrSlice (libcore) and UnicodeStrSlice
  (libunicode)
  - functionality formerly in StrSlice that relied upon Unicode
    functionality from Char is now in UnicodeStrSlice
    - words, is_whitespace, is_alphanumeric, trim, trim_left, trim_right
  - also moved Words type alias into libunicode because words method is
    in UnicodeStrSlice
- unified Unicode tables from libcollections, libcore, and libregex into
  libunicode
- updated unicode.py in src/etc to generate aforementioned tables
- generated new tables based on latest Unicode data
- added UnicodeChar and UnicodeStrSlice traits to prelude
- libunicode is now the collection point for the std::char module,
  combining the libunicode functionality with the Char functionality
  from libcore
  - thus, moved doc comment for char from core::char to unicode::char
- libcollections remains the collection point for std::str

The Unicode-aware functions that previously lived in the Char and
StrSlice traits are no longer available to programs that only use
libcore. To regain use of these methods, include the libunicode crate
and use the UnicodeChar and/or UnicodeStrSlice traits:

    extern crate unicode;
    use unicode::UnicodeChar;
    use unicode::UnicodeStrSlice;
    use unicode::Words; // if you want to use the words() method

NOTE: this does *not* impact programs that use libstd, since UnicodeChar
and UnicodeStrSlice have been added to the prelude.

closes #15224
[breaking-change]
2014-07-07 14:52:24 -04:00
Patrick Walton
7e4e99123a librustc (RFC #34): Implement the new Index and IndexMut traits.
This will break code that used the old `Index` trait. Change this code
to use the new `Index` traits. For reference, here are their signatures:

    pub trait Index<Index,Result> {
        fn index<'a>(&'a self, index: &Index) -> &'a Result;
    }
    pub trait IndexMut<Index,Result> {
        fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Result;
    }

Closes #6515.

[breaking-change]
2014-07-07 11:43:23 -07:00
Patrick Walton
3c9443b6e5 librustc: Disallow modules and types from having the same name.
This will break code that looks like:

    struct Foo {
        ...
    }

    mod Foo {
        ...
    }

Change this code to:

    struct Foo {
        ...
    }

    impl Foo {
        ...
    }

Or rename the module.

Closes #15205.

[breaking-change]
2014-07-07 10:54:32 -07:00
bors
49bc17bfdd auto merge of #15502 : sfackler/rust/link_args_spaces, r=alexcrichton
Closes #15487
2014-07-07 17:16:34 +00:00
Steven Fackler
12b3498ced Strip empty strings from link args
Closes #15487
2014-07-07 10:13:22 -07:00
Erick Tryzelaar
b4984a490b collections: merge unsafe_push_all_clone and push_all 2014-07-07 09:45:00 -07:00
Erick Tryzelaar
e2d107c397 collections: minimize code that's in unsafe blocks
This changes Vec::from_slice to call unsafe_push_all_clone
directly to avoid doing an unnecessary reserve_additional call
2014-07-07 09:16:36 -07:00
Erick Tryzelaar
7d3899430b collections: flesh out the Vec::clone_from benchmarks to cover reuse 2014-07-07 09:16:36 -07:00
Jason Thompson
7158e8a1b7 Add example for str replace() and MaybeOwned
- for 3 implementations of into_maybe_owned()
  - is_slice()
  - is_owned()
2014-07-07 06:26:52 -04:00
bors
4f120e6baf auto merge of #15496 : ruud-v-a/rust/patch-1, r=huonw
Also removes redundant newline in code block.
2014-07-07 08:16:29 +00:00
bors
f78d2f5900 auto merge of #15489 : jakub-/rust/issue-15488, r=pcwalton
Fixes #15488.
2014-07-07 06:31:30 +00:00
Ruud van Asseldonk
90b79b7686 manual: Fix typo.
Also removes redundant newline in code block.
2014-07-07 07:51:34 +02:00
bors
179b2b48ba auto merge of #15411 : mitchmindtree/rust/master, r=alexcrichton
I ran `make check` and everything went smoothly. I also tested `#[deriving(Decodable, Encodable)]` on a struct containing both Cell<T> and RefCell<T> and everything now seems to work fine.
2014-07-07 04:46:31 +00:00
mitchmindtree
0e84d6fc1a Implemented Decodable/Encodable for Cell and RefCell. Fixes #15395
Updated PR with fixme and test

Updated PR with fixme and test
2014-07-07 13:02:09 +10:00
bors
d9db7f6137 auto merge of #15464 : dotdash/rust/bool_stores, r=pcwalton
LLVM doesn't handle i1 value in allocas/memory very well and skips a number of optimizations if it hits it. So we have to do the same thing that Clang does, using i1 for SSA values, but storing i8 in memory.

Fixes #15203.
2014-07-07 03:01:34 +00:00
bors
21ef888bb7 auto merge of #15481 : alexcrichton/rust/fix-nightly, r=luqmana
The stage0 compiler for a non-CFG_BUILD architecture needs to have the new
`-C extra-filename` argument passed.
2014-07-06 23:06:34 +00:00
Jakub Wieczorek
9f460e7af8 Properly bind nested pattern bindings when there's more than one
Fixes #15488.
2014-07-07 00:26:41 +02:00
bors
c97f885aee auto merge of #15486 : jakub-/rust/test-case-12187, r=alexcrichton
Closes #12187.
2014-07-06 20:36:35 +00:00
Björn Steinbrink
dd4112bf79 Store booleans as i8 in memory to improve optimizations by LLVM
LLVM doesn't really like types with a bit-width that isn't a multiple of
8 and disable various optimizations if it encounters such types used
with loads/stores. OTOH, booleans must be represented as i1 when used as
SSA values. To get the best results, we must use i1 for SSA values, and
i8 when storing the value to memory.

By using range asserts on loads, LLVM can eliminate the required
zero-extend and truncate operations.

Fixes #15203
2014-07-06 22:12:10 +02:00