Commit Graph

1655 Commits

Author SHA1 Message Date
Huon Wilson
65c7c58c8f std: remove {all*,any*,count} in favour of iterators 2013-06-09 02:22:23 +10:00
Huon Wilson
ce4f63dcee std: add reverse vec iterators, replace vec::each*_reverse. 2013-06-09 02:22:23 +10:00
Philipp Brüschweiler
a99ba1180d rustc::regionck: fix ICE when getting signature of ty_err
Fixes #5062
2013-06-08 09:34:47 +02:00
Philipp Brüschweiler
f3f9db133a rustc: Fix an ICE "Autoderef but type not derefable"
Related to #5062 (same error message), but that test case causes
a different ICE than mentioned there (even without this fix).
2013-06-08 09:34:32 +02:00
Björn Steinbrink
2096d79626 Avoid unnecessary allocations in the metadata decoder 2013-06-08 03:27:48 +02:00
Björn Steinbrink
29e5aa0942 Remove some unnecessary closures 2013-06-08 03:24:47 +02:00
Björn Steinbrink
b65dc42b25 TypeChecker: Avoid unnecessary copies 2013-06-08 03:24:47 +02:00
Björn Steinbrink
96798f5e05 tydecode: Accept a plain borrowed pointer to the data 2013-06-08 03:24:47 +02:00
Björn Steinbrink
51e85f5e6e Avoid unnecessary heap allocations in the metadata ty decoder 2013-06-08 03:24:47 +02:00
Philipp Brüschweiler
080a462050 rustc::typeck: fix array out of bounds
Fixes #6155
2013-06-07 22:09:01 +02:00
Daniel Micay
d945543ebf Merge branch 'each-fn-kill' of https://github.com/huonw/rust into each-fn-kill 2013-06-07 14:43:02 -04:00
Huon Wilson
54d914a9a9 std: remove each[i]_mut functions, in favour of iterators. 2013-06-08 03:24:27 +10:00
Huon Wilson
bc81d279fa rustc: Convert a fail! to a useful error message. 2013-06-08 01:46:49 +10:00
Huon Wilson
f661a15b2b std: remove vec::each2 and vec::each2_mut in favour of iterators 2013-06-08 01:20:47 +10:00
Philipp Brüschweiler
9b3743938d rustc::metadata::decoder: cleanup and slightly speed up each_path 2013-06-07 10:00:48 +02:00
bors
4abd83b18d auto merge of #6985 : Aatch/rust/fixed-vec-6977, r=thestinger
This fixes #6977. Negative counts don't make sense anyway.
2013-06-06 20:34:32 -07:00
James Miller
de27064d84 Disallow negative counts in repeat expressions 2013-06-07 12:30:44 +12:00
bors
145279709d auto merge of #6980 : Kimundi/rust/iterator-collect3, r=thestinger 2013-06-06 14:46:41 -07:00
Marvin Löbel
cac4891154 Fixups 2013-06-06 22:40:35 +02:00
Michael Sullivan
8bbf83b62a Clean up a handful of build warnings. 2013-06-06 12:14:41 -07:00
Philipp Brüschweiler
13df1198d5 infer: remove superfluous call to try() 2013-06-06 11:53:09 +02:00
Alexei Sholik
e75572c879 Deduplicate words in code comments 2013-06-06 10:48:27 +03:00
bors
2c65e2e385 auto merge of #6956 : Blei/rust/fix-symbol-mangling, r=catamorphism
Handle more characters that appear in types, most notably <>): were
missing. Also the new scheme takes care that no two different input
strings result in the same mangled string, which was not the case before.

Fixes #6921
2013-06-05 14:13:43 -07:00
Philipp Brüschweiler
eb62781720 rustc:🔙🔗 redo symbol mangling
Handle more characters that appear in types, most notably <>): were
missing. Also the new scheme takes care that no two different input
strings result in the same mangled string, which was not the case before.

Fixes #6921
2013-06-05 22:21:25 +02:00
John Clements
8dad2bb281 removed unused imports (and one unused argument) 2013-06-05 12:01:39 -07:00
John Clements
04a691a511 token_to_ident takes argument by reference 2013-06-05 12:01:38 -07:00
John Clements
3203595471 interner just uses uints, not idents with syntax context 2013-06-05 12:01:38 -07:00
John Clements
ae02bf70e0 removed some interner fields 2013-06-05 12:01:38 -07:00
John Clements
22d21ab4c2 rename repr to name 2013-06-05 12:01:37 -07:00
bors
e2d0a30fa2 auto merge of #6947 : Blei/rust/fix-dup-freevars, r=bstrie 2013-06-05 05:19:41 -07:00
Philipp Brüschweiler
c08df70f2b rust::driver: remove accidental double freevar calculation 2013-06-05 13:31:19 +02:00
Patrick Walton
8114d0e950 librustc: Disallow multiple patterns from appearing in a "let" declaration.
You can still initialize multiple variables at once with "let (x, y) = (1, 2)".
2013-06-04 21:45:42 -07:00
bors
69511c219c auto merge of #6928 : Blei/rust/fix-constructors, r=bstrie
As part of #3853
2013-06-04 09:37:41 -07:00
Philipp Brüschweiler
e1c1c059c6 std::io: Modernize some constructors
Part of #3853
2013-06-04 12:47:45 +02:00
Philipp Brüschweiler
34ee63e93b std::cell: Modernize constructors
Part of #3853
2013-06-04 12:03:58 +02:00
Jed Davis
0c9510ac38 Use ABI alignment, not "preferred" alignment, to unify monomorphizations.
See the comment in the added test case for details.
2013-06-04 00:18:48 -07:00
Michael Sullivan
d85938f7c8 Make type_is_pod handle structs correctly. Closes #6868. 2013-06-03 17:16:12 -07:00
Philipp Brüschweiler
394ac1aae4 resolve: don't resolve paths that point to non-static methods
Fixes #6698
2013-06-03 13:31:43 +02:00
Björn Steinbrink
b51f44e21b Fix passing self by value for types passed by value
For types that are passed by value, we can't just cast the value to a
pointer, but have to use an alloca and copy the value there. This
handling is already present for all other arguments, but was missing
for "self".

