]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agomk: Run tidy after tests in 'make check'
Brian Anderson [Tue, 8 Jul 2014 01:02:59 +0000 (18:02 -0700)]
mk: Run tidy after tests in 'make check'

Tidy takes like forever to run.

10 years agoauto merge of #15406 : luqmana/rust/nop, r=pcwalton
bors [Tue, 8 Jul 2014 00:31:42 +0000 (00:31 +0000)]
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.

10 years agoauto merge of #15394 : pcwalton/rust/new-index-traits, r=nick29581
bors [Mon, 7 Jul 2014 22:46:41 +0000 (22:46 +0000)]
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

10 years agolibrustc: Update debuginfo.
Luqman Aden [Mon, 7 Jul 2014 21:41:18 +0000 (14:41 -0700)]
librustc: Update debuginfo.

10 years agoauto merge of #15440 : pcwalton/rust/struct-aliases, r=brson
bors [Mon, 7 Jul 2014 21:01:42 +0000 (21:01 +0000)]
auto merge of #15440 : pcwalton/rust/struct-aliases, r=brson

Closes #4508.

r? @nick29581

10 years agoImprove non-exhaustive pattern witnesses for structs with multiple fields
Jakub Wieczorek [Mon, 7 Jul 2014 18:54:50 +0000 (20:54 +0200)]
Improve non-exhaustive pattern witnesses for structs with multiple fields

10 years agoAdd libunicode; move unicode functions from core
kwantam [Mon, 30 Jun 2014 21:04:10 +0000 (17:04 -0400)]
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]

10 years agolibrustc (RFC #34): Implement the new `Index` and `IndexMut` traits.
Patrick Walton [Thu, 3 Jul 2014 21:32:41 +0000 (14:32 -0700)]
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]

10 years agolibrustc: Disallow modules and types from having the same name.
Patrick Walton [Sat, 5 Jul 2014 00:59:55 +0000 (17:59 -0700)]
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]

10 years agoauto merge of #15502 : sfackler/rust/link_args_spaces, r=alexcrichton
bors [Mon, 7 Jul 2014 17:16:34 +0000 (17:16 +0000)]
auto merge of #15502 : sfackler/rust/link_args_spaces, r=alexcrichton

Closes #15487

10 years agoStrip empty strings from link args
Steven Fackler [Mon, 7 Jul 2014 16:54:38 +0000 (09:54 -0700)]
Strip empty strings from link args

Closes #15487

10 years agocollections: merge unsafe_push_all_clone and push_all
Erick Tryzelaar [Mon, 7 Jul 2014 16:45:00 +0000 (09:45 -0700)]
collections: merge unsafe_push_all_clone and push_all

10 years agocollections: minimize code that's in unsafe blocks
Erick Tryzelaar [Mon, 7 Jul 2014 16:11:03 +0000 (09:11 -0700)]
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

10 years agocollections: flesh out the Vec::clone_from benchmarks to cover reuse
Erick Tryzelaar [Mon, 7 Jul 2014 16:07:49 +0000 (09:07 -0700)]
collections: flesh out the Vec::clone_from benchmarks to cover reuse

10 years agoauto merge of #15496 : ruud-v-a/rust/patch-1, r=huonw
bors [Mon, 7 Jul 2014 08:16:29 +0000 (08:16 +0000)]
auto merge of #15496 : ruud-v-a/rust/patch-1, r=huonw

Also removes redundant newline in code block.

10 years agoauto merge of #15489 : jakub-/rust/issue-15488, r=pcwalton
bors [Mon, 7 Jul 2014 06:31:30 +0000 (06:31 +0000)]
auto merge of #15489 : jakub-/rust/issue-15488, r=pcwalton

Fixes #15488.

10 years agomanual: Fix typo.
Ruud van Asseldonk [Mon, 7 Jul 2014 05:51:34 +0000 (07:51 +0200)]
manual: Fix typo.

Also removes redundant newline in code block.

10 years agoauto merge of #15411 : mitchmindtree/rust/master, r=alexcrichton
bors [Mon, 7 Jul 2014 04:46:31 +0000 (04:46 +0000)]
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.

10 years agoImplemented Decodable/Encodable for Cell and RefCell. Fixes #15395
mitchmindtree [Fri, 4 Jul 2014 12:24:50 +0000 (22:24 +1000)]
Implemented Decodable/Encodable for Cell and RefCell. Fixes #15395

Updated PR with fixme and test

Updated PR with fixme and test

10 years agoauto merge of #15464 : dotdash/rust/bool_stores, r=pcwalton
bors [Mon, 7 Jul 2014 03:01:34 +0000 (03:01 +0000)]
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.

10 years agoauto merge of #15481 : alexcrichton/rust/fix-nightly, r=luqmana
bors [Sun, 6 Jul 2014 23:06:34 +0000 (23:06 +0000)]
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.

