Patrick Walton
7ed556cf8e
rustc: Check iter return types. Closes #638 .
2011-07-07 19:08:59 -07:00
Patrick Walton
2255eda625
rustc: Fix long line
2011-07-07 18:41:54 -07:00
Patrick Walton
edf8245273
rustc: Make trans use interior vectors
2011-07-07 18:39:05 -07:00
Patrick Walton
e1b107d74e
rustc: Remove all exterior vectors from the AST
2011-07-07 18:39:05 -07:00
Lindsey Kuper
3243144046
Fix a bug that was interfering with method overriding. Issue #543 .
...
Previously, we were creating both a normal vtable entry and a
forwarding function for overriding methods, when they should have just
gotten a vtable entry. This patch fixes that.
2011-07-07 17:29:15 -07:00
Patrick Walton
deca79f372
Merge pull request #634 from robarnold/upstream-stable
...
Allocate ivecs out of the kernel pool
2011-07-07 15:18:07 -07:00
Brian Anderson
6ee1ffe4ac
Rename encoder::ty_str to encoded_str
2011-07-07 13:31:12 -07:00
Brian Anderson
de88739350
Don't expert def_to_str from metadata::encoder
2011-07-07 13:31:12 -07:00
Brian Anderson
7d26d1d67b
Move tyencode::ty_str to metadata::encoder
2011-07-07 13:31:12 -07:00
Brian Anderson
73963eae9a
Refactor tyencode::ty_str to not require a tyencode::ctxt
...
All users were constructing the context the same way.
2011-07-07 13:31:11 -07:00
Brian Anderson
4304f8d4f6
Remove duplicate definition of def_to_str from middle::ty
2011-07-07 13:31:11 -07:00
Brian Anderson
e29ef1bec2
Refactor a few things in the metadata module
...
Rename metadata::tags to metadata::common. Move some utility functions from
metadata::encoder to metadata::common.
2011-07-07 13:31:11 -07:00
Brian Anderson
b723082cdb
Rename hash_def_id to hash_node_id
2011-07-07 13:31:11 -07:00
Brian Anderson
d2362599d6
Remove metadata::encoder's dependence on trans::node_id_type
2011-07-07 13:31:11 -07:00
Patrick Walton
0e2fff5337
rustc: Change lots of AST nodes to use interior vectors
2011-07-07 12:53:17 -07:00
Rafael Ávila de Espíndola
77c708cdbf
Implement --lib --static.
2011-07-07 15:25:09 -04:00
Rafael Ávila de Espíndola
b13527735e
Use an early exit to reduce indentation.
2011-07-07 14:59:18 -04:00
Rafael Ávila de Espíndola
6d6c4c2a76
Command line changes for adding support for static libraries.
2011-07-07 14:42:50 -04:00
Marijn Haverbeke
16f82dce1c
Clean up trans_arg_expr
...
As a preparation for implementing the temporary-move optimization for
argument passing. The optimization itself isn't in yet, since it
mysteriously corrupts memory.
2011-07-07 17:54:58 +02:00
Marijn Haverbeke
3bdbf74d47
Make moving of temporaries do the right thing, use it to optimize
...
This adds support for dropping cleanups for temporary values when they
are moved somewhere else. It then adds wraps most copy operations
(return, put in data structure, box, etc) in a way that will fall back
to a move when it is safe.
This saves a lot of taking/dropping, shaving over a megabyte off the
stage2/rustc binary size.
In some cases, most notably function returns, we could detect that the
returned value is a local variable, and can thus be safely moved even
though it is not a temporary. This will require putting some more
information in lvals.
I did not yet handle function arguments, since the logic for passing
them looked too convoluted to touch. I'll probably try that in the
near future, since it's bound to be a big win.
2011-07-07 15:54:01 +02:00
Marijn Haverbeke
007a736642
Improve handling of move and swap by alias checker
...
Closes issue #541 .
Closes issue #591
2011-07-07 10:37:19 +02:00
Rob Arnold
f6117173c9
Allocate rust_ivec buffers out of the kernel pool
...
The duplication of upcalls is due to the fact that the runtime is
shared between stage0/rustc and stage1/rustc. Once snapshots are
updated, they should be de-duplicated.
2011-07-06 20:41:24 -07:00
Lindsey Kuper
130006cdda
Tie the knot for self-calls inside extended objects. Closes #539 .
2011-07-06 18:39:01 -07:00
Brian Anderson
cf4c2ac0be
Generate a main fn for test running. Issue #428
2011-07-06 18:26:22 -07:00
Lindsey Kuper
6ca81b3407
Fix a pointer bug.
2011-07-06 17:16:54 -07:00
Lindsey Kuper
553beda96d
Add span information to create_vtbl and friends.
2011-07-06 17:16:53 -07:00
Lindsey Kuper
41f6a3d5e1
Comments and cleanup.
2011-07-06 17:16:53 -07:00
Patrick Walton
2f29f9931d
rustc: Make constraint args in the AST interior vectors
2011-07-06 16:19:19 -07:00
Patrick Walton
f164d7779a
rustc: Move AST constraints to interior vectors
2011-07-06 16:12:39 -07:00
Patrick Walton
c83782f500
rustc: Migrate core AST types to interior vectors
2011-07-06 16:01:47 -07:00
Patrick Walton
aad0bcc8d5
rustc: Make AST tuple types use interior vectors
2011-07-06 15:53:47 -07:00
Patrick Walton
401b6362d7
rustc: Make meta items into interior vectors
2011-07-06 15:46:03 -07:00
Patrick Walton
479ce4d783
rustc: Move crate directives over to interior vectors
2011-07-06 15:15:06 -07:00
Patrick Walton
0226f56115
rustc: Convert attribute in the AST to interior vectors
2011-07-06 15:15:00 -07:00
Patrick Walton
7714cb297b
rustc: Make AST paths use interior vectors
2011-07-06 15:14:52 -07:00
Patrick Walton
368f1f4ba8
rustc: Move middle::tstate::collect_locals over to interior vectors
2011-07-06 15:14:45 -07:00
Patrick Walton
b232ad94fd
rustc: Remove unused or seldom-used imports from middle::tstate::{bitvectors, ck}
2011-07-06 15:14:35 -07:00
Patrick Walton
5739e0be01
rustc: Remove some unused references to std::vec from tstate::ann and tstate::auxiliary
2011-07-06 15:14:29 -07:00
Patrick Walton
abab04635a
rustc: Move middle::tstate::auxiliary and middle::tstate::bitvectors over to interior vectors
2011-07-06 15:14:19 -07:00
Patrick Walton
6d1517cf3a
rustc: Move tstate::annotate over to interior vectors
2011-07-06 15:14:09 -07:00
Patrick Walton
35c1dbd492
rustc: Convert bind_params_in_type() to use interior vectors
2011-07-06 15:13:59 -07:00
Patrick Walton
1d57800236
rustc: Migrate tag variants to interior vectors
2011-07-06 15:13:54 -07:00
Patrick Walton
2e1aa04fcd
rustc: Make object methods into interior vectors
2011-07-06 15:13:47 -07:00
Brian Anderson
b06ccb45ab
Begin adding unit testing infrastructure to the compiler
...
Add a --test flag and a pass for transforming the AST to generate a test
harness.
Issue #428
2011-07-06 14:39:36 -07:00
Brian Anderson
0eac640fdd
Swap the expected/actual for typechecking fields of updated records
...
In 'rec(a = b with c)', if a exists in c then the expected type for b is the
type of c.
2011-07-06 14:04:52 -07:00
Patrick Walton
05954f37b7
rustc: Use an interior vector for ty::count_ty_params
2011-07-06 12:05:18 -07:00
Patrick Walton
e066bae56e
rustc: Move the interner over to interior vectors
2011-07-06 12:05:13 -07:00
Patrick Walton
717ac3df77
rustc: Make the various constraint-related types in middle::ty use interior vectors
2011-07-06 12:05:06 -07:00
Patrick Walton
2fd46b54fb
rustc: Make type parameter substitutions interior vectors
2011-07-06 12:04:59 -07:00
Patrick Walton
cb2018c6db
rustc: Change constraints in types to use interior vectors
2011-07-06 12:04:07 -07:00
Patrick Walton
13d920c10d
rustc: Switch tag type parameters to interior vectors
2011-07-06 12:03:55 -07:00
Patrick Walton
ede35f4c43
rustc: Use interior vectors for tag type parameters
2011-07-06 12:03:06 -07:00
Brian Anderson
066bcc6c79
Make "cannot determine a type for this local variable" non-fatal
2011-07-06 11:44:42 -07:00
Brian Anderson
5c20a8aa9c
Make "cannot determine a type for this expression" non-fatal. Closes #621
2011-07-06 11:44:36 -07:00
Brian Anderson
c31472e845
Refactor the typeck::writeback AST walk
...
All visitors take a wb_ctxt now instead of some taking a fn_ctxt and some
taking an ignore flag.
2011-07-06 11:42:20 -07:00
Brian Anderson
0c9c4cb575
Remove unused method from typeck::writeback
2011-07-06 11:42:20 -07:00
Brian Anderson
c1136e4e05
Limit exports from typeck
2011-07-06 11:42:20 -07:00
Brian Anderson
97c1537374
Limit exports from typeck::writeback
2011-07-06 11:42:20 -07:00
Lindsey Kuper
e30d2c82ae
Simplify AST for expr_anon_obj.
2011-07-06 11:36:06 -07:00
Lindsey Kuper
23bae67f4c
Simplify arguments to trans_anon_obj and friends.
2011-07-06 11:36:06 -07:00
Patrick Walton
bbdba21b1f
rustc: Revert the conversion to interior vectors due to heap corruption
2011-07-06 11:26:26 -07:00
Patrick Walton
ec890fff23
Temp commit on the way to making meta_item into an interior vector
2011-07-06 11:09:08 -07:00
Patrick Walton
3f6c9f8d84
rustc: Move crate directives over to interior vectors
2011-07-06 11:09:08 -07:00
Patrick Walton
c927d97fa0
rustc: Convert attribute in the AST to interior vectors
2011-07-06 11:09:08 -07:00
Patrick Walton
1591955adf
rustc: Make AST paths use interior vectors
2011-07-06 11:09:08 -07:00
Patrick Walton
b108280db1
rustc: Move middle::tstate::collect_locals over to interior vectors
2011-07-06 11:09:08 -07:00
Patrick Walton
48438ba1ae
rustc: Remove unused or seldom-used imports from middle::tstate::{bitvectors, ck}
2011-07-06 11:09:07 -07:00
Patrick Walton
ec634e471f
rustc: Remove some unused references to std::vec from tstate::ann and tstate::auxiliary
2011-07-06 11:09:07 -07:00
Patrick Walton
cfc659009e
rustc: Move middle::tstate::auxiliary and middle::tstate::bitvectors over to interior vectors
2011-07-06 11:09:07 -07:00
Patrick Walton
702f88a3be
rustc: Move tstate::annotate over to interior vectors
2011-07-06 11:09:07 -07:00
Patrick Walton
4c384304e9
rustc: Convert bind_params_in_type() to use interior vectors
2011-07-06 11:09:07 -07:00
Patrick Walton
5703bd1760
rustc: Migrate tag variants to interior vectors
2011-07-06 11:09:07 -07:00
Patrick Walton
52a7c2b78e
rustc: Make object methods into interior vectors
2011-07-06 11:09:07 -07:00
Patrick Walton
75c5f9bdba
rustc: Use an interior vector for ty::count_ty_params
2011-07-06 11:09:06 -07:00
Patrick Walton
bd7a072266
rustc: Move the interner over to interior vectors
2011-07-06 11:09:06 -07:00
Patrick Walton
b9a2117475
rustc: Make the various constraint-related types in middle::ty use interior vectors
2011-07-06 11:09:06 -07:00
Patrick Walton
0eb889f9d2
rustc: Make type parameter substitutions interior vectors
2011-07-06 11:09:06 -07:00
Patrick Walton
8bee69da25
rustc: Change constraints in types to use interior vectors
2011-07-06 11:09:06 -07:00
Patrick Walton
f391acbd3f
rustc: Switch tag type parameters to interior vectors
2011-07-06 11:09:06 -07:00
Patrick Walton
09e591c12f
rustc: Use interior vectors for tag type parameters
2011-07-06 11:09:06 -07:00
Marijn Haverbeke
8e585e7008
Support paren-free and lightweight-case syntax
...
(The old syntax is still supported as well, for now.)
It is now possible to leave out the parens around if, while, and
do/while conditions, and around alt expressions. Cases in an alt block
can now leave off the case keyword and parens around the pattern.
After the next snapshot, we can start migrating our code to use the
new alt syntax, probably with a pretty-printer pass. The paren-free
syntax will remain optional (you may always parenthesize expressions),
but the old case syntax will no longer be supported in the future.
2011-07-06 17:50:52 +02:00
Marijn Haverbeke
7661c08496
Remove temporary stdlib placeholders, use actual stdlib functions
...
(Possible now that a snapshot took place.)
2011-07-06 16:46:17 +02:00
Lindsey Kuper
4c315666dd
Forwarding functions. Lots of progress toward #539 , #540 , #543 .
2011-07-05 20:21:59 -07:00
Lindsey Kuper
993e47175f
Comments and cleanup.
2011-07-05 20:17:33 -07:00
Tim Chevalier
f279e0d76e
Handle pattern-bound upvars
...
If a closure inside a case alternative (for example, a for each loop)
referenced a pattern-bound variable, this would cause an assertion
failure in trans. Changed trans::collect_upvars to handle pattern-bound
vars correctly.
Incidentally, eliminated all direct uses of option::get in trans.
2011-07-05 19:58:49 -07:00
Brian Anderson
2cb129355b
Change ast::meta_name_value to accept any literal, not just string
...
This isn't useful for much of anything yet, since metadata::encoder doesn't
know how to handle the non-string variants.
Issue #611
2011-07-05 17:25:18 -07:00
Brian Anderson
375f0b2211
Require that the meta items in a use statement have unique names
2011-07-05 16:12:24 -07:00
Tim Chevalier
a793b85fbd
Handle fail inside a for-each loop properly
2011-07-05 16:05:38 -07:00
Tim Chevalier
ded9008e38
handle fail inside a for loop
2011-07-05 16:05:38 -07:00
Tim Chevalier
6d0cb70fc3
Handle fail as an argument
2011-07-05 16:05:38 -07:00
Graydon Hoare
741db24e49
Print remaining comments at end of *crate*, not module.
2011-07-05 14:44:54 -07:00
Brian Anderson
a9d84ab28a
Make type unification failures non-fatal
...
Add a failure checkpoint after the typechecking pass. There are still many
fatal errors in typeck, but loosening up this one makes it easier to lean on
the compiler when making changes to types.
Issue #440 .
2011-07-05 14:40:33 -07:00
Graydon Hoare
a7d82a7f0f
Factor the ivec code a touch.
2011-07-05 14:19:27 -07:00
Brian Anderson
57d94493cf
Remove unused eval function. Issue #604
2011-07-05 13:34:02 -07:00
Brian Anderson
b79ea489e3
Support conditional compilation of native items. Closes #610
2011-07-05 13:30:00 -07:00
Brian Anderson
8499c77cee
Parse attributes for native items. Closes #609
2011-07-05 12:43:44 -07:00
Brian Anderson
10a4737d34
Warn when compiling shared crates that don't have name/vers link attributes
...
Closes #614
2011-07-05 11:58:44 -07:00
Brian Anderson
6f8bc404f8
Error if the link attribute has duplicate items. Issue #614
2011-07-05 11:46:02 -07:00
Marijn Haverbeke
4349eaed84
Don't thread the local crate number through the session
...
It's a constant, anyway.
2011-07-05 16:09:32 +02:00
Marijn Haverbeke
6fd6fdea93
Move everything syntax-related to syntax/, break deps on rest of compiler
...
src/comp/syntax is currently just a sub-module of rustc, but it will,
in the near future, be its own crate. This includes:
- The AST data structure
- The parser
- The pretty-printer
- Visit, walk, and fold
- The syntax extension system
- Some utility stuff that should be in the stdlib*
*) Stdlib extensions currently require a snapshot before they can be
used, and the win build is very broken right now. This is temporary
and will be cleaned up when one of those problems goes away.
A lot of code was moved by this patch, mostly towards a more organized
layout. Some package paths did get longer, and I guess the new layout
will take some getting used to. Sorry about that!
Please try not to re-introduce any dependencies in syntax/ on any of
the other src/comp/ subdirs.
2011-07-05 15:57:21 +02:00