Commit graph

2103 commits

Author SHA1 Message Date
bors
1785841a5b auto merge of #8410 : luqmana/rust/mcpu, r=sanxiyn
Adds `--target-cpu` flag which lets you choose a more specific target cpu instead of just passing the default, `generic`. It's more or less akin to `-mcpu`/`-mtune` in clang/gcc.
2013-08-11 20:50:14 -07:00
bors
0679436381 auto merge of #8427 : brson/rust/rustc-stack, r=thestinger
A lot of people are hitting stack overflows in rustc. This will make it
easier to experiment with stack size.
2013-08-11 17:38:09 -07:00
bors
b285f1e6c9 auto merge of #8455 : nikomatsakis/rust/issue-5762-objects-dralston-d, r=graydon
Fix #5762 and various other aspects of object invocation.

r? @graydon
2013-08-11 14:17:09 -07:00
Niko Matsakis
7343478d67 Convert from transform to map 2013-08-11 14:56:43 -04:00
Niko Matsakis
df016dc4bf Update type visitor to use &Visitor and not @Visitor 2013-08-11 14:01:23 -04:00
Niko Matsakis
66b8ad5867 borrowck: Integrate AutoBorrowObj into borrowck / mem_categorization
Also cleanup the treatment of mutability in mem_categorization, which still
included the concept of interior mutability. At some point, we should
refactor the types to exclude the possibility of interior mutability rather
than just ignoring the mutability value in those cases.
2013-08-11 14:01:23 -04:00
Niko Matsakis
1bceb98084 typeck: Modify method resolution to use new object adjustments, and
to favor inherent methods over extension methods.

The reason to favor inherent methods is that otherwise an impl
like

    impl Foo for @Foo { fn method(&self) { self.method() } }

causes infinite recursion.  The current change to favor inherent methods is
rather hacky; the method resolution code is in need of a refactoring.
2013-08-11 14:01:23 -04:00
Niko Matsakis
006c6b6be4 trans: Rely on new AutoBorrowObj adjustment to match up object receivers
Note: some portions of this commit written by @Sodel-the-Vociferous
(Daniel Ralston)
2013-08-11 14:01:19 -04:00
Niko Matsakis
6f319812d6 ty: Add (but do not yet use) AutoBorrowObject option to adjustments
Note: some portions of this commit written by @Sodel-the-Vociferous
(Daniel Ralston)
2013-08-11 14:01:19 -04:00
Niko Matsakis
38357ebef4 typeck/check/method: Remove pub from most methods 2013-08-11 13:59:46 -04:00
Niko Matsakis
38b2e2980e Misc small cleanups 2013-08-11 13:59:46 -04:00
Niko Matsakis
6fe59bf877 Add a field borrow_offset to the type descriptor indicating
what amount a T* pointer must be adjusted to reach the contents
of the box. For `~T` types, this requires knowing the type `T`,
which is not known in the case of objects.
2013-08-11 13:59:45 -04:00
Niko Matsakis
3aefb9649d librustc: Convert from @Object to @mut Object as needed 2013-08-11 13:26:59 -04:00
bors
f08851e31a auto merge of #8421 : alexcrichton/rust/unnamed-addr, r=thestinger
This can be applied to statics and it will indicate that LLVM will attempt to
merge the constant in .data with other statics.

I have preliminarily applied this to all of the statics generated by the new
`ifmt!` syntax extension. I compiled a file with 1000 calls to `ifmt!` and a
separate file with 1000 calls to `fmt!` to compare the sizes, and the results
were:

```
fmt           310k
ifmt (before) 529k
ifmt (after)  202k
```

This now means that ifmt! is both faster and smaller than fmt!, yay!
2013-08-11 07:29:07 -07:00
Daniel Micay
076b91f8ad add intrinsics for checked overflow add/sub/mul 2013-08-11 02:51:20 -04:00
Luqman Aden
fcfd6e7c79 rustc: Add --target-cpu flag to select a more specific processor instead of the default, 'generic'. 2013-08-10 17:03:43 -04:00
Erick Tryzelaar
20953bb1fb Merge branch 'match' of https://github.com/msullivan/rust into rollup 2013-08-10 13:04:16 -07:00
Erick Tryzelaar
5e1ca23a65 Merge branch 'vec-exh' of https://github.com/stepancheg/rust into rollup 2013-08-10 13:00:20 -07:00
Erick Tryzelaar
09f4c9af13 Merge branch 'enum-method-privacy' of https://github.com/michaelwoerister/rust into rollup
Conflicts:
	src/libsyntax/opt_vec.rs