10 years agoProperly bind nested pattern bindings when there's more than one
Jakub Wieczorek [Sun, 6 Jul 2014 21:54:40 +0000 (23:54 +0200)]
Properly bind nested pattern bindings when there's more than one

Fixes #15488.

10 years agoauto merge of #15486 : jakub-/rust/test-case-12187, r=alexcrichton
bors [Sun, 6 Jul 2014 20:36:35 +0000 (20:36 +0000)]
auto merge of #15486 : jakub-/rust/test-case-12187, r=alexcrichton

Closes #12187.

10 years agoStore booleans as i8 in memory to improve optimizations by LLVM
Björn Steinbrink [Sat, 5 Jul 2014 19:47:14 +0000 (21:47 +0200)]
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

10 years agoRemove remainders from when booleans were i8
Björn Steinbrink [Sat, 5 Jul 2014 19:43:47 +0000 (21:43 +0200)]
Remove remainders from when booleans were i8

10 years agoAdd a test case for #12187, which appears to have been fixed
Jakub Wieczorek [Sun, 6 Jul 2014 19:39:59 +0000 (21:39 +0200)]
Add a test case for #12187, which appears to have been fixed

Closes #12187.

10 years agoauto merge of #15467 : brson/rust/guideversion, r=alexcrichton
bors [Sun, 6 Jul 2014 18:51:34 +0000 (18:51 +0000)]
auto merge of #15467 : brson/rust/guideversion, r=alexcrichton

10 years agoauto merge of #15465 : SimonSapin/rust/patch-4, r=alexcrichton
bors [Sun, 6 Jul 2014 17:06:36 +0000 (17:06 +0000)]
auto merge of #15465 : SimonSapin/rust/patch-4, r=alexcrichton

`Vec::push_all` with a length 1 slice seems to have significant overhead compared to `Vec::push`.

```
test new_push_byte ... bench:      6985 ns/iter (+/- 487) = 17 MB/s
test old_push_byte ... bench:     19335 ns/iter (+/- 1368) = 6 MB/s
```

```rust
extern crate test;
use test::Bencher;

static TEXT: &'static str = "\
    Unicode est un standard informatique qui permet des échanges \
    de textes dans différentes langues, à un niveau mondial.";

#[bench]
fn old_push_byte(bencher: &mut Bencher) {
    bencher.bytes = TEXT.len() as u64;
    bencher.iter(|| {
        let mut new = String::new();
        for b in TEXT.bytes() {
            unsafe { new.as_mut_vec().push_all([b]) }
        }
    })
}

#[bench]
fn new_push_byte(bencher: &mut Bencher) {
    bencher.bytes = TEXT.len() as u64;
    bencher.iter(|| {
        let mut new = String::new();
        for b in TEXT.bytes() {
            unsafe { new.as_mut_vec().push(b) }
        }
    })
}
```

10 years agomk: Fix bootstrapping the nightly builds
Alex Crichton [Sun, 6 Jul 2014 15:28:06 +0000 (08:28 -0700)]
mk: Fix bootstrapping the nightly builds

The stage0 compiler for a non-CFG_BUILD architecture needs to have the new
`-C extra-filename` argument passed.

10 years agoauto merge of #15456 : aochagavia/rust/guide, r=alexcrichton
bors [Sun, 6 Jul 2014 13:26:35 +0000 (13:26 +0000)]
auto merge of #15456 : aochagavia/rust/guide, r=alexcrichton

Fixes https://github.com/rust-lang/rust/issues/15452

10 years agoauto merge of #15454 : jakub-/rust/15453, r=huonw
bors [Sun, 6 Jul 2014 11:41:37 +0000 (11:41 +0000)]
auto merge of #15454 : jakub-/rust/15453, r=huonw

I forget we now have byte string literals.

10 years agoauto merge of #15447 : patrickyevsukov/rust/patch-1, r=alexcrichton
bors [Sun, 6 Jul 2014 09:56:38 +0000 (09:56 +0000)]
auto merge of #15447 : patrickyevsukov/rust/patch-1, r=alexcrichton

Fix Typos

10 years agoauto merge of #15472 : luqmana/rust/snaps, r=alexcrichton
bors [Sun, 6 Jul 2014 07:31:38 +0000 (07:31 +0000)]
auto merge of #15472 : luqmana/rust/snaps, r=alexcrichton

10 years agoRegister snapshot.
Luqman Aden [Sun, 6 Jul 2014 06:13:35 +0000 (02:13 -0400)]
Register snapshot.

10 years agostd: flesh out MemWriter benchmarks
Erick Tryzelaar [Sun, 6 Jul 2014 05:31:57 +0000 (22:31 -0700)]
std: flesh out MemWriter benchmarks

