Tim Chevalier
e5d095d67e
Change option::t to option
...
Now that core exports "option" as a synonym for option::t, search-and-
replace option::t with option.
The only place that still refers to option::t are the modules in libcore
that use option, because fixing this requires a new snapshot
(forthcoming).
2012-01-31 17:05:20 -08:00
Kevin Cantu
c7454f5595
Rename str::to_chars -> str::chars
2012-01-31 14:29:11 -08:00
Tim Chevalier
45c1dfe5b3
Don't compute pre- and postconditions for item_consts
...
Since item_consts can't refer to or modify local variables, they
don't participate in typestate and thus get empty pre and
postconditions by default.
Closes #1660
2012-01-31 11:52:46 -08:00
Tim Chevalier
fba35e1a3c
Require alts to be exhaustive
...
middle::check_alt does the work. Lots of changes to add default cases
into alts that were previously inexhaustive.
2012-01-31 10:08:24 -08:00
Brian Anderson
0e498da47e
rustc: Allow attributes on methods. Closes #1709
2012-01-30 11:43:45 -08:00
Paul Woolcock
a02493b969
Fix last failing test
...
All tests now pass, without the ternary operator.
2012-01-30 18:21:12 +01:00
Paul Woolcock
e1f15a71e3
Alter/remove tests that include/concern ternary
...
3 tests, pretty/block-disambig.rs, run-pass/operator-overloading.rs,
and run-pass/weird-exprs.rs, all included the ternary operator. These
were changed to use the if-then-else construct instead.
2 tests, run-pass/block-arg-in-ternary.rs and run-pass/ternary.rs, were
only there because of the ternary operator, and were removed.
2012-01-30 18:20:05 +01:00
Marijn Haverbeke
964bd485c6
Revert self types
2012-01-30 11:37:52 +01:00
Brian Anderson
fa13fd9d64
rt: Remove set_min_stack
2012-01-29 21:27:37 -08:00
Brian Anderson
3321880f13
Merge remote-tracking branch 'killerswan/fixing_strings_2'
...
Conflicts:
src/comp/driver/driver.rs
src/comp/middle/trans/base.rs
src/comp/syntax/parse/lexer.rs
2012-01-27 16:44:40 -08:00
Marijn Haverbeke
b80f0a3c9f
Use the method name 'unary-' for overloading negation
...
It's less likely to clash with something than 'neg'.
Issue #1520
2012-01-27 10:06:53 +01:00
Marijn Haverbeke
6bead0e4cc
Use operator names for operator methods
...
The methods used to implement operators now simply use
the name of the operator itself, except for unary -, which is called
min to not clash with binary -. Index is called [].
Closes #1520
2012-01-26 15:52:28 +01:00
Marijn Haverbeke
888262b337
Allow operator overloading of the indexing operator
...
The method `op_index` (which takes a single argument) is used for
this.
Issue #1520
2012-01-26 15:23:11 +01:00
Marijn Haverbeke
87b064b249
First stab at operator overloading
...
When no built-in interpretation is found for one of the operators
mentioned below, the typechecker will try to turn it into a method
call with the name written next to it. For binary operators, the
method will be called on the LHS with the RHS as only parameter.
Binary:
+ op_add
- op_sub
* op_mul
/ op_div
% op_rem
& op_and
| op_or
^ op_xor
<< op_shift_left
>> op_shift_right
>>> op_ashift_right
Unary:
- op_neg
! op_not
Overloading of the indexing ([]) operator isn't finished yet.
Issue #1520
2012-01-26 14:25:06 +01:00
Brian Anderson
2999479a2d
rustc: Allow attributes on enum variants. Closes #1663
2012-01-25 16:24:06 -08:00
Brian Anderson
4168101b03
test: Un-xfail run-pass/tag-auto-disr-val-shape
2012-01-25 12:44:13 -08:00
Brian Anderson
19a9a475a6
test: Add regression test for #1659
2012-01-25 12:40:08 -08:00
Brian Anderson
ba7299ba65
test: Un-xfail run-pass/tag-disr-val-shape
...
Fixed by 96f1eda6d0
2012-01-25 12:34:37 -08:00
Marijn Haverbeke
2d4d8e8bdb
Implement implicit self type parameters for ifaces
...
Closes #1661
2012-01-25 20:47:11 +01:00
Kevin Cantu
c7b23f9a86
Replacing str::unsafe_from_bytes with str::from_bytes (part 1)
2012-01-25 00:53:17 -08:00
Niko Matsakis
5e13d19cc0
s/block()/fn()/g
2012-01-23 19:06:33 -08:00
Tim Chevalier
9dc59e1506
Export all enum variants by default; new syntax for selectively exporting variants
...
See issue 1426 for details. Now, the semantics of "export t;" where t is a tag are
to export all of t's variants as well. "export t{};" exports t but not its
variants, while "export t{a, b, c};" exports only variants a, b, c of t.
To do:
- documentation
- there's currently no checking that a, b, c are actually variants of t in the
above example
- there's also no checking that t is an enum type, in the second two examples above
- change the modules listed in issue 1426 that should have the old export
semantics to use the t{} syntax
I deleted the test export-no-tag-variants since we're doing the opposite now,
and other tests cover the same behavior.
2012-01-23 15:48:08 -08:00
Brian Anderson
a88c0847c2
core: Reexport all the imports in f32/64
2012-01-22 16:42:00 -08:00
Niko Matsakis
ec8273587c
update to new tag syntax
2012-01-21 19:31:52 -08:00
Niko Matsakis
85a3298229
unify size_of, align_of into one call (metrics)
...
create some new (xfail'd) tests looking at tag variant alignment
2012-01-21 19:31:52 -08:00
Niko Matsakis
cd1056df78
migrate size_of() and related funcs from trans into shape
2012-01-21 19:31:51 -08:00
Graham Fawcett
7763b40c71
issue #1352 : change param order on vec::init_elt, putting block in final position.
...
To match the init_fn() and init_fn_mut() changes.
2012-01-21 13:33:16 -08:00
Brian Anderson
8c92ea49d3
core: Shuffle around a #fmt test
2012-01-21 13:20:14 -08:00
Tim Chevalier
ba5cc236f7
WIP on issue 1426 (exporting all tags)
...
Support Lenny222's proposed syntax for exporting a tag without
its variants, or selected tags from a variant, in the AST and parser.
No support further down the line yet. Tests are xfailed.
2012-01-20 19:48:33 -08:00
Tim Chevalier
d242edb57b
Handle predicates that recurse in a check() expression
...
typestate was using the enclosing function ID for the "this function
returns" constraint, which meant confusion and panic in the case
where a predicate p includes "check p()". Fixed it to use a fresh
ID.
Closes #933
2012-01-19 22:53:22 -08:00
Graydon Hoare
7b1a8f0a91
Additional ; to , changes, disable "tag" and ";" in parser. Close #1430 . Close #1428 .
2012-01-19 19:29:21 -08:00
Patrick Walton
59ebe6af18
rustc: Make the pretty printer output commas after enum variants. Update all tests accordingly.
2012-01-19 18:41:06 -08:00
Patrick Walton
3333fef1af
test: "tag" -> "enum" in run-pass and run-fail
2012-01-19 16:11:17 -08:00
Niko Matsakis
882bea5b6d
Rename fn*() to fn() as originally planned.
2012-01-19 07:11:50 -08:00
Niko Matsakis
1f0b3d2247
treat fn*() as fn&()
...
This is not my ideal way of going about things. I'd prefer not
to have expressions typed as fn*(), for example, but I couldn't
get that to work together with inferring the modes of arguments
and other corner cases.
2012-01-19 07:10:59 -08:00
Tim Chevalier
5b028f527f
Remove support for the '.' after a nullary tag in a pattern
...
(Commit also includes lots of changes to remove '.'s that a git
merge messed up, or else it was monkeys.)
2012-01-19 01:04:59 -08:00
Tim Chevalier
04a2887f87
Remove '.' after nullary tags in patterns
...
Does what it says on the tin.
The next commit will remove support for this syntax.
2012-01-18 23:17:34 -08:00
Niko Matsakis
54f6bf57e6
remove align_mode and rewrite GEP_tup_like to align correctly
...
Although the old version of GEP_tup_like was incorrect in some
cases, I do not believe we ever used it in an incorrect fashion.
In particular, it could go wrong with extended index sequences
like [0, 1, 3], but as near as I can tell we only ever use it
with short sequences like [0, i].
2012-01-18 17:20:46 -08:00
Niko Matsakis
da828747e6
correct use of GEP_tup_like in closure constr
...
also, streamline type_is_tup_like() to the cases which
actually work
2012-01-18 17:20:46 -08:00
Graydon Hoare
711fc20d88
Merge pull request #1544 from kevina/issue-1393
...
Minor cleanups to custom discriminator code.
2012-01-17 12:45:09 -08:00
Niko Matsakis
a83ad1b9e6
encode variant names and have log print them out.
2012-01-17 10:33:28 -08:00
Tim Chevalier
c3bc8fada8
Allow omission of the '.' after nullary tag patterns
...
This commit allows patterns like:
alt x { some(_) { ... } none { } }
without the '.' after none. The parser suspends judgment about
whether a bare ident is a tag or a new bound variable; instead,
the resolver disambiguates.
This means that any code after resolution that pattern-matches on
patterns needs to call pat_util::normalize_pat, which consults
an environment to do this disambiguation.
In addition, local variables are no longer allowed to shadow
tag names, so this required changing some code (e.g. renaming
variables named "mut", and renaming ast::sub to subtract).
The parser currently accepts patterns with and without the '.'.
Once the compiler and libraries are changed, it will no longer
accept the '.'.
2012-01-17 10:08:16 -08:00
Kevin Atkinson
bdc8e8d222
Minor cleanups to custom discriminator code.
...
Mostly updates to the comments and docs from Pull Request #1537 .
2012-01-16 21:04:02 -07:00
Kevin Atkinson
2d36a71aee
Update pretty printer to print out disr. values.
...
Partly fixes issue #1510 . "rustc --pretty=typed" fails.
2012-01-16 11:19:32 +01:00
Brian Anderson
3466c9b4be
rustc: Parse fn inner attributes. Closes #1506
2012-01-15 17:48:58 -08:00
Niko Matsakis
4a34a7128a
xfail the tests for now, pending #1511 being fixed
2012-01-13 15:30:50 -08:00
Brian Anderson
a2e07a97ba
test: xfail-pretty run-pass/tag-disr-val-shape
2012-01-13 15:14:06 -08:00
Niko Matsakis
31bb6a60bb
Fixes #1499 : a test that shape code can walk explicit disr values
2012-01-13 13:57:06 -08:00
Niko Matsakis
8685a1f7c4
distinguish "any closure" and "stack closure" (block)
2012-01-13 09:31:40 -08:00
Niko Matsakis
3f3bfeec27
make "native fn" the type for bare functions, remove fn exprs
2012-01-13 06:27:35 -08:00
Niko Matsakis
455f8b0d45
deprecate fn exprs and the fn() type, preferring fn@ and native fn
2012-01-13 06:27:34 -08:00
Marijn Haverbeke
d2be5b6c7a
Remove tests for objs, adjust tests that use objs
2012-01-13 11:52:13 +01:00
Niko Matsakis
8818f42b19
make parser disambiguate fn~ at top level correctly
2012-01-12 13:47:38 -08:00
Niko Matsakis
263f4c58a0
add tydescs into shape, rewrite walk_fn_contents()
2012-01-12 13:47:38 -08:00
Niko Matsakis
e55aa6e5ef
free uniq data we encounter on the sweep, walk thru them otherwise
2012-01-12 13:47:38 -08:00
Marijn Haverbeke
56fe4c2681
Implement passing cast-to-vtable values as bounded params
...
Closes #1492
2012-01-12 16:57:58 +01:00
Brian Anderson
70367d757c
test: xfail-win32 run-pass/too-much-recursion
2012-01-11 15:10:36 -08:00
Brian Anderson
94c389a25b
rt: Add RUST_MAX_STACK env var with 8MB default
...
Closes #1489
2012-01-11 13:57:11 -08:00
Niko Matsakis
c68345e57e
add a log_str() function and allow '%?' in fmt strings to use it
2012-01-11 10:32:54 -08:00
Niko Matsakis
f3b867fd04
add section on spawn_connected to tutorial and pull test into file
2012-01-11 09:49:21 -08:00
Niko Matsakis
441a42c5d2
update shape code to handle iface instances
2012-01-10 19:05:28 -08:00
Kevin Atkinson
1dc3debdaf
Add support for casting enum-like tags to scalar values.
2012-01-10 15:59:57 -08:00
Kevin Atkinson
08abf8d37f
Support explicit discriminant numbers on tag variants.
...
Addresses issue #1393 .
For now disallow disr. values unless all variants use nullary
contractors (i.e. "enum-like").
Disr. values are now encoded in the crate metadata, but only when it
will differ from the inferred value based on the order.
2012-01-10 15:59:57 -08:00
Niko Matsakis
8b911587df
rename sendfn to fn~, lambda to fn@
2012-01-10 13:31:06 -08:00
Niko Matsakis
110c3ccdca
add rust_task_is_unwinding predicate and do not kill if already unwinding
2012-01-09 19:53:32 -08:00
Austin Seipp
a94b1ccacb
Change all uses of 'when' in alt-patterns to 'if'
...
Issue #1396
2012-01-09 19:27:05 -08:00
Graydon Hoare
8387896dda
Remove proto_sugar and 'lambda' as keyword, commit to fn@.
2012-01-09 16:12:48 -08:00
Marijn Haverbeke
f30c5ea686
Remove leftover comm.rs in std
...
(The actual comm module lives in core.)
2012-01-09 14:53:13 +01:00
Niko Matsakis
7a336f1e7c
modify last use to take into account cap clause, add new test
2012-01-08 14:57:03 -08:00
Niko Matsakis
6237368cc2
plug leak: free shared type descrs recursively, as we ought to
2012-01-06 22:40:32 -08:00
Niko Matsakis
4f52e5a5ec
make size_of and align_of take an optional value
2012-01-06 22:40:31 -08:00
Niko Matsakis
9f84f88276
port over the tests to use the new API
2012-01-06 22:40:31 -08:00
Niko Matsakis
e88905cd28
remove trailing whitespace
2012-01-06 22:07:29 -08:00
Niko Matsakis
373dbe7741
test exposing memory management failure for #1078
2012-01-06 21:15:27 -08:00
Marijn Haverbeke
41a2d8495e
Fix pretty-printing of ty params in iface methods
2012-01-06 17:40:05 +01:00
Marijn Haverbeke
7c1f683c6d
Fix bug in method type parameter passing
...
It would occasionally pass the wrong type parameter, when calling
a generic method from a generic impl on a bounded param type.
2012-01-06 17:40:05 +01:00
Niko Matsakis
f832edc369
require a non-semi expr acting as a stmt to have unit return type
2012-01-05 10:44:38 -08:00
Niko Matsakis
37ba5f3b32
make parser handle parenthesized block-sugar exprs properly
2012-01-05 10:44:38 -08:00
Stefan Plantikow
c8467977c4
Merge branch 'master' into kmath
...
Conflicts:
src/libcore/float.rs
2012-01-05 17:20:13 +01:00
Stefan Plantikow
494ad4e601
Merge branch 'master' into kmath
2012-01-05 16:25:51 +01:00
Marijn Haverbeke
60ae1590af
Switch to new param kind bound syntax
...
And remove support for the old syntax
2012-01-05 15:50:02 +01:00
Stefan Plantikow
6284190ef9
Merge branch 'master' into kmath
...
Conflicts:
src/libcore/cmath.rs
2012-01-05 02:07:12 +01:00
Marijn Haverbeke
71c1c15805
xfail-pretty iface-generic.rs until i have time to debug
2012-01-04 19:58:02 +01:00
Marijn Haverbeke
b02a77d6b4
Add test for generic iface methods
...
Issue #1227
2012-01-04 17:30:36 +01:00
Tim Chevalier
439e28b751
Add missing ty_constr cases to trans::type_of_inner and ty::fold_ty.
...
Closes #970
2012-01-03 15:50:05 -08:00
Niko Matsakis
72a3667eb3
Allow tail expressions even in no_value blocks. Type checker
...
will guarantee they have unit type.
2012-01-03 13:13:52 -08:00
Niko Matsakis
43a9d50a74
new tests
2012-01-03 13:13:52 -08:00
Brian Anderson
513a263e81
Merge pull request #1392 from Lenny222/list
...
list: add "is_not_empty" requirement to "head" and "tail" (analogous to "vec")
2012-01-03 12:18:53 -08:00
Marijn Haverbeke
4e88d5ae92
Make resolution of dictionaries on bounded params work
...
Issue #1227
2012-01-03 16:37:41 +01:00
Marijn Haverbeke
5ea3c96938
Wire in resolution of param bounds for method calls
...
Issue #1227
2012-01-03 16:18:40 +01:00
Marijn Haverbeke
15be2fc73a
Add 'copy' bounds to functions that were faultily accepted without
...
Issue #1390
2012-01-02 15:31:58 +01:00
Marijn Haverbeke
bd6646e698
Make last-use pass properly handle closed-over variables
...
Closes #1399
2012-01-02 10:20:58 +01:00
User Jyyou
a59c4b1b47
freebsd support
2012-01-01 20:18:55 -08:00
Stefan Plantikow
49d36c7f85
Trying to remove wrappers from float
2011-12-31 03:45:17 +01:00
Niko Matsakis
aa5382bb13
split proto from fn_decl, as not all fn_decls know the proto.
...
this will address the (crashing) new test added.
2011-12-29 20:29:28 -08:00
Graydon Hoare
36c55b20a8
Add support in lexer for utf8 identifiers. No NFKC logic in char yet.
2011-12-29 14:45:18 -08:00
Lenny222
d07c6e8a0e
list: use predicate to enforce non-empty requirement
2011-12-29 21:24:03 +01:00
Graydon Hoare
f0dfbe7b1b
Register new snapshots, purge log_err and log_full in favour of log(...).
2011-12-22 17:53:53 -08:00
Graydon Hoare
389329ef1e
Merge all 3 log syntaxes, tidy up residual misuses.
2011-12-22 16:14:00 -08:00
Graydon Hoare
8b580954fe
Register snapshots and switch logging over to use of log_full or #error / #debug.
2011-12-22 14:42:52 -08:00