Fixes #6682, #4850 and #4878
2013-06-03 00:06:09 +02:00
bors
fc5debd8fd auto merge of #6807 : catamorphism/rust/rustpkg-extern-mod, r=catamorphism
r? @graydon Addresses #5681
2013-06-01 19:22:42 -07:00
Tim Chevalier
c120464be0 rustc/rusti/rustpkg: Infer packages from extern mod directives
This commit won't be quite as useful until I implement RUST_PATH and
until we change `extern mod` to take a general string instead of
an identifier (#5682 and #6407).

With that said, now if you're using rustpkg and a program contains:

extern mod foo;

rustpkg will attempt to search for `foo`, so that you don't have to
provide a -L directory explicitly. In addition, rustpkg will
actually try to build and install `foo`, unless it's already
installed (specifically, I tested that `extern mod extra;` would
not cause it to try to find source for `extra` and compile it
again).

This is as per #5681.

Incidentally, I changed some driver code to infer the link name
from the crate link_meta attributes. If that change isn't ok, say
something. Also, I changed the addl_lib_search_paths field in the
session options to be an @mut ~[Path] so that it can be modified
after expansion but before later phases.
2013-06-01 18:48:07 -07:00
Tim Chevalier
341678b815 rustc: Call str::is_empty 2013-06-01 18:48:07 -07:00
Tim Chevalier
231aea6d6e rustc: Improve astconv error message 2013-06-01 18:48:07 -07:00
bors
63417daea4 auto merge of #6885 : erickt/rust/move-callee_id, r=catamorphism
The `callee_id` in `ast::expr` in only used in a couple expression variants. This moves the `callee_id` into those branches to make it more clear when its should be used.

Also, it fixes a bug in a std::run test when there is a symlink in the path rust where was checked out.
2013-06-01 17:13:39 -07:00
bors
24e85ac82d auto merge of #6880 : thomaslee/rust/issue-6745, r=catamorphism
This fixes #6745, which itself relates to #4202. Slightly ham-fisted -- feel particularly funny about using the typeck phase to gather the base -> impl mapping, and the separate code paths for traits vs. "real" bases feels like it could be avoided -- but it seems to work.

As always, open to suggestions if there's a better way to accomplish what I'm trying to do.

@catamorphism r?
2013-06-01 15:46:40 -07:00
Erick Tryzelaar
23808efd11 syntax: move callee_id into the expr_ variants 2013-06-01 15:31:56 -07:00
Luqman Aden
64759c9f25 librustc: Have destructor run for unit-like structs. 2013-06-01 17:41:07 -04:00
Patrick Walton
5fb254695b Remove all uses of pub impl. rs=style 2013-06-01 09:18:27 -07:00
Patrick Walton
1e52eede31 librustc: Don't require pub extern to make extern functions visible 2013-06-01 09:16:46 -07:00
bors
b8391ccea0 auto merge of #6881 : Aatch/rust/new-passes-2, r=thestinger
This is a better pipeline, both faster-running and produces faster code.

For some reason the `mergefunc` pass screws over resolve. I have no idea why though.
2013-06-01 06:13:40 -07:00
James Miller
6e075b6bb6 Better optimization pipeline 2013-06-02 00:08:38 +12:00
Tom Lee
42466949c2 Fix a small typo in a comment. 2013-06-01 04:24:31 -07:00
Tom Lee
f6fa5b91e2 Reexport static methods on structs & enums. 2013-06-01 04:14:58 -07:00
bors
2bf053c0a3 auto merge of #6851 : alexcrichton/rust/bugfixes, r=pcwalton
Closes #5090 by using the excellent new generic deriving code

Promotes the unreachable code attribute to a lint attribute (instead of always being a warning)

Fixes some edge cases when creating hashmaps/hashsets and also when consuming them. (fixes #5998)
2013-05-31 23:10:36 -07:00
bors
5028ac7396 auto merge of #6863 : huonw/rust/error-span, r=thestinger 2013-05-31 07:43:49 -07:00
Huon Wilson
4f92d3a11c rustc: adjust span for error message to not trim last letter 2013-06-01 00:39:02 +10:00
James Miller
85e3c96236 Remove the slow bb-vectorize pass 2013-05-31 09:01:13 -04:00
bors
030f471f26 auto merge of #6853 : bblum/rust/sized, r=pcwalton
r? @nikomatsakis @pcwalton
2013-05-31 02:01:44 -07:00
bors
1dd5cd9731 auto merge of #6833 : fdr/rust/fix-warnings, r=Aatch
Fix a laundry list of warnings involving unused imports that glutted
up compilation output.  There are more, but there seems to be some
false positives (where 'remedy' appears to break the build), but this
particular set of fixes seems safe.
2013-05-31 00:43:45 -07:00
bors
6fcb483609 auto merge of #6848 : pcwalton/rust/issue-6352, r=pcwalton
r? @nikomatsakis
2013-05-30 23:31:48 -07:00
bors
3869f7a99c auto merge of #6818 : nikomatsakis/rust/irrefut-patterns-refactoring, r=graydon
Various bug fixes and simplifications I did as part of a patch to fix `let` patterns.

r? @catamorphism
2013-05-30 19:04:52 -07:00
Alex Crichton
aed53f9bf0 Promote unreachable code to being a lint attribute 2013-05-30 20:45:13 -05:00
Ben Blum
b8a53b5a4c Add 'Sized' builtin kind; doesn't do anything yet 2013-05-30 21:41:41 -04:00
Patrick Walton
40b455792d librustc: Bump the offset when translating const structs. Closes #6352. 2013-05-30 18:17:32 -07:00
Graydon Hoare
2bed5dc528 rustc: change 'use' to 'add' in error message, fix #2994 2013-05-30 13:45:53 -07:00
Daniel Farina
aef1e10eba Remove unnecessary 'use' forms
Fix a laundry list of warnings involving unused imports that glutted
up compilation output.  There are more, but there seems to be some
false positives (where 'remedy' appears to break the build), but this
particular set of fixes seems safe.
2013-05-30 13:08:18 -07:00
Niko Matsakis
9c7eb068e5 Replace NDM with proper FIXME 2013-05-30 15:20:36 -04:00
Niko Matsakis
7a1a40890d Remove copy bindings from patterns. 2013-05-30 15:20:36 -04:00
Niko Matsakis
5209709e46 Fix matching of rvalues with destructors
Fixes #4542.
2013-05-30 15:20:36 -04:00
Niko Matsakis
c492a2126f Remove some spurious copies that are identified by later patches 2013-05-30 09:54:39 -04:00
Niko Matsakis
7dfb865339 Remove local_imm/local_mem since all variables are now by reference 2013-05-30 09:54:38 -04:00
Niko Matsakis
2616581863 Refactor helper routines to be less tied to match syntax 2013-05-30 09:47:15 -04:00
Niko Matsakis
dcd84901c6 Remove TrByImplicitRef and source field on datums 2013-05-30 09:47:14 -04:00
Björn Steinbrink
1720d9f663 Remove a bunch of unnecessary allocations and copies 2013-05-30 11:49:04 +02:00
Alex Crichton
4a5d887b58 Allow doc(hidden) and --test to disable doc linting 2013-05-30 01:02:55 -05:00
Alex Crichton
af995ce1e7 Make missing documentation linting more robust
Add some more cases for warning about missing documentation, and also add a test
to make sure it doesn't die in the future.
2013-05-30 01:02:55 -05:00
Erick Tryzelaar
b916e65f3e librustc: add some imports to back/passes.rs rs=burningtree 2013-05-29 20:00:43 -07:00
Patrick Walton
206ab89629 librustc: Stop reexporting the standard modules from prelude. 2013-05-29 19:04:53 -07:00
Patrick Walton
4e3d4b36dc libsyntax: Stop parsing mutable fields 2013-05-29 19:04:51 -07:00
Patrick Walton
aeda178011 librustc: Redo the unsafe checker and make unsafe methods not callable from safe code 2013-05-29 19:04:50 -07:00
bors
b5da389d36 auto merge of #6799 : Aatch/rust/pass-refactor, r=graydon
This refactors pass handling to use the argument names, so it can be used
in a similar manner to `opt`. This may be slightly less efficient than the
previous version, but it is much easier to maintain.

It also adds in the ability to specify a custom pipeline on the command
line, this overrides the normal passes, however. This should completely
close #2396.
2013-05-29 16:58:44 -07:00
bors
d2957091c4 auto merge of #6733 : alexcrichton/rust/issue-2400, r=brson
Most of the relevant information can be found in the commit messages.

r? @brson - I just wanted to make sure the make changes aren't completely bogus

This would close #2400, #6517, and #6489 (although a run through incoming-full on linux would have to confirm the latter two)
2013-05-29 12:13:49 -07:00
bors
844b5cff36 auto merge of #6794 : thestinger/rust/align_zero, r=pcwalton
This is unlikely to alter optimized codegen much but there's no point in downgrading the known alignment to 1.
2013-05-29 07:32:06 -07:00
James Miller
faf1afee16 Further refactor optimization pass handling
This refactors pass handling to use the argument names, so it can be used
in a similar manner to `opt`. This may be slightly less efficient than the
previous version, but it is much easier to maintain.

It also adds in the ability to specify a custom pipeline on the command
line, this overrides the normal passes, however. This should completely
close #2396.
2013-05-29 20:08:20 +12:00
bors
e3e55c5c04 auto merge of #6793 : graydon/rust/drop-ast-before-llvm, r=Aatch 2013-05-29 00:52:47 -07:00
bors
d80642b519 auto merge of #6784 : nikomatsakis/rust/moves-into-borrowck, r=pcwalton
Move the computation of what data is moved out of `liveness` and into `borrowck`. The resulting code is cleaner, since before we had a split distribution of responsibilities, and also this avoids having multiple implementations of the dataflow code. Liveness is still used to report warnings about useless writes. This will go away when we get the control-flow graph code landed (working on that).

Also adds borrow checker documentation.

Fixes #4384.
Required to support once fns and to properly fix closures (#2202).
First step to generalize our treatment of moves somewhat as well.
2013-05-28 22:16:50 -07:00
Alex Crichton
ff86830c9c Define rustc's host triple at compile time
This way a cross-compiled rustc's answer to host_triple() is correct. The return
value of host_triple() reflects the actual host triple that the compiler was
build for, not the triple the compiler is being built on
2013-05-28 21:23:42 -05:00
James Miller
6861d542a2 Remove now-unused import 2013-05-29 14:16:49 +12:00
James Miller
998e2ce4ff Remove passes that were causing bad optmizations 2013-05-29 14:16:49 +12:00
James Miller
4988c89e86 Move the initial dead prototype removal pass 2013-05-29 14:16:49 +12:00
James Miller
a5b87d71e0 Fix pass creation typo 2013-05-29 14:16:49 +12:00
James Miller
d694e283b3 Refactor optimization pass handling.
Refactor the optimization passes to explicitly use the passes. This commit
just re-implements the same passes as were already being run.

It also adds an option (behind `-Z`) to run the LLVM lint pass on the
unoptimized IR.
2013-05-29 14:16:49 +12:00
bors
e3d0c1eb0e auto merge of #6731 : thomaslee/rust/issue-6575, r=pcwalton
Fix for #6575. In the trans phase, rustc emits code for a function parameter that goes completely unused in the event the return type of the function in question happens to be an immediate.

This patch modifies rustc & parts of rustrt to ensure that the vestigial parameter is no longer present in compiled code.
2013-05-28 17:37:57 -07:00
Niko Matsakis
f30b538929 Update documentation for moves 2013-05-28 20:22:15 -04:00
Niko Matsakis
e35db1ab35 Reconcile treatment of &mut with the docs 2013-05-28 20:22:15 -04:00
Niko Matsakis
bf1647c92a Reconcile docs and code, adding examples and adding RESTR_CLAIM 2013-05-28 20:22:15 -04:00
Niko Matsakis
329f7a17e2 Update docs on the formal basis of the borrow checker. 2013-05-28 20:22:15 -04:00
Niko Matsakis
5851d3242c Move checking for moves and initialization of local variables and patterns into
borrow checker and generalize what moves are allowed. Fixes a nasty
bug or two in the pattern move checking code. Unifies dataflow code
used for initialization and other things. First step towards
once fns. Everybody wins.

Fixes #4384. Fixes #4715. cc once fns (#2202), optimizing local moves (#5016).
2013-05-28 20:22:14 -04:00
Daniel Micay
9ab2921300 use the type's alignment for generated memsets 2013-05-28 18:38:46 -04:00
Graydon Hoare
b4a3fe25c6 librustc: drop AST before running LLVM, frees 400mb on a librustc build 2013-05-28 15:31:32 -07:00
bors
d7e1f08b21 auto merge of #6774 : alexcrichton/rust/silence-warnings, r=graydon
Also as a bonus this fixes #6767
2013-05-28 13:35:05 -07:00
Alex Crichton
b04c40bb1c Silence various warnings throughout test modules 2013-05-28 15:27:35 -05:00
Daniel Micay
accc5272f8 noalias on all &mut parameters is too coarse
it can alias `&const` and `@mut`
2013-05-28 13:05:50 -04:00
bors
b738b5766e auto merge of #6754 : thestinger/rust/noalias, r=nikomatsakis
The compiler guarantees that there are no other references to a unique pointer when it's passed by-value to a function.

The existence of the header and annihilator don't matter since it's not relevant to the call:

> For a call to the parent function, dependencies between memory references from before or after the call and from those during the call are “irrelevant” to the noalias keyword for the arguments and return value used in that call.

@graydon's tracing garbage collector stores the metadata outside of the boxes, so that won't be a problem. I'm unsure if updating the header while inside a function where it's marked as `noalias` would be a problem anyway since you never actually read or write to the header.

@nikomatsakis: r?
2013-05-28 02:59:03 -07:00
bors
6264df5331 auto merge of #6777 : alexcrichton/rust/less-memory, r=graydon
Via my super-accurate timing (`/usr/bin/time -l`), I get 2431119360 => 1884430336 == ~520MB

Closes #6637.
2013-05-27 22:29:09 -07:00
Alex Crichton
ae7df57c5a Prevent refcount cycles during linting
Shaves off ~600MB of memory while compiling rustc
2013-05-27 22:22:09 -05:00
Graydon Hoare
3c4ce79518 rustc: Switch ty::node_type_table to smallintmap, cut 400mb memory use off a librustc build.
Smallintmap was being populated with sparse keys during ast deserialization.
2013-05-27 19:50:49 -07:00
Tom Lee
b7f71e1ee6 Implementing suggestions from @nikomatsakis 2013-05-27 19:34:25 -07:00
bors
2061ce9aff auto merge of #6741 : pcwalton/rust/intra-crate-start, r=graydon
r? @brson
2013-05-27 18:26:04 -07:00
Tom Lee
67283eaad2 Omit unused implicit argument if return type is immediate. 2013-05-27 17:13:01 -07:00
bors
dbc57584bd auto merge of #6724 : thestinger/rust/swap_fast, r=thestinger
Passing higher alignment values gives the optimization passes more freedom since it can copy in larger chunks. This change results in rustc outputting the same post-optimization IR as clang for swaps and most copies excluding the lack of information about padding.

Code snippet:

```rust
#[inline(never)]
fn swap<T>(x: &mut T, y: &mut T) {
    util::swap(x, y);
}
```

Original IR (for `int`):

```llvm
define internal fastcc void @_ZN9swap_283417_a71830ca3ed2d65d3_00E(i64*, i64*) #1 {
static_allocas:
  %2 = icmp eq i64* %0, %1
  br i1 %2, label %_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit, label %3

; <label>:3                                       ; preds = %static_allocas
  %4 = load i64* %0, align 1
  %5 = load i64* %1, align 1
  store i64 %5, i64* %0, align 1
  store i64 %4, i64* %1, align 1
  br label %_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit

_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit:  ; preds = %3, %static_allocas
  ret void
}
```

After #6710:

```llvm
define internal fastcc void @_ZN9swap_283017_a71830ca3ed2d65d3_00E(i64* nocapture, i64* nocapture) #1 {
static_allocas:
  %2 = load i64* %0, align 1
  %3 = load i64* %1, align 1
  store i64 %3, i64* %0, align 1
  store i64 %2, i64* %1, align 1
  ret void
}
```

After this change:

```llvm
define internal fastcc void @_ZN9swap_283017_a71830ca3ed2d65d3_00E(i64* nocapture, i64* nocapture) #1 {
static_allocas:
  %2 = load i64* %0, align 8
  %3 = load i64* %1, align 8
  store i64 %3, i64* %0, align 8
  store i64 %2, i64* %1, align 8
  ret void
}
```

Another example:

```rust
#[inline(never)]
fn set<T>(x: &mut T, y: T) {
    *x = y;
}
```

Before, with `(int, int)` (align 1):

```llvm
define internal fastcc void @_ZN8set_282517_8fa972e3f9e451983_00E({ i64, i64 }* nocapture, { i64, i64 }* nocapture) #1 {
static_allocas:
  %2 = bitcast { i64, i64 }* %1 to i8*
  %3 = bitcast { i64, i64 }* %0 to i8*
  tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 16, i32 1, i1 false)
  ret void
}
```

After, with `(int, int)` (align 8):

```llvm
define internal fastcc void @_ZN8set_282617_8fa972e3f9e451983_00E({ i64, i64 }* nocapture, { i64, i64 }* nocapture) #1 {
static_allocas:
  %2 = bitcast { i64, i64 }* %1 to i8*
  %3 = bitcast { i64, i64 }* %0 to i8*
  tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 16, i32 8, i1 false)
  ret void
}
```
2013-05-27 15:56:08 -07:00
bors
5d04ee805b auto merge of #6715 : Xazax-hun/rust/incoming, r=graydon
Preliminary implementation for: https://github.com/mozilla/rust/issues/6275

This is my first (non hello world) rust code, so it may not be idiomatic.
2013-05-27 13:44:08 -07:00
bors
b0f3686515 auto merge of #6703 : sanxiyn/rust/allocation-lint, r=sanxiyn
Fix #6145. In particular, handle operator overloading.
2013-05-27 12:38:12 -07:00
Seo Sanghyeon
8f80323f09 Remove unnecessary allocations flagged by lint 2013-05-28 03:14:44 +09:00
Seo Sanghyeon
363e672736 Use adjustments table for allocation lint 2013-05-28 03:12:13 +09:00
gareth
76c31217be Refactor core::run in order to address many of the issues
mentioned in #2625.

This change makes the module more oriented around
Process values instead of having to deal with process ids
directly.

Apart from issues mentioned in #2625, other changes include:
- Changing the naming to be more consistent - Process/process
  is now used instead of a mixture of Program/program and
  Process/process.
- More docs/tests.

Some io/scheduler related issues remain (mentioned in #2625).
2013-05-27 13:50:33 +01:00
bors
d577eafff3 auto merge of #6688 : graydon/rust/issue-3396-mystery-bug-in-metadata, r=Aatch
Whatever it was, it is no longer a problem here.
2013-05-27 04:38:04 -07:00
bors
fa67e091e4 auto merge of #6719 : kud1ing/rust/rustc_w, r=bstrie
Fixes #6697
2013-05-26 22:26:06 -07:00
Daniel Micay
c302010ef0 mark unique pointer parameters as noalias
Closes #6749
2013-05-26 14:11:30 -04:00
Daniel Micay
58d6864ad7 add an align parameter to call_memcpy 2013-05-26 10:26:04 -04:00
Daniel Micay
d9c0f0f188 add memset32/memset64 2013-05-26 10:26:03 -04:00
Daniel Micay
cf8e9f9aec make the memcpy/memmove intrinsics higher-level
This allows them to make use of the type's alignment, instead of being
pessimistic and assuming it is only 1.
2013-05-26 10:26:03 -04:00
James Miller
2c2346e3d4 Mark &mut parameters as noalias 2013-05-26 17:40:07 +12:00
Patrick Walton
cf34f9f9a9 librustc: Allow intra-crate start functions, for runtimeless operation. 2013-05-25 18:20:33 -07:00
Alex Crichton
ac6c15aece Actually filter view_items in blocks 2013-05-24 17:31:15 -05:00
Lenny222
1009c21ad7 show options for -W help and -W 2013-05-24 21:32:30 +02:00
Gábor Horváth
3d61931fca Only trigger missing documentation warnings to public functions and fields. 2013-05-24 14:13:41 +02:00
Gábor Horváth
c6581325ac Warnings for missing documentations. 2013-05-24 10:27:31 +02:00
bors
ed9a793d24 auto merge of #6706 : brson/rust/glue, r=catamorphism
Instead of `glue_drop1234` it's `Type::<hash>::glue_drop1234`

Haven't done any performance testing.
2013-05-23 23:13:46 -07:00
bors
212d6a2f61 auto merge of #6710 : thestinger/rust/swap, r=catamorphism 2013-05-23 22:04:40 -07:00
Daniel Micay
a7f450ab22 indentation fix 2013-05-23 22:32:33 -04:00
Daniel Micay
7d2f836065 add memcpy intrinsic to mirror memmove 2013-05-23 22:29:30 -04:00
bors
a776d65b4d auto merge of #6690 : erickt/rust/cleanup-warnings, r=brson
Simple patch series to fix up all the warnings a rustc compile is giving at the moment. It also fixes a NOTE in `to_bytes.rs` to remove the `to_bytes::iter_bytes_<N>` functions.
2013-05-23 18:10:36 -07:00
Erick Tryzelaar
9635b30837 cleanup warnings from librustc 2013-05-23 17:57:07 -07:00
Erick Tryzelaar
1965d72957 core: remove iter_bytes helper functions 2013-05-23 17:48:16 -07:00
Brian Anderson
7f642f3d85 rustc: Give glue symbols meaningful names
Instead of `glue_drop1234` it's `Type::<hash>::glue_drop1234`

Haven't done any performance testing.
2013-05-23 17:01:45 -07:00
Brian Anderson
d213443a67 rustc: Check for null before dropping ~objects. #5192 2013-05-23 15:33:34 -07:00
Patrick Walton
18fca3e2e5 librustc: Add some missing use core::prelude::*; in the test cases 2013-05-22 21:57:12 -07:00
Patrick Walton
18df18c817 libstd: Fix merge fallout. 2013-05-22 21:57:11 -07:00
Patrick Walton
c10e0cb9c9 syntax: Change syntax extensions to expand to std::foo instead of core::foo 2013-05-22 21:57:08 -07:00
Patrick Walton
d5055f4e97 librustc: Make std_inject inject the name std, not core 2013-05-22 21:57:08 -07:00
Patrick Walton
c532e033c9 librustc: Change std to extra throughout libsyntax and librustc 2013-05-22 21:57:08 -07:00
Patrick Walton
f3723cf7c4 libextra: Rename the actual metadata names of libcore to libstd and libstd to libextra 2013-05-22 21:57:07 -07:00
Patrick Walton
ebfc2b8e56 librustc: Rename core injection to std injection 2013-05-22 21:57:05 -07:00
Patrick Walton
565942b145 librustc: Fix privacy checking for cross-crate variants 2013-05-22 21:57:03 -07:00
Patrick Walton
211d038abc librustc: Make ~Trait two words by storing the type descriptor in the vtable. 2013-05-22 21:57:03 -07:00
Patrick Walton
08e561ae70 librustc: Disable borrow check debugging even when rustc is compiled with -O0.
This improves -O0 compile times dramatically.
2013-05-22 21:57:02 -07:00
Patrick Walton
ca9bb2d9ac librustc: Disallow use from reaching into impls or traits.
This can perhaps be restored in the future. For now this is a precursor to
making typedefs work as expected.
2013-05-22 21:57:02 -07:00
bors
1d3e84c5d6 auto merge of #6669 : yjh0502/rust/fix_6209, r=graydon
Fix issue #6209, and some related issues about constant expression
 - unmatched type between arms
 - unmatched type in range
2013-05-22 18:01:36 -07:00
Graydon Hoare
ee1b419818 revert no-longer-required workaround for mystery bug, close #3396 2013-05-22 15:35:25 -07:00
Corey Richardson
e64339645b Implement static_assert attribute
This verifies that a static item evaluates to true, at compile time.
2013-05-22 13:13:24 -04:00
Jihyun Yu
f8af2b50ee fix issue #6209 2013-05-22 14:06:25 +09:00
Tim Chevalier
8c68c4a52c rustc: Don't generate code for unreachable expressions
The way we deal with unreachable expressions in trans is pretty ad hoc,
but this at least doesn't make it worse, and eliminates the LLVM
assertion failure reported in #5741.
2013-05-21 13:15:48 -07:00
bors
64963d6cba auto merge of #6611 : huonw/rust/syntax-ext-no-dup, r=jbclements
Fixes https://github.com/mozilla/rust/issues/6578 by merging the 3 different ways to build an AST into a single `AstBuilder` trait, creating a more uniform and briefer interface.

Also, converts the `ext_ctxt` trait-object to be a plain struct, as well as renaming it to `ExtCtxt`.

Seems to make expansion slightly faster for the normal case (e.g. `libcore` and `libstd`), but slower for `librustc` (slightly) and `libsyntax` (0.3s -> 0.8s! I'm investigating this, but I'd prefer this patch to land relatively quickly.).

`git blame` suggests maybe @graydon or @erickt are familiar with this area of the code. r?
2013-05-21 10:43:17 -07:00
Huon Wilson
4045da9f4f syntax/ext: modernise ext_ctxt to be CamelCase and use new. 2013-05-22 00:04:10 +10:00
bors
808aada1fb auto merge of #6654 : sanxiyn/rust/accurate-span-2, r=bstrie 2013-05-21 05:37:17 -07:00
Seo Sanghyeon
258d20ea84 Correct span for unused_import 2013-05-21 19:09:22 +09:00
bors
329d8e2622 auto merge of #6648 : alexcrichton/rust/issue-6633, r=graydon
Resolves #6633 and removes an unnecessary import in libcore
2013-05-21 01:04:16 -07:00
bors
5a3e320514 auto merge of #6647 : alexcrichton/rust/unnecessary-alloc, r=graydon
This adds a lint mode for detecting unnecessary allocations on the heap. This isn't super fancy, currently it only has two rules

1. For a function's arguments, if you allocate a `[~|@]str` literal, when the type of the argument is a `&str`, emit a warning.
2. For the same case, emit warnings for boxed vectors when slices are required.

After adding the lint, I rampaged through the libraries and removed all the unnecessary allocations I could find.
2013-05-20 23:55:20 -07:00
bors
d49a9dbc7f auto merge of #6646 : dotdash/rust/method_lookup, r=brson 2013-05-20 22:52:22 -07:00
bors
6c0a4693c9 auto merge of #6649 : brson/rust/atomic-load-align, r=graydon 2013-05-20 19:25:29 -07:00
bors
32e30aaa00 auto merge of #6576 : nikomatsakis/rust/issue-5362-tuple-indices, r=graydon
r? @pcwalton
2013-05-20 18:04:39 -07:00
Brian Anderson
474d9983be rustllvm: Use target alignment for atomic load/store 2013-05-20 17:28:06 -07:00
Alex Crichton
82fa0018c8 Remove all unnecessary allocations (as flagged by lint) 2013-05-20 16:10:40 -05:00
Alex Crichton
074799b4c5 Implement a lint mode to detect unnecessary allocations 2013-05-20 16:08:50 -05:00
Alex Crichton
15f97acdc8 Correctly track the source of imports with the same name 2013-05-20 13:02:08 -05:00
Björn Steinbrink
19dc72809d Optimize the lookup of traits containing a given method
Currently, trait_info is a hashmap that allows a quick lookup of all
methods contained in a given trait, but we actually only use it to
lookup traits that contain a given method. Adjusting the map to support
the lookup we actually need gives a nice speed boost, reducing the time
required for the resolution step for librustc from ~2.6s to ~1.0s on my
box.
2013-05-20 19:50:30 +02:00
Seo Sanghyeon
17dfebf883 Remove legacy_modes 2013-05-21 00:41:56 +09:00
bors
2e6cda254a auto merge of #6635 : brson/rust/snapshot, r=brson 2013-05-20 02:46:36 -07:00
bors
ab46a38039 auto merge of #6632 : steveklabnik/rust/remove_more_warnings, r=thestinger
With this, the build is almost 100% warning free.

One more can be fixed after the next snapshot, and there's one other that I filed an issue about already.
2013-05-20 01:37:39 -07:00
Brian Anderson
66319b0278 Register snapshots 2013-05-19 23:34:32 -07:00
Steve Klabnik
d3f70b141a Fix many warnings. 2013-05-19 21:32:32 -07:00
Corey Richardson
808c5b8d4e Test fixes, use LLVMConstFCmp in ConstFCmp 2013-05-19 22:09:32 -04:00
Corey Richardson
b97642758f Fix LLVMConst{I,F}Cmp 2013-05-19 22:09:32 -04:00
Corey Richardson
e42fcb958c Implement unimplemented const binops 2013-05-19 22:09:32 -04:00
Tom Lee
e3a91f60c5 Explain an odd conditional check. 2013-05-19 17:07:18 -07:00
Tom Lee
cac97d7ee5 Remove unused variable. 2013-05-19 17:07:18 -07:00
Tom Lee
e02716e6d3 Reexport static trait methods on traits in the same module. 2013-05-19 17:07:18 -07:00
Corey Richardson
cc57ca012a Use assert_eq! rather than assert! where possible 2013-05-19 08:16:02 -04:00
bors
99c7750ca6 auto merge of #6603 : thestinger/rust/whitespace, r=thestinger 2013-05-18 22:55:34 -07:00
Daniel Micay
20ef4238bb reduce the usage of explicit version markers 2013-05-19 00:21:41 -04:00
Daniel Micay
1789174541 minor automated whitespace fixes 2013-05-18 22:40:12 -04:00
Tim Chevalier
f21fb3aff5 rustc: Cleaning up bad copies and other XXXes 2013-05-17 21:41:54 -07:00
bors
d68c0279ea auto merge of #6249 : crabtw/rust/arm, r=brson
It uses the private field of TCB head to store stack limit. I tested on my Raspberry PI. A simple hello world program ran without any problem. However, for a more complex program, it segfaulted as #6231.
2013-05-17 18:19:27 -07:00
Niko Matsakis
5ca383b777 Distinguish tuple elements by index in mem_categorization. Fixes #5362. 2013-05-17 21:12:50 -04:00
Huon Wilson
aa179cb0f1 rustc: relax limits on (u)int type limit lint. Fixes #6130. 2013-05-18 01:49:36 +10:00
bors
a3d31f4b80 auto merge of #6550 : Aatch/rust/atomic-load, r=thestinger
This closes #6548

The change makes it match the standard Load signature.
2013-05-17 00:55:29 -07:00
bors
c69f8ea91a auto merge of #6093 : alexcrichton/rust/issue-2647, r=thestinger
Closes #2647

This way it's much easier to add lints throughout compilation correctly, and
functions on impls can alter the way lints are emitted. This involved pretty much rewriting how lints are emitted. Beforehand, only items could alter the lint settings, so whenever a lint was added it had to be associated with whatever item id it was coming from. I removed this (possibly questionably) in favor of just specifying a span and a message when adding a lint. When lint checking comes around, it looks at all the lints and sees which node with attributes best encloses it and uses that level of linting. This means that all consumer code doesn't have to deal with what item things came from (especially because functions on impls aren't items). More details of this can be found in the code (and comments).

As a bonus, I managed to greatly simplify emission of lints in resolve.rs about unused imports. Now instead of it manually tracking what the lint level is, it's all moved over into the lint module (as is to be expected).
2013-05-16 22:25:39 -07:00
Alex Crichton
4d44abd52a Change lints to indicate exactly where the level was set 2013-05-17 00:54:03 -04:00
Alex Crichton
1daaf785ab Optimize lint passes to perform far fewer allocations
Achieves ~3x speedup on lint passes for libcore
2013-05-17 00:49:17 -04:00
Alex Crichton
030c666cc1 Re-implement lint with less emphasis on item ids
This way it's much easier to add lints throughout compilation correctly, and
functions on impls can alter the way lints are emitted.
2013-05-17 00:49:16 -04:00
bors
918bfa710c auto merge of #6546 : cmr/rust/warning, r=thestinger 2013-05-16 21:19:38 -07:00
James Miller
a289dcd187 Fix AtomicLoad builder code 2013-05-17 14:48:24 +12:00
Corey Richardson
c2baaa8d84 fix warnings 2013-05-16 21:53:54 -04:00
bors
17970a9111 auto merge of #6545 : catamorphism/rust/unused-import, r=catamorphism 2013-05-16 17:52:40 -07:00
Tim Chevalier
1bf4f90291 rustc: Remove import that is, indeed, not necessary 2013-05-16 17:25:19 -07:00
Tim Chevalier
226f4dfdfb rustc: One less bad copy 2013-05-16 17:02:27 -07:00
bors
f89e00b3d1 auto merge of #6543 : catamorphism/rust/traits-cleanup, r=nikomatsakis
r? @nikomatsakis Impls can implement either zero or one traits; this has been true
more or less since we removed classes. So I got rid of the comments
saying "we should support multiple traits" and changed the code to
make it clear that we don't. This is just cleanup, and doesn't break
any existing tests.
2013-05-16 16:49:37 -07:00
Tim Chevalier
65b7903ba3 rustc: Change ty::get_impl_traits to return an option instead of a vec
Impls can implement either zero or one traits; this has been true
more or less since we removed classes. So I got rid of the comments
saying "we should support multiple traits" and changed the code to
make it clear that we don't. This is just cleanup, and doesn't break
any existing tests.
2013-05-16 15:54:51 -07:00
bors
00eef96a00 auto merge of #6536 : kud1ing/rust/patch-1, r=brson 2013-05-16 13:37:39 -07:00
bors
c8159b3e35 auto merge of #6473 : nikomatsakis/rust/issue-5967-rvalue-immutability, r=pcwalton
Simpler version of PR #5974 based on new borrowck.
2013-05-16 12:34:40 -07:00
Niko Matsakis
63d878f36b correct typo 2013-05-16 15:12:39 -04:00
Niko Matsakis
035c01af93 Add BuiltinBounds to closure type: parse and handle subtyping,
but do not integrate with kindck etc (requires a snapshot first)
2013-05-16 14:21:02 -04:00
kud1ing
f9a15a6976 main() is in ./rustc.rc. use "./../" pattern some more 2013-05-16 13:22:43 +03:00
bors
2329651770 auto merge of #6503 : sonwow/rust/at_vec-renamed, r=graydon
`str::from_slice` and `vec::from_slice` are changed to `str::to_owned` and `vec::to_owned`. (#6389)

Replace `at_vec::from_owned` and `at_vec::from_slice` with `at_vec::to_managed_consume` and `at_vec::to_managed`.
2013-05-15 19:22:49 -07:00
bors
8257528b6c auto merge of #6502 : huonw/rust/no-auto-code, r=graydon
Replace all instances of #[auto_*code] with the appropriate #[deriving] attribute
and remove the majority of the actual auto_* code, leaving stubs to refer the user to
the new syntax.

Also, moves the useful contents of auto_encode.rs to more appropriate spots: tests and comments to deriving/encodable.rs, and the ExtCtxtMethods trait to build.rs (unused so far, but the method syntax might be nicer than using the mk_* fns in many instances).
2013-05-15 18:16:51 -07:00
bors
c18e44ba17 auto merge of #6501 : june0cho/rust/incoming, r=graydon
Fix #3783.
2013-05-15 17:10:46 -07:00
Huon Wilson
5dc5efefd4 syntax: deprecate #[auto_{en,de}code] in favour of #[deriving({En,De}codable)].
Replace all instances of #[auto_*code] with the appropriate #[deriving] attribute
and remove the majority of the actual code, leaving stubs to refer the user to
the new syntax.
2013-05-16 08:55:57 +10:00
Youngsoo Son
f11297f608 rename at_vec::from_owned and at_vec::from_slice to at_vec::to_managed_consume and at_vec::to_managed 2013-05-16 00:33:54 +09:00
bors
4e82610099 auto merge of #6487 : recrack/rust/vec_len, r=thestinger
Rename vec::len(var) to var.len()

```
libcore, libfuzzer, librustc, librustdoc, libstd, libsyntax
test/auxiliary
test/bench
test/run-pass
```
2013-05-15 07:38:07 -07:00
bors
62c7027a32 auto merge of #6485 : cmr/rust/local_rename_import_error, r=catamorphism 2013-05-15 05:43:58 -07:00
Junyoung Cho
37fe2b60d5 Merge type_span and type_def, and ditto with value_span and value_def 2013-05-15 21:33:33 +09:00
Erick Tryzelaar
729708d112 rustc: rename ty::method to ty::Method and add ctor 2013-05-14 20:10:46 -07:00
Erick Tryzelaar
18f6a51d0a rustc: rename ast::self_ty and related fields to explicit_self 2013-05-14 20:10:46 -07:00
Erick Tryzelaar
70e02cf445 rustc: rename a method receiver type to rcvr_ty 2013-05-14 20:10:46 -07:00
Erick Tryzelaar
4bfe0f717f rustc: rename some ty_self variables to self_arg 2013-05-14 20:10:45 -07:00
Erick Tryzelaar
9c80cf548a rustc: Remove ty::arg 2013-05-14 20:10:45 -07:00
Erick Tryzelaar
191fdda46a rustc: minor cleanup 2013-05-14 20:10:45 -07:00
Youngmin Yoo
a2a8596c3d Rename vec::len(var) to var.len() 2013-05-15 11:05:28 +09:00
Corey Richardson
8a69dba84a Fix ICE 2013-05-14 20:34:05 -04:00
Corey Richardson
3bfc1ca91d Get span from import_directive 2013-05-14 19:28:28 -04:00
Corey Richardson
62cbea1ca1 Add span to some import resolution errors 2013-05-14 18:52:31 -04:00
Corey Richardson
03f75b629a Better error reporting with renaming imports 2013-05-14 18:51:36 -04:00
Alex Crichton
ffcc680f9c Fix test fallout from removing vecs_implicitly_copyable 2013-05-14 12:25:19 -04:00
Alex Crichton
5614e83e81 Remove vecs_implicitly_copyable from the compiler 2013-05-14 12:25:18 -04:00
Marvin Löbel
04de8f852c Fix cosmetics for fail!() calls 2013-05-14 16:36:24 +02:00
Björn Steinbrink
bdc182cc41 Use static string with fail!() and remove fail!(fmt!())
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
2013-05-14 16:36:23 +02:00
Niko Matsakis
87398f31e5 Add explanatory comment to is_rvalue_or_immutable() 2013-05-14 09:28:58 -04:00
Niko Matsakis
d204cfd739 Issue #5967: Make rvalues mutable 2013-05-14 09:26:21 -04:00
Alex Crichton
66e1e51701 Remove re-exports from libcore/core.rc
Also fix up all the fallout elsewhere throughout core. It's really nice being
able to have the prelude.
2013-05-13 18:51:40 -04:00
bors
3abc5b3ffb auto merge of #6417 : pcwalton/rust/exprs-in-patterns, r=pcwalton
r? @graydon
2013-05-13 13:25:42 -07:00
bors
935b7ba516 auto merge of #6443 : cmr/rust/resolution, r=bstrie
When trying to import nonexistent items from existing modules, specify that
that is what happened, rather than just reporting "unresolved name".

Ideally the error would be reported on the span of the import... but I do not see a way to get a span there. Help appreciated 😄
2013-05-13 09:28:46 -07:00
bors
1bf2f68bb2 auto merge of #6437 : Thiez/rust/atomic, r=Aatch
This pull request adds 4 atomic intrinsics to the compiler, in preparation for #5042.

* `atomic_load(src: &int) -> int` performs an atomic sequentially consistent load.
* `atomic_load_acq(src: &int) -> int` performs an atomic acquiring load.
* `atomic_store(dst: &mut int, val: int)` performs an atomic sequentially consistent store.
* `atomic_store_rel(dst: &mut int, val: int)` performs an atomic releasing store.

For more information about the whole acquire/release thing: http://llvm.org/docs/Atomics.html

r?
2013-05-13 05:04:41 -07:00
Matthijs Hofstra
852af346d3 Tidy 2013-05-13 13:33:34 +02:00
Corey Richardson
2210d2d5d5 Use backticks to delineate paths/identifiers 2013-05-13 06:22:32 -04:00
Luqman Aden
103a68b2e7 Correct #[always_inline] -> #[inline(always)] and __attribute((...)) -> __attribute__((...)). 2013-05-13 04:05:34 -04:00
Corey Richardson
be82449a9a Better error for some unresolved imports
When trying to import nonexistent items from existing modules, specify that
that is what happened, rather than just reporting "unresolved name".
2013-05-13 01:06:42 -04:00
bors
8291e36f18 auto merge of #6400 : cmr/rust/remove_useless_import_error, r=thestinger
Every unresolved import is reported. An additional error message isn't useful
and obscures (imo) the real errors: I need to take it into account when
looking at the error count.
2013-05-12 20:22:40 -07:00
Patrick Walton
5d3559e645 librustc: Make self and static into keywords 2013-05-12 16:35:18 -07:00
Matthijs Hofstra
fa1a172f9c Removed unnecessary check from build.rs 2013-05-13 00:12:14 +02:00
Matthijs Hofstra
a9f2132606 Adds atomic_load, atomic_load_acq, atomic_store, and atomic_store_rel intrinsics.
The default versions (atomic_load and atomic_store) are sequentially consistent.
The atomic_load_acq intrinsic acquires as described in [1].
The atomic_store_rel intrinsic releases as described in [1].

[1]: http://llvm.org/docs/Atomics.html
2013-05-12 23:23:40 +02:00
bors
638b394a37 auto merge of #6427 : catamorphism/rust/issue-6319, r=nikomatsakis
r? @nikomatsakis In #6319, several people mentioned they ran into a "computing
fictitious type" ICE in trans. This turns out to be because some
of my recent changes to typeck::check::_match resulted in type errors
getting reported with ty_err as the expected type, which meant the errors
were suppressed, and typechecking incorrectly succeeded (since the errors
weren't recorded).

Changed the error messages in these cases not to use an expected type at all,
rather, printing out a string describing the type that was expected (which is
what the code originally did). The result is a bit repetitive and the
proliferation of error-reporting functions in typeck::infer is a bit annoying,
but I thought it was important to fix this now; more cleanup can happen later.
2013-05-12 10:34:38 -07:00
Corey Richardson
a279d65102 clean up the last bit of warnings 2013-05-11 20:36:47 -07:00
Tim Chevalier
ed41864464 Warning police 2013-05-11 20:36:44 -07:00
Tim Chevalier
cdb52c0201 rustc: Don't call type_error_message() with ty_err as the expected type
In #6319, several people mentioned they ran into a "computing
fictitious type" ICE in trans. This turns out to be because some
of my recent changes to typeck::check::_match resulted in type errors
getting reported with ty_err as the expected type, which meant the errors
were suppressed, and typechecking incorrectly succeeded (since the errors
weren't recorded).

Changed the error messages in these cases not to use an expected type at all,
rather, printing out a string describing the type that was expected (which is
what the code originally did). The result is a bit repetitive and the
proliferation of error-reporting functions in typeck::infer is a bit annoying,
but I thought it was important to fix this now; more cleanup can happen later.
2013-05-11 17:51:00 -07:00
bors
82164a1e45 auto merge of #6402 : kud1ing/rust/fixes, r=pcwalton 2013-05-11 16:49:40 -07:00
bors
8ca64a423b auto merge of #6397 : cantsin/rust/rusti-fixes, r=catamorphism
Fixes #6378

Don't pass the binary name to the LLVMRustExecuteJIT closure, otherwise it will leak memory; the binary name doesn't seem to be needed, anyhow.
2013-05-11 14:04:44 -07:00
bors
957251817b auto merge of #6389 : sonwow/rust/issue-3356, r=bstrie
Fix for #3356
2013-05-11 12:55:49 -07:00
bors
e478cedb0a auto merge of #6385 : huonw/rust/rustc-dtor-struct-match, r=nikomatsakis
**Caveat**: With the current commit, this check only works for `match`s, the checks (incorrectly) do not run for patterns in `let`s, and invalid/unsafe code compiles.

I don't know how to fix this, I experimented with some things to try to make let patterns and match patterns run on the same code (since this would presumably fix many of the other unsoundness issues of let-patterns, e.g. #6225), but I don't understand enough of the code. (I think I heard someone talking about a fix for `let` being in progress?)

Fixes #6344 and #6341.
2013-05-11 11:49:50 -07:00
bors
96de2b0273 auto merge of #6383 : huonw/rust/rustc-expand-then-strip, r=thestinger
This allows macros to create tests and benchmarks.

This is possibly unsound (I've got no idea, but it seemed to work), and being able to programmatically generate benchmarks to compare several implementations of similar algorithms is nice.
2013-05-11 10:52:52 -07:00
bors
18a47f9580 auto merge of #6384 : thomaslee/rust/issue-4202, r=catamorphism
This fixes the issue described in #4202.

From what I understood of the code, when we reexport a trait in a submodule using e.g. "pub use foo::SomeTrait", we were not previously making an effort to reexport the static methods on that trait.

I'm new to the Rust code base (and the Rust language itself) so my approach may not be kosher, but this patch works by changing the encoder to include the static methods associated with traits.

I couldn't see any tests for this area of the code, so I didn't really have any examples to go by. If tests are needed, I'm happy to work through that if I can get some assistance to do so.
2013-05-11 00:43:51 -07:00
bors
9f106a643e auto merge of #6260 : alexcrichton/rust/issue-3466-no-swap, r=pcwalton
There may be a more efficient implementation of `core::util::swap_ptr`. The issue mentioned using `move_val_init`, but I couldn't figure out what that did, so I just used `copy_memory` a few times instead.

I'm not exactly the best at reading LLVM generated by rust, but this does appear to be optimized away just as expected (when possible).
2013-05-10 20:35:00 -07:00
Alex Crichton
63c7e2f991 Remove the '<->' operator from the language 2013-05-10 22:51:06 -04:00
bors
c49cf8b330 auto merge of #6205 : brson/rust/flate, r=brson
r? @graydon

I don't think this is necessary in core.
2013-05-10 19:41:00 -07:00
bors
3e0400fb86 auto merge of #6223 : alexcrichton/rust/issue-6183, r=pcwalton
Closes #6183.

The first commit changes the compiler's method of treating a `for` loop, and all the remaining commits are just dealing with the fallout.

The biggest fallout was the `IterBytes` trait, although it's really a whole lot nicer now because all of the `iter_bytes_XX` methods are just and-ed together. Sadly there was a huge amount of stuff that's `cfg(stage0)` gated, but whoever lands the next snapshot is going to have a lot of fun deleting all this code!
2013-05-10 17:56:02 -07:00
Alex Crichton
606bd75586 Fix merge "failures" 2013-05-10 19:20:21 -04:00
Brian Anderson
7652f3ddb8 Move flate from core to std 2013-05-10 16:00:26 -07:00
Lenny222
52610c3980 more back-ticks, less colons 2013-05-10 23:34:20 +02:00
Corey Richardson
7d4bb90e76 Remove redundant import error 2013-05-10 16:23:12 -04:00
bors
d546493096 auto merge of #6380 : pcwalton/rust/core-text-ice, r=pcwalton 2013-05-10 13:10:54 -07:00
James Tranovich
3db74ddd2e Fixes rusti crashes.
Don't pass the binary name to the LLVMRustExecuteJIT closure; doesn't
seem to be needed, anyhow.
2013-05-10 10:51:00 -07:00
Youngsoo Son
24ef88cee9 renamed str::from_slice to str::to_owned 2013-05-10 20:08:56 +09:00
Youngsoo Son
b7da975049 renamed vec::from_slice to vec::to_owned 2013-05-10 18:38:54 +09:00
bors
e9d0018abf auto merge of #6356 : dotdash/rust/strinterner, r=pcwalton
&str can be turned into @~str on demand, using to_owned(), so for
strings, we can create a specialized interner that accepts &str for
intern() and find() but stores and returns @~str.
2013-05-10 01:55:54 -07:00
Huon Wilson
f6743fea70 librustc: allow destructuring of structs with destructors if the pattern has no moves.
This check only works for `match`s, the checks (incorrectly) do not run for patterns in
`let`s.
2013-05-10 18:34:19 +10:00
bors
f04eb37c7e auto merge of #6347 : cmr/rust/unknown_module_resolve_error, r=catamorphism
This improves error reporting for the following class of imports:

```rust
use foo::bar;
```

Where foo, the topmost module, is unresolved. It now results in:

```text
/tmp/foo.rs:1:4: 1:7 error: unresolved import.  perhapsyou forgot an 'extern mod foo'?
/tmp/foo.rs:1 use foo::bar;
                  ^~~
/tmp/foo.rs:1:4: 1:12 error: failed to resolve import: foo::bar
/tmp/foo.rs:1 use foo::bar;
                  ^~~~~~~~
error: failed to resolve imports
error: aborting due to 3 previous errors
```

This is the first of a series of changes I plan on making to unresolved name error messages.
2013-05-10 00:52:52 -07:00
Alex Crichton
a87db3e2cd rustc: Use the new for protocol 2013-05-10 02:46:19 -04:00
Alex Crichton
0cde8ba684 Implement a new protocol for for loops that's much more easily composable 2013-05-10 02:46:18 -04:00
Tom Lee
9042e1e8de Include static methods on traits in reexports. 2013-05-09 23:00:03 -07:00
Patrick Walton
923450d00c librustc: Fix ICE in core-text resulting from dynamic borrowing. rs=blocking-servo 2013-05-09 19:39:07 -07:00
bors
ad8e236f32 auto merge of #6336 : nikomatsakis/rust/issue-6308-closure-bounds, r=nikomatsakis
Use a bitset to represent built-in bounds. There are several places in the language where only builtin bounds (aka kinds) will be accepted, e.g. on closures, destructor type parameters perhaps, and on trait types.

r? @brson
2013-05-09 17:50:21 -07:00
Corey Richardson
9cbab89076 fix formating and tests 2013-05-09 20:15:59 -04:00
bors
f547a671dc auto merge of #6373 : nikomatsakis/rust/issue-6355-perf-regression, r=graydon
Fix #6355 and #6272---we were not giving the correct index to the derefs that occur as part of the rooting process, resulting in extra copies and generally bogus behavior. Haven't quite produced the right test for this, but I thought I'd push the fix in the meantime. Test will follow shortly.

r? @graydon
2013-05-09 13:45:49 -07:00
Niko Matsakis
78520867b9 rustc: Add EnumSet tests 2013-05-09 16:28:25 -04:00
Corey Richardson
fa5baf399d Tweak error message
Recommendation of @kud1ing
2013-05-09 16:09:01 -04:00
Corey Richardson
d3ca9c61a0 Better error message for certain classes of unresolved imports 2013-05-09 16:08:53 -04:00
Niko Matsakis
e18ed77b72 Remove remnants of mutable fields from mem_categorization, borrowck. 2013-05-09 15:58:41 -04:00
Niko Matsakis
15164cc6a6 Issue the correct deref count for the implicit deref that occurs
as part of an autoslice operation (#6272).

Fixes #6272.
2013-05-09 15:58:02 -04:00
bors
7675856253 auto merge of #6354 : Aatch/rust/uninit-intrinsic, r=graydon
Adds an `uninit` intrinsic.

It's just an empty function, so llvm optimizes it down to nothing.

I changed all of the `init` intrinsic usages to `uninit` where it seemed appropriate to.
2013-05-09 12:37:00 -07:00
bors
7a4c6e587d auto merge of #6325 : sammykim/rust/lint-name, r=graydon
Fix #3525.
2013-05-09 08:54:38 -07:00
Niko Matsakis
dc2ca9d883 Refactor representation of bounds to separate out BuiltinBounds into
its own type. Use a bitset to represent built-in bounds. There
are several places in the language where only builtin bounds (aka kinds)
will be accepted, e.g. on closures, destructor type parameters perhaps,
and on trait types.
2013-05-09 11:39:06 -04:00
Björn Steinbrink
1393c3a3f4 Use a specialized string interner to reduce the need for owned strings
&str can be turned into @~str on demand, using to_owned(), so for
strings, we can create a specialized interner that accepts &str for
intern() and find() but stores and returns @~str.
2013-05-09 14:40:19 +02:00
bors
ca95e7f94e auto merge of #6345 : seanmoon/rust/fix-typos, r=sanxiyn
Hi there,

Really enjoying Rust. Noticed a few typos so I searched around for a few more--here's some fixes.

Ran `make check` and got `summary of 24 test runs: 4868 passed; 0 failed; 330 ignored`.

Thanks!

Sean
2013-05-09 03:51:32 -07:00
James Miller
050c744c23 Add uninit intrinsic 2013-05-09 22:23:38 +12:00
Youngmin Yoo
c02064d153 librustc: rename vec::each(var) to var.each 2013-05-09 14:20:04 +09:00
Huon Wilson
ea5c413427 Perform expansion before stripping/building a test harness.
This allows macros to create tests and benchmarks.
2013-05-09 15:15:54 +10:00
Sangeun Kim
1b4e375046 Add space 2013-05-09 10:44:27 +09:00
bors
3bbbb314ee auto merge of #6327 : z0w0/rust/rm-notest, r=brson
Makes it more consistent, imo.
2013-05-08 18:15:41 -07:00
Patrick Walton
3affc6ed40 librustc: Fix merge fallout. 2013-05-08 17:04:02 -07:00
Patrick Walton
16a0125e41 libcore: Fix tests. 2013-05-08 17:04:01 -07:00
Patrick Walton
49a66a5c5a librustc: Stop parsing modes and remove them entirely from the language 2013-05-08 17:04:01 -07:00
Patrick Walton
99daec602f librustc: Fix merge fallout. 2013-05-08 17:04:00 -07:00
Patrick Walton
db4573a776 librustc: Remove mutable fields from the language.
They're still parsed though, to get through bootstrapping.
2013-05-08 17:04:00 -07:00
Patrick Walton
d12d25534b libcore: Remove more mutable fields from comm 2013-05-08 17:03:59 -07:00
Patrick Walton
4dc1c2976d libcore: Remove mutable fields from hash 2013-05-08 17:03:58 -07:00
bors
5a65f51d66 auto merge of #6214 : sanxiyn/rust/simd-2, r=graydon
At the moment this only includes type checking and there is no code generation support yet. I wanted to get the design reviewed first.

From discussion with @graydon at #5841, re-implemented as `#[simd]` attribute on structs.

Progressing towards #3499.
2013-05-08 14:09:38 -07:00
bors
65ded84d20 auto merge of #6119 : brson/rust/main, r=brson
r? @ILyoan

This pulls all the logic for discovering the crate entry point into a new pass (out of resolve and typeck), then changes it so that main is only looked for at the crate level (`#[main]` can still be used anywhere).

I don't understand the special android logic here and worry that I may have broken it.
2013-05-08 12:24:39 -07:00
Brian Anderson
3970d02ec5 rustc: Fix the logic for finding the Android main function
I don't understand what this logic is doing
2013-05-08 12:03:15 -07:00
Sean Moon
bd4ee7c7d2 Fix typos 2013-05-09 02:34:47 +09:00
bors
b6f9295654 auto merge of #6317 : brson/rust/durable, r=z0w0
#6312
2013-05-08 05:03:38 -07:00