Commit Graph

639 Commits

Author SHA1 Message Date
bors
b171d0ef7b auto merge of #5159 : brson/rust/rtcall, r=brson 2013-02-28 01:12:38 -08:00
bors
c705440ee3 auto merge of #5155 : bstrie/rust/dedrop, r=pcwalton
This removes all but 6 uses of `drop {}` from the entire codebase. Removing any of the remaining uses causes various non-trivial bugs; I'll start reporting them once this gets merged.
2013-02-27 23:30:40 -08:00
Brian Anderson
2f858de1c3 Remove the last remnants of rtcalls 2013-02-27 18:34:04 -08:00
bors
d0a12347de auto merge of #5141 : nikomatsakis/rust/region-syntax-expl-lifetimes, r=nikomatsakis
Major changes are:
- replace ~[ty_param] with Generics structure, which includes
  both OptVec<TyParam> and OptVec<Lifetime>;
- the use of syntax::opt_vec to avoid allocation for empty lists;

cc #4846

r? @graydon
2013-02-27 17:36:41 -08:00
Niko Matsakis
c623d21e38 Introduce lifetime declarations into the lists of type parameters.
Major changes are:
- replace ~[ty_param] with Generics structure, which includes
  both OptVec<TyParam> and OptVec<Lifetime>;
- the use of syntax::opt_vec to avoid allocation for empty lists;

cc #4846
2013-02-27 19:42:09 -05:00
Ben Striegel
43d43adf6b Turn old drop blocks into Drop traits 2013-02-27 19:14:19 -05:00
Erick Tryzelaar
7f5d4cbda0 Merge remote-tracking branch 'remotes/origin/incoming' into incoming 2013-02-27 14:05:39 -08:00
bors
5fc0eccdfa auto merge of #5070 : youknowone/rust/struct-match2, r=nikomatsakis
It is reversed that type of arm pattern and type of search pattern
in error message.
2013-02-27 12:21:49 -08:00
Erick Tryzelaar
7d0ec86c4a Merge remote-tracking branch 'remotes/origin/incoming' into incoming 2013-02-27 11:03:21 -08:00
Jeong YunWon
35baf5b202 Fix reversed current/expected type
Fix some reversed type of arm pattern and type of search pattern
in error message.
2013-02-28 03:31:22 +09:00
Patrick Walton
07c3f5c0de librustc: Forbid pub or priv before trait implementations 2013-02-27 09:40:16 -08:00
bors
061a223723 auto merge of #5118 : youknowone/rust/match-guard, r=nikomatsakis
Fix ICE while there is no remained arms after checking guards.

This fix #3601 also.
2013-02-27 06:06:44 -08:00
bors
f4e8ac21cd auto merge of #5135 : brson/rust/start, r=pcwalton
r?

#3406

Pretty straightforward. I'm using opaque pointers instead trying to get trans and core to agree on the types of the main function and crate map. One oddity is that this required changing the order of the `-lrustrt` argument to the linker in order to resolve `upcall_new_stack`. Linkers are mysterious.
2013-02-26 23:45:39 -08:00
bors
99a902c81d auto merge of #5120 : jbclements/rust/macros-have-scope, r=pcwalton
r?

After this patch, macros declared in a module, function, or block can only be used inside of that module, function or block, with the exception of modules declared with the #[macro_escape] attribute; these modules allow macros to escape, and can be used as a limited macro export mechanism.

This pull request also includes miscellaneous comments, lots of new test cases, a few renamings, and a few as-yet-unused data definitions for hygiene.
2013-02-26 20:00:38 -08:00
Brian Anderson
f4327230fa Add a 'start' lang item and use it instead of rust_start 2013-02-26 19:43:26 -08:00
bors
28b50a4892 auto merge of #5096 : luqmana/rust/spell, r=catamorphism
Address #2281


```
-> % cat foo.rs
fn foo() -> int {
    let bar = 10;

    bad
}
```

```
-> % rustc foo.rs
foo.rs:4:4: 4:7 error: unresolved name: `bad`. Did you mean: `bar`?
foo.rs:4     bad
             ^~~
error: aborting due to previous error
```
2013-02-26 19:03:40 -08:00
bors
93a7f237d7 auto merge of #5115 : sanxiyn/rust/arm-abi, r=brson
Type size and alignment code needs to be factored, but I didn't want to interfere with MIPS port. Can be done later.

