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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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