Commit graph

3434 commits

Author SHA1 Message Date
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
Eric Holk
111989a626 Removed what seems to be the last of the calls to rand(). Closes #582. 2011-07-06 11:50:25 -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
Eric Holk
bc5d6aefda Added a task wakeup callback. Closes #599.
The callback happens when a task moves from the "blocked" state to the
"running" state. The callback is also inherited by child tasks. There
is currently only a native API.

This code hasn't been heavily exercised yet.
2011-07-06 11:30:00 -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
Patrick Walton
9c4411ac5e snap: Register new snapshots 2011-07-06 11:05:57 -07:00
Lindsey Kuper
6bd80d0121 Add a compile-fail test for attempts to extend non-objects. 2011-07-06 10:47:36 -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
Patrick Walton
1bba585044 stdlib: Implement ivec::foldl 2011-07-05 18:29:47 -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
Patrick Walton
8261d2e6fb stdlib: Add filter_map to ivec 2011-07-05 17:22:02 -07:00
Patrick Walton
ee5d7bbc86 stdlib: Don't have ivec::map take a mutable alias 2011-07-05 16:28:07 -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
Patrick Walton
1980a2db53 stdlib: Add str::connect_ivec() temporarily 2011-07-05 16:02:02 -07:00
Patrick Walton
219cd4b21f stdlib: Change ivec::rustrt::ivec_on_heap() to use a 32-bit return value 2011-07-05 15:34:50 -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
Patrick Walton
291df4d732 rt: Add missing CDECL to routines in rust_builtin 2011-07-05 14:29:14 -07:00
Graydon Hoare
a7d82a7f0f Factor the ivec code a touch. 2011-07-05 14:19:27 -07:00
Brian Anderson
c5e28567a2 Register new snapshots 2011-07-05 13:39:54 -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
Marijn Haverbeke
c59ebf0f01 Add a test file for distinct ty_native types
This should have gone into patch
77f5d14f14, had I not forgotten to add
the file.
2011-07-05 11:50:41 +02:00
Marijn Haverbeke
04acba7968 Move pretty-printing 'modes' into a callback hook
This way, the pretty-printer does not have to know about middle::ty.

(This is a preparation for separating the AST functionality into a
separate crate.)
2011-07-05 10:42:17 +02:00
Patrick Walton
001397da3c stdlib: Add ivec::any() and ivec::all(); put out burning tinderbox 2011-07-04 23:52:47 -07:00
Patrick Walton
f71c8dd918 stdlib: Implement interior vector map 2011-07-04 22:48:42 -07:00
Patrick Walton
d3a4102bc1 stdlib: Add an inefficient implementation of ivec::pop 2011-07-04 21:20:18 -07:00
Patrick Walton
5d2c189631 rustc: Remove obsolete "The second has to be authed pure" comment 2011-07-04 19:08:25 -07:00
Brian Anderson
ccf6112f15 Link the fuzzer crate to librustc again 2011-07-04 15:30:36 -07:00
Graydon Hoare
5c9fb0bc98 Merge pull request #605 from wilsonk/target
Update RustWrapper.cpp so that LLVM revision 134231 from June 30, 2011 at
2011-07-04 13:45:59 -07:00
Marijn Haverbeke
fb10829aef Switch the alias checking pass to use span_err instead of span_fatal
It'll now spit out all problems it finds, and only abort after
the whole pass has run.
2011-07-04 22:00:07 +02:00
Marijn Haverbeke
b1423be1d6 Move the ids of pat AST nodes into their struct
Just like it was done with items and exprs. Simplifies some code.
2011-07-04 22:00:06 +02:00
Rafael Ávila de Espíndola
b669430f72 Use metadata to avoid always passing -Lrustllvm to the linker. 2011-07-04 13:22:23 -04:00
Rafael Ávila de Espíndola
6b1da80eb4 Simplify. 2011-07-04 11:36:10 -04:00
Rafael Ávila de Espíndola
e0ce092ddc Simplify the code a bit. 2011-07-04 11:17:30 -04:00
Josh Matthews
7e7e326ee6 Make use of demand::simple instead of manually checking fail expr type. 2011-07-03 21:46:17 -07:00
Josh Matthews
a2775a5b72 Make non-str fail expression a type checking failure instead of a translation one. 2011-07-03 21:46:17 -07:00
Tim Chevalier
b110bbf886 Un-XFAIL fail-arg 2011-07-03 11:56:23 -07:00
Tim Chevalier
046c25dbc0 Handle fail as an argument; parse fail expressions unambiguously
An expression like:

