Commit Graph

873 Commits

Author SHA1 Message Date
Brian Anderson
02dde781eb rustc: Don't typestate fns that don't have constrained function calls 2012-05-30 17:48:05 -07:00
Michael Sullivan
ea8d4d7f17 Properly sign extend array indexes. Closes #2468. 2012-05-30 17:09:52 -07:00
Michael Sullivan
7fee392de5 Handle differing signedness in constant shifts. Closes #2426. 2012-05-30 15:03:24 -07:00
Eric Holk
f49b891ce5 Include capture clauses when generating metadata.
This may fix the bug that's blocking Issue #2441.
2012-05-30 12:03:51 -07:00
Niko Matsakis
1f4b3cfc36 zero out alloca for preserving values
conservatively do it always for now
2012-05-30 11:26:15 -07:00
Niko Matsakis
555492e427 port alt to dvec 2012-05-30 11:26:15 -07:00
Niko Matsakis
79b3dedac3 allow for loop bodies 2012-05-30 11:26:15 -07:00
Niko Matsakis
653a1f8781 integrate purity into type 2012-05-30 11:26:15 -07:00
Niko Matsakis
22a10f0e4a refactor region manip. to remove redundancy, get closer to fn subtyping
also: remove "auto-mode-matching" for implemented interfaces, as it
is complex and interacts poorly with classes

cc #2263
2012-05-30 11:04:12 -07:00
Niko Matsakis
e6b9db0884 refactor region manipulation routines to eliminate duplication
fn subtyping is starting to work, but it's exposing bugs in the
code which checks for iface conformance, which doesn't properly
skolemize the self region
2012-05-30 11:04:12 -07:00
Michael Sullivan
b744f52620 Make heap closures always require a capture clause to capture mutable variables. Closes #2446. 2012-05-30 10:46:22 -07:00
Brian Anderson
736ff34e8a rustc: Move filesearch into metadata mod
It's not that related to metadata, but metadata needs it and it will
probably be useful for doing dynamic loading.
2012-05-29 20:38:49 -07:00
Tim Chevalier
3f3c9caf4d Handle poststates of breaking loops correctly in typestate
The poststate should be one where all predicates are assumed false,
rather than the unchanged prestate.