10 years agocollections: Optimize Vec when cloning from a slice
Erick Tryzelaar [Sun, 6 Jul 2014 06:11:18 +0000 (23:11 -0700)]
collections: Optimize Vec when cloning from a slice

llvm is currently not able to conver `Vec::extend` into a memcpy
for `Copy` types, which results in methods like `Vec::push_all`
to run twice as slow as it should be running. This patch takes
the unsafe `Vec::clone` optimization to speed up all the operations
that are cloning a slice into a `Vec`.

before:

test vec::tests::bench_clone_from_0000_0000                ... bench:        12 ns/iter (+/- 2)
test vec::tests::bench_clone_from_0000_0010                ... bench:       125 ns/iter (+/- 4) = 80 MB/s
test vec::tests::bench_clone_from_0000_0100                ... bench:       360 ns/iter (+/- 33) = 277 MB/s
test vec::tests::bench_clone_from_0000_1000                ... bench:      2601 ns/iter (+/- 175) = 384 MB/s
test vec::tests::bench_clone_from_0010_0000                ... bench:        12 ns/iter (+/- 2)
test vec::tests::bench_clone_from_0010_0010                ... bench:       125 ns/iter (+/- 10) = 80 MB/s
test vec::tests::bench_clone_from_0010_0100                ... bench:       361 ns/iter (+/- 28) = 277 MB/s
test vec::tests::bench_clone_from_0100_0010                ... bench:       131 ns/iter (+/- 13) = 76 MB/s
test vec::tests::bench_clone_from_0100_0100                ... bench:       360 ns/iter (+/- 9) = 277 MB/s
test vec::tests::bench_clone_from_0100_1000                ... bench:      2575 ns/iter (+/- 168) = 388 MB/s
test vec::tests::bench_clone_from_1000_0100                ... bench:       356 ns/iter (+/- 20) = 280 MB/s
test vec::tests::bench_clone_from_1000_1000                ... bench:      2605 ns/iter (+/- 167) = 383 MB/s
test vec::tests::bench_from_slice_0000                     ... bench:        11 ns/iter (+/- 0)
test vec::tests::bench_from_slice_0010                     ... bench:       115 ns/iter (+/- 5) = 86 MB/s
test vec::tests::bench_from_slice_0100                     ... bench:       309 ns/iter (+/- 170) = 323 MB/s
test vec::tests::bench_from_slice_1000                     ... bench:      2065 ns/iter (+/- 198) = 484 MB/s
test vec::tests::bench_push_all_0000_0000                  ... bench:         7 ns/iter (+/- 0)
test vec::tests::bench_push_all_0000_0010                  ... bench:        79 ns/iter (+/- 7) = 126 MB/s
test vec::tests::bench_push_all_0000_0100                  ... bench:       342 ns/iter (+/- 18) = 292 MB/s
test vec::tests::bench_push_all_0000_1000                  ... bench:      2873 ns/iter (+/- 75) = 348 MB/s
test vec::tests::bench_push_all_0010_0010                  ... bench:       154 ns/iter (+/- 8) = 64 MB/s
test vec::tests::bench_push_all_0100_0100                  ... bench:       518 ns/iter (+/- 18) = 193 MB/s
test vec::tests::bench_push_all_1000_1000                  ... bench:      4490 ns/iter (+/- 223) = 222 MB/s

after:

test vec::tests::bench_clone_from_0000_0000                ... bench:        12 ns/iter (+/- 1)
test vec::tests::bench_clone_from_0000_0010                ... bench:       123 ns/iter (+/- 5) = 81 MB/s
test vec::tests::bench_clone_from_0000_0100                ... bench:       367 ns/iter (+/- 23) = 272 MB/s
test vec::tests::bench_clone_from_0000_1000                ... bench:      2618 ns/iter (+/- 252) = 381 MB/s
test vec::tests::bench_clone_from_0010_0000                ... bench:        12 ns/iter (+/- 1)
test vec::tests::bench_clone_from_0010_0010                ... bench:       124 ns/iter (+/- 7) = 80 MB/s
test vec::tests::bench_clone_from_0010_0100                ... bench:       369 ns/iter (+/- 34) = 271 MB/s
test vec::tests::bench_clone_from_0100_0010                ... bench:       123 ns/iter (+/- 6) = 81 MB/s
test vec::tests::bench_clone_from_0100_0100                ... bench:       371 ns/iter (+/- 25) = 269 MB/s
test vec::tests::bench_clone_from_0100_1000                ... bench:      2713 ns/iter (+/- 532) = 368 MB/s
test vec::tests::bench_clone_from_1000_0100                ... bench:       369 ns/iter (+/- 14) = 271 MB/s
test vec::tests::bench_clone_from_1000_1000                ... bench:      2611 ns/iter (+/- 194) = 382 MB/s
test vec::tests::bench_from_slice_0000                     ... bench:         7 ns/iter (+/- 0)
test vec::tests::bench_from_slice_0010                     ... bench:       108 ns/iter (+/- 4) = 92 MB/s
test vec::tests::bench_from_slice_0100                     ... bench:       235 ns/iter (+/- 24) = 425 MB/s
test vec::tests::bench_from_slice_1000                     ... bench:      1318 ns/iter (+/- 96) = 758 MB/s
test vec::tests::bench_push_all_0000_0000                  ... bench:         7 ns/iter (+/- 0)
test vec::tests::bench_push_all_0000_0010                  ... bench:        70 ns/iter (+/- 4) = 142 MB/s
test vec::tests::bench_push_all_0000_0100                  ... bench:       176 ns/iter (+/- 16) = 568 MB/s
test vec::tests::bench_push_all_0000_1000                  ... bench:      1125 ns/iter (+/- 94) = 888 MB/s
test vec::tests::bench_push_all_0010_0010                  ... bench:       159 ns/iter (+/- 15) = 62 MB/s
test vec::tests::bench_push_all_0100_0100                  ... bench:       363 ns/iter (+/- 12) = 275 MB/s
test vec::tests::bench_push_all_1000_1000                  ... bench:      2860 ns/iter (+/- 415) = 349 MB/s

