Marijn Haverbeke
e2e077c831
Remove trivial cast checker
...
I consider the added complexity not justified at this point, and it
interacts badly with the patches for issue #828 . Feel free to discuss.
2011-12-22 15:04:00 +01:00
Graydon Hoare
047b02d5bc
More flailing on log syntax due to call-expr ambiguity in previous attempt.
2011-12-21 18:05:08 -08:00
Graydon Hoare
5d1cf2a872
Out-of-order-code typo. Snapshot again.
2011-12-21 15:43:38 -08:00
Graydon Hoare
8d9e7deab5
Switch log_expr to carrying a full expr:u32 for level. Add log_full variant that parses that expr, prepare for snapshot.
2011-12-21 14:31:31 -08:00
Niko Matsakis
c03d14a33d
upgrade kind check
2011-12-21 06:14:36 -08:00
Niko Matsakis
01cb1044f7
update pprinter to understand ret type of block, add warnings
2011-12-21 06:14:35 -08:00
Niko Matsakis
6a90140941
Make { || ... } sugar for any type of closure, inferred
2011-12-21 06:14:35 -08:00
Haitao Li
1e4de33374
rustc: Exclude stdin from codemap files when lookup_pos
...
Fixes issue #1362
2011-12-21 22:07:48 +08:00
Graydon Hoare
3bc4da96f1
Inject "core macros" into default syntax-expansion environment. Bit of a kludge but enough to work on logging-via-macros.
2011-12-20 13:38:10 -08:00
Niko Matsakis
55a2fd18ec
implement capture clauses (move, in particular) and integrate
...
them into type state and so forth
2011-12-19 14:07:46 -08:00
Niko Matsakis
b2b2a430df
resolve capture clauses
2011-12-19 14:07:46 -08:00
Marijn Haverbeke
60acae4df7
Add type argument field to expr_path
...
This way, you can explicitly provide type parameters when calling a
generic method.
Issue #1227
2011-12-19 10:43:23 +01:00
Marijn Haverbeke
7185ea35c3
Use quotes around tokens in parser error messages to make them more readable
...
Closes #1328
2011-12-19 09:59:51 +01:00
Marijn Haverbeke
f4acaf6934
Only look for a matching method when normal field access fails
...
We should probalby warn when defining a method foo on {foo: int} etc.
This should reduce the amount of useless typevars that are allocated.
Issue #1227
2011-12-18 19:41:44 +01:00
Marijn Haverbeke
dd9693f211
Reserve node_id 0 for the crate top-level module
...
And define a const to refer to it.
2011-12-16 22:17:47 +01:00
Graydon Hoare
d1bca753b8
Switch fmt extension to reference extfmt that's in core.
2011-12-16 10:59:11 -08:00
Niko Matsakis
2833ca478c
reorder args to the various vec, option fns so blk comes last
2011-12-16 07:17:23 -08:00
Marijn Haverbeke
d529757515
Make polymorphic impl methods work
...
Something will still have to be done to the AST to make it possible to
say `x.foo::<int>()`, since currently field access never allows type
parameters.
Issue #1227
2011-12-16 13:47:48 +01:00
Marijn Haverbeke
cff6bdd036
Change syntax for impl
...
Move the name of the bundle to the front, allow type parameters (not
handled yet), and add a 'for' keyword:
impl utils for int {
fn str() -> str { int::str(self) }
fn times(f: block()) { ... }
}
2011-12-16 11:46:57 +01:00
Marijn Haverbeke
4f826d81f6
Make 1.f parse as a field access on the integer 1
...
A dot is only considered part of a number when not followed by a letter
Closes #1306
2011-12-16 11:46:57 +01:00
Marijn Haverbeke
7efef98901
Make uses of self in impls compile
...
Get rid of expr_self_call, introduces def_self. `self` is now,
syntactically, simply a variable. A method implicitly brings a `self`
binding into scope.
Issue #1227
2011-12-16 11:46:57 +01:00
Marijn Haverbeke
888bc80025
Parse and resolve implementations.
...
Issue #1227
2011-12-16 11:46:57 +01:00
Niko Matsakis
1e3259e119
massive refactor of how closures work
2011-12-15 13:44:06 -08:00
Marijn Haverbeke
f82d101511
Iterate over an array when creating the parser's reserved word table
2011-12-15 08:18:38 +01:00
Niko Matsakis
1869306a7e
change syntax from lambda[send] to sendfn
2011-12-14 14:32:24 -08:00
Niko Matsakis
85f381fb8a
restructure, temporarily working around what looks like an LLVM bug
2011-12-14 14:32:23 -08:00
Niko Matsakis
6b744b284e
remove extra trailing semicolon
2011-12-14 14:32:21 -08:00
Niko Matsakis
aa1cd61c84
push changes through to get things compiling, if not running.
2011-12-14 14:32:18 -08:00
Niko Matsakis
c28ada0368
first attempt, not happy with it
2011-12-14 14:32:18 -08:00
Niko Matsakis
941101a9cd
define ty and update parser for sendable lambdas
2011-12-14 14:32:17 -08:00
Graydon Hoare
fa9ad984fb
Copy first batch of material from libstd to libcore.
2011-12-13 16:34:50 -08:00
Marijn Haverbeke
44ffd8e3aa
Allow type annotations for blocks
...
I.e. {|foo: int| -> int foo + 2}
Issue #1275
2011-12-09 09:42:22 +01:00
Marijn Haverbeke
0e74121ddb
Error when parsing the empty record type
...
Issue #1200
2011-12-08 13:29:43 +01:00
Marijn Haverbeke
9a269a3aa8
Allow binding of nested patterns
...
See src/test/run-pass/nested-patterns.rs for some examples. The syntax is
boundvar@subpattern
Which will match the subpattern as usual, but also bind boundvar to the
whole matched value.
Closes #838
2011-12-08 12:03:48 +01:00
Marijn Haverbeke
a7c6cb7385
Consider variant constructors pure functions for the purpose of purity checking
...
Closes #1269
2011-12-08 10:26:42 +01:00
Graydon Hoare
e056ffa17d
Inject the view_items for core in the right place, add comment documenting why the wrong place was wrong.
2011-12-07 13:33:00 -08:00
Graydon Hoare
799690bea0
Remove stmt_crate_directive, it's vestigial and confusing.
2011-12-07 13:33:00 -08:00
Marijn Haverbeke
3d0610b072
Check for literals that are out of range for their type
2011-12-07 21:53:05 +01:00
Marijn Haverbeke
e3eca9174b
Change literal representation to not truncate
...
Also shuffles around the organization of numeric literals and types,
separating by int/uint/float instead of machine-vs-non-machine types.
This simplifies some code.
Closes #974
Closes #1252
2011-12-07 21:08:28 +01:00
Niko Matsakis
6c95e400d8
repair more hash functions
2011-12-07 07:35:25 -08:00
Niko Matsakis
8b608125ac
fix hash function: + binds tighter than <<
2011-12-06 21:34:50 -08:00
Stefan Plantikow
4ba3158e4f
parse: typeck: enabling trivial casts of tail-call return values
...
introduces ctypes::m_* machine type aliases for int, uint, float
depending on cfg(target_arch) that are used in tests
2011-12-02 11:38:24 -08:00
Stefan Plantikow
29f7cdffa4
ty: trans: added support for dropping trivial casts
2011-12-02 11:38:24 -08:00
Marijn Haverbeke
7655b3c0c6
Stop lexing -1 as a single token
...
And remove the hack that made 1-1 work given that other hack.
Issue #954
2011-12-02 13:57:12 +01:00
Marijn Haverbeke
64ce092c27
Allow literal patterns to contain arbitrary literal expressions
...
This removes the need for the unary minus hacks, and allows some other
neat things like matching on 1 >> 4.
Issue #954
2011-12-02 13:42:51 +01:00
Marijn Haverbeke
b40c6773c2
Box ast::path values
...
It seems inefficient to copy them around. Let's measure whether that's actually
> the case
2011-11-30 13:38:38 +01:00
Brian Anderson
7aee9f7b56
rustc: Fix a bug in cdir attribute parsing
...
The first attribute of the first mod was being applied to every mod.
2011-11-24 16:18:26 -08:00
Haitao Li
3e303af86b
rustc: Add a path attribute for crate directives
...
The path information was an optional "filename" component of crate
directive AST. It is now replaced by an attribute with metadata named
"path".
With this commit, a directive
mod foo = "foo.rs";
should be written as:
#[path = "foo.rs"]
mod foo;
Closes issue #906 .
2011-11-24 15:31:18 -08:00
Haitao Li
05b2cb8ecc
rustc: Accepts path
attributes for crate directives
...
Temporarily allow path specified in either as attribute or in AST, like:
#[path = "mymod.rs"]
mod mymod = "mymod.rs";
This is a transitional commit to avoid creating a stage1 snapshot.
2011-11-24 14:55:53 -08:00
Haitao Li
2253ed5d1c
rustc: Fix position of diagnostic highlight lines
...
Diagnostic highlight lines are incorrect placed when the related line
number is 10, 100, etc.
The root cause is line number are treated as 0 based (should be 1 based)
when calculating offset of line number digits.
2011-11-24 08:10:11 +01:00
Marijn Haverbeke
8746ebe2e6
Add some changes that *should* have been in e98286b594
...
Forgot to amend the commit after fixing the failure.
2011-11-23 21:22:56 +01:00
Marijn Haverbeke
e98286b594
Allow import directives in any block
...
Closes #49
2011-11-23 20:57:34 +01:00
Marijn Haverbeke
9fb3719ded
Rollback return-by-reference
...
It's proving too inflexible, so I'm ripping out the extra complexity
in the hope that regions will, at some point, provide something
similar.
Closes #918
2011-11-23 11:02:27 +01:00
Marijn Haverbeke
a8dd52ed36
Remove last traces of auth keyword
...
The reference now has an empty hole where the auth keyword used to be.
Changing the keyword table seems to require manually sorting the
keywords and putting them back into some kind of arcane interleaved
order. I'll open an issue to actually fix this.
Closes #1211
2011-11-23 11:02:27 +01:00
Haitao Li
a936f78d98
rustc: Allow trailing comma in record fields
2011-11-22 13:41:17 -08:00
Stefan Plantikow
148a6c1a38
comp: allowed the declaration of pure fn's in native mods
...
This is especially useful for the native calls in std::math
This commit does NOT yet point to new snapshots
2011-11-22 20:01:25 +01:00
Marijn Haverbeke
fedb775fbb
Add hacks to extract and compile tutorial code
...
Not included in the build by default, since it's fragile and kludgy. Do
something like this to run it:
cd doc/tutorial
RUSTC=../../build/stage2/bin/rustc bash test.sh
Closes #1143
2011-11-22 16:12:23 +01:00
Marijn Haverbeke
5d6a74f020
Only warn about unreachable range patterns when appropriate
...
Also simplifies the literal-munging, and moves it into ast_util
Closes #1170
2011-11-22 11:49:29 +01:00
Marijn Haverbeke
8cc852af8c
Make ast::visit only descend into types when necessary
...
If visit_ty is not overridden, it uses a stub function which does not
descend into types.
Closes #1204
2011-11-22 10:57:47 +01:00
Haitao Li
5ca83553bc
rustc: Remove abi from ast::native_mod
2011-11-21 13:49:52 +01:00
Marijn Haverbeke
f6491bb426
Update stdlib, compiler, and tests to new kind system
...
This involved adding 'copy' to more generics than I hoped, but an
experiment with making it implicit showed that that way lies madness --
unless enforced, you will not remember to mark functions that don't
copy as not requiring copyable kind.
Issue #1177
2011-11-18 12:49:01 +01:00
Marijn Haverbeke
4e03112141
Add a pass-by-copy parameter passing convention
...
This is intended to solve the problem of how to pass arguments to
constructor functions -- you want to move in rvalues, but not have to
explicitly copy stuff that is not an rvalue. The by-copy passing
convention will ensure the callee gets its own copy of the value. For
rvalues, it'll just pass off the value. For lvalues, it'll make a
copy.
Issue #1177
2011-11-18 12:49:00 +01:00
Marijn Haverbeke
9cf48d3753
Preparation for kind system overhaul
...
This goes before a snapshot, so that subsequenct patches can make the
transition without breaking the build. Disables kind checking pass, makes
parser accept both new and old-style kind annotation.
Issue #1177
2011-11-18 10:52:28 +01:00
Niko Matsakis
adc79e2f44
remove compile-command from local variable blocks
2011-11-17 11:46:13 -08:00
Brian Anderson
b655fb9ea7
Replace 'mutable?' with 'const'
2011-11-16 14:41:32 -08:00
Brian Anderson
045a437556
rustc: Accept 'const' as synonym for 'mutable?'
2011-11-16 13:52:08 -08:00
Haitao Li
88f29aab27
Use attributes for native module ABI and link name
...
This patch changes how to specify ABI and link name of a native module.
Before:
native "cdecl" mod llvm = "rustllvm" {...}
After:
#[abi = "cdecl"]
#[link_name = "rustllvm"]
native mod llvm {...}
The old optional syntax for ABI and link name is no longer supported.
Fixes issue #547
2011-11-16 11:35:13 -08:00
Haitao Li
fba0df72d3
Use attributes for native module ABI and link name [temp]
...
This patch adds support of using attributes to specify native mode ABI
and link name. The old optional syntax like:
native "cdecl" mod llvm = "rustllvm" { ... }
is still supported.
This is a transitional commit to avoid making a stage1 (backward
imcompatible) snapshot.
2011-11-16 23:45:07 +08:00
Haitao Li
3b683f5205
rustc: Use link_name attribute for native function
...
Fixes issue #906
2011-11-16 23:45:07 +08:00
Haitao Li
5a7249c935
Cleanup unused imports
2011-11-10 19:19:40 -08:00
Josh Matthews
43cb74b830
Add float support to #fmt. Fix #1014 .
2011-11-10 11:40:34 -08:00
Brian Anderson
0d9e32d70d
Rename "c-stack-stdcall" ABI to "stdcall"
2011-11-09 18:45:25 -08:00
Brian Anderson
b7ab28b50f
Rename "c-stack-cdecl" ABI to "cdecl"
2011-11-09 18:44:12 -08:00
Brian Anderson
d26a96d2bb
Add "cdecl" as synonym for "c-stack-cdecl"
2011-11-09 16:47:44 -08:00
Brian Anderson
e96342820d
Add "stdcall" as synonym for "c-stack-stdcall"
2011-11-09 16:47:44 -08:00
Brian Anderson
1afc943c91
rustc: Rename native_abi_c_stack_cdecl to native_abi_cdecl
2011-11-09 16:47:44 -08:00
Brian Anderson
10c35959e7
rustc: Rename native_abi_c_stack_stdcall to native_abi_stdcall
2011-11-09 16:47:44 -08:00
Brian Anderson
c7f0ca6063
Remove native "x86stdcall" ABI
2011-11-09 16:47:43 -08:00
Brian Anderson
4f3f04643f
Remove native "cdecl" ABI
2011-11-08 17:17:06 -08:00
Brian Anderson
fcd39b1191
Remove native "llvm" ABI
2011-11-07 15:29:05 -08:00
Brian Anderson
1103fe8ca0
Remove native "rust" ABI
2011-11-07 15:14:10 -08:00
David Rajchenbach-Teller
16bdb85cb4
[Parser] parser.rs: Made two error messages less ambiguous
2011-11-07 12:04:16 -08:00
Marijn Haverbeke
1a68a98824
Disallow writing to function arguments again
...
Remove implicit copying hack.
Closes #1118
2011-11-03 10:57:54 +01:00
Marijn Haverbeke
eaf9e05611
Make 'lambda(...) -> ...' parse as a type
2011-11-02 12:20:11 +01:00
Brian Anderson
e0f44730e8
rustc: Support 'companion mod's for crates and directory mods
...
Under this scheme when parsing foo.rc the parser will also look for
foo.rs to fill in the crate-level module, and when evaluating a
directory module directive it will look for a .rs file with the
same name as the directory.
2011-10-29 01:40:20 -07:00
Brian Anderson
2cebef095e
stdlib: Make io failures recoverable by returning a result
2011-10-29 01:25:11 -07:00
Brian Anderson
83219269d5
rustc: Remove broken --depend flag
2011-10-28 12:58:10 -07:00
Brian Anderson
8da8a4a018
rustc: Extract error reporting from codemap
2011-10-28 11:43:07 -07:00
Marijn Haverbeke
7dacccde94
Make shared kind the default only for generic functions
...
You almost never want a function with pinned type params. For
types, objects, resources, and tags, pinned types are actually often
more sane. For most of these, shared rarely makes sense. Only tricky
case is objs -- you'll have to think about the kinds you want there.
Issue #1076
2011-10-28 17:00:14 +02:00
Marijn Haverbeke
6fe7aa4aff
Move to blocks, rather than fn@s, in parser.rs
2011-10-28 16:41:56 +02:00
Marijn Haverbeke
7a0aee74bf
Move to short type parameter keywords
...
Issue #1076
2011-10-28 15:25:33 +02:00
Marijn Haverbeke
cba4ddc6a4
Start accepting short keywords for parameter kinds
...
This is a pre-snapshot commit to be able to implement #1076 without
the bootstrap compiler getting in my way.
2011-10-28 14:57:35 +02:00
Brian Anderson
8222fa4e27
Use the std::term color constants in the codemap
...
Exported constants work now. Woo!
2011-10-27 13:52:00 -07:00
Marijn Haverbeke
cfdf193c46
Update our code to new type parameter kind syntax
...
Closes #1067
2011-10-25 15:56:55 +02:00
Marijn Haverbeke
58c82a8da2
Remove support for @/~-style type param kind annotation
...
Issue #1067
2011-10-25 15:50:45 +02:00
Marijn Haverbeke
2884c722fe
Step one towards new type param kind syntax
...
Issue #1067
Needs a snapshot to finalize.
2011-10-25 14:31:56 +02:00
Brian Anderson
81a44ccacf
Remove hack to break the AST fold cycle. Closes #998
2011-10-21 17:47:31 -07:00
Marijn Haverbeke
b0a72ee06a
Be more careful when parsing block calls
...
Previously, the parser would try to interpret this as a block call:
if true {} // No semicolon
{|i, am, a, block|};
Which, though unlikely, might come up in practice.
2011-10-21 14:55:54 +02:00
Marijn Haverbeke
7114702496
Change the way block calls are parsed, mark them as block-calls.
...
This makes it possible to omit the semicolon after the block, and will
cause the pretty-printer to properly print such calls (if
pretty-printing of blocks wasn't so broken). Block calls (with the
block outside of the parentheses) can now only occur at statement
level, and their value can not be used. When calling a block-style
function that returns a useful value, the block must be put insde the
parentheses.
Issue #1054
2011-10-21 14:24:14 +02:00
Marijn Haverbeke
0ce40f60e7
Drop support for iter, put, and for-each
...
Closes #1056
2011-10-21 13:47:24 +02:00
Marijn Haverbeke
fd5a08384d
Move ast_util::pat_bindings over to new iter system.
...
Issue #1056
2011-10-21 12:41:42 +02:00
Marijn Haverbeke
6bcb4a426c
Remove last uses of iterators from stdlib
...
Issue #1056
2011-10-21 12:31:48 +02:00
Marijn Haverbeke
4ebbbe597e
Move hash table iteration over to block-taking functions
...
Issue #1056
2011-10-21 12:21:27 +02:00
Marijn Haverbeke
f134261ae6
Support Ruby-style block argument syntax
...
Issue #1054
2011-10-21 11:32:26 +02:00
Brian Anderson
ebc61e39d7
Remove temporary fn# syntax
2011-10-20 20:34:04 -07:00
Brian Anderson
5c38f7dfd7
Don't allow fn@ items
...
fn@ is intended to be caputring but isn't implemented.
2011-10-20 18:23:48 -07:00
Brian Anderson
9efdd0f326
Merge ast::proto_shared and ast::proto_closure
...
Now they are both just proto_shared and proto_shared takes an
argument indicating that it is sugared as 'lambda'
2011-10-20 18:23:48 -07:00
Brian Anderson
4b30a06abe
Rename ast::proto_fn to ast::proto_shared
2011-10-20 18:23:48 -07:00
Brian Anderson
29ad3bdb10
Make fn denote a bare function. Convert fn to fn@ as needed
2011-10-20 18:23:48 -07:00
Brian Anderson
f324704c0a
Parse obj methods as proto_bare
...
I don't know if this is the right thing to do, but it works
and it lets 'fn' always mean proto_bare
2011-10-20 18:23:48 -07:00
Brian Anderson
070c39ca1d
Split parsing of fn proto between types, items and anons
...
The meaning of various fn incantations is going to get temporarily confusing
2011-10-20 18:23:47 -07:00
Brian Anderson
0714bb5f7d
Fix the problem with check-fast randomly failing
...
Trans has been assuming that tag node id's are unique across crates and they
are not so, depending on which way the wind is blowing, it would choose to use
a crate-local tag variant instead of the correct one from std.
No test case since I can't come up with a reliable one that compiles in a
reasonable amount of time.
2011-10-20 15:38:51 -07:00
Brian Anderson
880b1ec9f5
Fail nicer when the parser doesn't find an expected string literal
...
Closes #1028
2011-10-19 18:04:44 -07:00
Brian Anderson
ac276f7016
Introduce fn@ as a synonym for fn
2011-10-18 11:14:02 -07:00
Niko Matsakis
212707ce84
make native functions markable as unsafe and incorporate that
...
into the type check
2011-10-12 14:39:34 -07:00
Niko Matsakis
cbe8da0655
make treatment of unchecked/unsafe blocks more uniform
...
also repair various errors in the parser related to such blocks.
rename checked_blk to default_blk to reflect the fact that it
inherits its purity from the surrounding context.
2011-10-12 14:39:24 -07:00
Niko Matsakis
046ca827dd
Add unsafe blocks, unsafe functions, and two rudimentary tests
...
related to them
2011-10-12 14:26:47 -07:00
Niko Matsakis
29584cc5ac
Extend the unchecked block stuff to allow unsafe blocks as well.
2011-10-12 14:26:47 -07:00
Niko Matsakis
58b8e88356
expand purity to include unsafe
2011-10-12 14:26:47 -07:00
Brian Anderson
b277039325
Introduce ast::proto_bare
...
Issue #1022
2011-10-11 10:51:10 -07:00
Brian Anderson
9c46cc58cb
Add a temporary syntax for bare functions
...
Bare functions will be represented as 'fn#' until they're implemented. Then
we'll switch it over to just 'fn'.
Issue #1022
2011-10-11 10:51:09 -07:00
Marijn Haverbeke
33167f7dec
Adjust function signatures to allow for vecs being immediate
...
Some code was relying on vectors being implicitly by-reference (as
non-immediate value). This adds the necessary &&-sigils.
Closes #1021
2011-10-10 16:01:51 +02:00
Marijn Haverbeke
f26e770745
Make 1-1 parse again
...
Issue #954
This is not a very elegant fix -- we should probably do something with
constant folding to handle negative-int alt patterns in the future.
2011-10-07 16:46:44 +02:00
Marijn Haverbeke
fe916fb9f0
Give up on providing a by-value version of map, convert fold over to
...
passing pointers by ref
Issue #1008
2011-10-07 09:56:12 +02:00
Marijn Haverbeke
f9fbd86f52
Parse and typecheck by-value and by-ref arg specs
...
Add sprinkle && throughout the compiler to make it typecheck again.
Issue #1008
2011-10-07 09:09:50 +02:00
Marijn Haverbeke
6a4270523e
Ignore && and + before argument names.
...
Issue #1008
2011-10-06 10:16:52 +02:00
Patrick Walton
968b66ad40
rustc: Implement C stack stdcall
2011-10-03 13:59:38 -07:00
Patrick Walton
f7d0c1cec3
rustc: Add a new "C stack cdecl" native ABI
2011-09-28 12:58:33 -07:00
Brian Anderson
381205b747
Revert "Revert "Implement pattern ranges for all numeric types.""
...
This reverts commit a034f87146
.
Conflicts:
src/comp/middle/check_alt.rs
src/comp/middle/trans_alt.rs
src/comp/syntax/ast.rs
src/comp/syntax/ast_util.rs
src/comp/syntax/fold.rs
src/comp/syntax/print/pprust.rs
Conflicts:
src/comp/middle/trans_alt.rs
2011-09-28 12:46:29 -07:00
Wade Mealing
f375391cb6
Patch to error instead of crashing when parsing unmatched double quotes
...
Patch to error and fail instead of using all available memory
then crashing to detect the error condition of an unmatched
double quote before the end of a file.
I couldn't get it to show nice error messages, so this may not be
the ideal fix.
A test case for this situation has also been added.
2011-09-27 23:20:31 -07:00
Marijn Haverbeke
8911aef798
Make return-by-ref function headers pretty-print safely
...
Closes #972
2011-09-26 04:11:35 +02:00
Jesse Ruderman
3b5b29c7ec
Reduce and clarify abuse of 'pure' in interner
2011-09-24 16:33:26 -07:00
Jesse Ruderman
064f52fa96
Mark some fns as pure so type_is_unique_box doesn't need to be unchecked
2011-09-24 15:36:09 -07:00
Brian Anderson
856acbf66d
Vectors containing pinned kinds become pinned
...
Otherwise they could be copied
2011-09-24 12:36:51 -07:00
Brian Anderson
122f714fde
Add missing case for pat_uniq to syntax::visit
...
Issue #409
2011-09-23 16:03:35 -07:00
Brian Anderson
2082f67765
Begin to support pattern matching on unique boxes
...
Issue #409
2011-09-23 15:15:30 -07:00
Marijn Haverbeke
b029789f02
Remove backward-compatible support for 'mutable' before type.
...
Closes #966
2011-09-23 09:58:51 +02:00
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
Brian Anderson
f809e22697
Represent unique creation as a unop in the AST instead of its own expr
...
Like the box unop.
Issue #409
2011-09-20 18:06:47 -07:00
Brian Anderson
865dcb663d
Parse unique box types
...
Issue #409
2011-09-20 17:51:17 -07:00
Brian Anderson
b1bf9ef5ae
Break fold's circular reference during unwinding
...
This converts the AST fold into a resource that breaks it's own circular
reference (just a temporary workaround until GC), so that failure during fold
will unwind correctly.
Issue #936
2011-09-19 15:32:56 -07:00
Marijn Haverbeke
133d36f452
Require body of else-less if expressions to be a value-less block
...
For consistency with other constructs that could not possibly return a
value (say, loops).
2011-09-16 18:21:06 +02:00
Marijn Haverbeke
d7587c1eda
Change convention for specifying referenced argument
...
It is now 1-based, rather than 0 based. (Seems more natural, and allows 0 to
be used to refer to self and maybe to closure.)
Also allows non-referenced args to be implicitly copied again.
Issue #918
2011-09-16 12:42:18 +02:00
Jesse Ruderman
ce1877dc8e
Add parens, as needed, around else-if conditions.
2011-09-15 21:24:24 -07:00
Marijn Haverbeke
7364a8c2b0
Prevent binary expressions from parsing when lhs is non-value block
2011-09-15 17:37:10 +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
25787bd2b8
Forbid assignment to by-reference bindings
...
Issue #918
2011-09-15 14:08:54 +02:00
Marijn Haverbeke
1cda74deee
Add representation for by-ref let bindings
...
Issue #918
2011-09-15 11:42:56 +02:00
Marijn Haverbeke
197f360e30
Ensure parens are wrapped around composite exprs in call/index/field pos
...
This is needed to fix the second example in issue #919
2011-09-15 11:15:14 +02:00
Marijn Haverbeke
8c83ea564b
More thorough check for (.. 10).x in pretty-printer
...
Closes #919
2011-09-15 10:59:06 +02:00
Marijn Haverbeke
63ecc84562
Also handle fail and put in print_maybe_parens_discrim
...
Closes #920
2011-09-15 10:14:52 +02:00
Marijn Haverbeke
3798b6f780
Remove maybe_protect_block kludge from pretty-printer
...
It is no longer needed.
2011-09-15 10:14:52 +02:00
Marijn Haverbeke
0b34e0e60b
Introduce new semicolon rules
...
- Loop bodies and resource constructors aren't allowed to have
trailing expressions anymore.
- An expression that ends* in a block without trailing expression can
can not be called, indexed, or subscripted.
- Only expression-statements that end* in a block without trailing
expression can omit their semicolon.
*) 'Ending in a trailing expression' is defined as being a block or
construct-ending-in-a-block (if, alt) that either ends in an
expression itself, or ends in another block-like expression that
has a trailing expression (by these same rules).
2011-09-15 09:49:00 +02:00
Marijn Haverbeke
7298b8f4ba
Insert omitted semicolons for statements
2011-09-15 09:49:00 +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
c1c083cd66
Refactor parse_ret_ty, start parsing by-alias return specs
2011-09-14 10:46:40 +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
Josh Matthews
f6fe07d1f3
Add support for negative literals.
2011-09-14 00:47:14 -04:00
Marijn Haverbeke
577d6dd602
Improve lexing of float literals
...
Closes #575
2011-09-13 17:43:01 +02:00
Marijn Haverbeke
f72573cce8
Properly pretty-print 10.x
...
Closes #890
2011-09-13 17:08:59 +02:00
Marijn Haverbeke
e64e9792ab
Make pretty-printer wrap fail/ret/put in parens in call/index/field pos
...
Closes #764
Closes #891
2011-09-13 17:02:36 +02:00
Marijn Haverbeke
be5537e95f
Be more strict about what constitutes a block expression
...
Blocks (or statements involving blocks) that end in a semicolon are no
longer considered the block-expression of their outer block. This used
to be an expression block, but now is a statement block:
{ if foo { ret 1; } else { ret 10; } }
This helps clear up some ambiguities in our grammar.
2011-09-13 15:50:03 +02:00
Graydon Hoare
7f94957721
Kill trailing whitespace.
2011-09-12 16:33:43 -07:00
Graydon Hoare
a4815b6742
Factor imports mindlessly.
2011-09-12 16:13:28 -07:00
Marijn Haverbeke
f4b6264f8c
Remove backwards-compatibility with old arg-mode syntax
2011-09-12 12:49:00 +02:00
Marijn Haverbeke
ca1df2b111
Pretty-print for new arg-mode syntax
2011-09-12 12:49:00 +02:00
Marijn Haverbeke
bfa021de0d
Switch pretty-printer to new arg-mode syntax
2011-09-12 12:48:59 +02:00
Marijn Haverbeke
3667137a41
Accept {|| ... } for argument-less block syntax
...
Closes #880
2011-09-12 12:04:41 +02: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
Jesse Ruderman
476bbca87a
Fuzzer: move tys around in addition to exprs
2011-09-10 18:55:09 -07:00
Jesse Ruderman
7182054416
Add missing arm, so pretty-printing the statement 'copy 1;' does not die.
2011-09-09 21:27:07 -07:00
Jesse Ruderman
8e00161819
Make the pretty printer disambiguatae blocks followed by vec expressions.
...
Semicolons are needed here now that postfix [] is used for vec indexing (the syntax change made in rev 518dc52f85
).
2011-09-09 19:47:40 -07:00
Brian Anderson
f1555e2ca8
Rename ty_istr to ty_str. Issue #855
2011-09-02 22:11:46 -07:00
Brian Anderson
b16457627c
Stop parsing transitional istr forms. 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
477c1bf6e1
Remove rustc::syntax::untyped_ast. Dead code
2011-09-02 16:40:59 -07:00
Marijn Haverbeke
785c26f7f4
Rename ivecs to vecs in the compiler
2011-09-02 16:09:41 +02:00
Brian Anderson
9c173f17c0
Remove lots of estr code from rustc. Issue #855
2011-09-01 23:25:33 -07:00
Brian Anderson
1d3eb4911a
Remove #ifmt. Issue #855
2011-09-01 18:54:06 -07:00
Brian Anderson
418d09e547
Convert all uses of #ifmt to #fmt. Issue #855
2011-09-01 18:54:03 -07:00
Brian Anderson
6972f07510
Make #fmt and #ifmt synonymous. Issue #855
2011-09-01 17:56:25 -07:00
Brian Anderson
ab6bb035e5
Rename std::istr to std::str. Issue #855
2011-09-01 17:27:58 -07:00
Brian Anderson
e35c021aa4
Parse "",str as istrs. Pretty print istrs as "",str. Issue #855
2011-09-01 16:53:53 -07:00
Brian Anderson
e824775d53
Remove std::str. Issue #855
2011-09-01 16:09:15 -07:00
Brian Anderson
7924368268
Allow istrs as patterns. Issue #855
2011-09-01 12:14:36 -07:00
Brian Anderson
3fe743bc9c
Remove various istr conversions. Issue #855
2011-09-01 12:14:34 -07:00
Brian Anderson
775b64c955
Remove the estr #fmt. Issue #855
2011-09-01 12:14:31 -07:00
Marijn Haverbeke
6ba4eacddf
Make resolve recognize upvars
...
Upvars are now marked with def_upvar throughout, not just when going
through freevars::lookup_def. This makes things less error-prone. One
thing to watch out for is that def_upvar is used in `for each` bodies
too, when they refer to a local outside the body.
2011-09-01 16:32:44 +02:00
Marijn Haverbeke
2d1dec78e7
Move mutability checking into its own pass.
...
Having it in the alias pass was slightly more efficient (finding
expression roots has to be done in both passes), but further muddled
up the already complex alias checker.
Also factors out some duplication in the mutability-checking code.
2011-09-01 16:32:38 +02:00
Marijn Haverbeke
34ae491ca9
Store arg mode and objfield mutability in their def
2011-09-01 16:32:38 +02:00
Brian Anderson
1772ee3c43
Remove a few more usages of std::str from rustc. Issue #855
2011-08-31 16:24:08 -07:00
Brian Anderson
498e38b705
Convert uses of #fmt to #ifmt. Issue #855
2011-08-31 11:44:06 -07:00
Brian Anderson
eb70267e5e
Convert #env to istrs. Temporarily disable usage in rustc. Issue #855
2011-08-30 21:08:07 -07:00
Brian Anderson
4c936d7992
Add #ifmt extension, like #fmt but for istrs. Issue #855
2011-08-30 21:08:07 -07:00
Brian Anderson
9e2c5f77a4
Remove the %S istr conversion from #fmt
...
I want to do the #fmt transition a different way. Issue #855
2011-08-30 21:08:07 -07:00
Marijn Haverbeke
7bbe8d2e8c
Stop relying on klunky hack in alias.rs
...
It assumed node_ids increased monotonically for locals, but macros
make this no longer the case, and it was a dubious assumption anyway.
It now numbers locals itself and uses that to determine which precede
which.
2011-08-30 17:03:00 +02:00
Marijn Haverbeke
c9c5ee252a
Implement non-internal ivecs
...
Vectors are now similar to our old, pre-internal vectors, except that
they are uniquely owned, not refcounted.
Their name should probably change too, then. I've renamed them to vec
in the runtime, will do so throughout the compiler later.
2011-08-29 09:07:53 +02:00