Commit graph

450 commits

Author SHA1 Message Date
Tim Chevalier
698c6406ba Reject programs with unsatisfied predicate constraints
Generate appropriate constraints for calls to functions with
preconditions, and reject calls where those constraints don't
hold true in the prestate.

...by which I mean that it works for one test case :-)
2011-06-10 19:17:15 -07:00
Graydon Hoare
9671d21408 Implement meta tag matching in creader. Start using it in rustc.rc. Close #459. Close #457. 2011-06-10 15:54:41 -07:00
Graydon Hoare
52c4c9014f Encode meta tags in the crate and start sketching enhanced logic for resolving crate "use" directives.
Now with extra "works on OSX" kludging.
2011-06-10 12:57:29 -07:00
Patrick Walton
7b7c746c1e Merge pull request #447 from paulstansifer/quick_error_message_fix
Error message, instead of segfault, when recursive types are used.
2011-06-10 10:53:42 -07:00
Patrick Walton
dfdd6dbc54 rustc: Remove the bitwise not operator 2011-06-10 10:47:33 -07:00
Marijn Haverbeke
fccf065266 Implement mutable/immutable alias distinction.
Before, all aliases were implicitly mutable, and writing
&mutable was the same as writing &. Now, the two are
distinguished, and assignments to regular aliases are
no longer allowed.
2011-06-10 12:15:58 +02:00
Marijn Haverbeke
798bbd2e22 Fix all occurrences of writing to immutable aliases
You'd be surprised.
2011-06-10 12:15:28 +02:00
Patrick Walton
40e3a9fcbc Revert "Encode meta tags in the crate and start sketching enhanced logic for resolving crate "use" directives." due to tree bustage
This reverts commit ab3635eebe.
2011-06-09 18:15:13 -07:00
Patrick Walton
60706f1e35 rustc: Write interior vecs and strings into the metadata and add logic for them in ty_to_str 2011-06-09 18:00:46 -07:00
Graydon Hoare
ab3635eebe Encode meta tags in the crate and start sketching enhanced logic for resolving crate "use" directives. 2011-06-09 17:24:32 -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
Patrick Walton
1c48102838 rustc: Add ty_istr and ty_ivec types 2011-06-09 16:23:19 -07:00
Patrick Walton
54d34bec59 rustc: Parse istr and ivec 2011-06-09 15:05:08 -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
Marijn Haverbeke
beda82ddf1 A revised, improved alias-checker
The old system tried to ensure that the location an alias pointed at
would retain its type. That turned out to not be strong enough in the
face of aliases to the inside of tags.

The new system instead proves that values pointed to by aliases are
not replaced (or invalidated in some other way) at all. It knows of
two sufficient conditions for this, and tries to prove at least of
them:

A) The alias is 'immutably rooted' in a local, and this local is not
   reassigned for the lifetime of the alias. Immutably rooted means
   the alias refers to the local itself, or to something reachable
   from the local through immutable dereferencing.

B) No value whose type might include the type of the 'inner mutable
   element' of the thing the alias refers to (for example, the box in
   rec(mutable x = @mutable int)) is from the outer scope is accessed
   for the lifetime of the alias. This means for functions, no other
   argument types may include the alias's inner mutable type. For alt,
   for each, and for, it means the body does not refer to any locals
   originating from outside their scope that include this type.