Fix #4797.
2013-02-26 17:57:41 -08:00
Luqman Aden
a0866d0166 Adjust error messages for compile-fail tests. 2013-02-26 17:23:30 -08:00
Luqman Aden
f460c2adf8 Move levenshtein distance fn to core::str. 2013-02-26 17:23:30 -08:00
Luqman Aden
0a0fcdb018 librustc: offer suggestions for unresolved names. 2013-02-26 17:23:30 -08:00
Alex Crichton
681e6dd40d Fix using the #[]-style attribute for unused imports 2013-02-26 17:51:26 -05:00
Alex Crichton
7e08d8f23c Don't warn about 'pub use' statements 2013-02-26 17:51:26 -05:00
bors
44acefd101 auto merge of #5126 : nikomatsakis/rust/issue-4808-representation-of-extern-fn, r=graydon
r? @graydon
2013-02-26 13:15:51 -08:00
Niko Matsakis
85aaf39291 Reimplement type_needs_drop on top of TypeContents 2013-02-26 15:28:32 -05:00
bors
0e6d895ed8 auto merge of #5119 : Kimundi/rust/incoming, r=catamorphism
Removed deprecated `str()` functions in int-template.rs and uint-template.rs
2013-02-26 10:54:39 -08:00
John Clements
ca147a029e Change imported macros to use leaky modules rather than leaky functions. 2013-02-26 10:26:41 -08:00
Marvin Löbel
42b0bacd76 Removed deprecated str() functions in int-template.rs and uint-template.rs 2013-02-26 16:38:30 +01:00
Jeong YunWon
b79c4dc262 Add non-exhaustive check for match guards
Fix ICE while there is no remained arms after checking guards
2013-02-26 22:20:02 +09:00
Patrick Walton
9b08cd4903 librustc: Make &const [T] mean the same thing as &[const T] 2013-02-26 04:18:12 -08:00
Patrick Walton
96bdc34930 librustc: De-[mut] librustc (remove all mutable arrays). rs=demuting 2013-02-26 04:18:12 -08:00
Patrick Walton
e2f90091cf libcore: Move Cell to core and de-~mut core and std 2013-02-26 04:18:12 -08:00
Patrick Walton
c483aab4ae librustc: Implement a lint mode for mutable structures; deny by default. r=tjc 2013-02-26 04:18:11 -08:00
Seo Sanghyeon
5098cf5bd2 ARM C ABI implementation 2013-02-26 20:24:15 +09:00
bors
9616b3d11e auto merge of #5089 : sanxiyn/rust/llvm-struct, r=pcwalton
Note on `struct_elt`: the comment is wrong, it actually dereferences the nth element of LLVM struct type if it is a pointer. That's why `T_ptr` is removed in `callee.rs`.
2013-02-25 18:36:39 -08:00
bors
580df4d997 auto merge of #5084 : oncemoreification/rust/issue-4517, r=brson
Patch for #4517

This works for fixed vectors, but I am unclear how slices should be printed, simply '&[...]'  or...

e.i. How should regions be printed?
2013-02-25 17:36:40 -08:00
bors
6e5705a877 auto merge of #5072 : youknowone/rust/repeat_count, r=brson
Fix issue #3645
2013-02-25 16:18:46 -08:00
Erick Tryzelaar
f14409c528 libsyntax: progress on making syntax::visit vecs_implicitly_copyable-free 2013-02-25 07:49:34 -08:00
Erick Tryzelaar
9ac5262bdf libsyntax: convert visit to pass ty_params by reference 2013-02-25 07:27:01 -08:00
Erick Tryzelaar
5b9e110eab libsyntax: Convert ast::attribute_ to store a @meta_item 2013-02-25 06:19:44 -08:00
Jeong YunWon
f0d0b5c116 Report error for non constant vector repeat count
Fix issue #3645
2013-02-25 00:21:03 +09:00
Daniel Micay
1afddff97f remove oldsmallintmap
Closes #4738
2013-02-23 01:40:17 -05:00
bors
ba7a870660 auto merge of #5051 : bstrie/rust/deimpself, r=pcwalton
With the exception of three places where explicit self ran into borrowing errors. Will try those again once borrowing is refined.
2013-02-22 10:24:43 -08:00
Seo Sanghyeon
ad414dec67 Consolidate codes dealing with LLVM struct type 2013-02-23 01:25:10 +09:00
oncemoreification
4ffff6697b Fix vector syntax in error messages 2013-02-22 02:19:41 -08:00
Graydon Hoare
0309af458c Put unique allocs in managed heap when they might contain managed boxes. 2013-02-21 23:01:17 -08:00
Ben Striegel
4a853894fa De-implicit-self librustc 2013-02-22 01:42:03 -05:00
bors
cec1f38c30 auto merge of #5077 : jbclements/rust/increase-monomorphization-depth-limit, r=catamorphism
It appears that using deriving_eq/auto_encode on ASTs bumps up against the "gee this looks like infinite unfolding" limit of 10 in monomorphization. Increasing it to 30 seems to solve this problem for me....

