Commit Graph

30393 Commits

Author SHA1 Message Date
bors 206dd91742 auto merge of #14832 : alexcrichton/rust/no-rpath, r=brson
This commit disables rustc's emission of rpath attributes into dynamic libraries
and executables by default. The functionality is still preserved, but it must
now be manually enabled via a `-C rpath` flag.

This involved a few changes to the local build system:

* --disable-rpath is now the default configure option
* Makefiles now prefer our own LD_LIBRARY_PATH over the user's LD_LIBRARY_PATH
  in order to support building rust with rust already installed.
* The compiletest program was taught to correctly pass through the aux dir as a
  component of LD_LIBRARY_PATH in more situations.

The major impact of this change is that neither rustdoc nor rustc will work
out-of-the-box in all situations because they are dynamically linked. It must be
arranged to ensure that the libraries of a rust installation are part of the
LD_LIBRARY_PATH. The default installation paths for all platforms ensure this,
but if an installation is in a nonstandard location, then configuration may be
necessary.

Additionally, for all developers of rustc, it will no longer be possible to run
$target/stageN/bin/rustc out-of-the-box. The old behavior can be regained
through the `--enable-rpath` option to the configure script.

This change brings linux/mac installations in line with windows installations
where rpath is not possible.

Closes #11747
[breaking-change]
2014-07-08 22:51:39 +00: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
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
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
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
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
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
Björn Steinbrink d2a22f520c Remove remainders from when booleans were i8 2014-07-06 22:12:00 +02:00
Jakub Wieczorek e05ec9a2bf Add a test case for #12187, which appears to have been fixed
Closes #12187.
2014-07-06 21:40:16 +02:00
bors 51a7488532 auto merge of #15467 : brson/rust/guideversion, r=alexcrichton 2014-07-06 18:51:34 +00:00
bors f601c3e7c3 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) }
        }
    })
}
```
2014-07-06 17:06:36 +00:00
Alex Crichton 6d4d83c94d 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.
2014-07-06 08:28:06 -07:00
bors 00a32f2f18 auto merge of #15456 : aochagavia/rust/guide, r=alexcrichton
Fixes https://github.com/rust-lang/rust/issues/15452
2014-07-06 13:26:35 +00:00
bors 4c0cab7f2f auto merge of #15454 : jakub-/rust/15453, r=huonw
I forget we now have byte string literals.
2014-07-06 11:41:37 +00:00
bors b7c4493b9f auto merge of #15447 : patrickyevsukov/rust/patch-1, r=alexcrichton
Fix Typos
2014-07-06 09:56:38 +00:00
bors 85d33e1aa1 auto merge of #15472 : luqmana/rust/snaps, r=alexcrichton 2014-07-06 07:31:38 +00:00
Luqman Aden 3fd2b0dc02 Register snapshot. 2014-07-06 02:13:35 -04:00
bors ea037d02de auto merge of #15441 : P1start/rust/lifetime-suggest, r=pcwalton
Closes #15433.
2014-07-06 05:46:36 +00:00
bors 0fa8a598f6 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.
2014-07-06 04:01:39 +00:00
bors 832731dace auto merge of #15417 : pfalabella/rust/rational-signed, r=alexcrichton 2014-07-06 01:26:41 +00:00
Brian Anderson 7b7d3c2458 doc: --version no longer displays the host triple 2014-07-05 17:54:24 -07:00
Simon Sapin ed3eee2e2a 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) }
        }
    })
}
```
2014-07-06 01:11:13 +01:00
bors c3ef04be55 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
2014-07-05 22:51:38 +00:00
bors b8ef5cf131 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.
2014-07-05 19:56:39 +00:00
Alex Crichton 56f7101551 rustc: Default #[crate_name] on input, not output 2014-07-05 12:46:42 -07:00
Alex Crichton 15b680ae86 Test fixes and rebase conflicts 2014-07-05 12:46:42 -07:00
Alex Crichton 41ed455db8 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]
2014-07-05 12:46:42 -07:00