10 years agocollections: flesh out Vec benchmarks
Erick Tryzelaar [Sun, 6 Jul 2014 06:07:28 +0000 (23:07 -0700)]
collections: flesh out Vec benchmarks

10 years agoauto merge of #15441 : P1start/rust/lifetime-suggest, r=pcwalton
bors [Sun, 6 Jul 2014 05:46:36 +0000 (05:46 +0000)]
auto merge of #15441 : P1start/rust/lifetime-suggest, r=pcwalton

Closes #15433.

10 years agoauto merge of #15439 : dotdash/rust/remove_entry_bcx, r=pcwalton
bors [Sun, 6 Jul 2014 04:01:39 +0000 (04:01 +0000)]
auto merge of #15439 : dotdash/rust/remove_entry_bcx, r=pcwalton

We no longer need to refer to the entry block from arbitrary places, so
we can drop it from FunctionContext.

10 years agoauto merge of #15417 : pfalabella/rust/rational-signed, r=alexcrichton
bors [Sun, 6 Jul 2014 01:26:41 +0000 (01:26 +0000)]
auto merge of #15417 : pfalabella/rust/rational-signed, r=alexcrichton

10 years agodoc: --version no longer displays the host triple
Brian Anderson [Sun, 6 Jul 2014 00:54:24 +0000 (17:54 -0700)]
doc: --version no longer displays the host triple

10 years agoOptimize String::push_byte()
Simon Sapin [Sun, 6 Jul 2014 00:11:13 +0000 (01:11 +0100)]
Optimize String::push_byte()

```
test new_push_byte ... bench:      6985 ns/iter (+/- 487) = 17 MB/s
test old_push_byte ... bench:     19335 ns/iter (+/- 1368) = 6 MB/s
```

```rust
extern crate test;
use test::Bencher;

static TEXT: &'static str = "\
    Unicode est un standard informatique qui permet des échanges \
    de textes dans différentes langues, à un niveau mondial.";

#[bench]
fn old_push_byte(bencher: &mut Bencher) {
    bencher.bytes = TEXT.len() as u64;
    bencher.iter(|| {
        let mut new = String::new();
        for b in TEXT.bytes() {
            unsafe { new.as_mut_vec().push_all([b]) }
        }
    })
}

#[bench]
fn new_push_byte(bencher: &mut Bencher) {
    bencher.bytes = TEXT.len() as u64;
    bencher.iter(|| {
        let mut new = String::new();
        for b in TEXT.bytes() {
            unsafe { new.as_mut_vec().push(b) }
        }
    })
}
```

10 years agoauto merge of #15319 : alexcrichton/rust/no-crate-id, r=brson
bors [Sat, 5 Jul 2014 22:51:38 +0000 (22:51 +0000)]
auto merge of #15319 : alexcrichton/rust/no-crate-id, r=brson