Also, commenting and a few renames.
2013-02-21 19:36:35 -08:00
bors
e7924ce18f auto merge of #5076 : pcwalton/rust/demuting, r=pcwalton 2013-02-21 18:27:32 -08:00
Luqman Aden
48c1c3cfc0 librustc: Fix broken test. 2013-02-21 16:40:52 -08:00
John Clements
1869df30a6 bump up limit on monomorphization 2013-02-21 16:18:22 -08:00
Patrick Walton
91479363cc librustc: Remove all mutable fields from librustc. rs=demuting 2013-02-21 15:45:55 -08:00
Patrick Walton
9c71249b9d librustc: De-mut trans. rs=demuting 2013-02-21 15:45:55 -08:00
Patrick Walton
553c27c515 librustc: De-mut some of trans 2013-02-21 15:45:55 -08:00
Patrick Walton
cdd6f38220 librustc: De-mut resolve. rs=demuting 2013-02-21 15:44:54 -08:00
Luqman Aden
9ea6a49696 Remove the last bits of structural records from tests/rustc/rusti/rustpkg. 2013-02-21 15:19:40 -08:00
bors
4a5e8c5218 auto merge of #5071 : luqmana/rust/derec, r=pcwalton
Rid libsyntax of records and get rid of the last piece in `librustc/front/test.rs`.
2013-02-21 09:20:43 -08:00
bors
c0218fb106 auto merge of #5069 : pcwalton/rust/plussing-2, r=pcwalton 2013-02-21 08:35:12 -08:00
Patrick Walton
c0defda499 librustc: Separate the rest of the trait bounds with + and stop parsing space-separated ones. rs=plussing 2013-02-21 08:29:48 -08:00
Luqman Aden
b02f5c2090 Get rid of structural records in libsyntax and the last bit in librustc. 2013-02-21 00:19:15 -08:00
bors
41a4151173 auto merge of #5065 : catamorphism/rust/issue-3453, r=catamorphism
...because it appears to work now. Removes a FIXME.
2013-02-20 22:36:31 -08:00
Patrick Walton
bf2a225c0b librustc: Separate most trait bounds with '+'. rs=plussing 2013-02-20 21:14:20 -08:00
Tim Chevalier
ad9c54c631 Merge 2013-02-20 19:09:32 -08:00
Tim Chevalier
f823d83718 Fix vdef pattern 2013-02-20 18:45:50 -08:00
Tim Chevalier
a4403e5cb8 Fix flipped tuple that was causing all that pain 2013-02-20 18:45:50 -08:00
Tim Chevalier
0c3290a217 Merge 2013-02-20 18:45:50 -08:00
Luqman Aden
6282e5da67 librustc: tidy 2013-02-20 18:45:50 -08:00
Luqman Aden
cd82c4566b librustc: Get rid of structural records save for front/test.rs. 2013-02-20 18:45:50 -08:00
Tim Chevalier
bad4463a6b rustc: Use position method in check::method
...because it appears to work now. Removes a FIXME.
2013-02-20 17:46:01 -08:00
bors
8f8f0ec2c6 auto merge of #5043 : brson/rust/swap, r=brson
r?
2013-02-20 16:58:34 -08:00
Brian Anderson
423843e54b Don't perform swap when src == dst. #5041 2013-02-20 16:18:48 -08:00
bors
62f2b4943a auto merge of #5046 : sanxiyn/rust/struct-match, r=catamorphism
Previously check always succeeded because struct type was derived from the matched expression, not the matched pattern.

Fix #4849.
2013-02-20 16:08:36 -08:00
bors
db25210244 auto merge of #5044 : thestinger/rust/range, r=pcwalton
Closes #4924

