Marijn Haverbeke
a034f87146
Revert "Implement pattern ranges for all numeric types."
...
This reverts commit ce0f054f9d
.
2011-09-21 18:42:09 +02:00
Josh Matthews
ce0f054f9d
Implement pattern ranges for all numeric types.
2011-09-21 09:36:12 +02:00
Marijn Haverbeke
3abe3671bd
Require the parameter that will be referenced to be noted
...
Issue #918
2011-09-15 16:15:17 +02:00
Marijn Haverbeke
93de2f0b74
Add syntax and representation for return-by-mutably-rooted-ref
...
This will be used in the near future to decide what can safely
be done with the returned reference.
Issue #918
2011-09-14 17:30:38 +02:00
Marijn Haverbeke
51dae63c44
Make most of the compiler aware of return-by-reference
...
tyencode/tydecode still don't know about it. return_ref will be extended to take
arguments anyway.
2011-09-14 11:31:05 +02:00
Marijn Haverbeke
6eb9738a66
Rename ast::controlflow to ast::ret_style
...
It will include information about returning by alias.
2011-09-14 10:38:23 +02:00
Michael Sullivan
c84b8e90b8
Print something when we can't figure out a tag name. Mitigates #876 .
2011-09-13 13:14:49 -04:00
Graydon Hoare
a4815b6742
Factor imports mindlessly.
2011-09-12 16:13:28 -07:00
Marijn Haverbeke
fc6b7c8b38
Reformat for new mode syntax, step 1
...
Long lines were fixed in a very crude way, as I'll be following up
with another reformat in a bit.
2011-09-12 12:04:14 +02:00
Marijn Haverbeke
0e6e56ca60
Make the names of the arg mode tag reflect their (revised) meaning
2011-09-12 11:07:17 +02:00
Brian Anderson
f1555e2ca8
Rename ty_istr to ty_str. Issue #855
2011-09-02 22:11:46 -07:00
Brian Anderson
6217ce958e
Print the type of istrs as 'str' in error messages. Issue #855
2011-09-02 22:11:46 -07:00
Brian Anderson
5c49e4f4e9
Reformat. Issue #855
2011-09-02 22:11:42 -07:00
Brian Anderson
9c173f17c0
Remove lots of estr code from rustc. Issue #855
2011-09-01 23:25:33 -07:00
Brian Anderson
ab6bb035e5
Rename std::istr to std::str. Issue #855
2011-09-01 17:27:58 -07:00
Brian Anderson
e824775d53
Remove std::str. Issue #855
2011-09-01 16:09:15 -07:00
Brian Anderson
3fe743bc9c
Remove various istr conversions. Issue #855
2011-09-01 12:14:34 -07:00
Tim Chevalier
f62add95da
Eliminate an unchecked use of map::get in ppaux
2011-08-30 16:19:52 -07:00
Brian Anderson
5f57a508af
Convert misc compiler bits to istrs. Issue #855
2011-08-27 18:05:59 -07:00
Brian Anderson
9fb085560d
Convert rustc::syntax::ast_util to istrs. Issue #855
2011-08-27 15:54:46 -07:00
Brian Anderson
cbad23a747
Convert pretty-printer to istrs. Issue #855
2011-08-27 15:54:46 -07:00
Brian Anderson
d2ae28fc99
Convert rustc::util to istrs. Issue #855
2011-08-27 15:54:45 -07:00
Brian Anderson
03119fe269
Convert ast::ident to istr. Issue #855
2011-08-27 15:54:44 -07:00
Brian Anderson
b2408d57f0
Convert portions of rustc to istrs. Recover a lot of performance.
...
Issue #855
2011-08-27 15:54:43 -07:00
Brian Anderson
53be480d20
Convert std::int to istrs. Issue #855
2011-08-27 15:53:08 -07:00
Brian Anderson
ee2a11eb4f
Convert std::uint to istrs. Issue #855
2011-08-27 15:53:08 -07:00
Eric Holk
640886ceb6
Polymorphic MapReduce!
2011-08-26 18:03:33 -07:00
Brian Anderson
152cbaade7
Move functions from syntax::ast to syntax::ast_util
...
This leaves syntax::ast just defining the AST, which strikes me as somewhat
nicer
2011-08-22 10:44:04 -07:00
Brian Anderson
518dc52f85
Reformat
...
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00
Michael Sullivan
94c6160c73
Some cleanup in ty_to_str.
2011-08-18 18:13:18 -07:00
Michael Sullivan
f8ac788d66
Print tag names in type error messages. Closes #834 .
2011-08-18 18:13:18 -07:00
Brian Anderson
4fc3618233
Change ast::ty_ivec, ty::ty_ivec to ty_vec
2011-08-18 14:11:06 -07:00
Brian Anderson
c2d2dad093
Remove ast::ty_vec
2011-08-18 13:09:50 -07:00
Erick Tryzelaar
af21a27002
Port the compiler to the expr foo::<T> syntax.
2011-08-16 15:05:56 -07:00
Erick Tryzelaar
4abc471390
Port the compiler to foo<T> decl syntax.
2011-08-16 15:05:56 -07:00
Erick Tryzelaar
e4a0f997fb
Port the compiler to the typaram foo<T> syntax.
2011-08-16 15:05:56 -07:00
Eric Holk
862bc521a1
Removing tasks, ports and chans from the compiler.
2011-08-16 10:59:49 -07:00
Brian Anderson
f05a91a0dc
Rename std::ivec to std::vec
2011-08-16 10:36:19 -07:00
Lindsey Kuper
f91351aaf6
The wonky for...in... whitespace was bothering me. Sorry!
2011-08-15 22:19:50 -07:00
Marijn Haverbeke
a21ebb2f5e
Fix bad argument type of pprust::print_type
...
AST types are boxed, there's no need for every caller to do the unboxing
2011-08-15 13:45:04 +02:00
Marijn Haverbeke
29ea87542f
Tuple fields are immutable
2011-08-15 12:08:05 +02:00
Marijn Haverbeke
9538b00363
Tuple types back, not constructable yet
2011-08-15 11:40:38 +02:00
Brian Anderson
7d05da96f7
Rename std::ioivec to std::io
2011-08-12 12:08:27 -07:00
Brian Anderson
119f43e0c7
Rename str::connect_ivec to str::connect
2011-08-12 12:08:27 -07:00
Brian Anderson
369be5c8df
Convert uses of str::connect to str::connect_ivec
2011-08-12 12:08:27 -07:00
Brian Anderson
740196987e
Rename std::str::unsafe_from_bytes_ivec to unsafe_from_bytes
2011-08-12 12:08:27 -07:00
Brian Anderson
a9ce342fa3
Convert all uses of unsafe_from_bytes to unsafe_from_bytes_ivec
2011-08-12 12:08:26 -07:00
Patrick Walton
19424dfab6
rustc: Add unique pointers to the set of types we support
2011-08-10 17:24:22 -07:00
Erick Tryzelaar
8b15045224
Port the compiler to the ivec type [T] syntax.
2011-08-09 15:53:26 -07:00
Michael Sullivan
8871462575
Do a bunch more typechecking for iters and for each loops.
...
Closes #771 .
Closes #772 .
Closes #796 .
2011-08-03 11:07:53 -07:00
Marijn Haverbeke
043d95a2bd
Move ppaux::ty_to_str to new record syntax
2011-08-02 12:09:15 +02:00
Graydon Hoare
0c9b749d20
Enable kind checking on typarams, fix kind constraints in library and comp.
2011-07-29 18:48:15 -07:00
Graydon Hoare
3e63fdc4c9
Thread kinds into the type system. Don't quite activate yet, since it breaks stdlib and snapshot isn't ready to compile modified stdlib.
2011-07-28 13:29:39 -07:00
Marijn Haverbeke
c78ac29002
Show millisecond precision for time_passes times
...
Closes #713
2011-07-28 07:22:16 +02:00
Marijn Haverbeke
df7f21db09
Reformat for new syntax
2011-07-27 15:54:33 +02:00
Marijn Haverbeke
e133f929b7
Convert all code that uses walk.rs in the straightforward way to simple_visit
...
Code that needs the keep_going functionality is still using walk. I will
add an equivalent to visit.rs later.
2011-07-26 17:13:48 +02:00
Marijn Haverbeke
2c1250780d
Remove tuple support from the compiler
2011-07-26 15:19:56 +02:00
Marijn Haverbeke
aea537779e
Remove all uses of tuples from the compiler and stdlib
2011-07-26 14:06:02 +02:00
Michael Sullivan
25a89e068d
Rename the block type to be blk also. Sorry.
2011-07-25 14:18:07 -07:00
Michael Sullivan
1a2a8b6b17
Have fn_to_str use proto_to_str.
2011-07-19 20:11:48 -07:00
Tim Chevalier
bd4aeef78b
Beginnings of support for constrained types
...
Programs with constrained types now parse and typecheck, but
typestate doesn't check them specially, so the one relevant test
case so far is XFAILed.
Also rewrote all of the constraint-related data structures in the
process (again), for some reason. I got rid of a superfluous
data structure in the context that was mapping front-end constraints
to resolved constraints, instead handling constraints in the same
way in which everything else gets resolved.
2011-07-19 18:57:28 -07:00
Patrick Walton
be489ee9e2
rustc: Move much of metadata reading over to interior vectors
2011-07-14 12:00:48 -07:00
Tim Chevalier
f26ca025de
Make resolve and the typechecker check for a main fn of the
...
correct type
This means if a non-library program leaves out the main program,
the error gets caught earlier than link.
Closes #626 .
2011-07-13 18:30:53 -07:00
Patrick Walton
cdda0fd6d6
rustc: Remove some useless std::vec imports
2011-07-12 18:07:12 -07:00
Patrick Walton
a3add84909
rustc: Remove some interior vectors from typestate and some useless vec-related imports
2011-07-12 16:44:57 -07:00
Patrick Walton
e038e8e52b
rustc: Move ppaux away from exterior vectors
2011-07-12 16:35:02 -07:00
Marijn Haverbeke
12d5532166
Use switches rather than chained conditionals to compile alt matches
...
This also moves the alt-related trans code into its own file.
Closes #467
2011-07-13 00:38:24 +02:00
Tim Chevalier
e1620def9f
In typeck, check for dynamically sized by-value arguments to thunks
...
A check in trans didn't have a corresponding check in typeck, causing
some programs (to wit, compile-fail/chan-parameterized-args.rs - part of this
commit) to fail with an assertion failure in trans instead of a type error.
Fixed it. In short, arguments that are future thunk arguments (any spawn
arguments, and _ arguments in bind) need to either not contain type params
or type vars, or be by-reference.
Closes #665 .
2011-07-11 17:32:00 -07:00
Brian Anderson
6ee1ffe4ac
Rename encoder::ty_str to encoded_str
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
Patrick Walton
0e2fff5337
rustc: Change lots of AST nodes to use interior vectors
2011-07-07 12:53:17 -07:00
Patrick Walton
2e1aa04fcd
rustc: Make object methods into interior vectors
2011-07-06 15:13:47 -07:00
Patrick Walton
cb2018c6db
rustc: Change constraints in types to use interior vectors
2011-07-06 12:04:07 -07:00
Patrick Walton
ede35f4c43
rustc: Use interior vectors for tag type parameters
2011-07-06 12:03: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
52a7c2b78e
rustc: Make object methods into interior vectors
2011-07-06 11:09:07 -07:00
Patrick Walton
8bee69da25
rustc: Change constraints in types to use 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
7661c08496
Remove temporary stdlib placeholders, use actual stdlib functions
...
(Possible now that a snapshot took place.)
2011-07-06 16:46:17 +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
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
b841152a40
rustc: Use interior vectors for tuple types
2011-06-30 11:35:05 -07:00
Brian Anderson
7c500fc0a0
Replace common::new_seq_hash with an adapter around std::smallintmap
...
It would be better to either convert ast_map to use smallintmap or make
smallintmap and hashmap follow the same interface, but I don't feel up to
it just now. Closes #585 .
2011-06-28 19:48:33 -07:00
Brian Anderson
29a8219c4c
Add a very simple map implementation for sequential integer keys
...
Use it for the ast_map. Cuts 40% off the time spent prior to LLVM.
2011-06-26 20:37:08 -07:00
Tim Chevalier
9a48bd2f21
Compute typestate properly for move
...
typestate now drops constraints correctly in the post-state of
a move expression or a declaration whose op is a move. It doesn't
yet drop constraints mentioning variables that get updated.
To do this, I had to change typestate to use trit-vectors instead
of bit-vectors, because for every constraint, there are three
possible values: known-to-be-false (e.g. after x <- y, init(y) is
known-to-be-false), known-to-be-true, and unknown. Before, we
conflated known-to-be-false with unknown. But move requires them
to be treated differently. Consider:
(program a)
(a1) x = 1;
(a2) y <- x;
(a3) log x;
(program b)
(b1) x = 1;
(b2) y <- z;
(b3) log x;
With only two values, the postcondition of statement a2 for
constraint init(x) is the same as that of b2: 0. But in (a2)'s
postcondition, init(x) *must* be false, but in (b2)'s condition,
it's just whatever it was in the postcondition of the preceding statement.
2011-06-22 22:13:42 -07:00
Marijn Haverbeke
c34e9b33d9
Move expr ids into the expr record type
...
This simplifies the tag variants a bit and makes expr_node_id
obsolete.
2011-06-21 22:25:32 +02:00
Paul Stansifer
391348ec86
Consistify ast::local.
2011-06-16 17:56:24 -07:00
Marijn Haverbeke
15f71b3600
Refactor ast::item representation
...
Most of the fields in an AST item were present in all variants. Things
could be simplified considerably by putting them in the rec rather
than in the variant tags.
2011-06-16 13:32:35 +02:00
Graydon Hoare
ce72993488
Reformat source tree (minus a couple tests that are still grumpy).
2011-06-15 11:19:50 -07:00
Brian Anderson
1c9277e0d3
rustc: Make room in remaining AST item nodes for attributes
...
Issue #487
2011-06-15 09:48:55 -07:00
Brian Anderson
31116dcdd5
rustc: Make room in item_mod for metadata
...
Issue #487
2011-06-15 09:46:37 -07:00
Tim Chevalier
d65ad8c31c
Change decl to local in expr_for and expr_for_each
...
Since the decl in a for or for-each loop must always be a local
decl, I changed the AST to express this. Fewer potential match
failures and "the impossible happened" error messages = yay!
2011-06-13 17:33:04 -07:00
Patrick Walton
5318248f24
rustc: Annotate vector and string literals in the AST with their uniqueness or lack thereof
2011-06-09 17:11:21 -07:00
Tim Chevalier
17ff2a0d79
Further support for predicate constraints
...
Changed function types to include a list of constraints. Added
code for parsing and pretty-printing constraints. This necessitated
splitting pprust into two files (pprust and ppaux) to break a
circulate dependency, as ty_to_str now needs to print out constraints,
which may include literals, but pprust depended on ty.
2011-06-09 11:37:52 -07:00
Tim Chevalier
1402cd101b
Redo typestate-related data structures to support predicate constraints. No actual support yet, just infrastructure.
2011-06-01 18:14:48 -07:00
Paul Stansifer
9f5dddf08c
Now imports are not re-exported unless 'export' is explicitly used.
2011-05-31 18:43:26 -07:00
Graydon Hoare
b6971d94df
Consolidate formatting functions a bit more.
2011-05-31 11:00:47 -07:00
Graydon Hoare
55e3cd41de
Fix utility printers to flush eof in common.rs.
2011-05-31 11:00:47 -07:00