Haitao Li
fe6484d3e6
rustc: Fix warn on unused import bug
...
rustc generates incorrect warning for cascaded import declarations like:
use std;
import std::io;
import io::println;
fn main() { println("hello"); }
warning: unused import io
A followup of issue #889
2011-11-17 09:27:17 +01:00
Niko Matsakis
809ca13bfa
fix minor merge errors
2011-11-16 16:13:43 -08:00
Niko Matsakis
037a1de405
apply calling convention at call site too
2011-11-16 15:27:09 -08:00
Niko Matsakis
834b6879ea
temp workaround for failure to pass ulonglong successfully
2011-11-16 15:27:09 -08:00
Niko Matsakis
cbcdeb80d9
remove wrappers from intrinsics
2011-11-16 15:27:08 -08:00
Niko Matsakis
e3699a2636
make stdcall use shim
2011-11-16 15:24:56 -08:00
Niko Matsakis
319f3b02f3
fix natives with user-specified link names, remove unused imports
2011-11-16 15:24:38 -08:00
Niko Matsakis
b27a88e99c
fix bug in shape where s_int/s_uint were not customized to platform
2011-11-16 15:16:43 -08:00
Niko Matsakis
b3ae63c9d9
temporarily disable these tests b/c they crash rustc
2011-11-16 15:16:43 -08:00
Niko Matsakis
cb9675259f
enable comments in generated asm, ll
2011-11-16 15:16:42 -08:00
Niko Matsakis
96cdfa11db
correct translation of neg. numbers in 64-bit architectures
2011-11-16 15:16:42 -08:00
Niko Matsakis
5cabfb3a39
remove fixed FIXME
2011-11-16 15:16:42 -08:00
Niko Matsakis
4fc34e23fa
wrap long line
2011-11-16 15:16:40 -08:00
Niko Matsakis
d77968dd7c
finish up the shim approach
2011-11-16 15:16:40 -08:00
Niko Matsakis
4f28419d0c
add back call to zero_and_revoke
2011-11-16 15:16:40 -08:00
Niko Matsakis
85083ec51b
begin efforts to use shim functions for c-stack calls
2011-11-16 15:16:40 -08:00
Haitao Li
3b683f5205
rustc: Use link_name attribute for native function
...
Fixes issue #906
2011-11-16 23:45:07 +08:00
Brian Anderson
a7188a6577
rustc: Don't sign extend uints during translation
...
Doing so produces incorrect results on a 32-bit compiler targeting 64-bits
2011-11-15 17:53:44 -08:00
Haitao Li
eae478cd74
Use native fn's link name attribute if given
...
Fixes issue #905
2011-11-15 22:31:33 +08:00
Marijn Haverbeke
9ff6f816ba
Fix handling of loops and conditionals in alias.rs
...
It now threads information about invalidated aliases through the AST
properly. This makes it more permissive for conditionals (invalidating
an alias in one branch doesn't prevent you from using it in another),
and less permissive for loops (it now properly notices when a loop
invalidates an alias that it might still use in another iteration).
Closes #1144
2011-11-15 13:29:57 +01:00
Haitao Li
b8dd148444
rustllvm: Add a GetOrInsertFunction wrapper
...
Fixes issue #1161
Test-case-by: Brian Anderson <banderson@mozilla.com>
Signed-off-by: Haitao Li <lihaitao@gmail.com>
2011-11-15 00:33:29 +08:00
Brian Anderson
3cc2641fc3
Make various binops not typecheck for unsafe pointers. Closes #1173
2011-11-13 13:55:12 -08:00
Haitao Li
5a7249c935
Cleanup unused imports
2011-11-10 19:19:40 -08:00
Haitao Li
9bc2f1800d
rustc: Add support of warning on unused imports
...
Fixes issue #889
2011-11-10 19:19:10 -08:00
Brian Anderson
1afc943c91
rustc: Rename native_abi_c_stack_cdecl to native_abi_cdecl
2011-11-09 16:47:44 -08:00
Brian Anderson
10c35959e7
rustc: Rename native_abi_c_stack_stdcall to native_abi_stdcall
2011-11-09 16:47:44 -08:00
Brian Anderson
c7f0ca6063
Remove native "x86stdcall" ABI
2011-11-09 16:47:43 -08:00
Brian Anderson
4a4d31cf0e
Make native "c-stack-stdcall" ABI work
...
The symbol name is based on the number of arguments, so we have to declare
it correctly.
For some reason GetLastError doesn't work now.
2011-11-09 15:29:53 -08:00
Joshua Wise
c8fae5dc75
trans: Add binops (except for logic and comparators) and unops to trans_const_expr. Working towards issue #570 .
2011-11-09 14:33:06 -08:00
Joshua Wise
e674a7e99f
middle: Add a pass to reject bad const expressions earlier. Currently just rejects unimplemented const expressions, but will be needed later.
2011-11-09 14:33:05 -08:00
Brian Anderson
4f3f04643f
Remove native "cdecl" ABI
2011-11-08 17:17:06 -08:00
Brian Anderson
fcd39b1191
Remove native "llvm" ABI
2011-11-07 15:29:05 -08:00
Brian Anderson
1103fe8ca0
Remove native "rust" ABI
2011-11-07 15:14:10 -08:00
Haitao Li
852e789e78
rustc: Set LLVM module identifier as crate name
2011-11-07 22:59:21 +08:00
Marijn Haverbeke
1a68a98824
Disallow writing to function arguments again
...
Remove implicit copying hack.
Closes #1118
2011-11-03 10:57:54 +01:00
Niko Matsakis
8385d77b32
fix line too long
2011-11-02 14:14:20 -07:00
Niko Matsakis
ec77144713
add -m64 to gcc args if appropriate
2011-11-02 14:14:20 -07:00
Niko Matsakis
e012fd03f3
correct more i32 vs int mismatches
2011-11-02 14:14:19 -07:00
Niko Matsakis
602ae9139c
convert various ints to i32 and vice versa
2011-11-02 14:14:19 -07:00
Niko Matsakis
4bd05e5be2
convert GEP to i32
2011-11-02 14:14:19 -07:00
Niko Matsakis
f1bc9307d8
get things checking on ia32
2011-11-02 14:14:19 -07:00
Niko Matsakis
c0e9c42bd2
thread the context through so that int can be 64 bits on x86_64
2011-11-02 14:14:19 -07:00
Niko Matsakis
2521cda1ec
work on making the size of ints depend on the target arch
2011-11-02 14:14:19 -07:00
Niko Matsakis
9146bb09a1
work on making the size of ints depend on the target arch
2011-11-02 14:14:19 -07:00
Niko Matsakis
5b3bddcd87
start to isolate target strings so that they can be configured for
...
x64 or other targets
2011-11-02 14:13:22 -07:00
Marijn Haverbeke
eef9a0bd39
Evaluate alt expressions in their own block context
...
Closes #785
2011-11-02 14:30:51 +01:00
Marijn Haverbeke
d8d35e7c40
Rename car/cdr to head/tail in std::list
...
Closes #1086
2011-11-02 14:23:49 +01:00
Marijn Haverbeke
5b0c103b39
Make it possible to cast unsafe pointers with the 'as' operator
2011-11-02 12:20:12 +01:00
Marijn Haverbeke
4e9b8a28f7
Make resolving of imports behave more sanely
...
An import now ignores itself when resolving its target. This gets rid of
the previously existing (problematic) behaviour where the import would start
looking one scope up when its name was the same as its target's first
component.
Closes #1114
2011-11-02 12:20:11 +01:00
Brian Anderson
61b604580b
Fix alignment of interior pointers of dynamic-size types. Closes #1112
...
GEP_tup_like finds interior pointers by creating a tuple of all the types
preceding the element it wants a pointer to, then asks for the size of that
tuple. This results in incorrect pointers when the alignment of that tuple
is not the alignment of the interior type you're getting a pointer to.
2011-11-01 12:13:00 -07:00
Matt Brubeck
b510a74a36
Cleanup: Remove uneccesary generic_cmp function.
2011-10-28 14:44:39 -07:00
Matt Brubeck
000b2fe9a6
Use IEEE 754 semantics for NaN (Issue #1084 )
2011-10-28 14:44:39 -07:00
Brian Anderson
f96ad30dfc
stdlib: Make reinterpret_cast and leak unsafe
2011-10-28 14:19:17 -07:00
Marijn Haverbeke
7dacccde94
Make shared kind the default only for generic functions
...
You almost never want a function with pinned type params. For
types, objects, resources, and tags, pinned types are actually often
more sane. For most of these, shared rarely makes sense. Only tricky
case is objs -- you'll have to think about the kinds you want there.
Issue #1076
2011-10-28 17:00:14 +02:00
Marijn Haverbeke
7a0aee74bf
Move to short type parameter keywords
...
Issue #1076
2011-10-28 15:25:33 +02:00
Matt Brubeck
5d6fe1a533
Remove uint::max/min in favor if math::max/min
2011-10-27 13:37:53 -07:00
Marijn Haverbeke
013107a25c
Properly take mutable object fields into account during alias analysis
...
Closes #1055
2011-10-25 17:57:26 +02:00
Marijn Haverbeke
cfdf193c46
Update our code to new type parameter kind syntax
...
Closes #1067
2011-10-25 15:56:55 +02:00
Niko Matsakis
c78b1639b4
fix c-stack-cdecl when used w/ i64
2011-10-24 17:03:18 -07:00
Niko Matsakis
d41385a69b
kill errant log_err
2011-10-24 16:06:18 -07:00
Niko Matsakis
8f2d75d53c
switch over sqrt from llvm to c-stack-cdecl, exposing a bug in
...
the supported return types of upcall_c_stack
2011-10-24 16:06:18 -07:00
Niko Matsakis
020726c981
update trans_c_stack_native_call() to use type_of_explicit_args()
...
currently trans_c_stack_native_call() had some ad-hoc code for
determining the type of the arguments. this code was not in
agreement with the rest of trans. now it uses the same code path.
2011-10-21 16:19:28 -07:00
Niko Matsakis
80102c9d24
avoid extra load for by_mutable_ref parameters
2011-10-21 16:19:27 -07:00
Marijn Haverbeke
7114702496
Change the way block calls are parsed, mark them as block-calls.
...
This makes it possible to omit the semicolon after the block, and will
cause the pretty-printer to properly print such calls (if
pretty-printing of blocks wasn't so broken). Block calls (with the
block outside of the parentheses) can now only occur at statement
level, and their value can not be used. When calling a block-style
function that returns a useful value, the block must be put insde the
parentheses.
Issue #1054
2011-10-21 14:24:14 +02:00
Marijn Haverbeke
0ce40f60e7
Drop support for iter, put, and for-each
...
Closes #1056
2011-10-21 13:47:24 +02:00
Marijn Haverbeke
050170d2af
Remove remaining uses of iter and for-each
...
Issue #1056
2011-10-21 13:34:35 +02:00
Marijn Haverbeke
fd5a08384d
Move ast_util::pat_bindings over to new iter system.
...
Issue #1056
2011-10-21 12:41:42 +02:00
Marijn Haverbeke
6bcb4a426c
Remove last uses of iterators from stdlib
...
Issue #1056
2011-10-21 12:31:48 +02:00
Marijn Haverbeke
4ebbbe597e
Move hash table iteration over to block-taking functions
...
Issue #1056
2011-10-21 12:21:27 +02:00
Brian Anderson
4ef2c37059
Give native functions proto_bare
2011-10-20 20:53:52 -07:00
Brian Anderson
6fb9d4f83b
Remove typeck::proto_to_ty_proto
2011-10-20 20:30:20 -07:00
Brian Anderson
9efdd0f326
Merge ast::proto_shared and ast::proto_closure
...
Now they are both just proto_shared and proto_shared takes an
argument indicating that it is sugared as 'lambda'
2011-10-20 18:23:48 -07:00
Brian Anderson
4b30a06abe
Rename ast::proto_fn to ast::proto_shared
2011-10-20 18:23:48 -07:00
Brian Anderson
29ad3bdb10
Make fn denote a bare function. Convert fn to fn@ as needed
2011-10-20 18:23:48 -07:00
Brian Anderson
391e12124b
Tweak typecheck to enforce covariance on higher-order function arguments
2011-10-20 18:23:48 -07:00
Brian Anderson
342a400e79
Remove type coercion from fn to block
...
fn is a proper subtype of block now
2011-10-20 18:23:48 -07:00
Brian Anderson
8136b92ee8
Give subtype relationships to function types
2011-10-20 18:23:48 -07:00
Brian Anderson
ed985b61d5
Bare functions can coerce to blocks
2011-10-20 18:23:48 -07:00
Brian Anderson
354bfc8292
Bare functions can coerce to shared closures
2011-10-20 18:23:48 -07:00
Brian Anderson
3bb020aaf8
Revert "Remove the environment argument from bare functions"
...
This reverts commit 1b0f1f0b79
.
2011-10-20 18:23:48 -07:00
Brian Anderson
0714bb5f7d
Fix the problem with check-fast randomly failing
...
Trans has been assuming that tag node id's are unique across crates and they
are not so, depending on which way the wind is blowing, it would choose to use
a crate-local tag variant instead of the correct one from std.
No test case since I can't come up with a reliable one that compiles in a
reasonable amount of time.
2011-10-20 15:38:51 -07:00
Marijn Haverbeke
ef63f09dcd
Don't rely on main.ll anymore
...
I'll remove the actual file after I register a snapshot.
Issue #992
2011-10-20 17:18:38 +02:00
Marijn Haverbeke
8124846b2c
Get rid of taskpointer-passing throughout the compiler
...
Only intrinsics still take a dummy taskptr. We'll have to do some
makefile stunts to snapshot a version without taskptrs-in-intrinsics.
Issue #466
2011-10-20 14:22:17 +02:00
Marijn Haverbeke
457683c7fe
Do not pass taskpointers to "rust" native functions
...
Issue #466
2011-10-20 14:22:17 +02:00
Marijn Haverbeke
6323a012bd
Remove taskptr argument from upcalls
...
Issue #466
2011-10-20 13:15:21 +02:00
Marijn Haverbeke
e927df17f7
Remove spawn_wrap and main_wrap kludges
...
This isn't needed now that our functions are cdecl (and was apparently
only still working by accident).
Issue #992
2011-10-20 13:15:09 +02:00
Brian Anderson
314c011d71
Immutable and mutable? are covariant on their inner types
...
Whereas [mutable T] is invariant with respect to T, [T] and [mutable? T]
are covariant with respect to T.
2011-10-18 10:37:04 -07:00
Marijn Haverbeke
71a4a66135
Add a math module to the standard lib
...
I need some rudimentary stdlib stuff for the tutorial.
Closes #1042
2011-10-18 13:54:35 +02:00
Marijn Haverbeke
d9d0782b5f
Don't try to build an LLVM switch on floats
...
Closes #1046
2011-10-18 13:54:35 +02:00
Brian Anderson
0f0fa26c72
Enforce variance rules for mutable types
2011-10-17 20:51:34 -07:00
Brian Anderson
48d351b21e
Add a variance transform for calculation of recursive variance
2011-10-17 19:37:34 -07:00
Brian Anderson
d6613384fd
Introduce covariance, contravariance and invariance to the type unifier
...
This will be used to resolve some problems with mutable? covariance and also
to implement function subtyping
2011-10-17 19:34:12 -07:00
Brian Anderson
b61578e1cd
Don't unify from mutable? to immutable
...
Immutable is supposed to be a subtype of mutable-huh.
2011-10-17 16:36:49 -07:00
Brian Anderson
f7a825c614
Split record_var_binding into methods for expected and actual
...
This allows unify to maintain the same subtype relationship between
expected and actual throughout unify, which we are going to need
for mutable? and for function types.
2011-10-17 16:36:49 -07:00
Brian Anderson
1a64153b24
Correct two more analyses of mutable? as mutable
...
I can't come up with test cases but this seems correct.
2011-10-17 16:35:33 -07:00
Brian Anderson
4d9d889dbf
Don't allow assignment to mutable-wha?
2011-10-17 16:35:33 -07:00
Marijn Haverbeke
0a01144797
Use trans_expr_save_in instead of trans_expr when appropriate
...
This guards against passing a save_in destination to nil or bot-typed things.
2011-10-14 11:27:16 +02:00
Marijn Haverbeke
06257d66e7
Don't crash when reporting an unresolved import in the nil scope
...
Closes #1027
2011-10-14 11:25:14 +02:00
Brian Anderson
3808a498cd
Remove an unnecessary visitor from rustc::middle::fn_usage
2011-10-13 14:55:50 -07:00
Brian Anderson
acf9b83e71
Fix a use of visit in rustc::middle::fn_usage
...
This was working by just skipping an AST node instead of doing the advertised
check. I can't find a test case for it, but this is more correct.
2011-10-13 14:55:47 -07:00