Commit graph

1769 commits

Author SHA1 Message Date
Tim Chevalier
e36df0f6c8 Handle fail after return correctly in typestate
Previously, typestate would conclude that this function was
correctly diverging:

fn f() -> ! { ret; fail; }

even though it always returns to the caller. It wasn't handling the
i_diverge and i_return bits correctly in the fail case. Fixed it.

Closes #897
2012-01-20 17:26:31 -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
Tim Chevalier
c7592803d9 Compute typestates for FRU exprs correctly, plus a bit of cleanup
The code in Issue 948 was causing typestate to diverge because
it was using the prestate for the whole expression -- not the post-
state for the fields list -- as the prestate for the record base
expression. Fixed.

Closes #948
2012-01-19 17:24:27 -08:00
Patrick Walton
b58f2b7bfb Merge pull request #1571 from kevina/fixup-1
Remove incorrect comments from a few test cases.
2012-01-19 17:21:29 -08:00
Kevin Atkinson
d388daa996 Remove incorrect comments from a few test cases. 2012-01-19 17:31:36 -07:00
Patrick Walton
3333fef1af test: "tag" -> "enum" in run-pass and run-fail 2012-01-19 16:11:17 -08:00
Patrick Walton
1461cfe416 test: "tag" -> "enum" in bench 2012-01-19 16:11:17 -08:00
Patrick Walton
d97783e3e5 test: "tag" -> "enum" in compile-fail 2012-01-19 16:01:47 -08:00
Patrick Walton
1731f5d709 test: Fix error patterns in name-clash-nullary 2012-01-19 14:47:43 -08:00
Tim Chevalier
94d2063577 Handle log expressions with a _|_-typed level
If we have log(foo, quux) where foo:_|_, just translate foo and
ignore the rest of the expression.

Closes #1459
2012-01-19 14:44:40 -08:00
Tim Chevalier
3e25444e51 In trans, allow _|_-typed things to be the argument to fail
Rationale: _|_-typed things diverge, so it's safe to use them in
any context.

Closes #1465
2012-01-19 13:30:31 -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
Haitao Li
327a15d58c rustc: Add a usage pass to collect one-off analyses
This patch starts from move the analysis which checkes of probably
incorrectly usage of `int|uint` in native fn.

Issue #1543
2012-01-19 17:27:44 +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
Patrick Walton
5ac57d1891 test: Don't test that tags with zero variants are supported 2012-01-18 12:43:01 -08:00
Haitao Li
f03eb96f39 rustc: Warn when int or uint is used in a native type decl
Issue #1403
2012-01-19 02:10:36 +08:00
Brian Anderson
6e27b27cf8 libstd: Move std tests into libstd 2012-01-17 19:48:58 -08:00
Brian Anderson
17bf4b0e1b libcore: Move core tests into libcore 2012-01-17 19:41:05 -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
Marijn Haverbeke
1375b31c1c Store type names in crate metadata
Improves type error messages referring to external types.

Issue #1507
2012-01-16 12:08:00 +01:00
Marijn Haverbeke
c2fe7b6398 When pretty-printing fn types, leave off arg modes when they are the default
This reduces ++/&& spam in the output to a bare minimum.

Issue #1507
2012-01-16 12:08:00 +01:00
Kevin Atkinson
e1c50c4410 Don't evaluate discriminator value constants when parsing.
Remove disr_val from ast::variant_ and always use ty::variant_info
when the value is needed.  Move what was done during parsing into
other passes, primary typeck.rs.  This move also correctly type checks
the disr. value expression; thus, fixing rustc --pretty=typed when
disr. values are used.
2012-01-16 11:19:33 +01: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
Kevin Cantu
d8b0a1910a Added string functions: split_func, split_char, lines, lines_any, words,
and more tests
2012-01-15 20:20:06 -08:00
Brian Anderson
3466c9b4be rustc: Parse fn inner attributes. Closes #1506 2012-01-15 17:48:58 -08:00
Brian Anderson
7e6ce6637e bench: Lower the default inputs on many shootout benchmarks
Make them run a bit faster during normal testing
2012-01-14 20:34:02 -08:00
Brian Anderson
1588ae204e bench: Update shootout-nbody for style 2012-01-14 20:29:56 -08:00
Brian Anderson
93dcb9fb6b bench: Update fannkuchredux for style 2012-01-14 20:13:03 -08:00
Brian Anderson
9c21673e3f bench: Update shootout-binarytrees for style 2012-01-14 20:13:03 -08:00
Brian Anderson
c53d0a0af8 bench: Update shootout-ackermann for performance 2012-01-14 20:13:01 -08:00
Brian Anderson
492dba8bfe bench: Update shootout-fibo for performance 2012-01-14 19:39:52 -08:00
Brian Anderson
c6f62b6374 bench: Update shootout-binarytrees to use unique boxes
Shared boxes have a huge performance overhead due to #1493
2012-01-14 17:02:51 -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
Brian Anderson
d76362d45e test: Simplify rope::bal1. Closes #1424 2012-01-13 14:55:07 -08:00
Brian Anderson
e66c036c9f libcore: Add task::try 2012-01-13 14:21:17 -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