There are some more `Load` calls that could use this, so it's not completely done yet.
2013-02-19 19:04:28 -08:00
Daniel Micay
fa6e3b49bf replace explicit loops with foldr 2013-02-19 21:20:07 -05:00
bors
b88e4f3b9f auto merge of #5039 : alexcrichton/rust/issue-4875, r=catamorphism
It looks like the type for the whole pattern wasn't being written back, so when privacy tried to look it up everything died.
2013-02-19 17:38:29 -08:00
Daniel Micay
12b43b274b add range assert when loading bools 2013-02-19 20:22:04 -05:00
Daniel Micay
0262e4b138 use range assert when loading enum discriminant
Closes #4924
2013-02-19 17:59:24 -05:00
Alex Crichton
cc3fbcee51 Fix for issue 4875 2013-02-19 17:35:02 -05:00
bors
1f956fc3b2 auto merge of #4999 : erickt/rust/incoming, r=brson
This patch series is doing a couple things with the ultimate goal of removing `#[allow(vecs_implicitly_copyable)]`, although I'm not quite there yet. The main change is passing around `@~str`s in most places, and using `ref`s in others. As far as I could tell, there are no performance changes with these patches, and all the tests pass on my mac.
2013-02-19 12:24:30 -08:00
Erick Tryzelaar
68746cd4fb librustc: change driver::session::Session::str_of to return @~str 2013-02-19 10:11:05 -08:00
Erick Tryzelaar
b90ccc9a38 librustc: minor cleanup 2013-02-19 10:02:52 -08:00
Erick Tryzelaar
ae86c03af2 librustc: change check_item_non_camel_case_types to not copy 2013-02-19 10:02:52 -08:00
Erick Tryzelaar
3c0eca7940 librustc: convert creader and cstore to use @~strs 2013-02-19 10:02:52 -08:00
Erick Tryzelaar
a18e7d6656 librustc: minor cleanup 2013-02-19 10:02:52 -08:00
Erick Tryzelaar
53951afe48 librustc: convert lint_dict to take @~strs as keys 2013-02-19 10:02:52 -08:00
Erick Tryzelaar
04334c1ae0 librustc: convert LangItemsCollector::item_refs to take @~str as a key 2013-02-19 10:02:52 -08:00
Erick Tryzelaar
de5fdaf934 convert ast::meta_items to take @~strs 2013-02-19 10:02:52 -08:00
Erick Tryzelaar
a2b754788d convert syntax::attr to use @~strs 2013-02-19 10:02:51 -08:00
Seo Sanghyeon
a29023e9b2 Check type when struct is matched against enum-like pattern
Previously check always succeeded because struct type was derived from
the matched expression, not the matched pattern.
2013-02-20 02:44:02 +09:00
Kang Seonghoon
f513c567cb fix ICE after incorrect number of args in calls 2013-02-20 00:53:54 +09:00
bors
396f911925 auto merge of #5017 : catamorphism/rust/less-copy, r=catamorphism 2013-02-18 22:06:33 -08:00
bors
24603afc93 auto merge of #5010 : youknowone/rust/match_const_typecheck, r=catamorphism
Fix of issue #4968
2013-02-18 20:18:34 -08:00
bors
9ba2e65fd6 auto merge of #5004 : luqmana/rust/rename-use-import, r=catamorphism
Seems like my previous pull request got lost along the way somehow. So here it is updated.
2013-02-18 17:48:34 -08:00
Tim Chevalier
43dc67b74a rustc: Less copy in trans, rs=removing copies 2013-02-18 15:53:37 -08:00
Jeong YunWon
092b6114c1 add missing typecheck for const pattern match arm
Issue #4968
2013-02-19 00:56:02 +09:00
Luqman Aden
5b5ac331db Long lines. 2013-02-17 21:53:29 -05:00
Luqman Aden
0f09c106f0 libsyntax: Update view_item_use/import to reflect actual usage 2013-02-17 21:45:00 -05:00
Jed Davis
d009c6330b Make univariant enums act like structs, so that they're aligned correctly.
Consts of such enums are aligned correctly, so we could either misalign
them to match the type_of, or fix the type_of.  The latter seems like a
better idea.
2013-02-17 12:20:42 -08:00
Seth Pink
60bd4a5385 Removed more capture claueses. 2013-02-17 12:41:45 +10:00
Patrick Walton
548c0982ca librustc: Remove simplify_type and replace with sizing_type_of. rs=blocking-servo
`simplify_type` was bogus, as there was no way for it to handle enums
properly. It was also slow, because it created many Rust types at runtime. In
general creating Rust types during trans is a source of slowness, and I'd like
to avoid doing it as much as possible. (It is probably not possible to
eliminate it entirely, due to `subst`, but we should get rid of as much of it
as we can.) So this patch replaces `simplify_type` with `sizing_type_of`,
which creates a size-equivalent LLVM type directly without going through a
Rust type first.

Because this is causing an ICE in Servo, I'm rubber stamping it.
2013-02-16 10:20:52 -08:00
Patrick Walton
bb833ca0f0 librustc: Stop parsing impl Type : Trait and fix several declarations that slipped through. r=tjc 2013-02-15 16:59:56 -08:00
bors
566bcf2225 auto merge of #4969 : nickdesaulniers/rust/issue3869, r=brson
Issue #3869
review? @nikomatsakis 

Convert all uses of vec::slice to vec::view Issue #3869
Rename const_view to const_slice
Renamed mut_view to mut_slice
Fix windows build error.  `buf` is borrowed by the call to
`as_mut_buf()` and so we must invoke `slice()` outside of that
call.
2013-02-15 13:54:49 -08:00
Luqman Aden
99b3c07b4e librustc: Get rid of move. 2013-02-15 02:49:55 -08:00
bors
9727008ed0 auto merge of #4944 : catamorphism/rust/xxx-to-fixme, r=catamorphism 2013-02-14 23:11:13 -08:00
Tim Chevalier
3201c6fe3f rustc: De-XXX resolve and borrowck...
and remove an un-needed hashmap from resolve
2013-02-14 23:08:18 -08:00
bors
af2f0ef088 auto merge of #4927 : sanxiyn/rust/remove-dvec, r=catamorphism 2013-02-14 17:23:18 -08:00
Nick Desaulniers
5d62a4a52e Convert all uses of vec::slice to vec::view Issue #3869
Rename const_view to const_slice
Renamed mut_view to mut_slice
2013-02-14 16:14:32 -08:00
Patrick Walton
9143688197 librustc: Replace impl Type : Trait with impl Trait for Type. rs=implflipping 2013-02-14 14:44:12 -08:00
Daniel Micay
762ce323c0 stop applying noinline to glue code 2013-02-14 14:48:34 -05:00
Seo Sanghyeon
ae38935ff3 Remove DVec from check_const 2013-02-14 22:36:56 +09:00
bors
6efa3543a8 auto merge of #4922 : jbclements/rust/add-deriving-eq-to-asts, r=catamorphism
r?

