Commit Graph

1360 Commits

Author SHA1 Message Date
Elliott Slaughter
38fee9526a rustc: When landing pads are off, avoid skipping cleanup code.
This forces various things to be created (e.g. drop glue), and also
happens to be necessary for GC liveness to recognize cleanups as
roots.
2012-08-27 12:48:35 -07:00
Elliott Slaughter
5593add3a8 rustc: Break cyclical dependence between emit_tydescs and gen_shape_tables.
Force all tydescs to be emitted before emit_tydescs to avoid linker
failures.
2012-08-27 12:48:35 -07:00
Brian Anderson
8337fa1a54 Camel case the option type 2012-08-26 15:56:16 -07:00
Patrick Walton
62be878ed1 rustc: Use memmove in unsafe::reinterpret_cast (issue #3025).
This was causing a bunch of structural copies, which when inlined
was leading to enormous register pressure. Often this is seen in
code which makes use of result::unwrap.
2012-08-26 11:25:53 -07:00
Patrick Walton
ff9151fa55 rustc: Use memset when zeroing allocas out (issue #3025).
Previously, LLVM was generating a ton of byte-by-byte copies,
leading to huge numbers of vregs and bloating the code. Now, using
memset, the code becomes a nice series of SSE moves instead.
2012-08-26 10:50:06 -07:00
Patrick Walton
80429dd7bd rustc: Add some more debugging to vtable 2012-08-25 23:13:50 -07:00
Brian Anderson
09df8f1abf Fix more unused variable warnings 2012-08-25 18:38:21 -07:00
Patrick Walton
8ef4551904 rustc: Implement foreign constants.
This is needed for a lot of Apple libraries, as Apple tends to put a lot of
globals in dynamic libraries.
2012-08-25 15:09:33 -07:00
Tim Chevalier
33ba097069 Add backquotes to error message 2012-08-25 09:15:26 -07:00
Vincent Belliard
bdbedb9d35 implements issue #2356 2012-08-25 17:01:52 +02:00
Tim Chevalier
5e22fb9c7f Remove match check 2012-08-24 22:28:12 -07:00
Tim Chevalier
0dad78e03d Eliminate match checks in trans and typeck 2012-08-24 20:45:30 -07:00
Michael Sullivan
90812c143d Rework method lookup to properly handle self types for non impl matches. Closes #3268. Closes #3274. 2012-08-24 17:57:41 -07:00
Michael Sullivan
6a56212649 A bunch of code refactoring in method matching. 2012-08-24 17:57:41 -07:00
Michael Sullivan
cf62433f43 Comments only: fix a comment in method resolution. 2012-08-24 17:57:41 -07:00
Graydon Hoare
c284b8b1dc Start using core::path2::Path in a lot of places. 2012-08-24 15:51:16 -07:00
Niko Matsakis
a8f1bee457 fix some unused pattern binding warnings 2012-08-24 15:37:21 -07:00
Michael Sullivan
e55c5ceac2 Infer purity for || style closures. Closes #3023. 2012-08-24 14:21:27 -07:00
Michael Sullivan
2c96a43cf1 Get rid of the unsafe hacks in resolve3. Closes #3267. 2012-08-24 14:21:26 -07:00
Elliott Slaughter
7706262a73 rustc: Add flag for enabling GC. 2012-08-24 14:01:27 -07:00
Elliott Slaughter
30768d3609 rustc: Don't emit metadata for default and GC box addrspaces. 2012-08-24 14:01:27 -07:00
Elliott Slaughter
e68db3ad3c rustc: Fix for updated macro syntax. 2012-08-24 14:01:26 -07:00
Elliott Slaughter
a7a74c79fa rustc: Emit index of tydescs by addrspace. 2012-08-24 14:01:26 -07:00
Elliott Slaughter
c2e99ba826 rustc: Root resources with addrspaces. 2012-08-24 14:01:26 -07:00
Ben Blum
37bcd67a09 Enforce copyability in bind_by_value match arms (fix #3255) 2012-08-24 16:43:03 -04:00
Niko Matsakis
e47d2f6060 extend liveness to treat bindings more like other variables
This results in a lot of warnings in rustc.  I left them in because
many are bugs and we should fix our code, but Graydon asked that
I not touch every file in the codebase.
2012-08-24 12:55:08 -07:00
Michael Sullivan
0f996f70a6 Remove purity from fn_decl and move it out to containing AST elements. 2012-08-23 19:40:01 -07:00
Ben Blum
673d0d83cf Less confusing error message when copying into heap closures (close #2942) 2012-08-23 22:07:56 -04:00
Niko Matsakis
a08f3a7d4d More complete fix to #3162 (borrowck bug related to access to rec fields) 2012-08-23 18:54:08 -07:00
Niko Matsakis
5ccf8175a8 don't consider use of @fn to be region-param'd 2012-08-23 17:55:04 -07:00
Tim Chevalier
6b6bea9531 Add boolean constants as part of const_eval
Doesn't exactly eliminate a match check, but simplifies the logic a bit
2012-08-23 17:22:08 -07:00
Niko Matsakis
5eea7d6e61 don't infer region paramaterization for ids in a bound context 2012-08-23 16:22:23 -07:00
Tim Chevalier
9f591319dd Rename str::bytes to str::to_bytes
Closes #3245
2012-08-23 15:46:10 -07:00
Ben Blum
caceac06ce Remove old-moded atomic intrinsics (#3200) 2012-08-23 16:54:25 -04:00
Niko Matsakis
3cf74564b8 update liveness to camel-cased conventions, silence warnings 2012-08-23 12:38:18 -07:00
Paul Stansifer
29f32b4a72 m1!{...} -> m1!(...) 2012-08-23 11:14:14 -07:00
Michael Sullivan
0f0a9775ba Some error message cleanup in check.rs. 2012-08-23 10:21:35 -07:00
Ben Blum
5d5cfcc005 Merge pull request #3258 from erickt/serialization
Fixing serialization no-implicit-copies warnings, and other misc cleanup
2012-08-23 09:37:21 -07:00
Niko Matsakis
511e7626ae Infer variance of types with respect to the region parameter.
A similar approach could be used for type parameters.

Fixes #2282.
2012-08-23 06:30:43 -07:00
Tim Chevalier
c8ce32e7f4 Represent "item families" in the decoder as an enum
This eliminates some match checks. Also get rid of other match checks
in metadata code.
2012-08-22 20:32:09 -07:00
Erick Tryzelaar
cfa71a135b rustc: add all the pretty printer modes to error message 2012-08-22 19:10:28 -07:00
Brian Anderson
4ef1d9d5b5 rustc: Remove typestate source 2012-08-22 18:33:19 -07:00
Ben Blum
9f0b3e3164 remove a debug print statement moving out of enums 2012-08-22 21:16:34 -04:00
Tim Chevalier
f61bbe2709 Dead code elimination 2012-08-22 17:52:27 -07:00
Ben Blum
37962288ec Compile moving out of enums (#2329) 2012-08-22 20:40:25 -04:00
Ben Blum
5b25fc918a Parse and typecheck moving out of enums (#2329) 2012-08-22 20:40:25 -04:00
Tim Chevalier
1b804ce343 Merge find_linkage_attrs with find_linkage_metas
This gets rid of a gratuitous `match check`.
2012-08-22 16:43:23 -07:00
Paul Stansifer
1153b5dcc8 intern identifiers 2012-08-22 14:59:25 -07:00
Michael Sullivan
744fea1a4f Track the type of self properly. Closes #3247. 2012-08-22 13:18:29 -07:00
Tim Chevalier
7284969292 Eliminate many match checks in rustc 2012-08-22 12:25:08 -07:00
Niko Matsakis
ce3cc46ce6 Fix generation of generic methods with explicit self
There used to be two distinct code paths.  Now there is one.
2012-08-21 20:15:22 -07:00
Ben Blum
9b489f6fff Don't refute "()" in let-bindings (fixes #3104). 2012-08-21 21:05:01 -04:00
Ben Blum
f5332769d5 Convert atomic intrinsics away from old argument modes (partial #3200) 2012-08-21 15:30:53 -04:00
Niko Matsakis
9423302c82 remove trailing whitespace 2012-08-21 11:24:41 -07:00
Niko Matsakis
652b312122 more sound treatment of fn& regions; change all & to be distinct 2012-08-21 10:28:34 -07:00
Niko Matsakis
8ee79c79aa new region inference, seperate infer into modules, improve error msgs
Fixes #2806
Fixes #3197
Fixes #3138
2012-08-20 22:00:06 -07:00
Michael Sullivan
71ec545614 Try to do some resolution of vtables earlier, in a fairly ad-hoc way. Closes #3156. 2012-08-20 19:00:27 -07:00
Ben Blum
c321cdbac6 Disallow deconstructing destructing structs (fixes #3147) 2012-08-20 20:05:00 -04:00
Ben Blum
849d5649ef remove fixme in check::alt 2012-08-20 18:25:05 -04:00
Ben Blum
aa3df17445 Re-allow pattern-matching structs (#3215) 2012-08-20 18:22:11 -04:00
Michael Sullivan
a14485b7fd Do vtable resolution for *all* method calls, not just statically resolved ones... Closes #3221. 2012-08-20 13:36:15 -07:00
Patrick Walton
19b8598c09 rustc: Implement "priv" for simple items.
Inherited privacy doesn't work yet. This probably requires a snapshot since
it won't be backwards compatible. Additionally, two errors are printed instead
of one. For this reason the test is XFAIL'd.
2012-08-17 17:56:47 -07:00
Niko Matsakis
4b1d83ca64 fix deprecated-mode lint warning to consider dtors 2012-08-17 17:31:03 -07:00
Michael Sullivan
457e78cd53 Make by-val explicit self actually work. Closes #2585. 2012-08-17 17:14:32 -07:00
Patrick Walton
6b1a9af173 rustc: Remove all the code dealing with named implementations in resolve3 2012-08-17 17:09:53 -07:00
Patrick Walton
26aaf08ff4 rustc: Remove the impl map 2012-08-17 16:53:07 -07:00
Patrick Walton
10c997a746 rustc: Get rid of the impl_map in the encoder 2012-08-17 16:38:07 -07:00
Patrick Walton
1ed94a5674 rustc: Prevent destructors from being run twice with the repeated vector syntax 2012-08-17 16:12:07 -07:00
Patrick Walton
9ea6b3a32e rustc: Remove a few allocations from metadata. Shaves a few milliseconds off compilation of hello world. 2012-08-17 15:54:18 -07:00
Patrick Walton
69daeffddb rustc: Remove a bunch of unused metadata tags from common 2012-08-17 15:25:40 -07:00
Patrick Walton
f79006937a rustc: Remove tag_paths and all of the associated encoding 2012-08-17 15:23:44 -07:00
Niko Matsakis
ea549e7a71 make borrowck more conservative around rvalues.
this will require more temporaries, but is probably less magical.
also, it means that borrowck matches trans better, so fewer crashes.
bonus.

Finally, stop warning about implicit copies when we are actually borrowing.

Also, one test (vec-res-add) stopped failing due to #2587, and hence I
added an xfail-test.

Fixes #3217, #2977, #3067
2012-08-17 15:14:13 -07:00
Patrick Walton
8f01343f01 rustc: Remove resolve_path 2012-08-17 15:07:14 -07:00
Patrick Walton
75d3e3c755 rustc: Remove a user of tag_paths.
This commit breaks the item-printing functionality. It will return in a faster
form.
2012-08-17 14:55:52 -07:00
Lindsey Kuper
0ace896d1f Remove a match check 2012-08-17 14:32:34 -07:00
Lindsey Kuper
2b3c86cb02 More and better debug messages for method typechecking 2012-08-17 14:32:34 -07:00
Patrick Walton
6f441e8fde rustc: Remove lookup_defs; unused. 2012-08-17 14:31:39 -07:00
Patrick Walton
578b7266f2 rustc: Encode reexports in the metadata and don't have each_path search tag_paths 2012-08-17 12:42:45 -07:00
Ben Blum
89c2a9f4cf Forbid pattern-matching structs until the next snapshot (#3215) 2012-08-17 15:34:06 -04:00
Ben Blum
09cf5c1de4 Work around #3215/#3217 use-after-free in typeck::check::alt 2012-08-17 15:07:09 -04:00
Brian Anderson
5026ea0446 rustc: upcall_alloc_c_stack doesn't exist 2012-08-17 11:43:58 -07:00
Lindsey Kuper
280dfd2d29 Default methods with self-calls make it as far as trans. 2012-08-17 11:04:53 -07:00
Lindsey Kuper
3a5c7f52cc Change node_id to def_id in self_info. 2012-08-17 11:04:53 -07:00
Brian Anderson
3ab4b014cf Remove the class keyword 2012-08-17 10:13:45 -07:00
Graydon Hoare
45e7b89279 s/class/struct/ in an error message. 2012-08-16 14:25:53 -07:00
Patrick Walton
bf0d4cc035 rustc: Allow external structs to be constructed. Closes #3012.
Embarrassing.
2012-08-15 21:03:40 -07:00
Brian Anderson
9c6890f488 Convert more core types to camel case 2012-08-15 17:46:05 -07:00
Patrick Walton
6319c8fbc4 rustc: Fix long lines and trailing whitespace 2012-08-15 16:25:42 -07:00
Patrick Walton
3038968f28 rustc: Perform some AST surgery to separate out class fields from methods 2012-08-15 16:20:35 -07:00
Patrick Walton
bdb206f285 rustc: Parse labeled loop, break, and again 2012-08-15 16:20:34 -07:00
Patrick Walton
d54db12155 rustc: Implement automatic reference for method receivers 2012-08-15 16:20:33 -07:00
Patrick Walton
fe9d07dda6 rustc: "as Trait" can now be written "as @Trait".
There is also code for ~Trait and &Trait, but these are currently (incorrectly)
synonyms for "as @Trait" and "as &Trait".
2012-08-15 16:20:31 -07:00
Tim Chevalier
c0140f5c34 Reject empty matches on inhabited types
Closes #3096
2012-08-15 14:57:45 -07:00
Brian Anderson
a83414b6e8 lint: Allow leading underscores on camel case types 2012-08-15 14:54:33 -07:00
Brian Anderson
74c69e1053 Convert more core types to camel case 2012-08-15 14:14:20 -07:00
Brian Anderson
11258310e2 Convert more core types to camel case 2012-08-14 18:26:03 -07:00
Michael Sullivan
e640a66eb4 Make most forms of explicit self work. By-value not implemented. Work on #2585. 2012-08-14 17:40:04 -07:00
Graydon Hoare
4c16ff516d Convert a couple hundred ~""s to ""s, in trans functions. 2012-08-14 16:45:51 -07:00
Lindsey Kuper
fb05f57881 Compile default methods; un-xfail default methods test (cc: #2794). 2012-08-14 09:02:47 -07:00
Brian Anderson
5394e34aa4 core: Camel case some lesser-used modules 2012-08-13 18:59:48 -07:00
Brian Anderson
6b43c0c1ad Stop parsing old operator overloading syntax 2012-08-13 18:59:17 -07:00
Ben Blum
2e1b98d34f Change borrowck error 'the the block' -> 'the block' 2012-08-13 21:53:41 -04:00
Tim Chevalier
c0858f4f7a In typeck::collect::ensure_trait_methods, don't assume the trait was already checked
Instead of using node_id_to_type to look up the trait type, pass it
in as an argument. This handles the case where we check an impl of a trait T
before T has been traversed.
2012-08-13 17:38:58 -07:00
Graydon Hoare
91612dbb7e De-mode-ify a few minor libcore modules. 2012-08-13 17:11:33 -07:00
Patrick Walton
5bd4110170 rustc: Mostly implement region-bounded stack closures 2012-08-13 15:34:36 -07:00
Brian Anderson
395d1ac185 rustc: Enum idents are not in the value namespace. Closes #3186 2012-08-13 15:17:54 -07:00
Lindsey Kuper
b1ec0a582e Default methods get through compilation, but not linkage (cc: #2794). 2012-08-13 10:34:35 -07:00
Lindsey Kuper
0e0833e0b0 Change "iid" identifiers (apparently "interface id") to "trait_id" 2012-08-13 10:34:35 -07:00
Niko Matsakis
9169a1b26a correct glb computation, improve region error msgs
cc #3180
2012-08-11 20:24:11 -07:00
Niko Matsakis
0475406178 infer: better names, docs 2012-08-11 20:24:11 -07:00
Niko Matsakis
a9979c0ae4 switch over some newtyped enums to structs 2012-08-11 20:24:11 -07:00
Niko Matsakis
6d2bef53aa rename var_bindings to be less cryptic 2012-08-11 20:24:11 -07:00
Patrick Walton
7634e2911b Revert "rustc: Make function types have vstores in them"
This reverts commit 0101125a96.
2012-08-10 18:14:55 -07:00
Patrick Walton
0101125a96 rustc: Make function types have vstores in them 2012-08-10 16:22:06 -07:00
Lindsey Kuper
4597fe1320 Remove unneeded imports now that #1873 seems to be fixed 2012-08-10 13:38:21 -07:00
Lindsey Kuper
0c35489858 Move a comment to where it belongs. 2012-08-10 13:38:21 -07:00
Brian Anderson
96fdad2fb7 Change 'ret' to 'return' in an error message 2012-08-10 12:20:58 -07:00
Patrick Walton
68bdc09650 rustc: Allow @fn to be used as a synonym for fn@, and likewise with ~ and & 2012-08-10 12:18:47 -07:00
Niko Matsakis
2082a979e7 remove modes from ty.rs 2012-08-10 10:52:11 -07:00
Patrick Walton
770a21272b rustc: Initialize the drop flag with the new struct literal syntax. Closes #3172. 2012-08-09 19:45:37 -07:00
Niko Matsakis
1b2d91c79d de-mode-ify infer and some parts of typeck
also, fix bug in the various lint passes that fn() was considered
not suitable for the default mode
2012-08-09 18:26:50 -07:00
Ben Blum
d913492855 Change coherence error 'implement a trait instead' -> 'implement a trait or new type instead' 2012-08-09 20:29:34 -04:00
Graydon Hoare
f0775d7bfe Finish translating const indexing. Close #1417, close #570, close #571, close #1272, close #2317. 2012-08-09 16:05:34 -07:00
Niko Matsakis
22a14dd700 Enforce a stricter notion of purity when borrowing. Fixes #3162. 2012-08-09 14:23:56 -07:00
Lindsey Kuper
e82d2ef763 Minor cleanup 2012-08-09 11:10:09 -07:00
Brian Anderson
7bbdf296e0 lint: Don't warn about non-camel case impl names
Impls are always named __extensions__ so this warning is bogus
2012-08-08 22:21:47 -07:00
Graydon Hoare
a0e3a2ae8e Const field access (working) and vec indexing (almost). More for #2317. 2012-08-08 19:59:30 -07:00
Brian Anderson
780b3853d1 rustc: Remove some uses of impl_map 2012-08-08 19:27:20 -07:00
Brian Anderson
6a0720b439 Convert impls to new syntax 2012-08-08 18:19:24 -07:00
Patrick Walton
4f98e80db1 rustc: Do some plumbing work in preparation for common fields in enums 2012-08-08 17:15:37 -07:00
Lindsey Kuper
edf1d0c245 Minor cleanups/comments/whitespace changes 2012-08-08 16:07:52 -07:00
Lindsey Kuper
293f371477 Default methods in traits get through typeck. 2012-08-08 16:07:52 -07:00
Lindsey Kuper
c8bad36312 Change a match check to match 2012-08-08 16:07:52 -07:00
Lindsey Kuper
8b79bed6dd Clean up whitespace 2012-08-08 16:07:52 -07:00
Tim Chevalier
febd7ee239 Make let _ = e; have the same semantics as e;
The first case was getting treated like a variable binding, meaning that
if e had a destructor, it wouldn't run until the end of the enclosing scope.
To me it seems less confusing for let _ = e; and e; to work exactly the same
way, so now, the destructor for e runs immediately in both cases.
2012-08-08 15:37:45 -07:00
Brian Anderson
d99ca69cf7 lint: Allow trailing underscores in camel case idents 2012-08-08 15:05:49 -07:00
Patrick Walton
f110e8f21c rustc: Do some plumbing work on nested enums 2012-08-08 14:19:21 -07:00
Elliott Slaughter
166cb1b28b rustc: Strict enforcement of glue function types.
Make all glue functions take values by alias to remove the need for
bitcasts at the top of every glue function. Use static type
information to produce the correct type for glue functions so that
LLVM can enforce the type system at call sites.
2012-08-08 12:21:25 -07:00
Michael Sullivan
76d04af71a In decoder, rename class_member_id to item_def_id. 2012-08-08 12:01:19 -07:00
Tim Chevalier
c7d60ee053 Don't add struct names to the value name space if there's no constructor
Closes #3149
2012-08-08 11:53:08 -07:00
Niko Matsakis
802ea5d57e refactor categorization out of borrowck into its own module.
first step towards #3148 and #3024.
2012-08-08 09:22:07 -07:00
Niko Matsakis
52c517383e improve borrowck error messages to explain regions better 2012-08-07 20:59:06 -07:00
Patrick Walton
31965860c7 rustc: Resolve constructor expressions for variant structs 2012-08-07 19:12:58 -07:00
Patrick Walton
5ce3281a62 rustc: Parse variant structs; add a trivial test case 2012-08-07 18:55:19 -07:00
Graydon Hoare
8c95feda39 Add minor debug mode for measuring type sizes, helper for #3025. 2012-08-07 18:40:02 -07:00
Patrick Walton
438765da59 rustc: Box struct_defs 2012-08-07 17:46:51 -07:00
Graydon Hoare
175be53e3f Translate const structs. 2012-08-07 17:31:26 -07:00
Michael Sullivan
7f7f47620e Implement static typeclass methods. Closes #3132. 2012-08-07 17:18:14 -07:00
Elliott Slaughter
a695e074f2 rustc: Cosmetic change to type_of to make control flow more obvious. 2012-08-07 16:58:15 -07:00
Elliott Slaughter
cdfc4b1c7a rustc: Fix for type_of on recursive enum creating two types instead of one. 2012-08-07 16:58:15 -07:00