foo(1, fail, 2)

was failing to parse, because the parser was interpreting the comma
as the start of an expression that was an argument to fail, rather
than recognizing that the fail here has no arguments

Fixed this by using can_begin_expr to determine whether the next
token after a fail token suggests that this is a nullary fail or a
unary fail.

In addition, when translating calls, check before translating each
argument that the block still isn't terminated. This has the effect
that if an argument list includes fail, the back-end won't keep trying
to generate code for successive arguments and trip the !*terminated
assertion.
2011-07-03 11:51:47 -07:00
Tim Chevalier
6369807ffe Add a predicate that determines whether a token can begin an expression 2011-07-03 11:51:46 -07:00
Tim Chevalier
48a69d2100 Eliminate all direct calls to option::get() from typeck
This means fewer mysterious error messages.
2011-07-03 02:48:08 -07:00
Tim Chevalier
c425a422ed Manipulate contexts correctly in trans_fail_expr
This fixes Issue #617
2011-07-03 02:38:11 -07:00
Tim Chevalier
9349826909 XFAILing the new test case...
...because the parsing of fail got changed out from under me.
Will fix shortly.
2011-07-03 01:15:41 -07:00
Tim Chevalier
7426252549 Generate code properly for calls with _|_ - typed arguments
The code for translating a fail (for example) would call
Unreachable(), which terminates the block; if a fail appeared as an
argument, this would cause an LLVM assertion failure. Changed
trans_call to handle this situation correctly.
2011-07-02 22:02:59 -07:00
Tim Chevalier
f0fad0dca5 Add a function that determines whether the block is terminated 2011-07-02 22:02:08 -07:00
Josh Matthews
a4421cc4e8 Fix assertion failure when syntax extension name is missing. 2011-07-02 00:06:58 -07:00
Brian Anderson
7c8ee712be Fix the error-pattern on compile-fail/fail-simple
Recent changes to the fail statement changed the way the parser errors in this
scenario.
2011-07-02 00:06:58 -07:00
Josh Matthews
d485e0d15a Allow any string expression to be used with fail. 2011-07-02 00:06:58 -07:00
Patrick Walton
67c9ef9b30 rustc: Fix memory corruption with ivectors-inside-ivectors by duplicating *first*, and *then* copying subtypes. 2011-07-01 20:07:19 -07:00
Patrick Walton
d39c59ae41 rustc: Move path_to_str to front::ast 2011-07-01 17:22:18 -07:00
Rob Arnold
4e59b0be54 Sync rust_chan's deref() method with rustc's code.
If the channel is associated with a port then the destructor will assert.
Additionally, destruction of the object is not always appropriate. This brings
the deref() method into sync with the behavior of generated rust code which
only invokes destroy() once the reference count goes to 0.
2011-07-01 16:59:11 -07:00
Rob Arnold
02a5949aba Add macro for refcounting runtime structures.
The macro with the extra dtor parameter is intended for structures like
rust_chan which may not necessarily delete themselves when the ref count
becomes 0. This functionality will be used in an upcoming changeset.
2011-07-01 16:59:10 -07:00
Rob Arnold
73cc624e8e Move the channel destroy code into rust_chan.
This lets native code more easily destroy channels since directly deleting a
channel is not always the right way to destroy it.
2011-07-01 16:59:10 -07:00
Rob Arnold
09921cf86f Move channel cloning logic into a method on rust_chan.
This will allow us to more easily clone channels from native code.
2011-07-01 16:59:10 -07:00
Brian Anderson
396c4defcc Introduce --cfg argument for providing additional configuration. Issue #489 2011-07-01 15:30:25 -07:00
Brian Anderson
a34b61fb15 Add some FIXMEs for issue #607 2011-07-01 12:51:46 -07:00
Brian Anderson
021b203fc6 Add some logging to attr when reading crate link attributes
Only link attributes of the meta_list type are considered when matching crate
attributes. Instead of doing nothing we can at least log that link attributes
of other types were ignored.
2011-07-01 12:30:27 -07:00
Brian Anderson
22be98264e Add a test for mismatched crate metadata in use statements 2011-07-01 12:26:57 -07:00