Apply deriving_eq to the data structures in ast.rs, and get rid of the custom definitions of eq that were everywhere. resulting ast.rs is about 400 lines shorter.

Also: add a few test cases and a bunch of comments.

Also: change ast_ty_to_ty_cache to use node ids rather than ast::ty's. I believe this was a suggestion related to my changes, and it appears to pass all tests.

Also: tiny doc fix, remove references to crate keywords.
2013-02-13 18:49:29 -08:00
Nick Desaulniers
4445b38df2 Remove die!, raplace invocations with fail! Issue #4524 pt 3 2013-02-13 17:01:32 -08:00
bors
d5bf3b85d1 auto merge of #4908 : bstrie/rust/rimov3, r=pcwalton
This patch finishes removing inner vector mutability from the vast majority of the compiler. Exceptions:

* core::dvec: ideally this entire type will be able to be replaced by `~[]`, but Niko asked me to hold off on removing Dvecs until he makes some fixes to borrowed pointers. 
* liveness: liveness.rs is an impenetrable neutron star of deprecated semantics.
* compile-fail: I'm not sure if a lot of these tests are testing inner mutability or mutability in general. I figure that RIMOVing this folder should wait until this syntax is removed from the parser.

I also took this chance to remove many of the inner-mutability-related functions from core::vec, or as many uses of those functions as possible where still necessary. consume_mut and append_mut have been axed. cast_to_mut and cast_from_mut are still needed in a few places.
2013-02-13 15:09:07 -08:00
John Clements
16da4e15af use node_id for indexing in ast_to_ty_cache 2013-02-13 15:08:27 -08:00
Graydon Hoare
e5aa399e0d rustc and std: teach about #[bench], modernize to use quote_expr! some. 2013-02-13 11:46:25 -08:00
Ben Striegel
e6c82c0375 RIMOV core::vec
Also remove as many uses as possible of vec::cast_to_mut and
cast_from_mut
2013-02-13 12:48:24 -05:00
Ben Striegel
e58c812f77 Partially de-vec-mut librustc 2013-02-13 12:47:43 -05:00
Patrick Walton
e07623d70b librustc: Make monomorphic newtype structs work cross-crate 2013-02-13 09:47:20 -08:00
bors
27b3e01377 auto merge of #4914 : nikomatsakis/rust/issue-4856, r=nikomatsakis
and then adjust code to match. rs=unsound (will review post-landing)

rs=unsound
2013-02-12 20:40:19 -08:00
Niko Matsakis
ab2534974c Adjust borrow checker algorithm to address #4856 unsoundness,
and then adjust code to match. rs=unsound (will review post-landing)
2013-02-12 20:10:50 -08:00
Patrick Walton
a165f88272 librustc: Speed up moves a lot. r=nmatsakis 2013-02-12 16:16:23 -08:00
Graydon Hoare
1d82d8dd5d Revert "librustc: Make monomorphic newtype structs work cross-crate"
This reverts commit a8f039a085.
2013-02-12 09:02:17 -08:00
Patrick Walton
a8f039a085 librustc: Make monomorphic newtype structs work cross-crate 2013-02-11 20:09:11 -08:00
Jed Davis
3742b62f64 Omit discriminant from nullary univariant enums.
If an enum is isomorphic to unit, there's no need to use any bits to
represent it.  The only obvious reason this wasn't the case was because
the enum could be C-like and have a user-specified discriminant -- but
that value is constant, so it doesn't need to be stored.

This change means that all newtype-like enums have the same size (and
layout) as their underlying type, which might be a useful property to
have, at least in terms of making programs' low-level behavior less
surprising.
2013-02-09 22:28:43 -08:00
bors
d6442e97a5 auto merge of #4854 : thestinger/rust/oldmap, r=catamorphism 2013-02-09 15:02:51 -08:00
bors
d90abd5879 auto merge of #4848 : nikomatsakis/rust/issue-4821-bad-kind-computation, r=catamorphism
...ear

values to be copied.  Rewrite kind computation so that instead of directly
computing the kind it computes what kinds of values are present in the type,
and then derive kinds based on that. I find this easier to think about.

Fixes #4821.

r? @catamorphism
2013-02-09 10:20:55 -08:00
Daniel Micay
a32c5c73ee oldmap: get rid of legacy _ref suffixes 2013-02-08 19:12:51 -05:00
Niko Matsakis
a380df809c Fix subtle error in caching during kind computation that could cause linear
values to be copied.  Rewrite kind computation so that instead of directly
computing the kind it computes what kinds of values are present in the type,
and then derive kinds based on that. I find this easier to think about.

Fixes #4821.
2013-02-08 07:20:39 -08:00
Jed Davis
9318babf6c Fix const array index limit calculation.
The number of operands of the LLVM node initializing the array
underlying a const vector isn't always the array length -- if the
array is of a sufficiently primitive type and all the elements' values
are known (or something like that), LLVM uses a specialized Constant
subclass that stores the data packed, and thus has no operands.  Oops.

