Commit graph

2990 commits

Author SHA1 Message Date
Rafael Ávila de Espíndola
46920e073b Remove hack now that stage0 doesn't use it. 2011-06-09 14:26:10 -04:00
Patrick Walton
a4663d2845 rustc: Add fast paths for vars and param folds. 3x typechecking speedup. 2011-06-09 11:20:47 -07:00
Patrick Walton
73ae684536 rustc: Don't resolve all type variables eagerly for paths 2011-06-09 10:51:51 -07:00
Patrick Walton
80f86d1e9b stdlib: Make union-find not create loops when unifying two already-unified sets 2011-06-09 10:51:51 -07:00
Marijn Haverbeke
537d879dc1 Properly handle lifetime of aliases in nested blocks
There was a bug that would cause the alias analyser to allow you to
invalidate an alias that was no longer directly referred to, even if
another alias was rooted in it. It now properly tracks dependencies
between live aliases.

Required another case of copying values in map.rs.
2011-06-09 14:19:13 +02: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
Marijn Haverbeke
43fbb07126 Add vec::member 2011-06-09 13:11:28 +02:00
Marijn Haverbeke
77c1b9650f Some more workarounds to please the alias checker
Some of the vec utilities now only work on immutable vecs, since they
would have to be rewritten to do a lot more copying to be alias-safe.

Some forced copying was added to map.rs, showing a weakness in the
alias checker (or maybe the alias system): when fn args are passed
into a function, calling them must assume all aliases that are not
immutably rooted (directly connected to a local or temporary without
any mutable edges) become invalid. This will be a drag on functional
programming in Rust.

Work around alias issues in the stdlib
2011-06-09 13:08:39 +02:00
Marijn Haverbeke
bd90c7a3cb Add new visitor framework 2011-06-09 13:08:38 +02:00
Patrick Walton
6feb1dfd76 rustc: Don't eagerly resolve type variables after unification 2011-06-08 18:42:34 -07:00
Patrick Walton
537d4ac65a rustc: Fix error pattern in compile-fail/arg-count-mismatch.rs 2011-06-08 18:42:34 -07:00
Patrick Walton
cc7a8b668f rustc: Make resolve_all_vars() check to see whether the type actually has vars before folding over it; also remove some debug code. 2x typechecking speedup. 2011-06-08 18:05:45 -07:00
Patrick Walton
7527084e62 rustc: Don't generate so many variables when typechecking functions; remove mo_either 2011-06-08 18:05:45 -07:00
Graydon Hoare
8691a1a1e5 Tidy up 'export meta' situation now that snapshot understands it. 2011-06-08 15:58:03 -07:00
Patrick Walton
99c72b98b5 rustc: Use cnames in ty_to_str again; debugging code crept in 2011-06-08 15:49:46 -07:00
Patrick Walton
cc06bd4aa5 rustc: Add some miscellaneous demands that pushdown had previously caught; put out burning tinderbox 2011-06-08 15:33:16 -07:00
Graydon Hoare
b02b50c695 Register new snapshots. 2011-06-08 14:58:58 -07:00
Patrick Walton
2f853ddb8d test: Add a test case for issue #362, "ret none". 2011-06-08 12:52:36 -07:00
Patrick Walton
4571172c03 rustc: Remove pushdown. 15 second improvement. 2011-06-08 12:24:05 -07:00
Graydon Hoare
f54f2799c3 Merge pull request #403 from espindola/newllvm
Update rust to build with newer llvm versions.
2011-06-08 11:41:01 -07:00
Rafael Ávila de Espíndola
698022d351 Update rust to build with newer llvm versions. 2011-06-08 14:08:24 -04:00
Patrick Walton
08dcb9306b rustc: Remove all traces of the unification cache 2011-06-08 10:52:12 -07:00
Rafael Ávila de Espíndola
d360c481e8 Don't force the fetch of main.o from main.a, we are not using main.a anymore. 2011-06-08 13:47:21 -04:00
Rafael Ávila de Espíndola
2c16be424b Use main.o directly now that stage0 is ok with it. 2011-06-08 13:33:35 -04:00
Patrick Walton
124ad321ad authors: Add Josh Matthews to AUTHORS 2011-06-08 09:09:50 -07:00
Patrick Walton
42ac269b5f Merge pull request #455 from jdm/fail_str
Add optional message to fail.
2011-06-08 09:08:11 -07:00
Josh Matthews
2235fb73ef Add optional message to fail. 2011-06-08 04:02:55 -04:00
Josh Matthews
b5c73605ea Merge remote branch 'graydon/master' 2011-06-08 03:59:34 -04:00
Patrick Walton
0857d22c04 rustc: Print out a real error message on unresolved types. Puts out burning tinderbox. 2011-06-07 23:03:41 -07:00
Patrick Walton
ddec6b5f47 rustc: Use a set-based approach to unification; remove ty_bound_param and ty_local.
Sorry, big perf regression; will fix soon.
2011-06-07 19:33:18 -07: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
Rafael Ávila de Espíndola
7034a28241 Update the snapshot. 2011-06-07 20:40:31 -04:00
Lindsey Kuper
a4ca75e6af For consistency, use ctxt instead of ty_ctxt outside of unify. 2011-06-07 15:18:30 -07:00
Lindsey Kuper
ab69c4a98f Removing dead code and redundant fails; changing fails to sess.bug
calls (issue #444).
2011-06-07 14:12:34 -07:00
Rafael Ávila de Espíndola
b1d6f12a05 Don't put a copy of main (the C one) in each binary we produce. This is a step
in getting a driver that works on all linux systems.

Sorry for the linker hacks, I will remove them after snapshotting a new compiler.
2011-06-07 16:56:27 -04:00
Josh Matthews
df9cf0be9b Add multiline, whitespace-eating strings. 2011-06-07 11:21:10 +02:00
Josh Matthews
a078844201 Add multiline, whitespace-eating strings. 2011-06-07 04:53:47 -04:00
Graydon Hoare
319156c8d1 Begin tidying up name-mangling rules. 2011-06-06 15:48:47 -07:00
Rafael Ávila de Espíndola
ee54fa5c7d Implement enough support for pointer to get an identity function working. 2011-06-06 16:36:01 -04:00
Marijn Haverbeke
4bd5f834b0 First take on an alias-safety checker
The alias checker works by ensuring that any value to which an alias
is created is rooted in some way that ensures it outlives the alias.

It is now disallowed to create an alias to the content of a mutable
box, or to a box hanging off a mutable field. There is also machinery
in place to prevent assignment to local variables whenever they are
the root of a live alias.
2011-06-06 21:24:03 +02:00
Marijn Haverbeke
2b334f061a Change unsafe aliases
This litters aberrations like 'alt({foo.bar}) { ... }' and f({*baz})
though the code (mostly in trans.rs). These are a way to explicitly
copy the given value so that it can be safely aliased. At some point
we'll probably want a more explicit copy operator.
2011-06-06 21:09:55 +02:00
Brian Anderson
4d8f715dab rustc: Make resolve::unresolved return !. Remove redundant fails 2011-06-05 00:11:44 -04:00
Lindsey Kuper
2736d63db0 Adding comments; removing dead code. 2011-06-04 19:38:11 -07:00
Lindsey Kuper
5f95766a40 Remove redundant 'fail' exprs and dead code; use sess.bug or
sess.span_err instead of 'fail'.  (issue #444)
2011-06-04 18:34:40 -07: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