The lifetime of an alias in an alt, for each, or for body is defined
as the range from its definition to its last use, not to the point
where it goes out of scope. This makes working around these
restrictions somewhat less annoying. For example, you can assign to
your alt-ed value you don't refer to any bindings afterwards.
2011-06-09 13:11:29 +02:00
Josh Matthews
2235fb73ef Add optional message to fail. 2011-06-08 04:02:55 -04:00
Graydon Hoare
721c5bbee8 More work on proper linkage name-mangling. Almost right, aside from version numbers. 2011-06-07 18:08:17 -07:00
Josh Matthews
df9cf0be9b Add multiline, whitespace-eating strings. 2011-06-07 11:21:10 +02:00
Brian Anderson
53ea2a4751 stdlib: Use spans for #fmt errors originating in std
Issue #444
2011-06-04 19:48:19 -04:00
Brian Anderson
a177dc485b rustc: Reenable debug logging in extfmt
This is not obnoxious now that logging is off by default
2011-06-04 17:57:53 -04:00
Brian Anderson
4b566fe7f9 rustc: Hide the parser from syntax extensions
Eventually extensions will probably need access to the parser again, but it'll
be in a different form.
2011-06-04 17:51:59 -04:00
Brian Anderson
c88fa92de4 rustc: Generate extension annotations from ext_ctxt instead of parser 2011-06-04 17:44:24 -04:00
Brian Anderson
1d6f1dc58d rustc: Add a next_ann method to ext_ctxt
After this we can remove the parser from the syntax extensions, at least for
now.
2011-06-04 17:31:44 -04:00
Brian Anderson
3ca5fff195 rustc: Use spans for #env errors
Issue #444
2011-06-04 17:14:32 -04:00
Brian Anderson
ac83e34dc6 rustc: Report unimplemented #fmt features with spans 2011-06-04 17:10:08 -04:00
Brian Anderson
dd588519bd rustc: Add a span_unimpl method to ext_ctxt 2011-06-04 17:10:08 -04:00
Brian Anderson
ecf1bd7651 rustc: Use spans on extfmt error messages
Issue #444
2011-06-04 17:10:04 -04:00
Brian Anderson
794221b353 rustc: Return the correct span from parse_seq 2011-06-04 16:36:08 -04:00
Brian Anderson
c18f2e2dac rustc: Pass the correct span to syntax extensions 2011-06-04 15:57:13 -04:00
Brian Anderson
af46f3ed0d rustc: Introduce ext module. Move some things from parser to ext.
Introduce an ext_ctxt record to provide a span_err method for use while
expanding syntax extensions. Hopefully it will be useful for other things.
2011-06-04 15:49:42 -04:00
Paul Stansifer
dbd066a02a "macro" -> "syntax extension" for now 2011-06-03 18:47:11 -07:00
Paul Stansifer
79fcd51b46 Make the macro system more modular. 2011-06-03 18:47:11 -07:00
Graydon Hoare
088ab03fdb Add spans to fields, args, methods. Improve pp of same. 2011-06-03 15:42:42 -07:00
Rafael Ávila de Espíndola
429e21414b Parse pointers in metadata. 2011-06-03 15:13:10 -04:00
Rafael Ávila de Espíndola
18b63865ce Accept *foo as a pointer to foo.
This is accepted everywhere, since just passing a pointer is safe.
2011-06-03 14:34:19 -04:00
Graydon Hoare
cb61d7b38e Pretty-print literals exactly as we saw them in the source. 2011-06-02 17:18:49 -07:00
Paul Stansifer
1377e9b341 Implement pcwalton's code review suggestions. 2011-06-02 15:12:17 -07:00
Paul Stansifer
5cd10d2fef Error message, instead of segfault, when recursive types are used. 2011-06-02 14:03:17 -07:00
Tim Chevalier
ac4ef1741e Allow constraint args to be literals 2011-06-01 17:45:13 -07:00
Graydon Hoare
023bbc0449 Add a space after @mutable. 2011-06-01 13:12:12 -07:00
Graydon Hoare
2ef2bda276 Move brace/if/for/while/do/alt/spawn exprs into bottom_expr rule. 2011-06-01 12:42:28 -07:00
Paul Stansifer
9f5dddf08c Now imports are not re-exported unless 'export' is explicitly used. 2011-05-31 18:43:26 -07:00
Michael Sullivan
fd1029e6dd Support move as an initializer. 2011-05-31 17:39:14 -07:00
Michael Sullivan
5e7bba3d23 Insert plumbing for move that behaves just like assign. 2011-05-31 17:39:14 -07:00
Eric Holk
84a56ed7cd Teach the compiler to understand yield and join, as well as using task as a type name. 2011-05-31 16:28:13 -07:00
Graydon Hoare
223c7dfb11 Fix comment-scanning logic in lexer. 2011-05-31 15:31:50 -07:00
Graydon Hoare
b6971d94df Consolidate formatting functions a bit more. 2011-05-31 11:00:47 -07:00
Graydon Hoare
b48cab962a Add span to field to catch per-field comments in rec exprs. 2011-05-31 11:00:47 -07:00
Graydon Hoare
d12ea39896 Improve comment handling in pp. 2011-05-31 11:00:47 -07:00
Brian Anderson
81fc2d8728 rustc: Remove unneeded type params from alt patterns 2011-05-31 01:23:53 -04:00