But, because llsize_of now gives us a ConstantInt, we can just fix
mozilla/rust#3169 and this all goes away.
2013-02-08 01:52:55 -08:00
Jed Davis
dd7a81d025 Let llsize_of be a ConstantInt 2013-02-08 01:52:47 -08:00
Jed Davis
e89d9853a6 Fix vector indexing in consts so it works with the enum vector const fix. 2013-02-07 18:31:12 -08:00
Jed Davis
de8dc02634 Make tuple-like structs containing enums work as constants. 2013-02-07 18:31:12 -08:00
Jed Davis
30aae3d910 Fix const enum type issues for structs. 2013-02-07 18:31:12 -08:00
Jed Davis
29b99669dc Fix pointer consts to work with enums 2013-02-07 18:28:31 -08:00
Jed Davis
9ad616a102 Make vectors of enums work as constants 2013-02-07 18:28:11 -08:00
Jed Davis
6cdc283415 Also need to pad out "C-like" enum consts (paths as well as calls). 2013-02-07 17:57:02 -08:00
Jed Davis
877fc8d891 Pad out enum consts to the expected size; makes enums in tuples work.
This is wasted space if the const is just an enum, but optimizing that
case without breaking everything else is an issue that can be addressed
separately.
2013-02-07 17:57:02 -08:00
Jed Davis
52cf61fd3b Fix const enums better: let them have the same alignment as an "opaque enum". 2013-02-07 17:57:02 -08:00
Patrick Walton
472797b04a librustc: Lots of de-muting. rs=demuting 2013-02-07 16:17:39 -08:00
bors
2bc9655bc1 auto merge of #4803 : alexcrichton/rust/fix-unused-imports, r=graydon
The first commit message has most of the comments, but this pull request basically fixes a lot of issues surrounding the `unused_imports` warning/deny attribute.

Before this patch there were these problems:

1. Unused imports from `prelude.rs` were warned about with dummy spans, leading to a large number of confusing warnings.
2. Unused imports from `intrinsic.rs` were warned about with the file `<intrinsic>` which couldn't be forced to go away
3. Methods used from imported traites (like `io::WriterUtil`) resulted in an unused warning of the import even though it was used.
4. If one `use` statement imported N modules, M of which weren't used, M warning statements were issued.
5. If a glob import statement was used, each public export of the target module which wasn't used had a warning issued.

This patch deals with all these cases by doing:

1. Ignore unused imports from `prelude.rs` (indicated by a dummy span of 0)
2. Ignore unused imports from `intrinsic.rs` (test on the imported module name, is there a better way?)
3. Track when imported modules are used as candidates for methods, and just assume they're used. This may not end up being the actual case, but in theory not warning about an unused thing is worse than warning about a used thing.
4. Only issue one warning statement
5. Only issue one warning statement.

This is the first time I've edited the compiler itself, and I tried to keep up with the style around, but I may have missed something here or there...
2013-02-07 15:20:16 -08:00
Niko Matsakis
a32498d846 Make ~fn non-copyable, make &fn copyable, split barefn/closure types,
correct handling of moves for struct-record update.

Part of #3678.  Fixes #2828, #3904, #4719.
2013-02-07 05:53:30 -08:00
bors
82d7396333 auto merge of #4823 : pcwalton/rust/enum-variant-discriminants, r=graydon
r? @graydon
2013-02-07 04:02:51 -08:00
bors
f13ea4121e auto merge of #4795 : catamorphism/rust/less-copy, r=catamorphism 2013-02-06 17:06:15 -08:00
Patrick Walton
cf6c3d96fb librustc: Attempt to put out burning tree by fixing translation of unary negation in boolean constants. rs=burningtree 2013-02-06 15:38:23 -08:00
Patrick Walton
6d13c90256 librustc: Stop loading enum variant discriminants from memory 2013-02-06 15:08:33 -08:00
Patrick Walton
b34f871dda librustc: Change i1 to i8 for bools. Attempts to put out burning tree. rs=burningtree 2013-02-06 14:28:02 -08:00
Tim Chevalier
739e5ba369 rustc: Less copy 2013-02-06 12:09:11 -08:00
Patrick Walton
801f3225b2 oldmap: use &K instead of K in find and get
This reverts commit a4250a96fd.

This is not the cause of the nonexhaustive-match failure.
2013-02-05 19:41:45 -08:00
Graydon Hoare
a4250a96fd Revert "oldmap: use &K instead of K in find and get"
This reverts commit 8e643525d4.
2013-02-05 14:30:53 -08:00
Alex Crichton
b368cb2341 Don't warn when imported traits are indeed used 2013-02-05 12:41:19 -05:00
Alex Crichton
6a4483ec7a Fix some bugs with -W unused-imports
1. Don't warn about anything not used in the prelude which is autmoatically
   injected, accomplished with a test that the span is equal to a dummy span.
