Commit Graph

953 Commits

Author SHA1 Message Date
Seo Sanghyeon
ba1f3c9b1f Convert to C string inside WriteOutputFile 2013-04-22 20:17:25 +09:00
Brendan Zabarauskas
01eb5e8ad3 Rename Div operator trait to Quot and Modulo operator trait to Rem 2013-04-22 01:58:53 +10:00
bors
0e017ab4e0 auto merge of #5979 : Thiez/rust/no_reinterpret_cast, r=catamorphism
As the name suggests this replaces many instances of cast::reinterpret_cast by cast::transmute. It's essentially the boring part of fixing #5163, the remaining reinterpret_casts should be more tricky to remove (unless I missed a boring case).

r? @catamorphism
2013-04-20 14:24:51 -07:00
bors
f0afe23dce auto merge of #5978 : alexcrichton/rust/issue-5954, r=catamorphism
Closes #5954
2013-04-20 13:33:51 -07:00
Matthijs Hofstra
51a68eb9b1 Replaced many instances of reinterpret_cast with transmute 2013-04-20 22:05:50 +02:00
Alex Crichton
3c2a44b60f Don't warn about unsafe functions which don't need to be unsafe 2013-04-20 15:52:05 -04:00
Huon Wilson
93c0888b6c librustc: implement and use fixed_stack_segment attribute for intrinsics. 2013-04-21 01:40:48 +10:00
Alex Crichton
1e4a439f7f rustc: de-mode + fallout from libsyntax changes 2013-04-19 23:23:23 -04:00
Alex Crichton
be9f4ef65f Fix an ICE when dereferencing types which cannot be dereferenced 2013-04-19 23:21:52 -04:00
bors
8b3c09a103 auto merge of #5962 : pcwalton/rust/shootout, r=pcwalton
r? @brson
2013-04-19 19:24:52 -07:00
Patrick Walton
dcea717208 librustc: Fix botched merge. rs=merge 2013-04-19 15:57:31 -07:00
bors
7d250d3181 auto merge of #5824 : bleibig/rust/debuginfo, r=brson
This adds debugging symbol generation for boxes, bare functions, vectors, and strings, along with a tests for boxes and vectors.