This is an implementation of [RFC 35](https://github.com/rust-lang/rfcs/blob/master/active/0035-remove-crate-id.md).

The summary for this PR is the same as that of the RFC, with one addendum:

* Removes the `#[crate_id]` attribute and knowledge of versions from rustc.
* Added a `#[crate_name]` attribute similar to the old `#[crate_id]` attribute
* Output filenames no longer have versions or hashes
* Symbols no longer have versions (they still have hashes)
* A new flag, `--extern`, is used to override searching for external crates
* A new flag, `-C metadata=foo`, used when hashing symbols
* [added] An old flag, `--crate-name`, was re purposed to specify the crate name from the command line.

I tried to maintain backwards compatibility wherever possible (with warnings being printed). If I missed anywhere, however, please let me know!

[breaking-change]

Closes #14468
Closes #14469
Closes #14470
Closes #14471

10 years agoauto merge of #15225 : Ryman/rust/liburl_minor, r=alexcrichton
bors [Sat, 5 Jul 2014 19:56:39 +0000 (19:56 +0000)]
auto merge of #15225 : Ryman/rust/liburl_minor, r=alexcrichton

See commits for info, a number of these are 'breaking', although liburl is marked experimental so I'm not sure that matters so much.

First two commits will be impacted if #15138 is adopted, but it's a simple rename.

10 years agorustc: Default #[crate_name] on input, not output
Alex Crichton [Sat, 5 Jul 2014 19:37:43 +0000 (12:37 -0700)]
rustc: Default #[crate_name] on input, not output

10 years agoTest fixes and rebase conflicts
Alex Crichton [Thu, 3 Jul 2014 14:43:12 +0000 (07:43 -0700)]
Test fixes and rebase conflicts

10 years agorustc: Repurpose the --crate-name CLI flag
Alex Crichton [Wed, 2 Jul 2014 00:07:06 +0000 (17:07 -0700)]
rustc: Repurpose the --crate-name CLI flag

In a cargo-driven world the primary location for the name of a crate will be in
its manifest, not in the source file itself. The purpose of this flag is to
reduce required duplication for new cargo projects.

This is a breaking change because the existing --crate-name flag actually
printed the crate name. This flag was renamed to --print-crate-name, and to
maintain consistence, the --crate-file-name flag was renamed to
--print-file-name.

To maintain backwards compatibility, the --crate-file-name flag is still
recognized, but it is deprecated.

[breaking-change]

10 years agotest: Fix tests for crate_id removal
Alex Crichton [Tue, 1 Jul 2014 18:51:41 +0000 (11:51 -0700)]
test: Fix tests for crate_id removal

This involved removing some tests whose functionality was removed such as many
of the crateresolve tests

10 years agorustc: Add a flag for specifying dependencies
Alex Crichton [Tue, 1 Jul 2014 15:37:54 +0000 (08:37 -0700)]
rustc: Add a flag for specifying dependencies

This comit implements a new flag, --extern, which is used to specify where a
crate is located. The purpose of this flag is to bypass the normal crate
loading/matching of the compiler to point it directly at the right file.

This flag takes the form `--extern foo=bar` where `foo` is the name of a crate
and `bar` is the location at which to find the crate. Multiple `--extern`
directives are allowed with the same crate name to specify the rlib/dylib pair
for a crate. It is invalid to specify more than one rlib or more than one dylib,
and it's required that the crates are valid rust crates.

I have also added some extensive documentation to metadata::loader about how
crate loading should work.

RFC: 0035-remove-crate-id

10 years agorustc: Stop putting hashes in filenames by default
Alex Crichton [Tue, 1 Jul 2014 14:57:07 +0000 (07:57 -0700)]
rustc: Stop putting hashes in filenames by default

The compiler will no longer insert a hash or version into a filename by default.
Instead, all output is simply based off the crate name being compiled. For
example, a crate name of `foo` would produce the following outputs:

* bin => foo
* rlib => libfoo.rlib
* dylib => libfoo.{so,dylib} or foo.dll
* staticlib => libfoo.a

The old behavior has been moved behind a new codegen flag,
`-C extra-filename=<hash>`. For example, with the "extra filename" of `bar` and
a crate name of `foo`, the following outputs would be generated:

* bin => foo (same old behavior)
* rlib => libfoobar.rlib
* dylib => libfoobar.{so,dylib} or foobar.dll
* staticlib => libfoobar.a

The makefiles have been altered to pass a hash by default to invocations of
`rustc` so all installed rust libraries will have a hash in their filename. This
is done because the standard libraries are intended to be installed into
privileged directories such as /usr/local. Additionally, it involves very few
build system changes!

RFC: 0035-remove-crate-id
[breaking-change]

10 years agoAdd #[crate_name] attributes as necessary
Alex Crichton [Tue, 1 Jul 2014 14:12:04 +0000 (07:12 -0700)]
Add #[crate_name] attributes as necessary

10 years agorustc: Modify crate loading to ignore versions
Alex Crichton [Tue, 1 Jul 2014 05:53:13 +0000 (22:53 -0700)]
rustc: Modify crate loading to ignore versions

This commit modifies crate loading to purely work off a `crate_name` and nothing
else. This commit also changes the patterns recognized from `lib<foo>-*` to
`lib<foo>*` to accomodate the future renamings of output files.

RFC: 0035-remove-crate-id

10 years agorustc: Add a new codegen flag, -C metadata=foo
Alex Crichton [Tue, 1 Jul 2014 05:52:48 +0000 (22:52 -0700)]
rustc: Add a new codegen flag, -C metadata=foo

This metadata is used to drive the hash of all symbols in a crate. The flag can
be specified a multiple number of times

RFC: 0035-remove-crate-id

10 years agorustc: Remove CrateId and all related support
Alex Crichton [Fri, 6 Jun 2014 20:21:18 +0000 (13:21 -0700)]
rustc: Remove CrateId and all related support

This commit removes all support in the compiler for the #[crate_id] attribute
and all of its derivative infrastructure. A list of the functionality removed is:

* The #[crate_id] attribute no longer exists
* There is no longer the concept of a version of a crate
* Version numbers are no longer appended to symbol names
* The --crate-id command line option has been removed

To migrate forward, rename #[crate_id] to #[crate_name] and only the name of the
crate itself should be mentioned. The version/path of the old crate id should be
removed.

For a transitionary state, the #[crate_id] attribute is still accepted if
the #[crate_name] is not present, but it is warned about if it is the only
identifier present.

RFC: 0035-remove-crate-id
[breaking-change]

10 years agoAdded num::Signed implementation to Ratio (squashed)
Paolo Falabella [Fri, 4 Jul 2014 16:48:58 +0000 (17:48 +0100)]
Added num::Signed implementation to Ratio (squashed)

10 years agoauto merge of #15431 : iliekturtles/rust/13279-error-msg-order, r=pcwalton
bors [Sat, 5 Jul 2014 18:11:43 +0000 (18:11 +0000)]
auto merge of #15431 : iliekturtles/rust/13279-error-msg-order, r=pcwalton

Moved note after error to reduce confusion when the pair appears in the
middle of other errors. Closes #13279.

10 years agoauto merge of #15429 : kballard/rust/vim_tab_conventions, r=pcwalton
bors [Sat, 5 Jul 2014 16:26:44 +0000 (16:26 +0000)]
auto merge of #15429 : kballard/rust/vim_tab_conventions, r=pcwalton

10 years agoImproved example in the Guide
Adolfo Ochagavía [Sat, 5 Jul 2014 16:12:46 +0000 (18:12 +0200)]
Improved example in the Guide

Fixes https://github.com/rust-lang/rust/issues/15452

10 years agoauto merge of #15428 : phildawes/rust/master, r=huonw
bors [Sat, 5 Jul 2014 14:41:44 +0000 (14:41 +0000)]
auto merge of #15428 : phildawes/rust/master, r=huonw

Fix small bug introduced in e38cb972dcf: PatIdent span was incorrect
because self.last_span was being used before the ident token was
parsed.

10 years agoFix #15453
Jakub Wieczorek [Sat, 5 Jul 2014 14:22:21 +0000 (16:22 +0200)]
Fix #15453

10 years agoauto merge of #15427 : aochagavia/rust/parse, r=pcwalton
bors [Sat, 5 Jul 2014 12:56:44 +0000 (12:56 +0000)]
auto merge of #15427 : aochagavia/rust/parse, r=pcwalton

10 years agoauto merge of #15442 : luqmana/rust/odp, r=pnkfelix
bors [Sat, 5 Jul 2014 11:11:47 +0000 (11:11 +0000)]
auto merge of #15442 : luqmana/rust/odp, r=pnkfelix

Inadvertently changed the order in which destructors ran in certain cases with #15076.

Fixes #15438.

10 years agolibcore: Fix Items iterator for zero sized types.
Luqman Aden [Fri, 4 Jul 2014 22:29:47 +0000 (15:29 -0700)]
libcore: Fix Items iterator for zero sized types.

10 years agoauto merge of #15418 : pnkfelix/rust/fsk-revise-VecPerParamSpace, r=pcwalton
bors [Sat, 5 Jul 2014 08:31:48 +0000 (08:31 +0000)]
auto merge of #15418 : pnkfelix/rust/fsk-revise-VecPerParamSpace, r=pcwalton

In my informal measurements, this brings the peak memory usage when
building librustc from 1662M down to 1502M.  Since 1662 - 1502 = 160,
this may not recover the entirety of the observed memory regression
(250M) from PR #14604.  (However, according to my local measurements,
the regression when building librustc was more like 209M, so perhaps
this will still recover the lions share of the lost memory.)