2. Don't warn about unused imports from the injected intrinsic module,
   accomplished by testing against the name of the imported module
3. If anything is used from a glob import, don't warn about the glob import.
4. If an import imports more than one thing, and none of them are used, only
   issue a warning once

Also updated the unused-imports-warn test to have stricter requirements on
error messages.
2013-02-05 12:40:59 -05:00
bors
52817092a9 auto merge of #4747 : sanxiyn/rust/integral-type, r=graydon
`ty::type_is_integral` returns `true` for `ty_bool`. This causes `-true` to compile, instead of resulting in a type error.
2013-02-04 19:59:06 -08:00
bors
bffe3088c7 auto merge of pull req #4777 from thestinger/rust, r=graydon 2013-02-04 17:24:40 -08:00
bors
3c6b9c2363 automated merge 2013-02-04 15:39:10 -08:00
Seo Sanghyeon
6d5428cb4e Let type_is_integral return false for bool type 2013-02-04 23:01:47 +09:00
ILyoan
6105f09cc1 Use x86-64 CABI for foreign function on arm target 2013-02-04 19:30:17 +09:00
Erick Tryzelaar
9adfa59d8e core: convert ToStr::to_str to take explicit &self 2013-02-03 20:47:26 -08:00
Daniel Micay
8e643525d4 oldmap: use &K instead of K in find and get 2013-02-03 23:30:56 -05:00
Brian Anderson
3b396d17d6 Merge remote-tracking branch 'thestinger/old_map' into incoming
Conflicts:
	src/test/bench/core-map.rs
2013-02-03 17:56:49 -08:00
Patrick Walton
04eb9b4eb0 librustc: Fix bugs regarding to impl privacy. rs=bugfix 2013-02-03 17:50:27 -08:00
Marvin Löbel
eb19462104 Converted libcore/uint-template.rs to the new string functions.
- Moved ToStr implementation of unsigned integers to uint-template.rs.
- Marked the `str()` function as deprecated.
- Forwarded all conversion functions to `core::num::to_str_common()`
  and `core::num::from_str_common()`.
- Fixed most places in the codebase where `to_str()` is being used.
- Added uint-template to_str and from_str overflow tests.
2013-02-03 15:37:24 -08:00
Marvin Löbel
26e72bf92b Converted libcore/int-template.rs to the new string functions.
- Moved ToStr implementation of integers to int-template.rs.
- Marked the `str()` function as deprecated.
- Forwarded all conversion functions to `core::num::to_str_common()`
  and `core::num::from_str_common()`.
- Fixed most places in the codebase where `to_str()` is being used.
- Added int-template to_str and from_str overflow tests.
2013-02-03 15:37:24 -08:00
Daniel Micay
4fd9264875 oldmap: &K instead of K for the remove parameter 2013-02-03 18:20:59 -05:00
Daniel Micay
81b4f36d49 oldmap: remove legacy each method 2013-02-03 15:55:11 -05:00
Daniel Micay
2e496818a5 oldmap: get rid of the legacy each_key method 2013-02-03 15:55:10 -05:00
Daniel Micay
88d9d417a1 oldmap: remove the legacy each_value method 2013-02-03 15:55:10 -05:00
Daniel Micay
1b4eb145f9 oldmap: implement core::container::Container 2013-02-03 15:55:10 -05:00
Daniel Micay
f4a27b2c7d oldmap: get rid of the legacy contains_key method 2013-02-03 15:55:10 -05:00
Daniel Micay
319eeb1c79 rename map -> oldmap and mark it as deprecated
LinearMap is quite a bit faster, and is fully owned/sendable without
requiring copies. The older std::map also doesn't use explicit self and
relies on mutable fields.
2013-02-03 15:55:10 -05:00
Brian Anderson
9dc6938292 Merge remote-tracking branch 'nickdesaulniers/issue4524' into nocomm1 2013-02-01 11:18:58 -08:00
Nick Desaulniers
7868b6bf55 Remove fail keyword from lexer & parser and clean up remaining calls to
fail

Fix merge conflicts - Issue 4524
2013-02-01 00:15:42 -08:00
John Clements
53688addaa test cases, cleanup 2013-01-31 23:05:12 -08:00
Nick Desaulniers
6fb4239bb3 Replace most invocations of fail keyword with die! macro 2013-01-31 22:25:12 -08:00
Daniel Micay
70855f5a07 move smallintmap to oldsmallintmap 2013-01-31 23:13:56 -05:00
Nick Desaulniers
aee7929469 Replace most invocations of fail keyword with die! macro 2013-01-31 20:12:49 -08:00
Tim Chevalier
2db3175c76 rustc: Stamp out XXXes in middle (comments only) 2013-01-31 19:48:43 -08:00
Brian Anderson
9673005afe Merge pull request #4703 from sanxiyn/remove-tps
Remove `tps` from `trans_enum_def` and `trans_struct_def`
2013-01-31 16:59:47 -08:00
Niko Matsakis
71478f9ce3 Workaround for #4717: pad contents of ast. rs=breakage 2013-01-31 16:56:12 -08:00
Niko Matsakis
0682ad0eb9 Finalize moves-based-on-type implementation.
Changes:

