Patrick Walton
b12588a197
rustc: Fix mutability checking when dereferencing a region-annotated pointer
2012-03-19 17:28:00 -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
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
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
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
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
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
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
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
Brian Anderson
2a293ed8b8
Convert *u8 native string users to *c_char
2012-03-14 18:20:14 -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
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
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
Niko Matsakis
7c70d35a10
rewrite unify in a modal style, extend result module
2012-03-13 21:53:14 -04:00
Niko Matsakis
d91742294f
first (functional) version of the auto_serialize syntax ext
2012-03-13 21:30:07 -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
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
Brian Anderson
91e5a1c8b3
core: Remove the nearly empty math module
...
This mod only had two functions, all of whose users have been changed
to use the uint module.
2012-03-10 17:43:19 -08:00
Brian Anderson
e4bb2d707f
core: Rename vec::tail_n to vec::tailn to match other fns
2012-03-10 00:44:13 -08:00
Tim Chevalier
a0521971b1
Merge branch 'master' into floop-for-snapshot
2012-03-09 22:16:52 -08:00
Patrick Walton
e8c7b5347d
rustc: Add a region checking pass
...
Errors aren't reported yet, because the regions aren't properly inferred from the & operator at the moment and that would break the tests.
2012-03-09 17:39:32 -08:00
Tim Chevalier
321fd80219
Add an infinite loop construct
...
Add a loop {} construct for infinite loops, and use it in test
cases. See #1906 for details.
2012-03-09 16:40:58 -08:00
Patrick Walton
4ffcb95974
rustc: Perform region inference
2012-03-09 16:40:37 -08:00
Patrick Walton
7b938d8903
rustc: Add region def ids to the AST
2012-03-09 15:55:13 -08:00
Patrick Walton
e2f6052c6d
Revert "rustc: Create def IDs for region parameters"
...
This reverts commit 0d4cb75949
.
2012-03-09 14:40:36 -08:00
Patrick Walton
0d4cb75949
rustc: Create def IDs for region parameters
2012-03-09 14:06:43 -08:00
Patrick Walton
8ce6b0dd21
rustc: Add appropriate type predicates for references. Simple uses of references/region pointers now work.
2012-03-08 17:22:43 -08:00
Patrick Walton
71799cff2b
rustc: Actually write the type back
2012-03-08 16:44:33 -08:00
Patrick Walton
ddeaea2287
rustc: Change the address-of operator to an explicit production so that we can parse the mutability
2012-03-08 16:34:36 -08:00
Patrick Walton
0722786664
rustc: Add some missing cases in various folds for reference types and some broken trans code for the address-of operator
2012-03-08 15:55:28 -08:00
Tim Chevalier
0c5fdc8745
Rename last to last_opt, last_unsafe to last
...
As per discussion on IRC. I am about to file an RFC for further
discussion about the more general issue of whether to enforce
invariants through types, typestate, or dynamic checks, but for now,
removing the misleading name "last_unsafe".
2012-03-08 15:25:56 -08:00
Patrick Walton
8047c0cd68
rustc: Typecheck dereference operations on safe references.
...
They require unsafe blocks for now. This will be removed once they typecheck properly.
2012-03-08 15:08:26 -08:00
Patrick Walton
fcde161f4f
rustc: Stub typechecking for the address-of operator
2012-03-08 14:55:51 -08:00
Tim Chevalier
d048a00cf3
Change util::unreachable to core::unreachable
...
Closes #1931
2012-03-08 14:30:01 -08:00
Patrick Walton
0e17cdb627
rustc: Add regions to the type system
2012-03-08 14:05:56 -08:00
Tim Chevalier
ebc1d3e704
Rename last_total to last_unsafe
...
See Issue 1943 for any discussion (reopen it if necessary).
Closes #1943
2012-03-08 13:07:31 -08:00
Patrick Walton
c9cf73f0a8
rustc: represend -> represent in a comment
2012-03-08 13:01:08 -08:00
Marijn Haverbeke
c71306b0db
Explicitly store self_ids use for self locals in methods
...
This makes it possible to move them between crates without confusion,
and to instantiate them at a point where the monomorphizing
substitutions are known.
Issue #1944
2012-03-08 21:17:32 +01:00
Marijn Haverbeke
fd465f91a8
Drop collect_items pass, create decls on demand
...
This solves a problem with inlined functions that have inner functions.
2012-03-08 21:17:32 +01:00
Patrick Walton
ec8380f9b1
rustc: Add the safe address-of operator to the AST
2012-03-08 12:04:02 -08:00
Patrick Walton
6224fdcd08
rustc: Add region-annoted type parameters to the AST; stub associated patterns
2012-03-08 10:49:43 -08:00
Niko Matsakis
2bfed908e3
Fix #1941 : inlining of items that themselves contain nested items
...
The fix is to drop nested items from the encoded AST. Nested items may
themselves be inlined, but that is an independent question.
2012-03-07 18:06:29 -08:00
Patrick Walton
c9375fed8d
stdlib: Stop incurring vtable dispatch costs when hashmaps are used
...
This required changing almost all users of hashmaps to import the hashmap interface first.
The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
2012-03-07 17:35:13 -08:00
Patrick Walton
c245d9e980
Revert "stdlib: Stop incurring vtable dispatch costs when hashmaps are used"
...
This reverts commit f0250a23d3
.
2012-03-07 16:56:45 -08:00
Patrick Walton
f0250a23d3
stdlib: Stop incurring vtable dispatch costs when hashmaps are used
...
This required changing almost all users of hashmaps to import the hashmap interface first.
The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
2012-03-07 16:51:31 -08:00
Tim Chevalier
90ac69904f
Improve a type error message (avoid the word 'non-dereferenceable')
2012-03-07 14:14:34 -08:00
Marijn Haverbeke
7b81cd8930
Fix #1503 in a saner way
...
Closes #1933
2012-03-07 09:19:29 +01:00
Niko Matsakis
712dd23541
make inline enabled by default
2012-03-06 09:01:40 -08:00
Marijn Haverbeke
4e4bd585cd
Track all exports in exp_map
...
This is needed because the reachability checker needs to be able to
follow exports.
Issue #1934
2012-03-06 17:11:30 +01:00
Marijn Haverbeke
19508c7d53
Make trans pass responsible for pulling in inlined functions
...
This makes the logic for finding the inlinable items much easier --
they are simply pulled in lazily when encountered.
2012-03-06 14:00:21 +01:00
Marijn Haverbeke
9b88219723
Don't attach def ids to types when the type already contains the def id
2012-03-06 14:00:13 +01:00
Brian Anderson
77ed09728b
rustc: Use std::util::unreachable
2012-03-05 18:16:25 -08:00
Brian Anderson
0ee96de4ee
rustc: Lower case error messages
2012-03-05 17:05:20 -08:00
Brian Anderson
13a07ce1d4
rustc: Remove some redundant text from error messages
2012-03-05 17:05:20 -08:00
Niko Matsakis
0416a946b7
give user control of whether we use inline hint or inline always
...
supply inline hints for resource ctors/dtors
2012-03-05 16:47:51 -08:00
Niko Matsakis
cc2ebfc105
set LLVM inline hint for all #[inline] methods, whether CC or local
2012-03-05 16:47:51 -08:00
Brian Anderson
15df3950ad
rustc: Remove remaining non-inbounds GEPs
2012-03-05 15:12:36 -08:00
Tim Chevalier
e2fa6f03f5
Translate simple classes
...
Programs using classes with fields only (no methods) compile and run,
as long as nothing refers to a class in a different crate (todo).
Also changed the AST representation of classes to have a separate
record for constructor info (instead of inlining the fields in the
item_class node), and fixed up spans and pretty-printing for
classes.
2012-03-04 12:43:17 -08:00
Graydon Hoare
87c14f1e3d
Move src/comp to src/rustc
2012-03-02 18:46:13 -08:00