2013-08-10 12:59:52 -07:00
Erick Tryzelaar
c8a93efdae Merge remote-tracking branch 'remotes/origin/master' into cleanup-iterators 2013-08-10 12:04:40 -07:00
Erick Tryzelaar
5b2c1c543f syntax and rustc: fix some warnings 2013-08-10 07:33:22 -07:00
Erick Tryzelaar
6fcf2ee8e3 std: Transform.find_ -> .find 2013-08-10 07:33:22 -07:00
Erick Tryzelaar
1db62d8311 std: Iterator.chain_ -> .chain 2013-08-10 07:33:21 -07:00
Erick Tryzelaar
68f40d215e std: Rename Iterator.transform -> .map
cc #5898
2013-08-10 07:33:21 -07:00
Erick Tryzelaar
fad7857c7b Mass rename of .consume{,_iter}() to .move_iter()
cc #7887
2013-08-10 07:01:07 -07:00
bors
e70aac572a auto merge of #8270 : dotdash/rust/ret_alloca_elim, r=pcwalton
When there is only a single store to the ret slot that dominates the
load that gets the value for the "ret" instruction, we can elide the
ret slot and directly return the operand of the dominating store
instruction. This is the same thing that clang does, except for a
special case that doesn't seem to affect us.

Fixes #8238
2013-08-10 04:44:13 -07:00
Björn Steinbrink
4b74b8dca4 Elide unnecessary ret slot allocas
When there is only a single store to the ret slot that dominates the
load that gets the value for the "ret" instruction, we can elide the
ret slot and directly return the operand of the dominating store
instruction. This is the same thing that clang does, except for a
special case that doesn't seem to affect us.