- Refactor move mode computation
- Removes move mode arguments, unary move, capture clauses
  (though they still parse for backwards compatibility)
- Simplify how moves are handled in trans
- Fix a number of illegal copies that cropped up
- Workaround for bug involving def-ids in params
  (see details below)

Future work (I'll open bugs for these...):

- Improve error messages for moves that are due
  to bindings
- Add support for moving owned content like a.b.c
  to borrow check, test in trans (but I think it'll
  "just work")
- Proper fix for def-ids in params

Def ids in params:

Move captures into a map instead of recomputing.

This is a workaround for a larger bug having to do with the def-ids associated
with ty_params, which are not always properly preserved when inlining.  I am
not sure of my preferred fix for the larger bug yet.  This current fix removes
the only code in trans that I know of which relies on ty_param def-ids, but
feels fragile.
2013-01-31 12:09:00 -08:00
Seo Sanghyeon
0d1058a62e Remove tps from trans_enum_def and trans_struct_def 2013-01-31 17:12:33 +09:00
Patrick Walton
366812a5c3 librustc: Change self as a type to Self everywhere. r=brson 2013-01-30 19:52:45 -08:00
Patrick Walton
49472ec4c9 librustc: Remove legacy exports from the language. r=brson 2013-01-30 18:11:43 -08:00
Graydon Hoare
4030aaff20 rustc: make integral type inference transactional, close #3211, close #4401, close #3398. 2013-01-30 16:21:19 -08:00
Patrick Walton
d2e1bfb123 librustc: Long line. rs=burning 2013-01-30 14:30:42 -08:00
Patrick Walton
ae50912875 librustc: De-export rustc. rs=deexporting 2013-01-30 13:44:24 -08:00
Patrick Walton
cc9999c609 librustc: De-record the type context. rs=derecordification 2013-01-30 13:14:58 -08:00
Patrick Walton
684aa2b7fd librustc: De-export ty. rs=deexporting 2013-01-30 12:18:08 -08:00
Patrick Walton
ba11e96289 librustc: De-export trans. rs=deexporting 2013-01-30 11:47:02 -08:00
Patrick Walton
28ed9dc09e librustc: Long lines. rs=burning 2013-01-29 22:40:13 -08:00
Patrick Walton
0c1d9befb3 librustc: Speed up byte copy operations. r=nmatsakis 2013-01-29 22:15:06 -08:00
Patrick Walton
97c593a1ce librustc: Stop zeroing out allocas so much. Cuts 300K off librustc. 2013-01-29 22:14:08 -08:00
Patrick Walton
1b613ff9fc librustc: Strdup unique strings instead of copying in byte by byte. Shaves 2MB off librustc at -O0. 2013-01-29 22:14:08 -08:00
Patrick Walton
a47fa9b32f librustc: De-export some of trans. rs=deexporting 2013-01-29 22:14:08 -08:00
Tim Chevalier
a30ea013f5 Handle supertrait calls in default methods
Add a new method_super origin for supertrait methods. Also make
coherence create a table that maps pairs of trait IDs and self types
to impl IDs, so that it's possible to check a supertrait method
knowing only its index in its trait's methods (without knowing all
supertraits for a given trait).

r=nmatsakis and graydon -- with hope, we'll revamp all of this code as
per #4678, but for now this fixes the bug.

Closes #3979
2013-01-29 20:33:22 -08:00
Patrick Walton
bae4821851 librustc: De-export typeck. rs=deexporting 2013-01-29 16:26:16 -08:00
Patrick Walton
c25703ccb8 librustc: De-export front, borrowck, and typeck/check. rs=deexporting 2013-01-29 16:05:13 -08:00
Patrick Walton
226cd68f13 librustc: De-implicit-self the visitor. r=graydon 2013-01-29 10:43:12 -08:00
Patrick Walton
6ce74460e6 librustc: Disallow trait bounds in types, enumerations, and structure definitions. r=tjc 2013-01-29 10:42:58 -08:00
Patrick Walton
eb4d39e1fe libstd: Remove "dual impls" from the language and enforce coherence rules. r=brson
"Dual impls" are impls that are both type implementations and trait
implementations. They can lead to ambiguity and so this patch removes them
from the language.

This also enforces coherence rules. Without this patch, records can implement
traits not defined in the current crate. This patch fixes this, and updates
all of rustc to adhere to the new enforcement. Most of this patch is fixing
rustc to obey the coherence rules, which involves converting a bunch of records
to structs.
2013-01-29 10:42:45 -08:00
Tim Chevalier
15871a7458 rustc: Check struct field types when heap memory lint checks are enabled 2013-01-28 19:41:56 -08:00
Tim Chevalier
6cbccc92b7 rustc: In lint, forbid structural records unless legacy_records is on 2013-01-28 19:41:55 -08:00