10 years agoauto merge of #15414 : zsiciarz/rust/patch-1, r=alexcrichton
bors [Sat, 5 Jul 2014 06:46:47 +0000 (06:46 +0000)]
auto merge of #15414 : zsiciarz/rust/patch-1, r=alexcrichton

10 years agoauto merge of #15284 : apoelstra/rust/bitv-methods, r=cmr
bors [Sat, 5 Jul 2014 05:01:49 +0000 (05:01 +0000)]
auto merge of #15284 : apoelstra/rust/bitv-methods, r=cmr

The types `Bitv` and `BitvSet` are badly out of date. This PR:
- cleans up the code (primarily, simplifies `Bitv` and implements `BitvSet` in terms of `Bitv`)
- implements several new traits for `Bitv`
- adds new functionality to `Bitv` and `BitvSet`
- replaces internal iterators with external ones
- updates documentation
- minor bug fixes

This is a significantly souped-up version of PR #15139 and is the result of the discussion there.

10 years agoRevise `VecPerParamSpace` to use a one Vec rather than three.
Felix S. Klock II [Fri, 4 Jul 2014 16:47:59 +0000 (18:47 +0200)]
Revise `VecPerParamSpace` to use a one Vec rather than three.

In my informal measurements, this brings the peak memory usage when
building librustc from 1662M down to 1502M.  Since 1662 - 1502 = 160,
this may not recover the entirety of the observed memory regression
(250M) from PR #14604.  (However, according to my local measurements,
the regression when building librustc was more like 209M, so perhaps
this will still recover the lions share of the lost memory.)

