Commit Graph

1019 Commits

Author SHA1 Message Date
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
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
Patrick Walton
61446293f9 rustc: Move some more routines that operate on struct definitions out of line 2012-08-07 16:46:19 -07:00
Patrick Walton
deaef48675 rustc: Split out struct bodies into a separate "struct_def" type in the AST 2012-08-07 15:35:05 -07:00
Graydon Hoare
32e4fd62e9 Const slices now work. Something odd about non-const cases though, see #3138. 2012-08-07 15:04:40 -07:00
Patrick Walton
727c7c7499 rustc: Add stub support for struct variants to the AST 2012-08-07 14:25:53 -07:00
Brian Anderson
bc267c696c syntax: Rename expr_alt to expr_match 2012-08-07 13:35:51 -07:00
Brian Anderson
2772b2e5c7 syntax: Make match arm parsing more restrictive again
Require comma separators for all expression types except the plain block
2012-08-07 12:23:43 -07:00
Lindsey Kuper
efea6f016e Reindent some match exprs to agree with rust-mode.el 2012-08-07 10:41:48 -07:00
Lindsey Kuper
e656261ee7 Comments, minor refactoring, clean up wording of error messages 2012-08-07 10:29:19 -07:00
Niko Matsakis
7d374bde43 add lint mode for deprecated pattern usage 2012-08-07 07:14:44 -07:00
Niko Matsakis
dbef6e593d move borrowck tests to use ref, fix a few exposed shortcomings 2012-08-07 06:11:12 -07:00
Tim Chevalier
f3b2296ee4 Auto-deref the base expr in trans_method_callee
(specifically in the method_trait case) -- if you wrote x.f()
and x has type @T for a trait T, x wasn't getting auto-deref'ed.

This was bad.

Closes #2935
2012-08-06 19:17:44 -07:00
Niko Matsakis
aacd18f4ed first shot at integrating ref/value bindings into borrowck
(more needed)
2012-08-06 19:15:39 -07:00
Patrick Walton
60f47eabe2 rustc: Parse and stub (broken) typechecking for bounded function types 2012-08-06 18:55:24 -07:00
Patrick Walton
253dfc3387 rustc: Implement pattern matching for structs 2012-08-06 17:36:24 -07:00
Tim Chevalier
5cb3a94bfb Shorten lines, fix build breakage 2012-08-06 17:33:23 -07:00
Tim Chevalier
6bd01d0ac8 In resolve, forbid duplicate value, type, and module items
Closes #3099
2012-08-06 16:37:18 -07:00
Niko Matsakis
a6a5c48c64 make ref x bindings produce region ptrs and fix various minor bugs
we now detect inconsistent modes, binding names, and various other errors.
typeck/trans integration is mostly done.

borrowck not so much.

more tests needed.
2012-08-06 16:12:40 -07:00
Brian Anderson
ecaf9e39c9 Convert alt to match. Stop parsing alt 2012-08-06 15:36:30 -07:00
Patrick Walton
bff512a90f rustc: Implement functional record update for structs 2012-08-06 13:17:42 -07:00
Brian Anderson
025d86624d Switch alts to use arrows 2012-08-05 22:08:09 -07:00
Patrick Walton
8c77536526 rustc: Normalize region-bounded string slices properly
This prevents an LLVM assertion that will bite you if you try to put a static
string in an Error.
2012-08-04 15:11:54 -07:00
Graydon Hoare
edfc79cc47 Translate const vecs, most of const slices. More for #2317. 2012-08-03 21:44:52 -07:00
Patrick Walton
f23674394f rustc: Merge fn& and fn in favor of fn&.
This is a step on the way to moving the function "proto" sigil out front.
2012-08-03 19:49:12 -07:00
Patrick Walton
51a5a4ad0e rustc: Translate repeated vector syntax 2012-08-03 18:49:44 -07:00
Graydon Hoare
488ece05b5 Implement &-expressions in consts. Part of #2317. 2012-08-03 18:07:58 -07:00
Patrick Walton
e02b1b1ec8 rustc: Parse and typecheck repeating vector expressions; e.g. [ 0, ..512 ] 2012-08-03 18:03:19 -07:00
Lindsey Kuper
fe2f3d210a Further work on default methods in traits.
And some trait-related code cleanup in typeck::collect.
2012-08-03 16:17:54 -07:00
Patrick Walton
b65dd9d090 rustc: Parse, serialize, and deserialize trait inheritance 2012-08-03 15:02:53 -07:00
Patrick Walton
a805a1fb37 rustc: Add the notion of inherited visibility 2012-08-03 15:02:53 -07:00
Patrick Walton
9e68966611 rustc: Remove fixed-length string warning 2012-08-03 12:03:15 -07:00
Patrick Walton
4e60d7e3a6 rustc: "foo" is now a static string 2012-08-03 11:51:04 -07:00
Patrick Walton
dfe1f6260e rustc: Remove all fixed-length strings from our codebase 2012-08-03 11:22:35 -07:00
Tim Chevalier
336be1d644 Fix build breakage 2012-08-02 23:53:45 -07:00
Tim Chevalier
948172b93f Make comparisons between region pointers work
Region pointers were considered a scalar type, so compare_scalar_type would
get called to compare region pointers in trans. This would fail, since
compare_scalar_type has no case for region pointers.

