Commit Graph

430 Commits

Author SHA1 Message Date
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
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
4e6994dbfa librustc/back/rpath.rs: oldmap -> LinearSet 2013-02-08 21:22:54 -05: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
bors
e8fc4b347d auto merge of #4834 : veddan/rust/zflags, r=graydon
Converted --static, --gc, --jit, -g and --xg to -Z flags.
2013-02-07 19:50:03 -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
Viktor Dahl
fae8fc94dc Added a few missing 'pub's 2013-02-08 00:57:31 +01: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
Viktor Dahl
b8943474dc Moved experimental compiler flags to -Z (#4740) 2013-02-08 00:18:23 +01: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