10 years agoRefactored VecPerParamSpace to hide exposure of `Vec` representation.
Felix S. Klock II [Fri, 4 Jul 2014 14:39:28 +0000 (16:39 +0200)]
Refactored VecPerParamSpace to hide exposure of `Vec` representation.

This basically meant changing the interface so that no borrowed `&Vec`
is exposed, by hiding `fn get_vec` and `fn get_mut_vec` and revising
`fn all_vecs`.

Instead, clients should use one of the other methods; `get_slice`,
`pop`, `truncate`, `replace`, `push_all`, or `is_empty_in`, which
should work for any case currently used in rustc.

10 years agoUpdate RELEASES.txt
Patrick Yevsukov [Sat, 5 Jul 2014 04:22:59 +0000 (00:22 -0400)]
Update RELEASES.txt

Fix Typos

10 years agoauto merge of #15425 : jbclements/rust/hygiene-for-3-kinds-of-args, r=cmr
bors [Sat, 5 Jul 2014 03:16:50 +0000 (03:16 +0000)]
auto merge of #15425 : jbclements/rust/hygiene-for-3-kinds-of-args, r=cmr

This pull request adds hygiene for 3 kinds of argument bindings:
- arguments to item fns,
- arguments to `ExprFnBlock`s, and
- arguments to `ExprProc`s

It also adds a bunch of unit tests, fixes a few macro uses to be non-capturing, and has a few cleanup items.

local `make check` succeeds.

10 years agoauto merge of #15419 : erickt/rust/json, r=pcwalton
bors [Sat, 5 Jul 2014 01:31:52 +0000 (01:31 +0000)]
auto merge of #15419 : erickt/rust/json, r=pcwalton

This speeds up json serialization by removing most of the allocations.

10 years agolibrustc: Make sure to run destructors in the right order when matching on moved...
Luqman Aden [Sat, 5 Jul 2014 00:55:51 +0000 (17:55 -0700)]
librustc: Make sure to run destructors in the right order when matching on moved value.

10 years agomove lifetime suggestion note to after the error
P1start [Sat, 5 Jul 2014 00:54:26 +0000 (12:54 +1200)]
move lifetime suggestion note to after the error

Closes #15433.

10 years agolibrustc: Accept type aliases for structures in structure literals and
Patrick Walton [Fri, 4 Jul 2014 23:45:47 +0000 (16:45 -0700)]
librustc: Accept type aliases for structures in structure literals and
structure patterns.

Closes #4508.

10 years agoserialize: speed up json pretty printing by batch writing spaces
Erick Tryzelaar [Fri, 4 Jul 2014 23:56:23 +0000 (16:56 -0700)]
serialize: speed up json pretty printing by batch writing spaces

10 years agoRemove entry_bcx from FunctionContext
Björn Steinbrink [Fri, 4 Jul 2014 23:52:12 +0000 (01:52 +0200)]
Remove entry_bcx from FunctionContext

We no longer need to refer to the entry block from arbitrary places, so
we can drop it from FunctionContext.

10 years agoauto merge of #15415 : dgoon/rust/master, r=alexcrichton
bors [Fri, 4 Jul 2014 23:46:44 +0000 (23:46 +0000)]
auto merge of #15415 : dgoon/rust/master, r=alexcrichton

10 years agoserialize: escaping json strings should write in batches.
Erick Tryzelaar [Fri, 4 Jul 2014 23:36:49 +0000 (16:36 -0700)]
serialize: escaping json strings should write in batches.

This significantly speeds up encoding json strings.

10 years agoAdd tests for null pointer opt.
Luqman Aden [Fri, 4 Jul 2014 21:54:23 +0000 (14:54 -0700)]
Add tests for null pointer opt.

10 years agolibrustc: Don't create &[T] slices with NULL as the ptr.
Luqman Aden [Fri, 4 Jul 2014 05:24:33 +0000 (22:24 -0700)]
librustc: Don't create &[T] slices with NULL as the ptr.

