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
Marijn Haverbeke
c902eafa14
Convert old-style for loops to new-style
...
Most could use the each method, but because of the hack used to
disambiguate old- and new-style loops, some had to use vec::each.
(This hack will go away soon.)
Issue #1619
2012-04-06 20:38:23 +02:00
Brian Anderson
5dd1677b0a
rustc: Warn when linking to multiple versions of the same crate
...
This is not something most people want to be doing and may
be a source of error.
2012-04-06 10:58:03 -07:00
Brian Anderson
de3528846f
rustc: Fail when there are multiple matches for 'use'
2012-04-06 10:58:03 -07:00
Niko Matsakis
0255bf30ea
continue refactoring to remove commutativity assumption
...
and introduce more indirection where it may be needed
2012-04-06 10:35:44 -07:00
Niko Matsakis
586b072eef
Make tps invariant for now. Fixes #1973 .
2012-04-06 08:31:12 -07:00
Niko Matsakis
9de288c35f
further refactoring away from commutativity
2012-04-06 08:10:07 -07:00
Niko Matsakis
4856eab844
refactor to make combine less inherently commutative
2012-04-06 08:03:59 -07:00
Niko Matsakis
2c56ba7e43
improve error messages
2012-04-06 06:59:00 -07:00
Niko Matsakis
051f24da25
add static region and also fix regions to be contravariant
2012-04-05 21:16:28 -07:00
Niko Matsakis
f1afb0b3e2
utilities for indented logs
2012-04-05 21:16:28 -07:00
Brian Anderson
2577bd9df3
rustc: Don't assume that all crates with the same name are the same
2012-04-05 20:53:16 -07:00
Brian Anderson
d13c0c77a2
Explicitly use version 0.2 of crates
2012-04-05 20:29:42 -07:00
Tim Chevalier
c83d61de93
Mangle exported names using node IDs rather than types
...
Use node IDs rather than types to ensure exported names are unique.
duplicate symbol. Closes #2074 .
2012-04-05 18:22:53 -07:00
Niko Matsakis
b91c9f803d
simplify typing rule for vector addition: use mutability of LHS
2012-04-05 15:18:26 -07:00
Tim Chevalier
5a3875e998
Print "expected a record with field..." fields in the right order
...
Because terr_record_mismatch was getting called by infer::flds,
which takes types a and b where it's trying to prove a <: b, the
expected and actual fields were switched. Fixed it. Closes #2094
2012-04-05 15:16:12 -07:00
Niko Matsakis
c0d61795de
wip: refactor repr of regions
...
- we now distinguish bound/free parameters (see region-param
test case for why this is necessary)
- we also track bounds on region variables
- also, restructure fold_ty() to have multiple variants without
duplication instead of one overloaded folder. This also allows
for using block functions.
2012-04-04 19:41:23 -07:00
Niko Matsakis
1956d11f84
refactor to condense common usage pattern
2012-04-04 19:17:06 -07:00
Graydon Hoare
ab4105d9e8
Make nonconstructable enums noncopyable, close #1907 .
2012-04-04 19:07:52 -07:00
Brian Anderson
9aa7241f05
rustc: Don't allow recursive constants
2012-04-04 16:12:57 -07:00
Brian Anderson
38ed2ea096
rustc: Allow consts to refer to other consts
2012-04-04 15:03:39 -07:00
Erick Tryzelaar
2ad20df40b
std: Rename result::methods to result::extensions
2012-04-03 22:43:09 -07:00
Erick Tryzelaar
4871f11439
std: change timeval to ns resolution timespec
...
This lets us use the more precise clock_gettime on posix
machines.
2012-04-03 22:43:08 -07:00
Erick Tryzelaar
7aae7320db
std: change time::timeval to be {sec: i64, usec: i32}.
...
It's possible to have negative times if expressing time before 1970, so
we should use signed types. Other platforms can return times at a higher
resolution, so we should use 64 bits.
2012-04-03 22:43:08 -07:00
Tim Chevalier
1f892dcb01
Monomorphize class constructors, support generic classes and class methods
...
Allow class methods to have type parameters (this is a change from the
original classes proposal).
Add test cases for classes with type parameters, and classes with methods
that have their own type parameters.
2012-04-03 16:23:50 -07:00
Marijn Haverbeke
f65e26eeee
Output type sizes in reinterpret_cast error message
...
Closes #2095
2012-04-03 16:37:54 +02:00
Marijn Haverbeke
90d3f0fb5e
Ensure method names in iface and impl items are unique
...
Closes #2114
2012-04-03 16:37:28 +02:00
Graydon Hoare
28a0e9c999
Construct new strings through upcalls.
2012-04-02 17:38:06 -07:00
Tim Chevalier
21be1379d5
Rename some core::option functions
...
from_maybe => get_with_default
maybe => with_option
may => with_option_do
I know these names are kind of ridiculous, but it's the best I could think of.
Feel free to bikeshed. Closes #2081
2012-04-02 16:12:49 -07:00
Graydon Hoare
987bc23629
Remove redundant **tydesc gepi/load pair in call_tydesc_glue_full.
2012-04-02 15:26:12 -07:00
Jonathan Sternberg
3a0477c398
Fixing issue 1919. list_dir is the more general version that returns a vector with the contents of the directory. list_dir_path contains the old behavior (as a convenience function).
2012-04-01 11:39:17 -04:00
Brian Anderson
0904f25507
rustc: Convert some error logs to debug
2012-03-30 17:31:40 -07:00
Marijn Haverbeke
a4906b81f7
Change a span_err back to span_fatal
...
Closes #2073
2012-03-30 08:25:45 +02:00
Niko Matsakis
35a3fa0999
add some comments explaining how the tables work
2012-03-29 19:41:09 -07:00
Niko Matsakis
2b45da8a33
refactor to store the types during inference in tables in the fcx
...
this is a step towards separating out the repr. of
types during inference from the repr. in later stages.
2012-03-29 19:41:09 -07:00
Niko Matsakis
f682b99e36
generate correct constraints for assignments
2012-03-29 19:41:09 -07:00
Niko Matsakis
76d0a13ae5
resolve type variables with no constraints to bot
2012-03-29 19:41:09 -07:00
Brian Anderson
ad26b00696
rustc: Generate fewer landing pads
2012-03-29 16:43:18 -07:00
Brian Anderson
7f9ed39040
rustc: Only invoke when there are cleanups
2012-03-29 16:43:18 -07:00
Brian Anderson
8780db2e0b
rustc: Delete some unused invoke code
2012-03-29 16:43:18 -07:00
Brian Anderson
b420f46f03
rustc: Don't generate landing pad cleanups for boxy things
2012-03-29 16:43:18 -07:00
Brian Anderson
106c9faa59
rustc: Move ext to librustsyntax
2012-03-29 14:42:31 -07:00
Brian Anderson
0e87039348
rustc: Remove the rustsyntax::attr wrapper in front
2012-03-29 14:42:31 -07:00
Brian Anderson
ba69a738c7
rustc: Cleanup
2012-03-29 14:42:31 -07:00
Brian Anderson
442d0a783a
rustc: Move attr, parse, print to rustsyntax
2012-03-29 14:42:31 -07:00
Brian Anderson
15947f8b19
rustc: Move lexer and token to rustsyntax
2012-03-29 14:42:30 -07:00
Brian Anderson
ce216a5533
rustc: Remove the session dependency from front::attr
2012-03-29 14:42:30 -07:00
Brian Anderson
cb2840bcaf
rustc: Add an accessor to get the diagnostic handler from the session
2012-03-29 14:42:30 -07:00
Brian Anderson
8f809f89d9
rustc: Move diagnostic to rustsyntax
2012-03-29 14:42:30 -07:00
Brian Anderson
5c25e78b27
rustc: Move fold to rustsyntax
2012-03-29 14:42:30 -07:00
Brian Anderson
454df53464
rustc: Move interner to rustsyntax
2012-03-29 14:42:30 -07:00
Brian Anderson
9e299f53f4
rustc: Move ast, ast_util, visit to rustsyntax
2012-03-29 14:42:30 -07:00
Brian Anderson
140151f3f9
rustc: Move codemap to rustsyntax
2012-03-29 14:42:30 -07:00
Brian Anderson
a0ed1fb20b
build: Introduce rustsyntax crate
2012-03-29 14:42:30 -07:00
Tim Chevalier
c7082ce8e8
Require "self" as base expression for intra-class method or field references
...
All field or method references within a class must begin with "self." now.
A bare reference to a field or method in the same class will no longer
typecheck.
2012-03-29 12:22:01 -07:00
Patrick Walton
2663018792
rustc: Fix an infinite loop during size calculations for recursive region pointer types
2012-03-29 08:41:25 -07:00
Tim Chevalier
f7bbe537c1
Allow explicit self-calls within classes
...
Allow writing self.f() within a class that has a method f. In a future
commit, this syntax will be required. For now, you can write either
self.f() or f().
I added a "privacy" field to all methods (whether class methods or not),
which allowed me to refactor the AST somewhat (getting rid of the
class_item type; now there's just class_member).
2012-03-28 20:30:07 -07:00
Niko Matsakis
fe610f04d8
use fresh vars in place of _|_ when incorrect # of params supplied
2012-03-28 17:02:54 -07:00
Niko Matsakis
23f92ea370
Detect and report types which could never be instantiated.
...
Fixes #2063 .
2012-03-28 17:02:54 -07:00
Patrick Walton
3c398d28a4
rustc: Universally quantify regions when calling functions. Un-XFAIL regions-addr-of-ret.rs.
2012-03-28 14:24:18 -07:00
Tim Chevalier
ca6636d6b6
Allow references to "self" within classes
...
Allow writing self.f within a class that has a field f. Currently,
the compiler accepts either self.f or f. In a future commit I'll
require writing self.f and not f.
Not sure whether self.f() works if f is a method (making sure that
works next).
2012-03-28 14:19:00 -07:00
Graydon Hoare
b37d7e26fe
Update crate URLs to point to interesting things.
2012-03-28 13:52:47 -07:00
Marijn Haverbeke
90cf9e0d6f
Make sure type_use.rs doesn't get lost in recursive enums
...
Closes #2059
2012-03-28 10:35:16 +02:00
Tim Chevalier
edb747ceed
Enforce mutability declarations in classes; correct shapes for classes
...
1. Enforce mutability declarations on class fields. Don't allow any
mutation of class fields not declared as mutable (except inside the
constructor).
2. Handle classes correctly in shape (treat classes like records).
2012-03-27 22:11:58 -07:00
Niko Matsakis
c9102ee7a1
make type_kind exhaustive, add an entry for type_self (in particular)
2012-03-27 15:44:36 -07:00
Brian Anderson
ba3292d3be
rust: Remove extensions' dependency on the session
2012-03-27 14:16:46 -07:00
Marijn Haverbeke
73d6df32cd
Emergency safe-ref-checker maintenance
...
It still has some big problems, but at least it more or less
understands block arguments now.
Closes #1925
2012-03-27 17:22:57 +02:00
Marijn Haverbeke
b5a4fa9456
Move some code over to iterator-for to see how it performs.
2012-03-27 15:46:33 +02:00
Marijn Haverbeke
064f82d68d
Support returning from loop blocks
...
The code is somewhat invasive, but it seems hard to do this in a
clean way, since the design itself involves a bunch of 'action
at a distance'.
Issue #1819
2012-03-27 12:33:13 +02:00
Marijn Haverbeke
f6e3738b9c
Support an alternate for syntax that calls a higher-order function
...
The last argument of the call must be a block, and the type of this
argument must a function returning bool. `break` and `cont` are
supported in the body of the block, and return `false` or `true` from
the function. When the end of the function is reached, `true` is
implicitly returned.
for vec::all([1, 2, 3]) {|elt|
if elt == 2 { break; }
log(error, elt);
}
Issue #1619
2012-03-27 09:27:31 +02:00
Graydon Hoare
6e6798c4e1
Bulk-edit mutable -> mut.
2012-03-26 18:35:18 -07:00
Brian Anderson
45a709766c
rustc: Begin eliminating ext's dependency on the session
2012-03-26 17:16:26 -07:00
Brian Anderson
a477aaba08
rustc: Move eval_const_expr to its own mod
2012-03-26 17:16:26 -07:00
Patrick Walton
b7a741b5d0
rustc: Combine and unify regions
2012-03-26 15:07:15 -07:00
Patrick Walton
03086c5304
rustc: "unkown" -> "unknown"
2012-03-26 12:53:06 -07:00
Patrick Walton
b86c603bdf
rustc: Fix typo in infer
2012-03-26 12:52:31 -07:00
Patrick Walton
d877ebdd05
rustc: Remove obsolete FIXME in infer
2012-03-26 12:49:14 -07:00
Patrick Walton
407be52036
rustc: Generalize resolve_var to work with regions too
2012-03-26 12:42:38 -07:00
Tim Chevalier
11610f9ca1
In typeck, don't call ty::store_iface_methods on private methods
...
This was resulting in a different error message depending on whether
the private method you were trying to call was in the same crate
or a different one.
2012-03-26 10:46:37 -07:00
Niko Matsakis
21111660ca
Improve type inference to compute LUB/GLB
2012-03-26 10:34:58 -07:00
Tim Chevalier
c282810ab0
Enforce privacy declarations for class fields and methods
2012-03-26 10:00:33 -07:00
Marijn Haverbeke
b89a5af2ab
Check in a forgotten new file
2012-03-26 12:54:06 +02:00
Marijn Haverbeke
87e097a853
Disallow ret inside of block functions
...
Also adds proper checking for cont/break being inside a loop.
Closes #1854
Issue #1619
2012-03-26 12:45:47 +02:00
Marijn Haverbeke
e4c141a331
Fix bug in generation of non-generic resource dtors
...
Issue #1944
2012-03-26 11:31:17 +02:00
Niko Matsakis
763142816e
repair the build---also, make try/commit work over both ty/region vars
2012-03-25 13:32:13 -07:00
Patrick Walton
8462c6c831
rustc: Generalize several parts of infer in preparation for using them for region bounds as well
2012-03-24 23:14:45 -07:00
Niko Matsakis
bf9d714d46
Avoid unifying vars when possible; handle bot (more) correctly
2012-03-24 21:38:43 -07:00
Patrick Walton
bd6e6e349b
rustc: Stub some region resolution stuff in infer
2012-03-24 21:30:57 -07:00
Patrick Walton
7c27ec72d1
rustc: Add some simple region checking (no region vars yet)
...
Amazingly, this causes no test cases to fail!
2012-03-24 18:44:05 -07:00
Niko Matsakis
3e385a80d4
prune unused unification code; leave region code that still needs to be ported
2012-03-24 09:22:09 -07:00
Tim Chevalier
aae14e352a
Allow methods to call other methods in the same class
2012-03-23 23:10:45 -07:00
Niko Matsakis
6b84cee5d3
add a few measly comments, remove some dead code
2012-03-23 22:36:37 -07:00
Niko Matsakis
f5edb5ee18
xfail-test regions tests
2012-03-23 22:06:39 -07:00
Niko Matsakis
042c532a08
Implement new inference algorithm.
2012-03-23 21:47:28 -07:00
Tim Chevalier
40443768b1
Fix breakage
2012-03-23 20:53:38 -07:00
Tim Chevalier
8bbd78075f
Handle self correctly when translating classes
...
This change uses the same code for handling the "self" reference for
classes as is already used for impls/ifaces. This allows removing the
extra maybe_self_id argument (which was just for classes) to trans_closure
that I added before. I also rewrote the translation for class ctors so
that it doesn't generate new AST nodes (instead translating directly).
Also changed visit so that it visits class ctors correctly with visit_fn,
and changed typestate to not do return-checking when visiting a class ctor.
2012-03-23 20:37:50 -07:00
Patrick Walton
713b3585c6
rustc: Remove // */
sequence from trans/base.rs; it breaks vi syntax highlighting
2012-03-23 18:21:23 -07:00
Patrick Walton
0eae490669
rustc: Stub a table of borrowings
2012-03-23 17:28:24 -07:00
Patrick Walton
c56910fc9a
rustc: Make region folding not descend into function types
...
Since region parameters are always universally quantified at the function
level, this would be incorrect.
2012-03-23 17:06:24 -07:00
Patrick Walton
cba007e6c8
rustc: Fix parsing of ret &EXPR
...
The parser didn't think that `&` could start an expression.
2012-03-23 16:15:58 -07:00
Patrick Walton
7931a61ebb
rustc: Redo region inference to be a bit less broken
2012-03-23 12:22:58 -07:00
Marijn Haverbeke
84019aa0dc
Keep an explicit map of things that have to be spilled
...
This prevents us from spilling locals more than once.
Closes #2040
2012-03-23 16:08:01 +01:00
Marijn Haverbeke
1b81c5112a
Remove last vestiges of old-style intrinsics
...
Closes #2048
2012-03-23 16:08:01 +01:00
Marijn Haverbeke
a84b56bc70
Remove more needless context threading in trans
2012-03-23 14:45:47 +01:00
Marijn Haverbeke
5cfbbbc9ed
Revert resolve kludge that was working around #2049
2012-03-23 13:32:00 +01:00
Marijn Haverbeke
683085b3f0
Stop trying to link intrinsics.bc
2012-03-23 12:57:37 +01:00
Marijn Haverbeke
ca71e01bce
Interpret native mods with ABI rust-intrinsic as builtins
2012-03-23 12:52:53 +01:00
Marijn Haverbeke
52d618a99a
Revert removal of intrinsics
...
Oops. We can't do this yet until the next snapshot.
2012-03-23 12:51:20 +01:00
Marijn Haverbeke
c704d5a5d3
Clean up some confused shuffling of def_ids in resolve.rs
2012-03-23 12:38:36 +01:00
Marijn Haverbeke
562afef216
Rename builtin back to intrinsic
...
As per Graydon's request
Issue #1981
2012-03-23 12:21:56 +01:00
Marijn Haverbeke
f5024692d4
Remove support for the old-style intrinsics
...
Closes #2042
Closes #1981
2012-03-23 12:21:55 +01:00
Marijn Haverbeke
6374ffc5f3
Kludge in resolve to be able to land builtins
...
Something strange is happening to hash maps. I'm still investigating but
want to get my snapshot built in the meantime. (Problem only happened on
OS X.)
2012-03-23 11:09:19 +01:00
Marijn Haverbeke
cdb93d70a1
Fix bug in function-instance reuse
...
You can't safely reuse functions that pass a T by move, since they might
zero it out, which will not end well when it doesn't know its precise
size.
2012-03-23 10:49:47 +01:00
Marijn Haverbeke
16ca6e8d7f
Change vector append to no longer rely on an intrinsic
...
Issue #1981
2012-03-23 10:49:47 +01:00
Marijn Haverbeke
0545e4a920
Support [rust_stack] annotation on native functions (crudely)
2012-03-23 10:49:47 +01:00
Marijn Haverbeke
ea2e379e4f
Implement built-in native modules as an alternative to intrinsics
...
Issue #1981
2012-03-23 10:49:47 +01:00
Tim Chevalier
73a0c17d77
Make cross-crate calls to class methods work
2012-03-22 20:32:47 -07:00
Brian Anderson
f3fe85dad7
Bump version numbers to 0.2
2012-03-22 15:25:02 -07:00
Graydon Hoare
b224bcf6e1
Add an LLVM-instruction-counting mode to trans.
...
Pipe to xdu to see a trans call graph of generated insns.
2012-03-22 13:44:20 -07:00
Niko Matsakis
dc07280b08
make --enforce-mut-vars always on, add mut annotations to remaining files
2012-03-22 09:58:19 -07:00
Niko Matsakis
b653a18416
add mut decls to rustc and make them mandatory
2012-03-21 21:04:14 -07:00
Patrick Walton
44bd8da7fd
rustc: Use the right "nxt" function in unify_regions
2012-03-21 16:13:34 -07:00
Brian Anderson
75ee4633eb
rustc: Long lines
2012-03-21 16:10:39 -07:00
Josh Matthews
5835a4cc8e
Merge remote-tracking branch 'mozilla/master'
2012-03-21 19:01:04 -04:00
Patrick Walton
b0f6dad5e3
rustc: Add a function to record region bindings
2012-03-21 15:59:57 -07:00
Josh Matthews
8142438938
Avoid mangling names differently in debug builds to work around a build error. Fix up file name and path debug information, and build one compilation unit for a crate instead of one per source file.
2012-03-21 18:56:36 -04:00
Patrick Walton
c8ab0c1b3b
rustc: Replace region parameters in function return values
2012-03-21 15:22:12 -07:00
Patrick Walton
324f57a180
rustc: Check call and bind expressions using a set of region bindings
2012-03-21 14:47:57 -07:00
Patrick Walton
bdf968c9d9
rustc: Add a version of demand
that takes in a set of region variable bindings
2012-03-21 14:15:43 -07:00
Tim Chevalier
30c272cb3a
methods work
...
Cross-crate method calls don't work yet. Added
run-pass/class-method-cross-crate to test that, but it's xfailed
References to fields within methods don't work yet. Added
run-pass/class-methods to test that, but it's also xfailed
2012-03-21 13:53:21 -07:00
Patrick Walton
3e47442471
rustc: Add region unification functions
2012-03-21 13:28:50 -07:00
Patrick Walton
68e364b54d
rustc: Introduce re_params into the typechecker
...
This is the first step of the region refactoring I need to do in order to handle named regions properly.
2012-03-21 12:21:53 -07:00
Marijn Haverbeke
9502fb99e0
Fix bug in vtable resolution
2012-03-21 15:57:23 +01:00
Niko Matsakis
cfcbec3cc3
Implement an initial version of placement new.
2012-03-20 20:39:40 -07:00
Patrick Walton
ba39e277e2
stdlib: Implement arenas
2012-03-20 19:08:17 -07:00
Patrick Walton
237cd4455c
rustc: Fix a few more instances of node ID stomping, due to AST folding incorrectly passing stuff through unchanged
2012-03-20 18:37:09 -07:00
Patrick Walton
86ebde575c
rustc: Make the quasiquote operator stop reusing nodes (and therefore stop reusing node IDs). Should fix issue #1947 for real.
2012-03-20 17:23:46 -07:00
Tim Chevalier
b06dc884e5
Class methods WIP
...
In particular, use the ast::method type to represent a class method,
and try to reuse as much iface code as possible. (This makes sense now
since I'll be allowing polymorphic class methods.)
2012-03-20 17:07:07 -07:00
Brian Anderson
b181ea415e
core: Rename unsafe::leak to unsafe::forget. Closes #2031
2012-03-20 15:20:37 -07:00
Graydon Hoare
56828d49fd
Remove unused "flav" parameter from function registration paths.
2012-03-20 15:16:12 -07:00
Graydon Hoare
d282481c12
Fix naughty mangling-breakage from stringifying a node ID. Close #1344 .
2012-03-20 15:16:12 -07:00
Graydon Hoare
8e911cbd65
Work on fixing name mangling.
2012-03-20 15:16:12 -07:00
Brian Anderson
f3ed738399
rustdoc: Run the entire resolve pass
2012-03-20 14:54:40 -07:00
Graydon Hoare
b994b17be8
Remove object file directly rather than running "rm". Close #1778 also.
2012-03-20 12:39:40 -07:00
Jyun-Yan You
d3712a287d
make native and crust functions conform to x86-64 ABI
2012-03-20 11:59:24 -07:00
Marijn Haverbeke
1a20f8e7cc
rustc: Be more careful about spans in 'unexpected token' errors
...
Closes #2017
2012-03-20 15:05:14 +01:00
Marijn Haverbeke
7a34ac5890
Revert order of arguments to option::maybe and from_maybe
...
Closes #2019
2012-03-20 14:55:07 +01:00
Marijn Haverbeke
1547c27926
Fix caching bug in resolve, get rid of enumness kludge
...
Closes #1911
2012-03-20 14:33:04 +01:00
Marijn Haverbeke
928364b98b
Only make symbols external when they are actually externally accessible
...
Closes #2030
2012-03-20 13:19:33 +01:00
Marijn Haverbeke
ade1207ba3
Move external-reachability checker to trans
...
Preparation for a fix for issue #2020
2012-03-20 12:28:46 +01:00
Patrick Walton
bf13fb7921
rustc: Fix handling of the self
region in method return types. Also stub some code to allow the regions of simple field access expressions to be determined.
2012-03-19 18:52:18 -07:00
Patrick Walton
b12588a197
rustc: Fix mutability checking when dereferencing a region-annotated pointer
2012-03-19 17:28:00 -07:00
Brian Anderson
20417ebf31
core: Move unsafe conversions to str::unsafe
2012-03-19 15:47:52 -07:00
Graydon Hoare
869b2d7064
Send string concatenation to specialized upcall, shave 17s off librustc compile time.
2012-03-19 14:29:39 -07:00
Brian Anderson
bbfa08d947
rustc: Stop generating the flag_none #fmt flag. Issue #1993
2012-03-19 14:28:42 -07:00
Marijn Haverbeke
cec1a9b859
Properly check kinds when instantiating types
...
Closes #2011
2012-03-19 10:45:29 +01:00
Brian Anderson
13bcc73625
core: Rename vec::position_elt to position_elem
2012-03-18 17:40:49 -07:00
Damien Grassart
38ac87f0ff
rustc: Fix typo in error message
2012-03-18 04:45:03 +01:00
Tim Chevalier
e3a1c5c96a
Encode both private and public class fields in metadata
...
This is necessary to calculate the correct offsets for field references.
Simple cross-crate class tests (still with fields only) now pass.
2012-03-16 20:36:07 -07:00
Tim Chevalier
16dd6c4756
Fix encoding of class ctors
...
Class tests still fail at runtime
2012-03-16 19:20:36 -07:00
Josh Matthews
d958123d8a
Don't break -g in the presence of monomorphization.
2012-03-16 20:19:52 -04:00
Brian Anderson
154a3fdf44
rustc: Unify impl self types in the opposite order so variance is correct
2012-03-16 17:06:15 -07:00
Tim Chevalier
1680ccce1e
Classes WIP
...
Cross-crate metadata for classes works well enough that programs with
classes in other crates compile successfully, but output wrong results.
Checking in work so far to avoid merge hassles. (Tests are xfailed.)
2012-03-16 15:28:05 -07:00
Brian Anderson
47d468f08c
core: Store reexporting result and either. Closes #1997
2012-03-16 15:14:37 -07:00
Niko Matsakis
e399ddbf17
allow binding of fn~, make result fn@. fixes 1899.
2012-03-16 17:48:53 -04:00
Patrick Walton
f6a792585b
rustc: Give a better error message when references involving the caller region fail to unify
2012-03-16 14:02:02 -07:00
Marijn Haverbeke
35fc4a4291
Check kind bounds when calling methods
...
Closes #1915
2012-03-16 17:05:29 +01:00
Marijn Haverbeke
25c2be0ff4
Forbid boxed ifaces with self types or generic methods in bounded params
...
They are a soundness hole.
Closes #1994
2012-03-16 15:39:07 +01:00
Marijn Haverbeke
22bef74b55
Remove shared tydescs
...
All tydescs are static now, there's no need to worry about
marshalling them between threads anymore.
2012-03-16 15:38:42 +01:00
Marijn Haverbeke
15a325f267
Support binding of methods off boxed iface values
...
Closes #435
2012-03-16 12:58:26 +01:00
Patrick Walton
e464e2ba56
rustc: Describe why regions failed to unify as part of the type error message
2012-03-15 19:19:32 -07:00
Patrick Walton
4ea3b0b89c
rustc: Fix the AST map to actually map blocks. Also improve region error messages involving blocks.
2012-03-15 19:06:38 -07:00
Patrick Walton
e0edcfc21c
rustc: Index blocks
2012-03-15 18:46:57 -07:00
Tim Chevalier
e3222e9905
Improve error message for passing mutable argument by reference
2012-03-15 17:50:22 -07:00
Patrick Walton
95ce42b346
rustc: Instantiate self regions in impls
2012-03-15 17:14:02 -07:00
Patrick Walton
0095e6d85b
rustc: Have the typechecker pick up the resolved self region
2012-03-15 16:48:53 -07:00
Marijn Haverbeke
146b61189a
Get rid of rust_crate_cache in the runtime
...
We are no longer generating dynamic tydescs or dicts.
Issue #1982
2012-03-16 00:44:06 +01:00
Patrick Walton
bc21a5ddbe
rustc: Create self region bindings, and forbid the self region from being used in places it shouldn't be
2012-03-15 16:38:08 -07:00
Niko Matsakis
d365ec5c7d
kill old serialization code
2012-03-15 18:30:10 -04:00
Niko Matsakis
3dca3393fa
switch over to using new serialize/deserialize code
2012-03-15 18:30:08 -04:00
Brian Anderson
5e8004d493
std: Follow conventions in bitv
2012-03-15 14:08:47 -07:00
Marijn Haverbeke
337d860a87
Make last-use finder treat referenced function arguments properly
...
Closes #1964
2012-03-15 17:04:35 +01:00
Marijn Haverbeke
1745ac9c61
Remove tests from astencode.rs
...
They mysteriously fail on Windows, and Niko assures me this code is about
be replaced anyway.
2012-03-15 15:44:19 +01:00
Marijn Haverbeke
2e3f1096bb
Fix bug in vtable builder
...
Closes #1947 , which I completely misdiagnosed.
2012-03-15 15:08:31 +01:00
Marijn Haverbeke
24ed441a05
Reuse monomorphized functions more aggressively
...
Adds a trans::type_use pass that, given a function body, detects how
dependant that function is on properties of its type parameters.
2012-03-15 15:08:31 +01:00
Marijn Haverbeke
3ab9978b9b
Remove support for dynamically-sized types from translation code
2012-03-15 15:08:31 +01:00
Marijn Haverbeke
a4d75a4ed1
Remove GEP_tup_like
2012-03-15 15:08:31 +01:00
Marijn Haverbeke
c3a93ecd3f
Remove dynastack code from compiler
2012-03-15 15:08:30 +01:00
Marijn Haverbeke
bc8a43a776
Remove lltyparams field in trans::common::fn_ctxt
2012-03-15 15:08:30 +01:00
Marijn Haverbeke
332329f161
Don't pass an undef retptr to generic intrinsics
...
It leads to segfaults
2012-03-15 10:22:46 +01:00
Marijn Haverbeke
b6ad34bef4
Properly recognize external intrinsics
2012-03-15 10:22:46 +01:00
Marijn Haverbeke
e4cbd43c43
Huge kludge to get intrinsics' type parameters passed
2012-03-15 09:41:21 +01:00
Marijn Haverbeke
9aa78e34e4
Never pass tydesc to functions
...
My assumption that native generics needed them was wrong, so tydescs
can be eliminated from function signatures completely.
2012-03-15 09:40:52 +01:00
Marijn Haverbeke
47f35c9d34
Properly replace iface tps with impl tps in static method calls
...
Un-xfail iface-generic.rs
2012-03-15 09:32:53 +01:00
Marijn Haverbeke
fe90c189f4
Only write metadata for items that actually appear in the root AST
...
Not for imported ASTs from inlined items.
2012-03-15 09:32:53 +01:00
Marijn Haverbeke
2c8c50d6cb
Make sure enum and resource constructors are inlined properly
2012-03-15 09:32:53 +01:00
Marijn Haverbeke
4650e8bcf4
Make sure resource destructors are properly monomorphized
2012-03-15 09:32:53 +01:00
Marijn Haverbeke
8f84d4c8b6
Remove a large part of the tydesc-passing code
2012-03-15 09:31:34 +01:00
Marijn Haverbeke
83c9f58534
Rename dict to vtable throughout the compiler
...
The difference went away.
2012-03-15 09:28:50 +01:00
Marijn Haverbeke
4511f936b1
Hugely simplify iface handling
...
With the assumption of monomorphization
2012-03-15 09:26:54 +01:00
Marijn Haverbeke
168398bb3d
Stop generating generic versions of generic functions
...
Monomorphic instances are generated on demand.
2012-03-15 09:00:21 +01:00
Marijn Haverbeke
47e65403b7
Disallow calling generic methods through a boxed iface
2012-03-15 08:59:29 +01:00
Marijn Haverbeke
5e647d799e
Fix assumption that monomorphized method's impls are crate-local
2012-03-15 08:59:29 +01:00
Marijn Haverbeke
75e6fb4feb
Fix monomorphization of resource constructors
2012-03-15 08:59:29 +01:00
Marijn Haverbeke
0e5da379dd
Turn on monomorphization by default
2012-03-15 08:59:29 +01:00
Marijn Haverbeke
c67679ea03
Write out the AST for all externally-reachable generics
2012-03-15 08:59:29 +01:00
Brian Anderson
2a293ed8b8
Convert *u8 native string users to *c_char
2012-03-14 18:20:14 -07:00
Brian Anderson
3a2df84d89
core: Rename str::from_cstr et. al to from_buf
2012-03-14 18:19:08 -07:00
Brian Anderson
9e480708a2
core:: Eliminate str::sbuf. Replace with *u8
2012-03-14 18:19:08 -07:00
Brian Anderson
3864d6d845
std: Rename the hashmap constructors to conform to new standards
...
Instead of using the new_ prefix just name them after their type
2012-03-14 18:19:08 -07:00
Patrick Walton
383a801993
rustc: Universally quantify regions when looking up typeclass implementations
2012-03-14 18:17:40 -07:00
Niko Matsakis
a3d2882ffd
fixup auto_serialize's treatment of nullary variants
2012-03-14 21:05:06 -04:00
Niko Matsakis
e702d20191
allow immut vars to be moved. enforce mut vars after stage0 in std.
2012-03-14 20:46:36 -04:00
Patrick Walton
273c5e5f11
rustc: Lift the @ from the type definition of crate_ctxt into its uses
...
This will make it easier to convert crate_ctxt into a region pointer, since
there are functions that return crate contexts. There would be no way to type
these functions if crate_ctxt had to be an inferred region pointer.
2012-03-14 17:31:16 -07:00
Patrick Walton
1e0e089185
rustc: Fix a couple of bugs that prevented taking addresses of rvalues
2012-03-14 16:50:20 -07:00
Patrick Walton
fd9c9ac912
rustc: Make region dereference no longer require an unsafe block
2012-03-14 16:17:45 -07:00
Patrick Walton
0cd72d24dc
rustc: Autoderef through region pointers
2012-03-14 16:13:05 -07:00
Patrick Walton
45d0b5f0b9
rustc: Reword field/method-not-found error message to mention the possibility that a field wasn't found
2012-03-14 16:02:59 -07:00
Patrick Walton
1ed768bc3b
rustc: Determine the region of pointer dereference expressions
2012-03-14 15:13:04 -07:00
Niko Matsakis
1600be2c3b
fix auto_serialize for enums with type parameters
2012-03-14 17:19:33 -04:00
Patrick Walton
715d1995d7
rustc: Make the self region work properly in enums
2012-03-14 14:05:57 -07:00
Patrick Walton
3a45f87620
rustc: Record the parent blocks of locals
2012-03-14 11:41:50 -07:00
Marijn Haverbeke
de79caa97e
Add crude support for casts in constant expressions
...
Only casts to integral and float types are supported
Closes #1975
2012-03-14 18:05:28 +01:00
Marijn Haverbeke
c988800cf5
Properly walk pat_lit and pat_range in visit.rs
...
Issue #1975
2012-03-14 18:04:31 +01:00
Niko Matsakis
ffa187db25
adjust auto_serialize to generate fns named serialize_T()
...
We used to generate a module T with a serialize() and deserialize() fn,
but this was suboptimal for a number of reasons:
- it required moving serialization into core so that uint etc worked
- it was harder to override the serialization behavior locally
(this is now trivial)
2012-03-14 11:49:28 -04:00
Niko Matsakis
7c70d35a10
rewrite unify in a modal style, extend result module
2012-03-13 21:53:14 -04:00
Niko Matsakis
b30cb8e43a
implement deserialization, rename mk_mem_buffer() to mem_buffer()
2012-03-13 21:30:07 -04:00
Niko Matsakis
d91742294f
first (functional) version of the auto_serialize syntax ext
2012-03-13 21:30:07 -04:00
Niko Matsakis
06c8acdd31
fixup serialize_variant
2012-03-13 21:30:07 -04:00
Niko Matsakis
bdd0c9387b
get new decorator extensions working
2012-03-13 21:30:06 -04:00
Patrick Walton
c3516f091b
rustc: Allow the addresses of rvalues to be taken
2012-03-13 18:24:14 -07:00
Patrick Walton
fc50abe6c5
rustc: Instantiate "caller" regions when calling functions
2012-03-13 17:31:34 -07:00
Brian Anderson
aeb445b2ea
rustc: Don't make the while loop body's basic block a child of the condition
...
As a child of the condition, when the body encounters a ret or break it
incorrectly re-runs the cleanups of the condition.
2012-03-13 17:27:17 -07:00
Patrick Walton
b87cdd8572
rustc: Infer regions of variant arguments to the caller region
2012-03-13 16:16:27 -07:00
Patrick Walton
8cbaebbb49
rustc: Get reference typedefs working
2012-03-13 15:53:16 -07:00
Brian Anderson
b968c8e6cd
Name types after their modules instead of 't'
2012-03-13 15:14:17 -07:00
Patrick Walton
a38ccf1254
rustc: Thread the use site around in ast_ty_to_ty
2012-03-13 14:41:18 -07:00
Patrick Walton
0837a6ba04
rustc: Don't cache ast_ty_to_ty results for types that have references
2012-03-13 14:13:13 -07:00
Patrick Walton
107767731a
rustc: Use only ast_ty_to_ty for region inference
2012-03-13 12:01:34 -07:00
Patrick Walton
014dd547a0
rustc: Use the inferred region as the self region in ast_ty_to_ty as well
2012-03-13 11:34:48 -07:00
Patrick Walton
ec340c8f40
rustc: Look up inferred regions in ast_ty_to_ty
2012-03-13 11:26:55 -07:00
Brian Anderson
cd72b1f848
Overhaul constructor naming in libs
2012-03-13 11:07:22 -07:00
Patrick Walton
aea8736129
rustc: Fix long line
2012-03-13 11:04:02 -07:00
Patrick Walton
07b4c80c68
rustc: Record what &
would resolve to for every AST type
2012-03-13 10:44:37 -07:00
Marijn Haverbeke
e54cde5215
Use type size/alignment of target, rather than host, in debuginfo
2012-03-13 16:20:31 +01:00
Marijn Haverbeke
463cf837eb
rustc: Teach trans::alt.rs about exhaustive alts
...
Closes #1971
2012-03-13 16:20:31 +01:00
Kevin Atkinson
15985277b9
Fix Issue #1926 by sorting the gather list.
2012-03-13 07:40:41 -04:00
Graydon Hoare
6f5853f5a1
Libc/os/run/rand/io reorganization. Close #1373 . Close #1638 .
...
- Move io, run and rand to core.
- Remove incorrect ctypes module (use libc).
- Remove os-specific modules for os and fs.
- Split fs between core::path and core::os.
2012-03-12 20:08:29 -07:00
Patrick Walton
ac57bb3856
rustc: Word a comment more clearly in region.rs
2012-03-12 18:56:13 -07:00
Patrick Walton
afa046a56b
rustc: Use linked lists instead of hash tables for region binding scopes
...
Hash tables are overkill.
2012-03-12 18:47:18 -07:00
Patrick Walton
4571175568
stdlib: Make list::find do what the docs say it does.
...
Talked on #rust about this change, got approval from graydon and brson. Will bring up tomorrow at meeting to verify.
2012-03-12 18:28:16 -07:00
Patrick Walton
dd610a151b
rustc: Add node IDs to AST types so we can associate them with region environments
2012-03-12 17:34:37 -07:00
Patrick Walton
59a56ad043
Revert "rustc: Add node IDs to AST types so we can associate them with region environments"
...
This reverts commit 96e1bbd4a0
.
2012-03-12 16:33:55 -07:00
Patrick Walton
96e1bbd4a0
rustc: Add node IDs to AST types so we can associate them with region environments
2012-03-12 16:28:15 -07:00
Patrick Walton
db77c38fc9
rustc: Use the name map to resolve region names
2012-03-12 13:58:08 -07:00
Patrick Walton
864ff4707e
rustc: Map region names to their functions. Also speed up region checking by 17x.
2012-03-12 13:25:10 -07:00
Patrick Walton
47bfd4f4e9
rustc: Refactor regions to handle nested functions properly and fix the subtyping relation
2012-03-12 12:43:47 -07:00
Tim Chevalier
664d71f1f0
Improve a typechecker error message (wrong type for main())
...
As per #1903 , state what type is expected for main().
Closes #1903
2012-03-11 20:55:19 -07:00
Patrick Walton
46aec2c960
rustc: Record the parent function of each function
2012-03-11 17:02:16 -07:00
Patrick Walton
cb1efb0092
rustc: Fix long lines
2012-03-11 16:18:52 -07:00
Patrick Walton
8f9afec5a3
rustc: Turn on errors for region checking
2012-03-11 13:29:23 -07:00
Patrick Walton
3e8bb22af1
rustc: Unify regions in most cases. (Nested functions aren't properly handled yet.)
2012-03-11 13:28:43 -07:00
Patrick Walton
f7efc29b38
rustc: Determine regions for locals
2012-03-11 12:36:56 -07:00
Patrick Walton
e968672ac7
rustc: Map local variables to their containing blocks so we know their regions
2012-03-11 12:05:17 -07:00
Tim Chevalier
8ab075ee45
Clean up occurs check code and give non-breaking loop {..}s _|_ type
...
The latter change is so that code dominated by a loop{ } without a
break gets considered unreachable.
The former change is just cosmetic (occurs_check_fails was a predicate
when it should be a unit-typed function that can fail).
2012-03-10 20:35:41 -08:00
Tim Chevalier
205cefdc6e
In typestate, consider infinite loops w/ conts to be infinite
...
If a loop { } contains a cont, that doesn't affect whether the entire
loop diverges. Only breaks affect that. Fix that in typestate.
2012-03-10 20:34:57 -08:00
Tim Chevalier
35400e13ad
Use loop instead of while(true) in libraries and compiler itself
...
And remove spurious fails/unreachable() calls.
2012-03-10 20:34:17 -08:00
Tim Chevalier
98260a2a22
Handle infinite-loop poststate correctly in typestate
...
If control passes an infinite loop (that doesn't have non-local
exits), then everything is true.
2012-03-10 20:15:27 -08:00