Commit Graph

396 Commits

Author SHA1 Message Date
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
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