Changed type_is_scalar to return false for region pointers. This had the side
effect of breaking casts to types of the form &T. To ameliorate that, I added
library functions ptr::assimilate (taking a &T to a *T) and ptr::to_uint
(taking a &T to a uint), both of which use reinterpret_cast.

While I was at it, I removed ty::type_has_resources, which is dead code.
2012-08-02 23:53:45 -07:00
Niko Matsakis
31c5cec55b Purge placement new; Make borrowck know about unary move.
cc #3071
2012-08-02 22:36:36 -07:00
Tim Chevalier
c2bb2f0837 When checking loop bodies and do-expr bodies, don't require the expected type to exist
If the expected type is none (due to a type error), we shouldn't fail with an ICE, but
rather, just print out another type error. Changed the do-expr type error message to
make sense in this context (see the test case for how it works).

Closes #3044.
2012-08-02 21:44:14 -07:00
Eric Holk
c9c3a49bfc Fixing a long line 2012-08-02 19:27:07 -07:00
Patrick Walton
c076d3ccc0 rustc: Translate class literals correctly if the class has a destructor 2012-08-02 18:14:50 -07:00
Patrick Walton
16a0f72f8c rustc: Throw out some more regions when normalizing types 2012-08-02 18:14:50 -07:00
Graydon Hoare
4779d2b392 De-duplicate core::hash some, refactor the traits. 2012-08-02 18:06:33 -07:00
Lindsey Kuper
65e0e30e59 Make typeck::collect aware of provided methods in traits. 2012-08-02 17:15:36 -07:00
Michael Sullivan
2fe299d1a5 Extend ast_map to know about method declarations in traits. 2012-08-02 16:02:30 -07:00
Niko Matsakis
97452c0ca1 Remove modes from map API and replace with regions.
API is (for now) mostly by value, there are options to use it by
reference if you like.  Hash and equality functions must be pure
and by reference (forward looking to the day when something
like send_map becomes the standard map).
2012-08-02 15:53:28 -07:00
Brian Anderson
b355936b4d Convert ret to return 2012-08-01 19:16:06 -07:00
Patrick Walton
4991cc5d19 rustc: Translate by-value pattern bindings 2012-08-01 15:24:11 -07:00
Lindsey Kuper
300e2b8513 Start adding infrastructure for checking trait method bodies. 2012-08-01 11:08:47 -07:00
Lindsey Kuper
d747cd724e Rename convert_class_item to convert_field. 2012-08-01 11:08:47 -07:00
Lindsey Kuper
91bd291009 Fix bad indentation. 2012-08-01 11:08:46 -07:00
Lindsey Kuper
ac4e57c640 Introduce self_info (self_ty packaged up with a node_id). 2012-08-01 11:08:46 -07:00
Lindsey Kuper
361a9b03e6 Fix inaccurate comment. 2012-08-01 11:08:46 -07:00
Niko Matsakis
a334deb5d5 change how we print and explain region types 2012-07-31 22:00:19 -07:00
Patrick Walton
b414db041b rustc: Parse by-reference pattern bindings with the "ref" keyword 2012-07-31 19:26:25 -07:00
Brian Anderson
a841789a41 rustc: Add non_camel_case_types lint check 2012-07-31 18:58:23 -07:00
Graydon Hoare
2a3084b527 Start implementing structured constants. 2012-07-31 18:34:44 -07:00
Patrick Walton
c88933d714 rustc: Implement unary move. Closes #917. 2012-07-31 17:33:20 -07:00
Brian Anderson
7b2026bf21 Introduce 'return', 'match' and 'module' as synonyms 2012-07-31 17:22:30 -07:00
Patrick Walton
2cfe8fb357 rustc: Check self types in method lookup; allow required trait methods to have self types; write self types into metadata 2012-07-31 16:35:11 -07:00