Commit graph

3001 commits

Author SHA1 Message Date
Patrick Walton
c7ca08d1b6 rustc: Remove all calls to resolve_all_vars and the function itself 2011-06-09 14:17:50 -07:00
Patrick Walton
06d706e197 rustc: Remove the call to resolve_all_vars when typechecking field exprs 2011-06-09 14:04:11 -07:00
Patrick Walton
3009574165 rustc: Unify with the root types 2011-06-09 14:04:11 -07:00
Graydon Hoare
3c1be2aeba Merge pull request #462 from erickt/master
Make a .cpp file non-executable
2011-06-09 12:48:10 -07:00
Erick Tryzelaar
501201a431 Remove executable bit from lock_and_signal.cpp. 2011-06-09 12:30:57 -07:00
Marijn Haverbeke
1146136fa8 Fix double import that now somehow gets caught by resolve 2011-06-09 20:48:06 +02:00
Marijn Haverbeke
4ab862a50d Switch resolve pass to use visit.rs rather than walk.rs 2011-06-09 20:44:04 +02:00
Marijn Haverbeke
d8516178e5 Pass ty params to visit::visit_fn 2011-06-09 20:44:04 +02:00
Tim Chevalier
d1819fb747 Improve an error message in resolve 2011-06-09 11:37:52 -07:00
Tim Chevalier
b34a97de39 Start to check expr_check and expr_call constraints in typestate
Start writing the cases for expr_check and expr_call to take
predicates into account, but this isn't working yet.
2011-06-09 11:37:52 -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
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