Closes #2374
2012-05-29 18:22:38 -07:00
Tim Chevalier
8d7765be82 Resolve bounds in iface types
Closes #2311
2012-05-29 16:50:21 -07:00
Niko Matsakis
f90228b8a8 make all arguments modes immutable
note: you can still move from copy/move mode args
2012-05-29 16:22:17 -07:00
Niko Matsakis
47375439ed remove useless invocations of universally_quantify_from_sty() in method lookup 2012-05-29 16:20:54 -07:00
Niko Matsakis
37b78b48e3 modify shape code to only emit monomorphized enums (#2444)
this is hacky, but shape code is going away anyway and I didn't
want to invest too much effort into it
2012-05-29 15:12:36 -07:00
Tim Chevalier
ccc7651b48 In reachability, don't ignore nested items
Reachability was considering nested items to be unreachable, which
was causing the bug in #2383. Once I fixed that, I also had to make
impl::make_impl_vtable instantiate methods where necessary, before
calling monomorphic_fn.

Closes #2383
2012-05-29 14:40:35 -07:00
Michael Sullivan
5d1c29912d Fix an error message to not refer to "block type". Closes #2423. 2012-05-29 12:18:59 -07:00
Eric Holk
aa2efc05ea Adding shared_arc to hide some of the tedium of sharing an arc between tasks.
Also added some asserts and logging to trans.

Modified graph500 to use the shared_arc, but this unfortunately doesn't work due to #2444.
2012-05-29 10:43:19 -07:00
Erick Tryzelaar
68e5d8daa3 Merge pull request #2455 from erickt/master
Fleshing out result methods
2012-05-28 18:27:30 -07:00
Graydon Hoare
e0f0c5c1ab Remove bad Load in make_visit_glue, un-xfail reflect-visit-type.rs. 2012-05-28 13:19:31 -07:00
Erick Tryzelaar
46173e98ef Rename result::{iter,map,map2} to add _vec suffix
The result module doesn't follow the standard iter/map pattern
that we use in the rest of the library. So to
2012-05-28 12:03:25 -07:00
Brian Anderson
432c6cbde9 core: Make range follow the for loop protocol 2012-05-26 02:28:00 -07:00
Lindsey Kuper
e11742de32 More refactoring on a quest to understand region types. 2012-05-25 17:55:55 -07:00
Niko Matsakis
269bc6fb5c fix warning 2012-05-25 17:14:17 -07:00
Niko Matsakis
98740a59da detect ambig. calls to iface bounds, use transactions
cc #2433
2012-05-25 17:04:05 -07:00
Michael Sullivan
93633ea734 Add an internal notion of 'implicit copyability' and use it to warn when implicitly copying mutable data and some unique data. Closes #2448. 2012-05-25 16:53:34 -07:00
Michael Sullivan
8668d06400 Get rid of many implicit copies as a preliminary to Issue #2448. 2012-05-25 16:39:35 -07:00
Michael Sullivan
174f789e0b Add hack to silence the annoying liveness warning in trans/base.rs. 2012-05-25 15:34:09 -07:00
Niko Matsakis
9e6a068034 replace last_use with liveness info 2012-05-25 14:37:30 -07:00
Niko Matsakis
62fe587f81 revisit error message; create spill map 2012-05-25 14:37:30 -07:00
Lindsey Kuper
123c5c4315 typeck: cleanup/refactoring 2012-05-25 11:35:42 -07:00
Lindsey Kuper
f7cb7b06d5 typeck: Minor cleanup 2012-05-25 11:35:42 -07:00
Lindsey Kuper
7e70412711 Some refactoring and WIP on issue #2263. 2012-05-24 16:48:44 -07:00
Lindsey Kuper
ef33c5c9bc Typo fixes in comments. 2012-05-24 16:48:44 -07:00
Eric Holk
8b12892ca2 Convert kinds to strings better for more usable error messages. 2012-05-24 15:06:56 -07:00
Eric Holk
4ffe34cace Updating the comments in kind.rs to better reflect the current state of things. 2012-05-24 15:06:56 -07:00
Eric Holk
8b6bfc96cb Const kind checking. The rules are almost certainly incomplete and unsound... 2012-05-24 15:06:56 -07:00
Eric Holk
d993df74c3 Teach parser and related things to understand const kind bounds. 2012-05-24 15:06:56 -07:00
Niko Matsakis
ccd8d5573e remove dead assignments 2012-05-24 13:35:57 -07:00
Niko Matsakis
f5c51b0a9c remove initedness checking from typestate, as best I could 2012-05-24 09:52:16 -07:00
Niko Matsakis
0d3811e275 improve liveness so it reports unused vars / dead assignments
doesn't warn about pattern bindings yet though
2012-05-24 09:52:16 -07:00
Niko Matsakis
30b47649ea new liveness pass to supercede last_use / initedness 2012-05-24 09:52:03 -07:00
Niko Matsakis
a3be0b1054 fix classes and parameterized ifaces; remove needless self check
ref #1726, #2434
2012-05-24 06:49:40 -07:00
Niko Matsakis
bd573becf5 change region scope of call arguments, old one was unsound
improve error message to describe kind of deref'd ptr using sigil
2012-05-24 05:19:44 -07:00
Niko Matsakis
c9eb9ee612 rewrite purity check to search through scope chain 2012-05-24 05:19:44 -07:00
Eric Holk
5f154770e2 Prevent capturing non-copyable things in closures. 2012-05-23 15:46:43 -07:00
Niko Matsakis
9773a22119 shuffle error messages in borrowck, and prevent it from spewing too many
also, fix a few minor issues it complains about
2012-05-23 12:01:27 -07:00
Eric Holk
8678baab12 Resources are once again not copyable. 2012-05-23 10:27:42 -07:00
Niko Matsakis
e0f59e835e modify borrowck to allow arbitrary borrows in pure scopes 2012-05-23 06:30:29 -07:00
Niko Matsakis
00849191ce refactor loan to not return result<> 2012-05-23 06:30:29 -07:00
Niko Matsakis
01a2e99639 prepare for gather to gather up multiple maps 2012-05-23 06:30:29 -07:00
Brian Anderson
d2ec15bcf1 rustc: Eliminate metadata's dependency on util::common 2012-05-23 00:57:07 -07:00
Brian Anderson
f9d0cde19a syntax: Remove one of the two def_id hashers 2012-05-23 00:45:18 -07:00
Brian Anderson
4756556748 rustc: Move new_def_hash to ast_util 2012-05-23 00:43:02 -07:00
Tim Chevalier
ed357af980 Convert more resource tests to use classes with dtors
And monomorphize dtors correctly.
2012-05-22 22:12:18 -04:00
Brian Anderson
c0a36b71be rustc: Eliminate metadata's dependency on session 2012-05-22 18:07:36 -07:00
Brian Anderson
98b93b6c86 rustc: Eliminate some session deps from metadata::loader 2012-05-22 18:07:36 -07:00
Brian Anderson
c90a047016 rustc: Don't fall back to static libraries when shared isn't found
Nothing on Earth depends on this functionality and it is probably unexpected
2012-05-22 18:07:36 -07:00
Brian Anderson
5b4ab93017 rustc: Add cstore to ty::ctxt so csearch can get at it 2012-05-22 18:07:36 -07:00
Brian Anderson
99c1b2953d syntax: Add diagnostic::expect 2012-05-22 18:07:36 -07:00
Brian Anderson
a32392d032 Merge pull request #2427 from msullivan/shifts
Get rid of the >>> operator and make >> logical or arithmetic depending ...
2012-05-22 17:50:04 -07:00
Michael Sullivan
15cef374b9 Get rid of the >>> operator and make >> logical or arithmetic depending on the signedness. Closes #2417. 2012-05-22 14:59:15 -07:00
Eric Holk
0b2f2cabbe Send is no longer a subkind of copy. This allows for sendable, but non-copyable resources. Closes #2420. 2012-05-22 14:10:32 -07:00
Eric Holk
f213c1f3a8 Represent kinds as a bitfield of capabilities. 2012-05-22 12:48:31 -07:00
Michael Sullivan
8d7f3bd1ca Disallow type parameters to self. Closes #2422. 2012-05-22 11:52:22 -07:00
Niko Matsakis
073f90cdc4 introduce some copies so we are not alting into mut state 2012-05-22 05:21:13 -07:00
Brian Anderson
9aa18c2852 rustc: Move ast_map to the syntax crate 2012-05-21 23:39:27 -07:00
Brian Anderson
47bb1185f2 rustc: Move walk_pat to ast_util
This will allow ast_map to move to the syntax crate
2012-05-21 23:22:08 -07:00
Brian Anderson
df532e7f1b rustc: Remove ast_map's session dependency 2012-05-21 23:22:06 -07:00
Brian Anderson
611890013f rustc: Remove unused import 2012-05-21 22:50:10 -07:00
Brian Anderson
85d67723ee rustc: Move path_to_ident to ast_util 2012-05-21 22:41:59 -07:00
Niko Matsakis
2fa5a66310 remove mutable cycle from ast_fold 2012-05-21 20:07:14 -07:00
Niko Matsakis
34b42eeb65 change list so that it must be used in a purely boxed fashion
The old way was inconsistent---the head was unboxed but the
tail was boxed.  This resulted in numerous needless copies and
also made the borrow check unhappy, because the head tended to be
stored in mutable memory.
2012-05-21 09:37:34 -07:00
Niko Matsakis
8e73bb6ea0 detect and report shadows in nested bindings 2012-05-21 09:37:22 -07:00
Brian Anderson
239cf80c73 rustc: Remove dead code in encoder 2012-05-19 19:09:10 -07:00
Niko Matsakis
28d0ce9a8b fix up handling of &x where x is an arg or &self (for now at least). 2012-05-19 10:33:14 -07:00
Niko Matsakis
774ea145ec make more code use dvec 2012-05-18 20:00:51 -07:00
Niko Matsakis
0f969da882 port some code to use dvec 2012-05-18 20:00:50 -07:00
Niko Matsakis
35f6f37453 avoid modifying the variable we are alting over 2012-05-18 20:00:50 -07:00
Niko Matsakis
c9edc0f0a1 introduce a few copies here and there 2012-05-18 20:00:50 -07:00
Niko Matsakis
f9aef928ca purge ufind 2012-05-18 20:00:50 -07:00
Niko Matsakis
44c100c28d try to improve handling of methods 2012-05-18 20:00:50 -07:00
Niko Matsakis
253979236e print ids of patterns when doing --pretty identified 2012-05-18 19:07:20 -07:00
Niko Matsakis
b79d717c91 fix borrowing pats---the id field of cmt was assoc with wrong pat 2012-05-18 19:07:20 -07:00
Niko Matsakis
19ec5a41ed allow region ptrs to be cast to uints 2012-05-18 19:07:19 -07:00
Niko Matsakis
f1a46914c4 add a new debugging aid--tracing 2012-05-18 19:07:19 -07:00
Eric Holk
0eed37da29 Using const vector slices for more vec functions. 2012-05-18 16:55:42 -07:00
Brian Anderson
e546c4820b rustc: Don't copy vecs in seq_preconds. Huge perf win on some tests
Compile time for the included test goes from 5min to 18s.
2012-05-18 15:59:00 -07:00
Niko Matsakis
67ca37ac61 workaround a horribly obscure resolve bug 2012-05-18 14:32:37 -07:00
Niko Matsakis
a559329692 test that we preserve boxes in patterns---still one bug 2012-05-18 14:32:37 -07:00
Brian Anderson
3f283bb168 rustc: Don't recurse in seq_preconds. Consumes too much stack 2012-05-18 14:28:39 -07:00
Niko Matsakis
5be8bf1de7 use -Z to distinguish internal debugging options 2012-05-18 10:38:18 -07:00
Tim Chevalier
cdcce3ed5d Refactoring, annotating FIXMEs in remainder of metadata code 2012-05-17 22:15:07 -07:00
Tim Chevalier
c97b29afd1 Refactor encoder::encode_module_item_paths
to eliminate some repeated code.
2012-05-17 20:39:17 -07:00
Tim Chevalier
cf2fc2c34e Annotate or fix FIXMEs in LLVM bindings and metadata code
Fixed up a few FIXMEs in lib/llvm to use more descriptive data
types. Covered FIXMEs in metadata::{creader, csearch, decoder} and
one in encoder.
2012-05-17 20:39:17 -07:00
Patrick Walton
37abcda42b rustc: Make type_is_pod class-aware 2012-05-17 17:20:58 -07:00
Lindsey Kuper
7f45ba4744 Move inference-related fields/methods from fn_ctxt to infer_ctxt. 2012-05-17 14:34:41 -07:00
Tim Chevalier
9fa4763604 Comments only: annotate FIXMEs in front-end 2012-05-17 11:32:53 -07:00
Tim Chevalier
55c008874d Comments only: annotate FIXMEs in back-end and driver 2012-05-17 11:20:14 -07:00
Tim Chevalier
db8931c876 Minor edits to README 2012-05-17 10:13:30 -07:00
Tim Chevalier
a4f0021f89 Update and copyedit README for rustc
Lindsey pointed out that the location of librustsyntax was out-of-date,
so I fixed that; noticed a lot of other out-of-date info; and updated it.
I also obliterated all passive voice. Yay!

Closes #2382
2012-05-17 10:10:18 -07:00
Brian Anderson
288799786b rustc: Sever the link between metadata and resolve 2012-05-16 22:46:57 -07:00
Brian Anderson
322b20d14d rustc: Break another dependency between metadata and resolve 2012-05-16 22:28:17 -07:00
Brian Anderson
6a41eb0192 rustc: Break a dependency between metadata and resolve 2012-05-16 21:50:34 -07:00
Graydon Hoare
9752523f3a Include intrinsic module in all crates, emit visit glue, fn intrinsic::visit_ty. Not yet working. 2012-05-16 18:24:00 -07:00
Niko Matsakis
69eca26775 pull out id visitor into ast_util from astencode 2012-05-16 13:30:30 -07:00
Lindsey Kuper
9f8d2b97d3 Another typo fix. 2012-05-16 12:34:10 -07:00
Lindsey Kuper
76f49e497e Typo fixes. 2012-05-16 12:09:55 -07:00
Niko Matsakis
fa2ac66462 add a large comment on how infer works 2012-05-16 09:42:38 -07:00
Niko Matsakis
558be3a70f pull method lookup / region manip into their own modules 2012-05-16 08:51:16 -07:00
Niko Matsakis
564aa59a3f further reorganization 2012-05-16 08:02:43 -07:00
Niko Matsakis
63210ecddb correct preservation of explicit borrows like "let x = &*y;" 2012-05-16 07:19:19 -07:00
Niko Matsakis
5c8069d817 break out type checking of alts/patterns (again) 2012-05-16 06:57:13 -07:00
Niko Matsakis
da98e14c94 Revert "break out type checking of alts/patterns"
This reverts commit 8d1c1720e3.
2012-05-16 06:38:23 -07:00
Niko Matsakis
8d1c1720e3 break out type checking of alts/patterns 2012-05-16 06:37:53 -07:00
Niko Matsakis
fc8e1cb646 missing import 2012-05-16 06:16:55 -07:00
Niko Matsakis
7512284a94 further modularization of typeck, add comments 2012-05-16 06:06:42 -07:00
Brian Anderson
0e21a05e6c rustc: Extract loader mod from creader mod
loader is a utility for locating crates and loading their metadata.
creader is a compiler pass that loads metadata for all used libraries.
2012-05-15 21:36:16 -07:00
Niko Matsakis
9c7b74b025 check if the type of a local variable contains illegal region
also, try to suppress some of the duplicate errors---in general
more work is needed to make these error messages comprehensible
to ordinary humans
2012-05-15 21:20:37 -07:00
Tim Chevalier
8448711534 Add classes and class fields to the tcache
They were being added lazily, which prevented class types from being
used as an argument to a variant.
2012-05-15 20:35:57 -07:00
Tim Chevalier
bdef90730e Clarify a comment
...at least I think this is what was meant.
2012-05-15 20:35:57 -07:00
Tim Chevalier
e2d18c9a8a Remove an assertion from trans::base::iter_structural_ty
I had put in an assertion that if the ty is a class, it doesn't have a dtor,
but that doesn't make sense, since this gets used to make take glue and
not just drop glue.
2012-05-15 20:35:57 -07:00
Niko Matsakis
ab735320b4 move regionck into typeck, in the process fixing a bug or two 2012-05-15 19:05:03 -07:00
Tim Chevalier
fa5cc5bcd0 Generate drop glue correctly for classes with destructors 2012-05-15 18:00:41 -07:00
Patrick Walton
8fe0461f06 Remove the unused pairwise.rs 2012-05-15 15:08:52 -07:00
Niko Matsakis
250bbddb90 move infer into typeck module 2012-05-15 14:06:51 -07:00
Niko Matsakis
26dc48d67f break apart typeck a little (more to come) 2012-05-15 13:38:29 -07:00
Niko Matsakis
adb61e3e99 get preservation of boxes working, at least in simple cases 2012-05-15 13:38:16 -07:00
Niko Matsakis
4c7be32606 add node_ids to blocks 2012-05-15 11:49:11 -07:00
Niko Matsakis
e139793313 purge unused loop_cont field 2012-05-15 11:49:11 -07:00
Niko Matsakis
be48cd87dc make poison-on-free work, disable copying if borrowck is enabled 2012-05-15 11:49:08 -07:00
Lindsey Kuper
b8880e3254 Remove be keyword.
Closes #2227.
2012-05-15 10:41:14 -07:00
Brian Anderson
452fc46ffc rustc: Break some of metadata's dependencies on session 2012-05-14 20:41:33 -07:00
Brian Anderson
0f49928c2d rustc: Break metadata's dependency on link 2012-05-14 19:04:32 -07:00
Brian Anderson
f08fe56479 rustc: Break more metadata dependencies 2012-05-14 19:04:32 -07:00
Brian Anderson
fce6a474b1 rustc: Eliminate metadata's dependency on astencode 2012-05-14 19:04:32 -07:00
Brian Anderson
5c864e9de0 rustc: Eliminate encoder's dependency on astencode 2012-05-14 19:04:32 -07:00
Brian Anderson
32c4b6da5b rustc: Move astencode from metadata to middle 2012-05-14 19:04:31 -07:00
Graydon Hoare
e12b16cde7 Instantiate per-type iface-based visit_glue when intrinsic ifaces present. 2012-05-14 17:57:48 -07:00
Graydon Hoare
d899c3a579 More work on reflection, now calls iface visitors back as well. 2012-05-14 15:49:10 -07:00
Tim Chevalier
5428a22b95 First cut at dtors for classes
Classes with dtors should compile now. Haven't yet tested
whether they actually run correctly.

Beginnings of support for #2295, though that won't be done until
there's more test cases and resources are removed.
2012-05-14 14:26:10 -07:00
Tim Chevalier
89cd2f6bd0 Enforce that self doesn't escape from a class
Closes #2294
2012-05-14 14:26:10 -07:00
Brian Anderson
11e9947ff5 rustc: Eliminate a simple dependency from metadata mod 2012-05-13 17:49:27 -07:00
Brian Anderson
1f52652a06 rustc: Eliminate some indirection to the syntax crate 2012-05-13 17:33:29 -07:00
Brian Anderson
a2572fe77e rustc: Eliminate metadata's dependency on trans 2012-05-13 17:08:35 -07:00
Brian Anderson
ecf290d448 rustc: Be explicit about which peer modules the metadata mod can access
This is the first step in eliminating dependencies on rustc so we can extract
the metadata code into its own crate.
2012-05-13 15:58:10 -07:00
Niko Matsakis
63eb8e0e87 move purity checking into borrowck, addresses #1422 2012-05-11 14:05:58 -07:00
Graydon Hoare
2585384c97 First working monomorphic type-reflection. 2012-05-11 13:10:07 -07:00
Niko Matsakis
b4d1f1b2c1 replace mutbl pass with borrowck 2012-05-10 21:14:43 -07:00
Graydon Hoare
c23d6a50d7 Preliminary groundwork for intrinsic module, reflection interface. 2012-05-10 17:18:04 -07:00
Paul Stansifer
13c924c049 Remove do { ... } while ... from the language. 2012-05-10 15:09:33 -07:00
Paul Stansifer
5af58e7926 Removed all 4 uses of do ... while in the codebase. 2012-05-10 14:21:04 -07:00
Brian Anderson
fa6c18e014 rustc: Refactor driver to better understand string sources 2012-05-09 23:40:50 -07:00
Niko Matsakis
50a3dd40ae implement new borrow ck (disabled by default) 2012-05-09 17:00:19 -07:00
Niko Matsakis
5e7229b72c reduce self type to a special type parameter 2012-05-09 07:11:59 -07:00
Brian Anderson
d41af13334 rustc: Extract session::basic_options from rustdoc 2012-05-08 22:33:45 -07:00
Marijn Haverbeke
96a159a6ea Support visibility modifiers and attributes on view items
Issue #1893
Tangentially, issue #2357
2012-05-08 23:14:24 +02:00
Marijn Haverbeke
b619954457 Start parsing pub/priv on regular items
Issue #1893
2012-05-08 16:09:40 +02:00
Brian Anderson
b99038c2bf rustc: Put all boxes into addrspace 1 2012-05-07 15:24:32 -07:00
Tim Chevalier
0e43e8ccc8 That awkward moment when you forget to add your final changes
Fixes build breakage.
2012-05-07 15:15:13 -07:00
Tim Chevalier
4f105e4025 In resolve, visit the path in an iface ref
Necessary to resolve any type arguments in a ref to a parameterized
iface. This meant that, for example:

class A implements B<int> { ...

didn't work before, because the "int" in B's argument wasn't getting
visited, and thus wasn't getting resolved. Now it works.

Partially addresses Issue #2288, but I also want to check that class
ty params can appear as the type arguments to ifaces (for example,

class A<T> implements B<T> {...

should work.)
2012-05-07 14:43:31 -07:00
Niko Matsakis
8a9df5aa38 make it illegal to implicitly capture mutable variables
this is the final part of #1273
2012-05-07 13:22:42 -07:00
Niko Matsakis
50ec6bd2c3 new cap clause syntax 2012-05-04 12:33:08 -07:00
Tim Chevalier
8affc78e8a Turn constants in back::abi into uints, and propagate types
This means GEPi now takes a list of uints. Apologies in advance
if this is hard to rebase against, but it gets rid of many a cast :-)

Also modernized some for loops here and there.
2012-05-03 22:31:38 -07:00
Niko Matsakis
a7e0eb3581 allow enums that ref themselves via unsafe pointers 2012-05-03 17:08:18 -07:00
Tim Chevalier
29b807be2a Removed unused import of std::deque 2012-05-03 15:37:02 -07:00
Niko Matsakis
cfa09d35a3 Revert "allow fn exprs to omit arg types"
This reverts commit 1ba4ca4c4a.
2012-05-03 14:42:34 -07:00
Niko Matsakis
1ba4ca4c4a allow fn exprs to omit arg types
also, avoid using type variables for fn args with omitted types
unless necessary.  This will be important for bound regions in
fn types.

fixes #2093
2012-05-03 14:32:32 -07:00
Graydon Hoare
11a5d10bf2 Implement better shape code for evec, estr. 2012-05-03 13:09:02 -07:00
Tim Chevalier
d8f28be753 Check early on in typeck that types being implemented are actually iface types
Closes #2330.
2012-05-03 12:38:45 -07:00
Brian Anderson
74096a79d8 rustc: Fix comment about ABI in trans::native 2012-05-03 12:07:43 -07:00
Brian Anderson
af263e43c2 rustc: Link to original Clay x86 classification code 2012-05-03 11:42:25 -07:00
Jyun-Yan You
bdebe92400 add forgotten index and fix array type 2012-05-03 09:43:00 -07:00
Marijn Haverbeke
d0d71838cd Mention missing constructor when complaining about inexhaustive top-level pattern
It previously, uselessly, only pointed out the constructor when the
inexhaustive pattern was nested in some other pattern.

Closes #2337
2012-05-03 17:35:12 +02:00
Niko Matsakis
f1129635ee report ambig impl methods 2012-05-02 21:47:14 -07:00
Brian Anderson
11354963b3 rustc: Hack around some FFI bustage. Unbreak servo 2012-05-02 18:35:29 -07:00
Graydon Hoare
b12e27595e Error message reformatting, close #2309. 2012-05-02 14:47:33 -07:00
Tim Chevalier
931514cfb6 Remove commented-out code and old comments that accidentally snuck in 2012-05-02 14:02:22 -07:00
Tim Chevalier
3d4ef74c9b Encode the ifaces a class implements in metadata
This lets you use class A as if it had type B if A implements B,
and A and B are in different crates from your own.

Closes #2285
2012-05-02 13:38:56 -07:00
Graydon Hoare
1c1af99052 Fix symbol mangling in the presence of trailing version numbers. 2012-05-01 17:21:06 -07:00
Graydon Hoare
79ed1f2df4 New lint pass for picking out uses of old-style vecs and str. 2012-05-01 12:58:07 -07:00
Tim Chevalier
46425af8a5 Remove code that was accidentally committed
This was a workaround for the bug that was actually fixed in
164039e867
2012-05-01 08:48:25 -07:00
Tim Chevalier
164039e867 Don't re-export a glob-imported ID when the same ID is defined within
a module

See the test case I added (issue-2316-c) for a concrete example.
issue-2316 also contains the originally reported test case. resolve
was using bitwise or instead of logical or when checking exports,
resulting in excessively eager evaluation. A one-line fix that took
six hours to isolate ;-)
2012-05-01 08:43:17 -07:00
Niko Matsakis
2db4259b35 Stop inferring bot/static when types/regions are unconstrained.
Also, some other changes that came up along the way:
- add a 'blk' region for the current block.
- detect unused type/region variables.
2012-04-30 19:53:02 -07:00
Tim Chevalier
85fbfa25d7 Revert "Eliminate a copy in syntax::parse::new_parser_from_file"
This reverts commit 2bb3b63ec4.

(I was confused.)
2012-04-30 11:52:07 -07:00
Tim Chevalier
2bb3b63ec4 Eliminate a copy in syntax::parse::new_parser_from_file
Fixing a FIXME turned out to be pretty involved. I added an io function
that returns a unique boxed string (for the contents of a file) rather than
a string, and went from there. Also made the src field of codemap a unique
boxed string. This doesn't seem to make that much difference in amount of
allocation according to valgrind (disappointingly), but I also had to introduce
a copy somewhere else pending a new snapshot, so maybe that's it.
2012-04-30 10:44:31 -07:00
Brian Anderson
dc117fecde rustc: Use a slightly more consistent style for unexpected errors 2012-04-28 16:38:06 -07:00
Brian Anderson
0be41ce02b rustc: Remove old align_of intrinsic 2012-04-27 15:40:43 -07:00
Brian Anderson
582c71731d rustc: Clean up some enum code 2012-04-27 11:24:43 -07:00
Brian Anderson
e4277472d2 core: Split sys::align_of into min_align_of, pref_align_of 2012-04-27 00:12:42 -07:00
Brian Anderson
f4f909b8b5 rustc: Add min_align_of, pref_align_of intrinsic, deprecate align_of 2012-04-27 00:12:39 -07:00
Brian Anderson
1c46ee34be rustc: Add llalign_of_min 2012-04-26 21:59:59 -07:00
Brian Anderson
43751e45d9 rustc: Rename llalign_of_real to llalign_of_pref
This alignment is the "preferred" alignment of a type, which is not
necessarily the alignment the compiler will use when packing the
type into structures - that is the "ABI" alignment (in LLVM terms).

On x86, 64-bit ints have 8-byte preferred alignment, but 4-byte
ABI alignment.
2012-04-26 21:44:29 -07:00
Brian Anderson
3c16693760 rustc: Add LLVM bindings for more alignment-related functions 2012-04-26 21:33:38 -07:00
Graydon Hoare
1f92538e38 Add check for path-statements, close #400. 2012-04-26 14:43:43 -07:00
Graydon Hoare
33a296f2fc Lowercase warning message. 2012-04-26 14:43:43 -07:00
Graydon Hoare
61575582ba Describe warnings on command line if user says -W help. 2012-04-26 14:43:43 -07:00
Niko Matsakis
825fd1808e lots of work to make iface/impls parameterized by regions
- paths can now take region parameters, replacing the dirty hack
  I was doing before of abusing vstores.  vstores are now a bit
  of a hack though.

- fix various small bugs:
  - we never checked that iface types were compatible when casting
    to an iface with `as`
  - we allowed nonsense like int<int>
  - and more! (actually that may be it)
2012-04-25 19:26:56 -07:00
Graydon Hoare
458d2ff067 Be a bit more cautious about marking things no-throw. 2012-04-25 18:53:54 -07:00
Graydon Hoare
753b683939 More slice use in vec, io, str, ebml, metadata encoder and decoder. 2012-04-25 17:19:36 -07:00
Graydon Hoare
90c1b4645f Set no-unwind on glue functions that don't drop resources. 2012-04-25 17:19:36 -07:00
Graydon Hoare
fa6c68a025 Set no-unwind attribute on all upcalls other than fail. 2012-04-25 17:19:36 -07:00
Brian Anderson
3a3a7fc426 rustc: Cache normalized types 2012-04-25 15:49:27 -07:00
Brian Anderson
df0ef528b9 rustc: Use LLVM named structs for enum types 2012-04-25 15:49:25 -07:00
Marijn Haverbeke
10120cce0f typeck: Take more care to pass down expected types
This helps with prototype inference and avoids some 'must be known
in this context' errors.
2012-04-25 17:45:29 +02:00
Marijn Haverbeke
9f99c3263b Rewrite exhaustiveness checker
Issue #2111
2012-04-25 09:15:17 +02:00
Brian Anderson
5a0c564817 Revert "rustc: Use LLVM named structs for enum types"
This reverts commit 6e909e387d.
2012-04-24 20:47:06 -07:00
Brian Anderson
b88ecec08c Revert "rustc: Cache normalized types"
This reverts commit 06afe21c03.
2012-04-24 20:47:00 -07:00
Brian Anderson
06afe21c03 rustc: Cache normalized types 2012-04-24 18:24:35 -07:00
Brian Anderson
6e909e387d rustc: Use LLVM named structs for enum types 2012-04-24 18:24:35 -07:00
Graydon Hoare
929c3dd710 Workarounds for bug #2280: add some temporaries for borrowing. 2012-04-24 15:19:01 -07:00
Brian Anderson
e7dbf42214 rustc: Fix type_need_unwind_cleanup. Closes #2272 2012-04-24 14:55:16 -07:00
Brian Anderson
5437a045fc rustc: Remove a bitcast. Issue #2276 2012-04-24 14:00:50 -07:00
Brian Anderson
b4a3d525d8 rustc: Eliminate trans dependency from metadata::tyencode 2012-04-23 23:41:18 -07:00
Tim Chevalier
f7641286b2 Allow classes to be cast to ifaces that are in the same crate
I had to xfail one existing test case (class-implements-int) because,
I think, of the same bug described in #2272.
2012-04-23 21:15:03 -07:00
Tim Chevalier
1c39fda0ea Rename option::get_or_default to get_default, for consistency 2012-04-23 20:52:50 -07:00
Niko Matsakis
b04b415e0d encode the borrowing table, add a simple cross-crate borrowing test 2012-04-23 16:41:11 -07:00
Tim Chevalier
7d05bea7b9 Fix bug with * patterns in trans_alt
enter_opt was handling the (*) case wrong and causing a bounds check
    failure. Fixed it (the test case is one of the extracted ones from
    the reference manual)
2012-04-23 15:50:51 -07:00
Niko Matsakis
71128e75b0 moderate comment, remove some dead regions code 2012-04-23 08:02:59 -07:00
Niko Matsakis
7113a2c30b remove dead code 2012-04-23 08:02:59 -07:00
Niko Matsakis
4eb71c07c6 remove outdated comment 2012-04-23 08:02:59 -07:00
Niko Matsakis
30d563839e Various regions fixes. 2012-04-23 08:02:59 -07:00
Niko Matsakis
0d3658bb43 rewrite the resolution infrastructure; but it's still grody 2012-04-23 08:02:58 -07:00
Marijn Haverbeke
68f8812511 Guard against infinitely expanding generic/inline functions
Closes #2220

Test case disabled until a memory-leak issue is resolved.
2012-04-23 16:44:52 +02:00
Marijn Haverbeke
2782cfb783 Emit a more useful error when using an unsuitable function for a loop
Closes #2255
2012-04-23 15:43:29 +02:00
Marijn Haverbeke
9053f54498 Move map iface over to more for-friendly iteration methods 2012-04-23 15:18:19 +02:00
Marijn Haverbeke
a872a99bfe Simplify representation of ast::path 2012-04-23 13:04:46 +02:00
Marijn Haverbeke
587d8a5d4f Misc code cleanups using list::each for list iteration 2012-04-23 12:13:59 +02:00
Marijn Haverbeke
dfdca5d538 Fix broken determination of external method type param count
Closes #2185
2012-04-23 09:25:14 +02:00
Brian Anderson
734494a04d rustc: Cache constant C strings. Closes #2264 2012-04-21 14:26:13 -07:00
Tim Chevalier
734166f41c Print out return type correctly in typestate error message
In the "not all paths return" error message, typestate was printing
the AST type from the fn decl, not the ty::t type. This ended in tears
when the AST return type was "ty_infer". Now it looks up the function node
ID's type and uses util::ppaux::ty_to_str instead.

Closes #2163.
2012-04-20 18:48:08 -07:00
Graydon Hoare
14d0509691 Log decoded inline_items when debug is active. 2012-04-20 17:18:42 -07:00
Graydon Hoare
355422ddbd Implement tydecode::parse_vstore. 2012-04-20 17:18:42 -07:00
Graydon Hoare
90f82e171d Get borrowing working on fixed evecs. 2012-04-20 12:11:55 -07:00
Tim Chevalier
37b0549730 Add new syntax for patterns that match the head constructor only
Adds a new kind of pattern C(*) where C is a constructor that may
have any number of fields. This pattern matches any value
constructed with C, without binding names for any of the fields.

Closes #1701.
2012-04-20 00:56:46 -07:00
Niko Matsakis
3c995fb8f3 make nominal types optionally parameterized by a self region.
Issue #2201.
2012-04-19 21:01:11 -07:00
Niko Matsakis
f3f34bf09b correct universally_quantify to use structure_of, and introduce a test for this 2012-04-19 21:01:11 -07:00
Tim Chevalier
31ff64c62d Annotate FIXMEs in parser
Also, get rid of two FIXMEs by refactoring some code, and moving the
call_expr check for be expressions into typeck, where it seems to
make more sense.
2012-04-19 19:17:59 -07:00
Tim Chevalier
cdc8722f95 Add a lint pass to check for while true { ... } loops
And suggest changing them to loop { ... }. Had to fix the few
remaining while true loops (in core::io). Closes #1962.
2012-04-19 18:14:38 -07:00
Graydon Hoare
f641dce852 Get evec slices and unique-evec slice-borrowing working. 2012-04-19 16:51:37 -07:00
Tim Chevalier
b0074c5a92 Disallow rebinding / matching against consts in alts
As per Issue #1193. Closes #1193.

I had to rename a few variables ("info" and "epsilon") to avoid
clashing with in-scope constants, which is responsible for all the
changes other than resolve and issue-1193.rs.
2012-04-19 16:21:15 -07:00
Graydon Hoare
1e51196f33 Get fixed-size evecs working. 2012-04-19 15:52:50 -07:00
Graydon Hoare
956bc773c6 Fix [] on str to exclude the trailing null. 2012-04-18 17:50:58 -07:00
Brian Anderson
9a8a04629e syntax: Put the main parser interface in mod parse 2012-04-18 10:50:50 -07:00
Marijn Haverbeke
aa4278a3f5 Require values to be copyable when cast
Closes #2222
2012-04-18 17:21:39 +02:00
Marijn Haverbeke
fda7bb6721 Fix oversight in type_use.rs
Closes #2053
2012-04-18 17:21:39 +02:00
Marijn Haverbeke
054a312a33 Stop duplicating non-generic resource destructors
Closes #2177
2012-04-18 17:21:39 +02:00
Marijn Haverbeke
a0fa099469 Add a needs_drop intrinsic
Closes #2055
2012-04-18 13:15:02 +02:00
Marijn Haverbeke
35b8f87b89 Fix use of wrong block context in return-from-loop code
Closes #2142
2012-04-18 13:00:18 +02:00
Graydon Hoare
70a9ce626d Implement slice-borrowing on estr-uniq and str values. 2012-04-17 15:15:20 -07:00
Niko Matsakis
4c26d70a0a new debug flag, new test 2012-04-17 12:02:36 -07:00
Niko Matsakis
6b549f9f14 repair LUB/GLB of free/scope regions, and enable test 2012-04-17 12:02:36 -07:00
Niko Matsakis
58f8cb343d change printout to be what users will expect 2012-04-17 12:02:36 -07:00
Niko Matsakis
35a93e61d4 rewrite region resolution so it takes place in typeck 2012-04-16 19:48:00 -07:00
Graydon Hoare
82727b926f Get explicit unique estrs working. 2012-04-16 16:17:51 -07:00
Brian Anderson
dea8ae4e6f rustc: Resolve external impls defined in yet other crates. Issue #2196 2012-04-16 14:58:58 -07:00
Brian Anderson
f466a2fa8f rustc: -L also indicates the location of native libraries
-L currently specifies paths to search for Rust crates

Building crates that use native libraries is difficult. When the
library is located somewhere unexpected there is no way
to tell rustc additional paths to look in.

If libclang is located at `.` then rustc is not going to
know that and linking will fail.

To get around that I often end up inserting

    #[link_args = "-L."] native mod m { }

into other crates to get them to build.

Now you just `rustc -L .` and it builds.

This doesn't do any rpathing so it's still up to somebody else
to put the library somewhere it will be found or use LD_LIBRARY_PATH

This feature comes with a single, XFAILed test, because I could
not think of a way to test it. Odd.
2012-04-16 12:33:21 -07:00
Brian Anderson
4f576275be syntax: Cleanup attr module. Closes #1545 2012-04-15 01:43:38 -07:00
Tim Chevalier
4f4a468e84 Forbid deinitializing upvars in typestate
Closes #1965.
2012-04-15 01:05:41 -07:00
Niko Matsakis
cc16165e40 implement evec/estr subtyping/lub/glb/etc 2012-04-14 18:48:58 -07:00
Brian Anderson
979a225598 rustc: Don't hardcode -lm
It does not appear to serve a purpose
2012-04-13 22:35:01 -07:00
Niko Matsakis
247db704a9 integrate simple notion of borrowing into trans 2012-04-13 21:06:57 -07:00
Niko Matsakis
378996092e store into the borrowings table 2012-04-13 21:06:57 -07:00
Niko Matsakis
b3f308bec5 add initial code re: slices to borrowing, improve ty_to_str 2012-04-13 21:06:56 -07:00
Niko Matsakis
d2482fd763 use find not echo; this also brings fuzzer under the iron fist of tidy.py! 2012-04-13 11:59:17 -07:00
Niko Matsakis
27f1c2b742 first stab at type checking for borrow: not integrated into trans 2012-04-13 10:41:46 -07:00
Tim Chevalier
1adc26d5e7 Annotate FIXMEs in syntax::ast and syntax::ast_util
The main non-comment change was to change simple_path to path,
as per a FIXME in ast.
2012-04-13 01:46:56 -07:00
Brian Anderson
79e572ebbb rustc: Fix handling of - and _ in lint pass 2012-04-12 18:11:23 -07:00
Graydon Hoare
8a7fd4a04f Support general warnings and errors in lint pass via flags and attrs. Close #1543. 2012-04-12 17:31:49 -07:00
Brian Anderson
891dc84be2 rustc: Long lines 2012-04-11 21:32:05 -07:00
Brian Anderson
e7409859ce rustc: Fix typo in error message 2012-04-11 21:25:32 -07:00
Niko Matsakis
e712ad8f73 rewrite lookup_method(), lookup_method_inner(), and lookup_method_inner_() 2012-04-11 17:21:53 -07:00
Niko Matsakis
3e6943d820 refactor fixup_self 2012-04-11 17:21:53 -07:00
Niko Matsakis
c1c60c023e first attempt at an assignability check 2012-04-11 17:21:53 -07:00
Niko Matsakis
8967c4b409 simplify demand module 2012-04-11 17:21:53 -07:00
Tim Chevalier
5c12cd72f4 Allow classes to implement ifaces
Introduce syntax like:

iface animal { ... }
class cat implements animal { ... }

to allow classes to implement ifaces. Casting classes to ifaces
is *not* yet supported. ifaces that a class implements are not
yet included in metadata.

The syntax is subject to change, and may go away completely if we
decide to use duck typing to relate classes with ifaces (see
http://smallcultfollowing.com/babysteps/blog/2012/04/10/declared-vs-duckish-typing/ )
2012-04-11 16:20:01 -07:00
Graydon Hoare
f34eae8802 Translate slice-strings and make fixed-strings carry their null. 2012-04-11 12:07:19 -07:00
Graydon Hoare
c720ffdbc4 Improve region code surrounding slice types. 2012-04-11 12:07:19 -07:00
Graydon Hoare
9d7e4aefee Add enough tyencode stuff to stop faulting when we hit error messages. 2012-04-11 11:08:40 -07:00
Graydon Hoare
7a3b290245 Add vstore/evec/estr to compiler. 2012-04-11 11:08:40 -07:00
Tim Chevalier
fd26743bed Generic classes and generic class methods work cross-crate
Classes can have ty params now. So can methods inside classes.
That was probably true before, but now it should still work if you
call methods in a class that's defined in a different crate. Yay!
2012-04-10 11:01:36 -07:00
Niko Matsakis
24e921f7d4 make anything used in a resource body always reachable
(they appear to be uncond. inlined)

Fixes #2170.
2012-04-09 16:36:59 -07:00
Brian Anderson
a1d59704ed rustc: Add more creader logging 2012-04-09 15:06:38 -07:00
Haitao Li
46e4aaa0be rustc: External fns declared as fns not global variables
Issue #2167
2012-04-09 14:38:53 +08:00
Haitao Li
460b92a37f rustc: Declare rust_start as a function
Issue #2167
2012-04-09 12:02:16 +08:00
Haitao Li
7d227f21f7 Check metadata hash when loading transitive dependent crates
Fix issue #2138
2012-04-08 21:19:15 +08:00
Haitao Li
18597b22b5 Remove a FIXME note about closed issue #1001 2012-04-08 18:24:32 +08:00
Brian Anderson
a6e748a1d9 rustc: Hash the CMH into symbol names 2012-04-07 17:50:49 -07:00
Brian Anderson
d9070b4751 rustc: Append the crate version to symbols 2012-04-07 17:39:55 -07:00
Brian Anderson
19b7a7d803 Revert "Mangle exported names using node IDs rather than types"
This reverts commit c83d61de93.
2012-04-07 17:29:06 -07:00
Niko Matsakis
1e42c9a367 Do not consider ty_bot to be a "resolved type".
Fixes #2149. Fixes #2150. Fixes #2151.
2012-04-07 17:12:48 -07:00
Haitao Li
7aaa120bcc Check version when resolving transitive dependent crates
Issue #2138
2012-04-08 02:05:09 +08:00
Haitao Li
5aa5220f8a Encode crate dependencies' hash and version data 2012-04-08 02:00:58 +08:00
Niko Matsakis
5300662b4e Refactor inference so that subtyping/lub/glb share more code 2012-04-07 07:25:41 -07:00
Haitao Li
2f42b14b4f Use version and hash in crate_map name
Related issue #2137
2012-04-07 22:11:23 +08:00
Haitao Li
13686b6778 Use real crate name in crate_map name
`use` statement may introduce an crate name alias. This patch always
uses the link attrbute "name" as the crate's name when building the
crate map.

Closes #1706
2012-04-07 22:08:54 +08:00
Tim Chevalier
9d274ec5f2 Re-rename option functions
get_with_default (nee from_maybe) => get_default
with_option (nee maybe) => map_default
with_option_do (nee may) => iter

As per discussion of 21be1379d5
2012-04-06 12:20:13 -07:00
Marijn Haverbeke
fc202ca034 Remove support for old-style for
Closes #1619
2012-04-06 20:38:23 +02:00