Commit Graph

1028 Commits

Author SHA1 Message Date
Tim Chevalier
25b8b35c57 Finish compare glue for classes
This tests == and !=. I don't know what <, >, etc. should do.
Closes #2601
2012-06-25 12:20:10 -07:00
Brian Anderson
e991855d66 Make 'do' expressions accept stack closures 2012-06-24 18:01:27 -07:00
Tim Chevalier
487cbf8e90 Remove resources
Also fixed shapes for classes with dtors, as well as handling
offsets for classes with dtors correctly in take glue.

Closes #2485
2012-06-24 15:09:57 -07:00
Lindsey Kuper
ce7b803728 Minor capitalization/punctuation fixes in error messages 2012-06-22 16:48:03 -07:00
Lindsey Kuper
46809f7ab7 Nicer quoting in "attempted access of field" message. Issue #2358. 2012-06-22 16:48:03 -07:00
Lindsey Kuper
47b1b7a207 Don't need a span on "main function not found" error. Issue #2707. 2012-06-22 16:48:03 -07:00
Eric Holk
26c11f7b50 Use must_have_lock instead of private functions. (Issue #2700)
I hereby declare that messages sent from the same source arrive in order (Issue #2605)

Removing FIXME, owned is the correct type here. (Issue #2704)

Remove outdated FIXME (Issue #2703)

Updating test for spawning native functions (Issue #2602)

Removing bogus FIXME (Issue #2599)
2012-06-22 15:14:42 -07:00
Michael Sullivan
1d6fb24b70 Hack to make [] and []/~ the same type in preparation for switching to []/~. 2012-06-22 15:11:34 -07:00
Tim Chevalier
21399dca12 Change resources to classes in libstd and rustc 2012-06-22 11:53:25 -07:00
Michael Sullivan
986662cebd Make the implicit copyability of []/~ configurable, like [] is, since we will be switching sooner rather than later. 2012-06-22 11:23:54 -07:00
Tim Chevalier
a141f58e9b In reachability, traverse all classes that have dtors
since dtors always have external linkage
2012-06-21 21:46:12 -07:00
Tim Chevalier
cc323d8637 Make liveness print out a proper error message for moves out of a self field
This was a call to span_bug() before. I'm not sure about the other cases,
but the test case shows that the `vk_self` case can certainly arise with
a bad program, so it should be a span_err() thing and not a span_bug() thing.

Closes #2590
2012-06-21 17:43:10 -07:00
Graydon Hoare
312faf31df Tag all remaining FIXMEs with bugs. Install rule in tidy script to enforce this. 2012-06-21 16:44:10 -07:00
Lindsey Kuper
abfa8164cd Change the level of forcing in structurally_resolved_type().
A cleaner way to handle suffix inference for unary minus exprs.
2012-06-21 16:19:04 -07:00
Eric Holk
f54829cf13 Move vector addition out of trans and into libcore. 2012-06-21 16:11:11 -07:00
Eric Holk
0e5cfd9f33 Move vector addition out of trans and into libcore. 2012-06-21 16:11:11 -07:00
Eric Holk
f8fa0a2437 Generate a temporary for assign_ops. Issue #2581 2012-06-21 16:11:10 -07:00
Lindsey Kuper
e9d072ee89 Consolidate "make sure types are the same" fns. Issue #2644. 2012-06-21 11:16:36 -07:00
Michael Sullivan
393f739990 Rename upcall_malloc_dyn to just upcall_malloc. 2012-06-21 10:47:45 -07:00
Niko Matsakis
287f163136 Issue #2657: track mutability of bindings, also prevent move from bindings 2012-06-21 09:45:01 -07:00
Niko Matsakis
60603703ea handle moves in let initializers and allow moves from unsafe ptrs
Related to issue #2657, but this is not a complete fix.
2012-06-21 08:34:54 -07:00
Tim Chevalier
b02172971f Make trans give correct types to monomorphic dtors
Irritatingly, class dtors have a different type from resource
dtors (because class dtors have a self argument), and the monomorphic
case wasn't reflecting that. Fixed.
2012-06-20 20:12:14 -07:00
Tim Chevalier
76d6120e52 Fix resolve bug that made nested classes not work
It wasn't possible to refer to the constructor for a class nested inside
an item from the class's outer scope. Fixed.
2012-06-20 20:12:14 -07:00
Tim Chevalier
6db7843f46 Monomorphize dtors correctly
The same dtor was getting re-used for different instances, which
didn't always work right. Fixed.
2012-06-20 20:12:14 -07:00
Tim Chevalier
e7ce32310b Change map::get to map::find in ppaux 2012-06-20 20:12:13 -07:00
Tim Chevalier
f331cd9324 Don't consider loops to be breaking if they contain inner loops that break
Closes #2642
2012-06-20 18:53:38 -07:00
Brian Anderson
4dcf84e4f4 Remove bind. Issue #2189 2012-06-20 17:27:28 -07:00
Michael Sullivan
a057b13262 Don't allow + for evecs/estrs. It isn't implemented, and we are moving vec + to libs anyways. 2012-06-20 16:29:47 -07:00
Michael Sullivan
8aa5762d2e Repair the formatting of the table in is_binopable. 2012-06-20 16:29:47 -07:00
Michael Sullivan
8040fd86bf Call the correct type formatting function for more typecheck diagnostics. Closes #2652. 2012-06-20 15:44:58 -07:00
Lindsey Kuper
60a658250e Don't force resolution of integral type vars in unary minus exprs
These were getting resolved too early, when they were still
unconstrained by the rest of the typing context.  Waiting a bit longer
to resolve them gives the rest of the typing context a chance to come
into play, so that they don't default to `int`.
2012-06-20 14:33:25 -07:00
Lindsey Kuper
64912c9a56 Use an unambiguous abbreviation for "operand" :) 2012-06-20 14:29:24 -07:00
Lindsey Kuper
5316fe6bb5 Add comments explaining integral type variables; fix typos 2012-06-20 12:46:38 -07:00
Michael Sullivan
a01bdbe207 Don't reverse all the arguments to span_lint for lint checking passes. 2012-06-20 10:30:48 -07:00
Niko Matsakis
773a640303 support autoderef on method calls 2012-06-19 20:46:48 -07:00
Eric Holk
e30a8b6f8c Updating kind rules to make sure we don't sneakily send ports. 2012-06-19 17:37:51 -07:00
Lindsey Kuper
3cf582b529 Enable integer literal suffix inference. 2012-06-19 17:06:05 -07:00
Lindsey Kuper
b1fa8249f1 Fix incorrect fn name in debug statement 2012-06-19 17:04:39 -07:00
Lindsey Kuper
26bd186726 Don't create a new inference context for checking pattern ranges.
Ugly fix -- it would be better to refactor and consolidate the various
"make sure these types are the same" fns scattered around typeck.
2012-06-19 16:53:41 -07:00
Lindsey Kuper
3e281439a0 Union-find rank optimization for infer.
Makes deep-vector2 not run out of stack when suffix inference is
enabled.
2012-06-19 16:35:26 -07:00
Lindsey Kuper
906169d608 Add a node type in place of hand-rolled records in infer 2012-06-19 16:35:26 -07:00
Brian Anderson
636a849bf2 rustc: Add a temporary option to not link to the runtime 2012-06-19 12:36:59 -07:00
Niko Matsakis
6e73e45e37 first steps to autoderef on method calls 2012-06-19 11:52:39 -07:00
Niko Matsakis
b0646e0749 document liveness a bit better 2012-06-18 19:41:17 -07:00
Brian Anderson
1ec5a5c635 Add 'do' expressions 2012-06-18 17:42:30 -07:00
Michael Sullivan
30dd32d4db Fix generation of str/@. Closes #2638. 2012-06-18 15:54:37 -07:00
Michael Sullivan
797856cbde Use unboxed vecs for string shape glue. 2012-06-18 15:54:37 -07:00
Lindsey Kuper
567e4d9c6f Minor infer/typeck cleanups 2012-06-18 15:36:14 -07:00
Niko Matsakis
b0e66a6f3b Undo workaround for #2633 since it is fixed.
This reverts commit a14df270dc.

Conflicts:

	src/rustc/middle/trans/base.rs
2012-06-17 16:38:13 -07:00
Niko Matsakis
982e1166b2 Issue #2633: remove last_use entries that are subject to a loan 2012-06-17 16:17:40 -07:00
Tim Chevalier
416b3bfea4 Comments only 2012-06-16 15:16:31 -07:00
Tim Chevalier
a14df270dc Make move_val take its first argument by copy
Workaround for #2633 -- should allow changes on eholk's branch to
compile without segfaulting.
2012-06-16 14:30:20 -07:00
Michael Sullivan
6e63e2fd5f Fix copying of fixed length vectors. Closes #2630. 2012-06-15 15:31:19 -07:00
Michael Sullivan
a56902304d Make fixed length vecs implicitly copyable. Clean up some other kind code. Closes #2629 2012-06-15 15:31:19 -07:00
Tim Chevalier
093faaabe1 Handle index expressions' callee IDs correctly
Some code that handles unary and binary exprs' callee IDs was
    forgetting to handle the index expr case (since calls to
    user-defined index operators also have callee IDs). This was
    manifesting as an ICE in trans because when monomorphizing a
    function that had one of these operators in it (an index into a
    dvec, in the test case), the callee ID would be unbound to a type.

    Fixed it. Closes #2631.
2012-06-15 15:21:17 -07:00
Lindsey Kuper
7a253eabce Add an intermediate level of type/region variable resolution forcing
And change structurally_resolved_type() to force resolution of
non-region variables.
2012-06-15 12:54:44 -07:00
Paul Stansifer
1e36d216be Add the interner to parse_sess. 2012-06-15 12:41:41 -07:00
Michael Sullivan
68670f631c Make type_is_pod handle more types. 2012-06-15 11:48:04 -07:00
Patrick Walton
5151c08850 Issue #2591: Fix "upvar" jargon in borrowck error messages 2012-06-14 23:18:09 -07:00
Eric Holk
56bd689767 Merge branch 'incoming' of github.com:mozilla/rust into newsnap 2012-06-14 21:03:41 -07:00
Eric Holk
8ab15c0266 Merge branch 'incoming' into newsnap 2012-06-14 20:36:16 -07:00
Lindsey Kuper
77e6573929 Further work on integer literal suffix inference (#1425)
In this commit:

  * Change the lit_int_unsuffixed AST node to not carry a type, since
    it doesn't need one

  * Don't print "(unsuffixed)" when pretty-printing unsuffixed integer
    literals

  * Just print "I" instead of "(integral)" for integral type variables

  * Set up trans to use the information that will be gathered during
    typeck to construct the appropriate constants for unsuffixed int
    literals

  * Add logic for handling int_ty_sets in typeck::infer

  * Clean up unnecessary code in typeck::infer

  * Add missing mk_ functions to middle::ty

  * Add ty_var_integral to a few of the type utility functions it was
    missing from in middle::ty
2012-06-14 20:24:36 -07:00
Graydon Hoare
d953462d03 Complete a data visitor type that does proper pointer-walking. 2012-06-14 19:58:34 -07:00
Eric Holk
52c38ba886 Merge branch 'incoming' into newsnap 2012-06-14 19:36:22 -07:00
Patrick Walton
6969f0f2fc Issue #2572: (trans) Fix self-referential classes. 2012-06-14 18:51:31 -07:00
Tim Chevalier
dce5d6ab9c whitespace 2012-06-14 18:46:10 -07:00
Michael Sullivan
af60716281 Get an initial implementation of boxed vectors working. 2012-06-14 18:01:05 -07:00
Tim Chevalier
97bcb20244 Avoid some duplicated typechecking work
There was a FIXME noting that ty::enum_variants and typeck::check::
check_enum_variants both call eval_const_expr. I tried refactoring the
code so that check_enum_variants does all the work and enum_variants
just looks up cached results, but this turned out not to be easy because
several ty functions call enum_variants and it might get invoked on an
enum before that enum item has been typechecked. Instead, I just made
check_enum_variants update the enum_var_cache so that enum_variants
will never call eval_const_expr twice on the same const.
2012-06-14 16:21:53 -07:00
Graydon Hoare
aeb9a2b72c Add zero check/fail paths on div/mod paths. Close #944. 2012-06-14 15:39:24 -07:00
Tim Chevalier
c6462eec30 Comments only: annotate FIXMEs in reflect 2012-06-14 14:13:52 -07:00
Eric Holk
74d2f56f21 Adding move_val and move_val_init intrinsics. 2012-06-14 13:49:41 -07:00
Tim Chevalier
1642df8efa Remove a workaround 2012-06-14 12:40:49 -07:00
Tim Chevalier
fcab11da47 Refactor; annotate a FIXME 2012-06-14 12:24:56 -07:00
Tim Chevalier
24f9f45ac6 Comments only: annotate FIXMEs in typeck::infer 2012-06-14 12:10:48 -07:00
Tim Chevalier
699b14b99d Comments only: annotate a FIXME and remove an obsolete one 2012-06-14 12:07:42 -07:00
Tim Chevalier
730381d936 Annotate and fix FIXMEs in typeck 2012-06-14 12:04:05 -07:00
Tim Chevalier
87af3f3cca Dead code elimination 2012-06-14 11:10:32 -07:00
Michael Sullivan
591b2802ff Make trans only generate calls to the _dyn malloc upcalls, so we can get rid of the non dyn ones. 2012-06-13 18:00:17 -07:00
Michael Sullivan
4c0d41cffa Add a malloc_dyn upcall for dynamically sized allocations on the shared heap. 2012-06-13 17:59:21 -07:00
Tim Chevalier
e5a5fc2029 Allow impls to be re-exported
It was a little hard for me to believe, but it seems that re-exporting
an impl doesn't work at a, because encoder::encode_info_for_mod requires
that all the impls in the current module's impl map be local (that is,
bound to a value in the current crate's item map). Fixed it.

Closes #2414.
2012-06-13 15:52:00 -07:00
Tim Chevalier
6f95c79b95 Traverse types in reachability
Issue 2526 showed a test case where a library exported only a type
that was a synonym for a class. Because the class's destructor wasn't
getting marked as reachable, its linkage was wrongly getting set to
"internal". The solution is for reachability to traverse types.

Closes #2526.
2012-06-13 11:57:01 -07:00
Brian Anderson
ce750a7dbc Box AST idents 2012-06-13 11:30:45 -07:00
Michael Sullivan
bdd2000066 Some cleanup in tvec. 2012-06-13 11:17:02 -07:00
Tim Chevalier
aa9d2d88d3 Handle class destructors correctly in metadata
This allows destructors to be inlined, which is necessary since
classes can have both ty params and destructors.
2012-06-12 17:37:04 -07:00
Michael Sullivan
35dd717352 Simplify a bunch of trans functions to not need the rust type. Remove some PointerCasts. 2012-06-12 17:01:13 -07:00
Michael Sullivan
ccf4e8cf9a Make vectors contain the right type descriptor. Closes #2536. 2012-06-12 17:01:13 -07:00
Michael Sullivan
4f61dcb026 Introduce an unboxed_vec type 2012-06-12 17:01:13 -07:00
Michael Sullivan
e67b5b25a6 Introduce a SHAPE_UNBOXED_VEC shape in order to seperate out vector logic. 2012-06-12 17:01:13 -07:00
Tim Chevalier
ebdf0c20cd Correct typo in comment 2012-06-12 14:56:26 -07:00
Tim Chevalier
72360970fc Change trans::common::block to be a class
And replace trans::common::block_parent with option<block>. To handle
the recursive self-reference in the block_ class, I had to add a
newtype-like enum "block" which is equivalent to @block_ -- which due
to an interaction with borrowck, resulted in having to change a few
functions in trans::base to take their block argument in ++ mode,
irritatingly enough (but not that irritatingly, since we're supposed to
get rid of modes).
2012-06-12 14:55:44 -07:00
Niko Matsakis
d1ec1d4abb Treat enums with one variant specially in borrowck: #2573 2012-06-12 14:30:14 -07:00
Michael Sullivan
d04ed0c493 Reorder things in hash_type_structure to make more sense. 2012-06-12 10:58:00 -07:00
Graydon Hoare
9f3b12b6c6 Change llsize_real to use LLVMSizeOfTypeInBits. Add comments. 2012-06-11 18:34:24 -07:00
Lindsey Kuper
8467279fac Add a new AST node for unsuffixed integer types. 2012-06-11 16:34:56 -07:00
Michael Sullivan
baf58a764b Stop emitting type parameters in shape.rs. 2012-06-11 12:52:49 -07:00
Michael Sullivan
665ba3531d Clean up tydesc declaration to make it clear what is unused. 2012-06-11 12:29:04 -07:00
Michael Sullivan
b22620624c Get rid of a bunch of dead shape code. Closes #2552. 2012-06-11 12:19:40 -07:00
Tim Chevalier
87d57e4919 Don't treat all class fields as mutable, except in trans
Closes #2550
2012-06-11 10:16:17 -07:00
Niko Matsakis
013fc92423 remove alias analysis and replace with borrowck
This reverts commit 7ef825bb60.
2012-06-08 20:39:11 -07:00
Niko Matsakis
1351117aa8 avoid rooting @ptrs that live in immutable, stable memory 2012-06-08 20:39:11 -07:00
Niko Matsakis
a628f7f47e make ccx/tcx/sess methods on bcx pure 2012-06-08 20:39:10 -07:00
Lindsey Kuper
0863ac25a7 Update READMEs and comments to reflect "rustsyntax" -> "syntax" change 2012-06-08 17:24:14 -07:00
Lindsey Kuper
7c0fd858db Get rid of little-used logging fns in util::common. Closes #2553.
Also got rid of a bunch of commented-out logging statements and
generally cleaned up the logging situation, mostly in typestate.
2012-06-08 17:22:19 -07:00
Graydon Hoare
7a699852cb Pass names of fields and variants when reflecting. 2012-06-08 16:41:38 -07:00
Graydon Hoare
d182c14247 Visit the substructure for classes and enums as well. 2012-06-08 15:36:02 -07:00
Lindsey Kuper
b8af02e219 WIP on issue #1425: mostly infrastructure changes. 2012-06-08 15:20:21 -07:00
Niko Matsakis
fc9eadf75b profile LLVM cleanup insns 2012-06-08 14:34:55 -07:00
Graydon Hoare
dc94ccc4a4 More work on reflect, only missing enum and class substructures. 2012-06-08 13:26:15 -07:00
Brian Anderson
7a74545e97 Convert reinterpret_cast + forget to 'transmute' 2012-06-08 10:58:46 -07:00
Brian Anderson
95b9d538b8 Use #[cfg(unix)] and #[cfg(windows)] everywhere 2012-06-07 22:28:00 -07:00
Brian Anderson
7ef825bb60 Revert "remove alias analysis and replace with borrowck"
18s perf regression compiling rustc with opts

This reverts commit 7f6ee0ce0d.
2012-06-07 19:42:27 -07:00
Michael Sullivan
45cc95fa22 Remove a bunch of old "remove after snapshot" code. 2012-06-07 18:05:12 -07:00
Michael Sullivan
bf0d6a77c5 Reorder the arms of sty. 2012-06-07 17:09:23 -07:00
Niko Matsakis
7f6ee0ce0d remove alias analysis and replace with borrowck
cc #2540
2012-06-07 16:46:57 -07:00
Tim Chevalier
8c6d439a81 Comments only: annotate remainder of FIXMEs in typestate 2012-06-07 16:29:41 -07:00
Tim Chevalier
64b5ae27ac Start annotating FIXMEs in typestate; also some minor refactoring 2012-06-07 16:01:45 -07:00
Tim Chevalier
6b2cfe793b Remove an irrelevant comment
Comment doesn't seem relevant anymore because the block comment at the
very beginning of the file says it's a bad idea.
2012-06-07 15:13:35 -07:00
Tim Chevalier
d68c5cc399 Use c_ulonglong now that it works in FFI, etc...
Annotate FIXMEs; remove obsolete FIXMEs; remove an unnecessary
PointerCast.
2012-06-07 15:13:35 -07:00
Tim Chevalier
dc77386494 Remove obsolete comment
This comment seems to be no longer relevant, since we do have
user-defined vector sizes now (and they don't use the T_vec type)
2012-06-07 15:13:35 -07:00
Tim Chevalier
88f03743b0 Comments only: annotate FIXMEs 2012-06-07 15:13:35 -07:00
Graydon Hoare
9ee0137018 Refactor reflect.rs, begin visiting type substructures. 2012-06-07 13:51:41 -07:00
Tim Chevalier
a494cc1598 Comments only: annotate FIXMEs 2012-06-07 13:49:01 -07:00
Tim Chevalier
b0f01727fe Annotate FIXMEs in resolve
And fix one FIXME (use fk_ctor to visit a constructor)
2012-06-07 13:48:35 -07:00
Tim Chevalier
d8c16df153 Merge pull request #2523 from crabtw/freebsd
fix compiletest deadlock on freebsd
2012-06-07 09:25:34 -07:00
Jyun-Yan You
8f5f45bfe1 fix compiletest deadlock on freebsd 2012-06-07 16:38:10 +08:00
Brian Anderson
5f4837ad6a core: Start on a stack walker 2012-06-06 23:39:56 -07:00
Brian Anderson
125552fb19 rustc: Add frame_address intrinsic 2012-06-06 23:39:56 -07:00
Brian Anderson
469ff08e64 rustc: Enable #[cfg(windows)] and #[cfg(unix)] 2012-06-06 23:39:09 -07:00
Brian Anderson
eed3a36511 rustc: Add 'target_family' to default configuration 2012-06-06 23:39:09 -07:00
Graydon Hoare
c56b8f8924 Remove unused middle::ty::sort_methods function. 2012-06-06 20:20:22 -07:00
Graydon Hoare
3251bd690e Fix some copy-paste bugs in visit glue, un-xfail reflect-visit-type. 2012-06-06 19:38:56 -07:00
Tim Chevalier
f4fb0f9eea Handle regions correctly in class ctors and dtors
Class ctors and dtors were always getting assigned the empty region
before, which meant a reference to the "self" region in a ctor argument
got resolved to a named region called "self" rather than the class's
self region, which led to a rather confusing error message as documented
in #2502.

Closes #2502
2012-06-06 19:23:26 -07:00
Niko Matsakis
3b4cfdeee2 Merge remote-tracking branch 'mozilla/incoming'
Conflicts:
	src/rustc/middle/tstate/auxiliary.rs
2012-06-06 19:00:34 -07:00
Niko Matsakis
ab8fa495d0 some (very little) work on commenting 2012-06-06 18:42:09 -07:00
Niko Matsakis
e8dfe179da move tstate to dvec 2012-06-06 18:37:55 -07:00
Niko Matsakis
9be612f7ee move resolve to dvec, remove unnecessary mut annotations 2012-06-06 18:37:52 -07:00
Niko Matsakis
594e01d007 add pure, copies to liveness 2012-06-06 18:37:46 -07:00
Niko Matsakis
7d17c2d87f move check_const to dvec 2012-06-06 18:37:43 -07:00
Niko Matsakis
08520a1697 move borrowck to dvec, insert a few minor copies 2012-06-06 18:37:35 -07:00
Niko Matsakis
d9db4f02a4 move to dvec in metadata 2012-06-06 18:37:31 -07:00
Niko Matsakis
22cf4b9ac3 move test to dvec 2012-06-06 18:37:22 -07:00
Niko Matsakis
3bc42d5661 distinguish by-val passes of pointer and non-pointer things 2012-06-06 18:36:47 -07:00
Niko Matsakis
64c7897187 exempt unsafe ptrs from by-val checks 2012-06-06 18:36:42 -07:00
Michael Sullivan
d542e67827 Do some cleanup of the allocation code. 2012-06-06 18:26:47 -07:00
Tim Chevalier
32e448e0da Change subtypes_require to handle class fields correctly 2012-06-06 15:45:49 -07:00
Tim Chevalier
5e8ef74e22 Revert "Revert "Forbid classes with no fields" due to test failures"
This reverts commit e56a6e8cb0.
2012-06-06 15:08:24 -07:00
Tim Chevalier
a6c92f0a17 Revert "Revert "Merge pull request #2516 from mozilla/incoming" due to failures"
This reverts commit 9fae95860de510f6874810cf43efb83f101246ef.
2012-06-06 15:08:24 -07:00
Tim Chevalier
d5d7b3b921 Merge branch 'master' into really-really-to-snap 2012-06-06 12:47:34 -07:00
Brian Anderson
9975ad073a rustc: Add comments about linking to libm 2012-06-06 12:46:19 -07:00
Jyun-Yan You
b54c76c832 fix link error 2012-06-06 12:45:56 -07:00
Patrick Walton
055158d051 Revert "Merge pull request #2516 from mozilla/incoming" due to failures
This reverts commit adb717b5fa, reversing
changes made to aabf84cdd8.
2012-06-06 11:39:19 -07:00
Tim Chevalier
fec3b91a3c In reachability, visit class ctors 2012-06-05 21:17:16 -07:00
Tim Chevalier
8fd9986f0f Forbid classes with no fields
Classes with no fields don't really make sense, so forbid them
(just as records with no fields aren't allowed). Closes #2509
2012-06-05 20:47:55 -07:00
Michael Sullivan
167d726183 Get rid of spill_map and associated infrastructure. 2012-06-05 17:33:30 -07:00
Michael Sullivan
868e3f9180 Don't try to keep locals off of the stack. Closes #2408.
There were bugs in the code path for initialization of non-spilled
locals, the code-path is hit approximately never, and mem2reg can do
it for us.
I think this will let us kill spill_map.
2012-06-05 17:33:30 -07:00
Patrick Walton
49c6dac47a rustc: Fix some more cyclic imports 2012-06-05 15:50:46 -07:00
Tim Chevalier
8972588583 Dereference classes with dtors only on a field access
A class with a dtor has a different representation (a pair of a bit field
and a pointer to the class itself), and previously, the trans code
was selecting out the second field on any reference to a variable whose
type was a class with a dtor. This turned out to be wrong in the case where
a closure captures a variable with such a type. Changed the code to only
insert the field selection on a class field access.
2012-06-05 15:11:33 -07:00
Tim Chevalier
ebde93861f Allow classes with dtors to be used before declaration
get_item_val could generate an internal compiler error if a class with
a dtor was used before the class itself got translated, because it was
assuming that the dtor's node ID was always in the item_symbols table. Fixed
it to create a new symbol if necessary, and use it subsequently.
2012-06-05 15:11:33 -07:00
Brian Anderson
d3c641678e rustc: Put uniques into addrspace 1 2012-06-05 14:03:25 -07:00
Michael Sullivan
e86214830a Make "no implicit copies" diagnostics controllable through lint settings. Closes #2503. 2012-06-04 20:44:58 -07:00
Michael Sullivan
6396e2c3c3 Make vecs implicitly copyable for all of our projects. 2012-06-04 19:53:30 -07:00
Michael Sullivan
01a6c713c3 Make vecs/strs not implicitly copyable by default, but make it configurable. Closes #2450. 2012-06-04 19:53:30 -07:00
Michael Sullivan
a405ff9bf6 Fix lint's handling of multiple warn attributes... 2012-06-04 19:53:30 -07:00
Eric Holk
1e8f501343 Machine types are different from int/uint, etc (Issue #2187) 2012-06-04 19:16:47 -07:00
Niko Matsakis
903033bb03 handle fixed-length vecs in borrowck categorization 2012-06-04 16:40:09 -07:00
Michael Sullivan
6d9dd055d1 Get rid of warnings from instantiating typarams with non-implicitly copyable types. 2012-06-04 16:35:32 -07:00
Michael Sullivan
4d5d43beae Warn when invoking polymorphic functions with non copyable types. Closes #2466. 2012-06-04 16:30:41 -07:00
Michael Sullivan
5a4e53487f Heavily rework lint infrastructure. Split it into two passes: one that builds the table and one that does the checks. Build the table early and make session know about it fo reasy use. 2012-06-04 16:08:07 -07:00
Niko Matsakis
3c4baf694e better support for classes with polymorphic methods 2012-06-04 11:46:23 -07:00
Michael Sullivan
7213274e57 Make how lint handles unknown warn directives configurable by lint (default to warn). Closes #2480. 2012-06-04 09:54:03 -07:00
Michael Sullivan
9be94f6650 Provide mechanisms to inspect warning settings from outside lint. 2012-06-04 09:54:03 -07:00
Niko Matsakis
01b5777c8b prohibit type parameters in native fns and other minor fixes
trans now can safely assert that it never sees a type param
2012-06-03 20:03:08 -07:00
Niko Matsakis
3f6e6532ac make vec fns/methods take imm slices.
this also repairs the unsoundness in typing of unpack_slice,
which was silently converting a const ptr to an imm one.
2012-06-02 19:14:57 -07:00
Lindsey Kuper
7d0755529e Add ty_var_integral (WIP on issue #1425). 2012-06-02 11:19:27 -07:00
Niko Matsakis
77c470d183 Allow rcvrs to be borrowed; check rcvrs in borrowck properly 2012-06-02 10:08:04 -07:00
Niko Matsakis
cfac9b6833 improve borrowck to handle some frankly rather tricky cases
- receivers of method calls are also borrowed
- by-val arguments are also borrowed (needs tests)
- assignment to components can interfere with loans
2012-06-02 10:08:04 -07:00
Tim Chevalier
14e3fdea9c Check that classes are instantiable
that is, check that there aren't any mutually recursive cycles between
classes and other types
2012-06-01 20:40:35 -07:00
Tim Chevalier
79787833bb Make sure classes with dtors are still sendable (but not copyable) 2012-06-01 20:40:35 -07:00
Tim Chevalier
475013fcb6 Comment only: fix typo 2012-06-01 20:40:35 -07:00
Tim Chevalier
facb5c08c6 Enforce rule that classes with dtors aren't copyable
The test for this is copy-a-resource.
2012-06-01 20:40:35 -07:00
Tim Chevalier
bc5cb4deb3 Change type_needs_drop to say that any class w/ a dtor needs a drop
This was preventing dtors from running for class types that didn't
have pointer fields.
2012-06-01 20:40:34 -07:00
Michael Sullivan
8f7364b26d Don't try to compute kinds of fictitious types. Indicate a bug instead. 2012-06-01 17:58:40 -07:00
Niko Matsakis
6c6ad229a3 break up borrowck into modules and begin to document how it works 2012-06-01 10:50:19 -07:00
Michael Sullivan
e47962f6a9 Have lint build up a table of the warning settings on a per item basis for later use. 2012-05-31 19:07:24 -07:00
Michael Sullivan
d1a65da835 Time lint in the driver like every other pass, instead of in lint. 2012-05-31 19:07:24 -07:00
Michael Sullivan
af228711e5 Make lint properly deal with nested items. Closes #2473. 2012-05-31 19:07:24 -07:00
Michael Sullivan
84adcb9806 Rework lint to copy lint mode maps when changing them. 2012-05-31 19:07:24 -07:00
Michael Sullivan
7b02f29d47 Switch lint over to using a smallintmap. 2012-05-31 18:38:42 -07:00
Michael Sullivan
3dfb174793 Remove some dead code from kind checking. 2012-05-31 18:38:42 -07:00
Brian Anderson
89aa28289b rustc: Use fewer boxes in typestate 2012-05-31 16:20:58 -07:00
Niko Matsakis
c2ce2741a7 allow mutable vectors and so forth to be used as immutable slices 2012-05-31 15:07:09 -07:00
Eric Holk
0470abe1d2 Allow some resources to be considered const. 2012-05-31 13:55:54 -07:00
Kevin Cantu
7dcbaedd32 Rename librustsyntax to libsyntax
Per issue #2418.
2012-05-31 11:15:00 -07:00
Brian Anderson
41b02b7c57 Merge remote-tracking branch 'brson/self-describing-uniques'
Conflicts:
	src/snapshots.txt
2012-05-31 01:26:05 -07:00
Brian Anderson
151de909c1 rustc: Do less work still in typestate 2012-05-30 23:20:31 -07:00
Brian Anderson
4b7e40d817 rustc: Remove debug logging 2012-05-30 21:23:34 -07:00
Brian Anderson
a2bbdd3f52 rt: Remove upcall_shared_malloc/free/realloc 2012-05-30 21:23:34 -07:00
Brian Anderson
80dc2e11a1 rustc: Remove the last use of upcall_shared_malloc 2012-05-30 21:23:34 -07:00
Brian Anderson
54d42c4d74 rustc: Make trans handle self-describing strings 2012-05-30 21:23:34 -07:00
Brian Anderson
09a1b94907 Various changes for self-describing vecs 2012-05-30 21:23:34 -07:00
Brian Anderson
c6a23cddfb rustc: Make unique closures use the new unique allocator 2012-05-30 21:23:34 -07:00
Brian Anderson
654f7e3086 rustc: Make unique boxes self-describing 2012-05-30 21:23:34 -07:00
Brian Anderson
45933ca485 rustc: Add some methods for trans for mallocing uniques 2012-05-30 21:23:34 -07:00
Brian Anderson
508ccca014 rt: Add upcall_exchange_malloc/free 2012-05-30 21:23:33 -07:00
Brian Anderson
6d37c90ce6 rustc: Remove tuplify_cbox_ty. Unused 2012-05-30 21:23:33 -07:00
Brian Anderson
02dde781eb rustc: Don't typestate fns that don't have constrained function calls 2012-05-30 17:48:05 -07:00
Michael Sullivan
ea8d4d7f17 Properly sign extend array indexes. Closes #2468. 2012-05-30 17:09:52 -07:00
Michael Sullivan
7fee392de5 Handle differing signedness in constant shifts. Closes #2426. 2012-05-30 15:03:24 -07:00
Eric Holk
f49b891ce5 Include capture clauses when generating metadata.
This may fix the bug that's blocking Issue #2441.
2012-05-30 12:03:51 -07:00
Niko Matsakis
1f4b3cfc36 zero out alloca for preserving values
conservatively do it always for now
2012-05-30 11:26:15 -07:00
Niko Matsakis
555492e427 port alt to dvec 2012-05-30 11:26:15 -07:00
Niko Matsakis
79b3dedac3 allow for loop bodies 2012-05-30 11:26:15 -07:00
Niko Matsakis
653a1f8781 integrate purity into type 2012-05-30 11:26:15 -07:00
Niko Matsakis
22a10f0e4a refactor region manip. to remove redundancy, get closer to fn subtyping
also: remove "auto-mode-matching" for implemented interfaces, as it
is complex and interacts poorly with classes

cc #2263
2012-05-30 11:04:12 -07:00
Niko Matsakis
e6b9db0884 refactor region manipulation routines to eliminate duplication
fn subtyping is starting to work, but it's exposing bugs in the
code which checks for iface conformance, which doesn't properly
skolemize the self region
2012-05-30 11:04:12 -07:00
Michael Sullivan
b744f52620 Make heap closures always require a capture clause to capture mutable variables. Closes #2446. 2012-05-30 10:46:22 -07:00
Brian Anderson
736ff34e8a rustc: Move filesearch into metadata mod
It's not that related to metadata, but metadata needs it and it will
probably be useful for doing dynamic loading.
2012-05-29 20:38:49 -07:00
Tim Chevalier
3f3c9caf4d Handle poststates of breaking loops correctly in typestate
The poststate should be one where all predicates are assumed false,
rather than the unchanged prestate.

Closes #2374
2012-05-29 18:22:38 -07:00
Tim Chevalier
8d7765be82 Resolve bounds in iface types
Closes #2311
2012-05-29 16:50:21 -07:00
Niko Matsakis
f90228b8a8 make all arguments modes immutable
note: you can still move from copy/move mode args
2012-05-29 16:22:17 -07:00
Niko Matsakis
47375439ed remove useless invocations of universally_quantify_from_sty() in method lookup 2012-05-29 16:20:54 -07:00
Niko Matsakis
37b78b48e3 modify shape code to only emit monomorphized enums (#2444)
this is hacky, but shape code is going away anyway and I didn't
want to invest too much effort into it
2012-05-29 15:12:36 -07:00
Tim Chevalier
ccc7651b48 In reachability, don't ignore nested items
Reachability was considering nested items to be unreachable, which
was causing the bug in #2383. Once I fixed that, I also had to make
impl::make_impl_vtable instantiate methods where necessary, before
calling monomorphic_fn.

Closes #2383
2012-05-29 14:40:35 -07:00
Michael Sullivan
5d1c29912d Fix an error message to not refer to "block type". Closes #2423. 2012-05-29 12:18:59 -07:00
Eric Holk
aa2efc05ea Adding shared_arc to hide some of the tedium of sharing an arc between tasks.
Also added some asserts and logging to trans.

Modified graph500 to use the shared_arc, but this unfortunately doesn't work due to #2444.
2012-05-29 10:43:19 -07:00
Erick Tryzelaar
68e5d8daa3 Merge pull request #2455 from erickt/master
Fleshing out result methods
2012-05-28 18:27:30 -07:00
Graydon Hoare
e0f0c5c1ab Remove bad Load in make_visit_glue, un-xfail reflect-visit-type.rs. 2012-05-28 13:19:31 -07:00
Erick Tryzelaar
46173e98ef Rename result::{iter,map,map2} to add _vec suffix
The result module doesn't follow the standard iter/map pattern
that we use in the rest of the library. So to
2012-05-28 12:03:25 -07:00
Brian Anderson
432c6cbde9 core: Make range follow the for loop protocol 2012-05-26 02:28:00 -07:00
Lindsey Kuper
e11742de32 More refactoring on a quest to understand region types. 2012-05-25 17:55:55 -07:00
Niko Matsakis
269bc6fb5c fix warning 2012-05-25 17:14:17 -07:00
Niko Matsakis
98740a59da detect ambig. calls to iface bounds, use transactions
cc #2433
2012-05-25 17:04:05 -07:00
Michael Sullivan
93633ea734 Add an internal notion of 'implicit copyability' and use it to warn when implicitly copying mutable data and some unique data. Closes #2448. 2012-05-25 16:53:34 -07:00
Michael Sullivan
8668d06400 Get rid of many implicit copies as a preliminary to Issue #2448. 2012-05-25 16:39:35 -07:00
Michael Sullivan
174f789e0b Add hack to silence the annoying liveness warning in trans/base.rs. 2012-05-25 15:34:09 -07:00
Niko Matsakis
9e6a068034 replace last_use with liveness info 2012-05-25 14:37:30 -07:00
Niko Matsakis
62fe587f81 revisit error message; create spill map 2012-05-25 14:37:30 -07:00
Lindsey Kuper
123c5c4315 typeck: cleanup/refactoring 2012-05-25 11:35:42 -07:00
Lindsey Kuper
f7cb7b06d5 typeck: Minor cleanup 2012-05-25 11:35:42 -07:00
Lindsey Kuper
7e70412711 Some refactoring and WIP on issue #2263. 2012-05-24 16:48:44 -07:00
Lindsey Kuper
ef33c5c9bc Typo fixes in comments. 2012-05-24 16:48:44 -07:00
Eric Holk
8b12892ca2 Convert kinds to strings better for more usable error messages. 2012-05-24 15:06:56 -07:00
Eric Holk
4ffe34cace Updating the comments in kind.rs to better reflect the current state of things. 2012-05-24 15:06:56 -07:00
Eric Holk
8b6bfc96cb Const kind checking. The rules are almost certainly incomplete and unsound... 2012-05-24 15:06:56 -07:00
Eric Holk
d993df74c3 Teach parser and related things to understand const kind bounds. 2012-05-24 15:06:56 -07:00
Niko Matsakis
ccd8d5573e remove dead assignments 2012-05-24 13:35:57 -07:00
Niko Matsakis
f5c51b0a9c remove initedness checking from typestate, as best I could 2012-05-24 09:52:16 -07:00
Niko Matsakis
0d3811e275 improve liveness so it reports unused vars / dead assignments
doesn't warn about pattern bindings yet though
2012-05-24 09:52:16 -07:00
Niko Matsakis
30b47649ea new liveness pass to supercede last_use / initedness 2012-05-24 09:52:03 -07:00
Niko Matsakis
a3be0b1054 fix classes and parameterized ifaces; remove needless self check
ref #1726, #2434
2012-05-24 06:49:40 -07:00