Fixes #8238
2013-08-10 11:04:50 +02:00
bors
f0fc9c92ff auto merge of #8425 : dim-an/rust/increase-stack-size, r=brson 2013-08-10 01:20:14 -07:00
Erick Tryzelaar
ee59aacac4 Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls 2013-08-09 18:48:01 -07:00
Michael Sullivan
437a4c28a3 Fix interaction between default matches and guards. Closes #3121. 2013-08-09 17:39:21 -07:00
Brian Anderson
b473ce304f rustc: Obey RUST_MIN_STACK env var
A lot of people are hitting stack overflows in rustc. This will make it
easier to experiment with stack size.
2013-08-09 17:28:27 -07:00
Dmitry Ermolov
980bcdd381 Increase system stack size. 2013-08-10 03:37:39 +04:00
bors
6f6dce7bbc auto merge of #8176 : catamorphism/rust/rustpkg-extern-mod, r=catamorphism
r? @graydon Also, notably, make rustpkgtest depend on the rustpkg executable (otherwise, tests that shell out to rustpgk might run when rustpkg doesn't exist).
2013-08-09 16:17:10 -07:00
Tim Chevalier
96fd606ddd std/rustc/rustpkg/syntax: Support the extern mod = ... form
This commit allows you to write:

 extern mod x = "a/b/c";

which means rustc will search in the RUST_PATH for a package with
ID a/b/c, and bind it to the name `x` if it's found.

Incidentally, move get_relative_to from back::rpath into std::path
2013-08-09 14:11:50 -07:00
Alex Crichton
2f3fde60c3 Implement an address_insignificant attribute
This can be applied to statics and it will indicate that LLVM will attempt to
merge the constant in .data with other statics.

I have preliminarily applied this to all of the statics generated by the new
`ifmt!` syntax extension. I compiled a file with 1000 calls to `ifmt!` and a
separate file with 1000 calls to `fmt!` to compare the sizes, and the results
were:

fmt           310k
ifmt (before) 529k
ifmt (after)  202k

This now means that ifmt! is both faster and smaller than fmt!, yay!
2013-08-09 13:49:41 -07:00
Michael Sullivan
fb32ddf1a2 Fix vector pattern matching. Closes #6909. 2013-08-09 11:29:41 -07:00
Michael Sullivan
6362c3ad6b Switch to using .enumerate() some places in _match. 2013-08-09 11:29:41 -07:00
bors
6928a10e3f auto merge of #8362 : sfackler/rust/env, r=alexcrichton
env! aborts compilation of the specified environment variable is not
defined and takes an optional second argument containing a custom
error message. option_env! creates an Option<&'static str> containing
the value of the environment variable.

There are no run-pass tests that check the behavior when the environment
variable is defined since the test framework doesn't support setting
environment variables at compile time as opposed to runtime. However,
both env! and option_env! are used inside of rustc itself, which should
act as a sufficient test.

Fixes #2248.
2013-08-09 05:35:06 -07:00
bors
2fe2e59c67 auto merge of #8361 : alexcrichton/rust/fix-node-hashes-in-crates, r=thestinger
When running rusti 32-bit tests from a 64-bit host, these errors came up frequently. My best idea as to what was happening is:

1. First, if you hash the same `int` value on 32-bit and 64-bit, you will get two different hashes.
2. In a cross-compile situation, let's say x86_64 is building an i686 library, all of the hashes will be 64-bit hashes.
3. Then let's say you use the i686 libraries and then attempt to link against the same i686 libraries, because you're calculating hashes with a 32-bit int instead of a 64-bit one, you'll have different hashes and you won't be able to find items in the metadata (the items were generated with a 64-bit int).

This patch changes the items to always be hashed as an `i64` to preserve the hash value across architectures. Here's a nice before/after for this patch of the state of rusti tests

```
host   target  before  after
64     64      yes     yes
64     32      no      no (llvm assertion)
32     64      no      yes
32     32      no      no (llvm assertion)
```

Basically one case started working, but currently when the target is 32-bit LLVM is having a lot of problems generating code. That's another separate issue though.
2013-08-09 02:53:08 -07:00
bors
a931e04b75 auto merge of #8350 : dim-an/rust/fix-struct-match, r=pcwalton
Code that collects fields in struct-like patterns used to ignore
wildcard patterns like `Foo{_}`. But `enter_defaults` considered
struct-like patterns as default in order to overcome this
(accoring to my understanding of situation).

However such behaviour caused code like this:
```
enum E {
    Foo{f: int},
    Bar
}
let e = Bar;
match e {
    Foo{f: _f} => { /* do something (1) */ }
    _ => { /* do something (2) */ }
}
```
consider pattern `Foo{f: _f}` as default. That caused inproper behaviour
and even segfaults while trying to destruct `Bar` as `Foo{f: _f}`.
Issues: #5625 , #5530.

This patch fixes `collect_record_or_struct_fields` to split cases of
single wildcard struct-like pattern and no struct-like pattern at all.
Former case resolved with `enter_rec_or_struct` (and not with
`enter_defaults`).

Closes #5625.
Closes #5530.
2013-08-08 21:41:05 -07:00
Erick Tryzelaar
56730c094c Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls 2013-08-08 19:27:03 -07:00
bors
8f65dbfcfa auto merge of #8385 : cmr/rust/big-rollup, r=alexcrichton
This is a fairly large rollup, but I've tested everything locally, and none of
it should be platform-specific.

r=alexcrichton (bdfdbdd)
r=brson (d803c18)
r=alexcrichton (a5041d0)
r=bstrie (317412a)
r=alexcrichton (135c85e)
r=thestinger (8805baa)
r=pcwalton (0661178)
r=cmr (9397fe0)
r=cmr (caa4135)
r=cmr (6a21d93)
r=cmr (4dc3379)
r=cmr (0aa5154)
r=cmr (18be261)
r=thestinger (f10be03)
2013-08-08 14:32:02 -07:00
Steven Fackler
c3825c8351 env! syntax extension changes
env! aborts compilation of the specified environment variable is not
defined and takes an optional second argument containing a custom
error message. option_env! creates an Option<&'static str> containing
the value of the environment variable.

There are no run-pass tests that check the behavior when the environment
variable is defined since the test framework doesn't support setting
environment variables at compile time as opposed to runtime. However,
both env! and option_env! are used inside of rustc itself, which should
act as a sufficient test.

Close #2248
2013-08-08 10:35:42 -07:00
Do Nhat Minh
a185343fc4 misc help message fix 2013-08-07 22:41:14 -04:00
Alex Crichton
ffd80aa276 Fix unit structs in cross-crate situtations 2013-08-07 22:41:13 -04:00
Alex Crichton
e99eff172a Forbid priv where it has no effect
This is everywhere except struct fields and enum variants.
2013-08-07 22:41:12 -04:00
blake2-ppc
8523f6d643 rustc: Fix for-range loops that can use iterators
Transform range loops that can be regular iterator loops.
2013-08-07 22:39:57 -04:00
blake2-ppc
e7d4a9c7f2 Bugfix .each_edge in middle/graph.rs
Edge iterator used the length of the nodes vector, must be a mistake.
2013-08-07 22:39:57 -04:00
Brian Anderson
0929eb4ac8 rustc: Use 4MB stacks. Needed for unoptimized builds apparently. 2013-08-07 15:40:27 -07:00
Erick Tryzelaar
a54476b0aa Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls 2013-08-07 14:10:39 -07:00