Note that gdb will see them as their actual compiled representation with the refcount, tydesc, etc. fields, so if `b` refers to box, `b->boxed` will refer to its value. Also, since you seem to use the [C struct hack](http://c-faq.com/struct/structhack.html) for dynamic vectors, you won't be able to print out the whole vector at once, only one element at a time by indexing specific elements.
2013-04-19 12:03:49 -07:00
Patrick Walton
f93b3cd5c3 librustc: Remove debug code; xfail-pretty reverse-complement. 2013-04-19 12:00:48 -07:00
Patrick Walton
c995a62d44 librustc: WIP patch for using the return value. 2013-04-19 12:00:08 -07:00
Patrick Walton
0b0ca597bf librustc: Improve inlining behavior. 2013-04-19 11:53:34 -07:00
Patrick Walton
4c29b4cb93 librustc: Optimize metadata::decoder::item_name. 2013-04-19 11:53:33 -07:00
Patrick Walton
53f54dda60 librustc: Remove def_ids from types. 2013-04-19 11:53:33 -07:00
Patrick Walton
04df19c5ca librustc: Take primitive types out of the type hash table. 2013-04-19 11:53:33 -07:00
Patrick Walton
3ffaaab9e9 librustc: Switch the @s in types with ~ 2013-04-19 11:53:32 -07:00
Patrick Walton
f903ae9e72 librustc: Implement fast-ffi and use it in various places 2013-04-19 11:53:31 -07:00
Patrick Walton
1a36b0f17e librustc: Remove fail_unless! 2013-04-19 11:53:31 -07:00
bors
d3a58f3797 auto merge of #5943 : brson/rust/struct-return, r=graydon
Mac appears to follow the same ABI as MSVC. This fixes one case
but leaves others broken, like windows.
2013-04-18 19:45:48 -07:00
bors
225d74f211 auto merge of #5914 : catamorphism/rust/copy-cops, r=catamorphism 2013-04-18 17:51:51 -07:00
Tim Chevalier
3d43af15d8 rustc: Anti-copy police
In this case, some copies are still necessary to convert from
a mutable to an immutable @-box. It's still an improvement,
I hope.
2013-04-18 17:40:42 -07:00
bors
df9cc2eb66 auto merge of #5924 : catamorphism/rust/non-fatal-errors, r=catamorphism 2013-04-18 16:57:51 -07:00
Tim Chevalier
62847b0f24 rustc: Make some typechecker errors non-fatal 2013-04-18 15:12:27 -07:00
Tim Chevalier
18db9a2954 rustc: One less copy 2013-04-18 14:50:29 -07:00
Brian Anderson
8a6d6dd868 rustc: Fix struct returns on x86 mac for 8-byte structs
Mac appears to follow the same ABI as MSVC. This fixes one case
but leaves others broken, like windows.
2013-04-18 14:14:17 -07:00
Brian Anderson
decd3901d5 core::comm: Modernize constructors to use new 2013-04-18 14:07:35 -07:00
bors
fdb4ef321e auto merge of #5726 : brson/rust/struct-return, r=brson
r? @nikomatsakis

This doesn't completely fix the x86 ABI for structs, but it does fix some cases. On linux, structs appear to be returned correctly now. On windows, structs are only returned by pointer when they are greater than 8 bytes. That scenario works now.

In the case where the struct is less than 8 bytes our generated code looks peculiar. When returning a pair of u16, C packs both variables into %eax to return them. Our generated code though expects to find one of the pair in %ax and the other in %dx. Similar for u8. I haven't looked into it yet.

There appears to also be struct passing problems on linux, where my `extern-pass-TwoU8s` and `extern-pass-TwoU16s` tests are failing.
2013-04-17 18:45:58 -07:00
Brian Anderson
a5ddc00982 rustc: Use an out pointer to return structs in x86 C ABI. #5347
This Adds a bunch of tests for passing and returning structs
of various sizes to C. It fixes the struct return rules on unix,
and on windows for structs of size > 8 bytes. Struct passing
on unix for structs under a certain size appears to still be broken.
2013-04-17 15:49:19 -07:00
Josh Matthews
97303703ee Allow casting to mutable trait objects. 2013-04-17 00:34:25 +02:00
bors
07e087bf31 auto merge of #5890 : youknowone/rust/const-eval, r=catamorphism
This will help not to meet confusing errors.
In issue #5873, the error was "expected constant expr for vector length: Can't cast str to int".
It was originally "expected constant expr for vector length: Non-constant path in constant expr" (though still invalid error).
This patch make the original error to be printed.
2013-04-16 12:48:56 -07:00
bors
16e8af9e47 auto merge of #5895 : huonw/rust/no-pub-tests, r=thestinger
This patch is a sledge hammer that moves all tests into `#[cfg(test)] mod test { .. }`, and makes them private, there were several instances of `pub mod tests { #[test] pub fn ... } `.

(The reason for this is I was playing with using `syntax` to index code ([result so far](http://www.ug.it.usyd.edu.au/~hwil7821/rust-api/)) and it was getting some junk from the tests.)

The rustdoc commit is particularly brutal, so it's fine if that one isn't landed.
2013-04-15 20:00:56 -07:00
Tim Chevalier
39d45b75cc rustc: Anti-copy police 2013-04-15 19:06:36 -07:00
Huon Wilson
d3be98e9f5 libcore,std,syntax,rustc: move tests into mod tests, make them private (no pub mod or pub fn). 2013-04-16 09:57:47 +10:00
bors
4beebc427c auto merge of #5797 : alexcrichton/rust/issue-1913, r=catamorphism
Closes #5487, #1913, and #4568

I tracked this by adding all used unsafe blocks/functions to a set on the `tcx` passed around, and then when the lint pass comes around if an unsafe block/function isn't listed in that set, it's unused.

I also removed everything from the compiler that was unused, and up to stage2 is now compiling without any known unused unsafe blocks.

I chose `unused_unsafe` as the name of the lint attribute, but there may be a better name...
2013-04-15 13:00:56 -07:00
Jeong YunWon
9b55d86e74 Prevent eval_const_expr_partial hides prior error in expr_cast arm.
This will help not to meet confusing errors.
In issue #5873, the error was "expected constant expr for vector length: Can't cast str to int".
It was originally "expected constant expr for vector length: Non-constant path in constant expr"
This patch make the original error to be printed.
2013-04-16 04:13:37 +09:00
bors
3809a04bf7 auto merge of #5778 : jld/rust/reflect-abstract-enum, r=graydon
This takes care of one of the last remnants of assumptions about enum layout.  A type visitor is now passed a function to read a value's discriminant, then accesses fields by being passed a byte offset for each one.  The latter may not be fully general, despite the constraints imposed on representations by borrowed pointers, but works for any representations currently planned and is relatively simple.

Closes #5652.
2013-04-15 09:57:55 -07:00
Alex Crichton
72c24e20a9 rustc: remove unnecessary unsafe blocks/methods 2013-04-14 01:15:46 -04:00
Alex Crichton
4bfa3c6663 Add a lint mode for unused unsafe blocks/functions 2013-04-14 01:15:46 -04:00
Jyun-Yan You
4ad8ec351a fix index out of bounds error of x86_64 ABI 2013-04-13 15:04:30 +08:00
bors
76f6606a8c auto merge of #5827 : nikomatsakis/rust/issue-5656-change-meaning-of-borrowed-self, r=pcwalton
See #5656 for details.

r? @pcwalton
2013-04-12 15:14:24 -07:00
bors
63e2724cdb auto merge of #5809 : Aatch/rust/start-attr, r=thestinger
This implements #5158. Currently it takes the command line args and the crate map. Since it doesn't take a `main` function pointer, you can't actually start the runtime easily, but that seems to be a shim to allow the current `rust_start` function to call into main.

However, you can do an end-run round the io library and do this:

```rust
use core::libc::{write, c_int, c_void, size_t, STDOUT_FILENO};

#[start]
fn my_start(_argc:int, _argv: **u8, _crate_map: *u8) -> int {
    do str::as_buf("Hello World!\n") |s,len| {
        unsafe {
            write(STDOUT_FILENO, s as *c_void, len as size_t);
        }
    }
    return 0;
}
```

Which is the most basic "Hello World" you can do in rust without starting up the runtime (though that has quite a lot to do with the fact that `core::io` uses `@` everywhere...)
2013-04-12 02:34:02 -07:00
bors
2f8b36fc16 auto merge of #5819 : erickt/rust/incoming, r=erickt
Good morning,

This first patch series adds support for `#[deriving(Decodable, Encodable)]`, but does not yet remove `#[auto_encode]` and `#[auto_decode]`. I need a snapshot to remove the old code. Along the way it also extends support for tuple structs and struct enum variants.

Also, it includes a minor fix to the pretty printer. We decided a while ago to use 4 spaces to indent a match arm instead of 2. This updates the pretty printer to reflect that.
2013-04-11 06:55:01 -07:00
bors
e0defb8466 auto merge of #5826 : brson/rust/0.7-pre, r=brson
I accidentally changed the version to `0.7-rc` when `0.7-pre` is what @graydon and I agreed on. This fixes.
2013-04-11 02:48:59 -07:00
bors
c27fad7353 auto merge of #5811 : sanxiyn/rust/parse-uint, r=catamorphism
It does not handle signs.
2013-04-11 00:31:03 -07:00
ILyoan
344628fe91 FIX meta_section_name for macos 2013-04-10 18:49:51 -07:00
Niko Matsakis
49de82cdca Issue #5656: Make &self not mean "&'self self"
Fixes #5656.
Fixes #5541.
2013-04-10 17:32:02 -07:00
Erick Tryzelaar
419f6acf0e std: rename {read,emit}_field to {read,emit}_struct_field 2013-04-10 16:08:22 -07:00