10 years agorustc: Reorder error and note message to reduce confusion.
Mike Boutin [Fri, 4 Jul 2014 21:25:27 +0000 (17:25 -0400)]
rustc: Reorder error and note message to reduce confusion.

Moved note after error to reduce confusion when the pair appears in the
middle of other errors. Closes #13279.

10 years agovim: set Rust tab conventions
Kevin Ballard [Fri, 4 Jul 2014 21:09:47 +0000 (14:09 -0700)]
vim: set Rust tab conventions

10 years agoParser: fix PatIdent span bug
Phil Dawes [Fri, 4 Jul 2014 20:46:39 +0000 (21:46 +0100)]
Parser: fix PatIdent span bug

Fix small bug introduced in e38cb972dcf: PatIdent span was incorrect
because self.last_span was being used before the ident token was
parsed.

10 years agoauto merge of #15412 : dotdash/rust/builder, r=alexcrichton
bors [Fri, 4 Jul 2014 20:46:38 +0000 (20:46 +0000)]
auto merge of #15412 : dotdash/rust/builder, r=alexcrichton

10 years agoRemoved unnecessary method in test
Adolfo Ochagavía [Fri, 4 Jul 2014 20:36:27 +0000 (22:36 +0200)]
Removed unnecessary method in test

10 years agoimplement hygiene for ExprFnBlock and ExprProc
John Clements [Fri, 4 Jul 2014 00:20:25 +0000 (17:20 -0700)]
implement hygiene for ExprFnBlock and ExprProc

10 years agoadded test cases for closure arg hygiene
John Clements [Fri, 4 Jul 2014 18:02:17 +0000 (11:02 -0700)]
added test cases for closure arg hygiene

10 years agocomments only
John Clements [Fri, 4 Jul 2014 17:57:28 +0000 (10:57 -0700)]
comments only

10 years agomake any_pat! and u64_from_be_bytes_bench_impl! macros hygienic
John Clements [Thu, 3 Jul 2014 20:10:54 +0000 (13:10 -0700)]
make any_pat! and u64_from_be_bytes_bench_impl! macros hygienic

10 years agohygiene for item fn args
John Clements [Fri, 4 Jul 2014 19:19:15 +0000 (12:19 -0700)]
hygiene for item fn args

also, introduce fn_decl_arg_bindings and expand_and_rename abstractions

10 years agocomments & test cases for IdentRenamers
John Clements [Fri, 4 Jul 2014 19:18:37 +0000 (12:18 -0700)]
comments & test cases for IdentRenamers

10 years agouse PatIdentRenamer for match bindings
John Clements [Fri, 4 Jul 2014 19:15:24 +0000 (12:15 -0700)]
use PatIdentRenamer for match bindings

10 years agocomments only
John Clements [Thu, 3 Jul 2014 06:17:10 +0000 (23:17 -0700)]
comments only

10 years agonew_mark -> apply_mark, new_rename -> apply_rename
John Clements [Thu, 3 Jul 2014 21:38:59 +0000 (14:38 -0700)]
new_mark -> apply_mark, new_rename -> apply_rename

10 years agoadd PatIdentRenamer
John Clements [Thu, 3 Jul 2014 06:16:01 +0000 (23:16 -0700)]
add PatIdentRenamer

10 years agomove RenameList to mtwt, add new_renames abstraction
John Clements [Thu, 3 Jul 2014 05:38:30 +0000 (22:38 -0700)]
move RenameList to mtwt, add new_renames abstraction

10 years agocomments, whitespace, rename NameFinderContext to PatIdentFinder
John Clements [Fri, 4 Jul 2014 19:05:43 +0000 (12:05 -0700)]
comments, whitespace, rename NameFinderContext to PatIdentFinder

10 years agoauto merge of #15405 : pcwalton/rust/delifetime, r=nick29581
bors [Fri, 4 Jul 2014 19:01:33 +0000 (19:01 +0000)]
auto merge of #15405 : pcwalton/rust/delifetime, r=nick29581

This was parsed by the parser but completely ignored; not even stored in
the AST!

This breaks code that looks like:

    static X: &'static [u8] = &'static [1, 2, 3];

Change this code to the shorter:

    static X: &'static [u8] = &[1, 2, 3];

Closes #15312.

[breaking-change]

r? @nick29581

10 years agoserialize: Remove allocations from escaping strs and indenting spaces
Erick Tryzelaar [Fri, 4 Jul 2014 18:08:38 +0000 (11:08 -0700)]
serialize: Remove allocations from escaping strs and indenting spaces

10 years agoauto merge of #15404 : vhbit/rust/ios-ptr-fixes, r=pcwalton
bors [Fri, 4 Jul 2014 17:16:29 +0000 (17:16 +0000)]
auto merge of #15404 : vhbit/rust/ios-ptr-fixes, r=pcwalton