Commit Graph

23619 Commits

Author SHA1 Message Date
klutzy
d01ba2e824 Define WSAPOLLFD only on mingw 4.x
Fixes #10327
2013-11-08 15:00:40 +09:00
bors
22eb11c09b auto merge of #10227 : kud1ing/rust/ios, r=alexcrichton 2013-11-06 14:01:14 -08:00
kud1ing
2a333ed088 Fixes for compilation to iOS:
- remove /usr/include from the include path since the iOS SDK provides the correct version
- `_NSGetEnviron()` is private and not available on iOS
- `.align` without an argument is not allowed with the Apple tools. 2^2 should be the default alignment
- ignore error messages for XCode < 5
- pass include path to libuv
2013-11-06 22:11:09 +01:00
bors
fdc830df31 auto merge of #10289 : nikomatsakis/rust/issue-10157-TypeContents-refactor, r=pcwalton
See #10157. This compiles now.

Fixes #10278.
2013-11-06 11:51:09 -08:00
bors
dda67dfe27 auto merge of #10314 : ksh8281/rust/fix_some_cfail_test_cases_for_arm, r=yichoi
adding #[cfg(target_arch = "arm")] for asm of cfail test cases
2013-11-06 00:56:08 -08:00
bors
a66b372eb4 auto merge of #10306 : alexcrichton/rust/issue-9970-better, r=huonw
There were a few ambiguous error messages which look like they could have
cropped up from either the rust compiler for the format string parser. To
differentiate, the prefix 'invalid format string' is now added in front of all
format string errors.

cc #9970
2013-11-05 23:36:06 -08:00
sh8281.kim
65d35ac745 fix some cfail test cases for arm 2013-11-06 15:45:37 +09:00
bors
efaf730347 auto merge of #10305 : thestinger/rust/align, r=alexcrichton
Closes #10300
2013-11-05 20:41:07 -08:00
Daniel Micay
1c6ae5c5a2 fix alignment of pthread_attr_t
Closes #10300
2013-11-05 23:15:23 -05:00
bors
b17d4e335d auto merge of #10299 : alexcrichton/rust/osx-loader-path-fix, r=brson
According to apple's documentation of rpath semantics, `@executable_path` means
that the path is relative the the *process executable*, not necessarily the
library in question. On the other hand, `@loader_path` is the path that points to
the library which contains the `@loader_path` reference. All of our rpath usage is
based off the library or executable, not just the executable. This means that on
OSX we should be using `@loader_path` instead of `@executable_path` to achieve the
same semantics as linux's $ORIGIN.

The purpose of this is to unblock the current snapshot from landing. It appears that because we were propagating linker arguments we never saw this before. Now that we're no longer printing linker arguments, we're depending on the libraries to resolve their own references. In using `@executable_path` on OSX, libraries in different locations than the executable were not able to resolve their references (because their rpaths listed were all relative to the location of the library, not the executable).

I'm still a little unclear on how this ever passed locally on my own machine, but it's clear why this is failing on the bots at least.
2013-11-05 18:31:09 -08:00
Alex Crichton
2fc337a7d6 Clarify which errors are format string errors
There were a few ambiguous error messages which look like they could have
cropped up from either the rust compiler for the format string parser. To
differentiate, the prefix 'invalid format string' is now added in front of all
format string errors.

cc #9970
2013-11-05 17:59:40 -08:00
bors
99e866392f auto merge of #10261 : ksh8281/rust/makecheck_debuginfo_arm-linux-androideabi, r=brson
In order to pass make check on android target

credit to @ksh8281
2013-11-05 17:06:11 -08:00
sh8281.kim
4e54828b0d Add make check support(arm-linux-androideabi debuginfo) 2013-11-06 09:41:59 +09:00
Alex Crichton
243c0dac8f Use loader_path instead of executable_path for osx
According to apple's documentation of rpath semantics, @executable_path means
that the path is relative the the *process executable*, not necessarily the
library in question. On the other hand, @loader_path is the path that points to
the library which contains the @loader_path reference. All of our rpath usage is
based off the library or executable, not just the executable. This means that on
OSX we should be using @loader_path instead of @executable_path to achieve the
same semantics as linux's $ORIGIN.
2013-11-05 14:17:30 -08:00
Niko Matsakis
71acc543ca Make TypeContents consider the type T to be reachable via *T pointers
Fixes #9509
2013-11-05 15:51:18 -05:00
Niko Matsakis
3d1f3f4de0 Rename misleading contains_managed to owns_managed 2013-11-05 15:51:18 -05:00
Niko Matsakis
f3191a450c Refactor TypeContents to be more scrutable. In particular, create coarser bits
than the current ones, which were very fine-grained.  Also, cleanly distinguish
when properties must be found in *owned* types vs *reachable* types.

Fixes #10157
Fixes #10278
2013-11-05 14:50:35 -05:00
bors
7fb583be7b auto merge of #10290 : dbussink/rust/thread_in_rust, r=alexcrichton
This binds to the appropriate pthreads_* and Windows specific functions
and calls them from Rust. This allows for removal of the C++ support
code for threads.

This needs to be reviewed for the Windows parts, I've tested on OS X and Linux.

Fixes #10162
2013-11-05 08:56:08 -08:00
Dirkjan Bussink
47e0bd403a Move implementation for threads to Rust
This binds to the appropriate pthreads_* and Windows specific functions
and calls them from Rust. This allows for removal of the C++ support
code for threads.

Fixes #10162
2013-11-05 17:49:46 +01:00
bors
92065ceb63 auto merge of #10285 : sfackler/rust/weird-derivings, r=huonw
They seem to have been added by accident.
2013-11-05 01:47:43 -08:00
bors
379bda9e52 auto merge of #10282 : sfackler/rust/rustpkg-test-cfg, r=alexcrichton
Closes #10238
2013-11-05 00:07:20 -08:00
bors
bf98981696 auto merge of #10270 : alexcrichton/rust/no-super-buffer, r=brson
Right now if you're running a program with its output piped to some location and
the program decides to go awry, when you kill the program via some signal none
of the program's last 4K of output will get printed to the screen. In theory the
solution to this would be to register a signal handler as part of the runtime
which then flushes the output stream.

I believe that the current behavior is far enough from what's expected that we
shouldn't be providing this sort of "super buffering" by default when stdout
isn't attached to a tty.
2013-11-04 22:47:00 -08:00
Steven Fackler
6184e844fb Remove #[deriving]s on impls
They seem to have been added by accident.
2013-11-04 22:46:51 -08:00
bors
1c56652640 auto merge of #10064 : luqmana/rust/vvv, r=nikomatsakis
Fixes #2057.

Example:
```Rust
#[no_std];

type c_char = u8;
type c_int = i32;
type size_t = uint;

extern {
    fn printf(format: *c_char, ...) -> c_int;
}

#[lang="fail_bounds_check"]
fn fail_bounds_check(_: *c_char, _: size_t, _: size_t, _: size_t) {}

#[start]
#[fixed_stack_segment]
fn main(_: int, _: **u8) -> int {
    unsafe {
        let msg = bytes!("Hello World!
2013-11-04 21:02:07 -08:00
Luqman Aden
77e0235983 Add tests for variadic foreign functions. 2013-11-04 23:53:11 -05:00
Luqman Aden
c669ccf3d3 libsyntax/librustc: Allow calling variadic foreign functions. 2013-11-04 23:53:11 -05:00
Steven Fackler
4b9c5d6878 Allow --cfg on rustpkg test
Closes #10238
2013-11-04 20:41:32 -08:00
bors
4b04395c11 auto merge of #10182 : alexcrichton/rust/typeid-intrinsic, r=nikomatsakis
This isn't quite as fancy as the struct in #9913, but I'm not sure we should be exposing crate names/hashes of the types. That being said, it'd be pretty easy to extend this (the deterministic hashing regardless of what crate you're in was the hard part).
2013-11-04 19:21:50 -08:00
bors
72e432df9d auto merge of #10276 : alexcrichton/rust/fix-debug-info, r=jdm
The snapshot just failed due to a debuginfo test failing, and according to its
output at
http://buildbot.rust-lang.org/builders/snap3-linux/builds/564/steps/test/logs/stdio
it appears to be because the printed lines has a little less information than
the original lines were checking for. I would suspect that this is just because
of a slightly different version of gdb, but it's not that serious regardless.
2013-11-04 17:22:03 -08:00
Alex Crichton
e7a6782948 Relax the constraints on a debuginfo test
The snapshot just failed due to a debuginfo test failing, and according to its
output at
http://buildbot.rust-lang.org/builders/snap3-linux/builds/564/steps/test/logs/stdio
it appears to be because the printed lines has a little less information than
the original lines were checking for. I would suspect that this is just because
of a slightly different version of gdb, but it's not that serious regardless.
2013-11-04 17:11:44 -08:00
Alex Crichton
615444d263 Stop extra buffering when stdout isn't a tty
Right now if you're running a program with its output piped to some location and
the program decides to go awry, when you kill the program via some signal none
of the program's last 4K of output will get printed to the screen. In theory the
solution to this would be to register a signal handler as part of the runtime
which then flushes the output stream.

I believe that the current behavior is far enough from what's expected that we
shouldn't be providing this sort of "super buffering" by default when stdout
isn't attached to a tty.
2013-11-04 15:48:34 -08:00
bors
658637baf4 auto merge of #10179 : alexcrichton/rust/rt-improvements, r=cmr
This fleshes out the io::file module a fair bit more, adding all of the functionality that I can think of that we would want. Some questions about the representation which I'm curious about:

* I modified `FileStat` to be a little less platform-agnostic, but it's still fairly platform-specific. I don't want to hide information that we have, but I don't want to depend on this information being available. One possible route is to have an `extra` field which has all this os-dependent stuff which is clearly documented as it should be avoided.

* Does it make sense for directory functions to be top-level functions instead of static methods? It seems silly to import `std::rt::io::file` and `std::rt::io::File` at the top of files that need to deal with directories and files.
2013-11-04 12:21:11 -08:00
Alex Crichton
3c3ed1499a Move io::file to io::fs and fns out of File
This renames the `file` module to `fs` because that more accurately describes
its current purpose (manipulating the filesystem, not just files).

Additionally, this adds an UnstableFileStat structure as a nested structure of
FileStat to signify that the fields should not be depended on. The structure is
currently flagged with #[unstable], but it's unlikely that it has much meaning.

Closes #10241
2013-11-04 10:28:55 -08:00
bors
70e9b5ab39 auto merge of #10260 : alexcrichton/rust/fix-temp-name, r=thestinger
This file did not respect the #[link(name = "...")] attribute when it was
clearly intended to do so. The problem is that the crate attributes just weren't
passed in. This causes lots of problems in rust today because the object file
for all our libraries is inferred to be 'lib.o' because all of the files are
called 'lib.rs'.

I tried to figure out a good way to test for this, but I wasn't able to come up
with a good way that fit into our current testing framework. Nonetheless, I have
tested this locally and object files get named as they should. This should fix
compiling with `make -jN` again (because the object files are all different
again).
2013-11-04 00:06:18 -08:00
Alex Crichton
c3089a1d31 Fix the temporary name of the object file created
This file did not respect the #[link(name = "...")] attribute when it was
clearly intended to do so. The problem is that the crate attributes just weren't
passed in. This causes lots of problems in rust today because the object file
for all our libraries is inferred to be 'lib.o' because all of the files are
called 'lib.rs'.

I tried to figure out a good way to test for this, but I wasn't able to come up
with a good way that fit into our current testing framework. Nonetheless, I have
tested this locally and object files get named as they should. This should fix
compiling with `make -jN` again (because the object files are all different
again).
2013-11-03 23:56:45 -08:00
bors
94677c18af auto merge of #10254 : sfackler/rust/rustpkg-test-failure, r=alexcrichton
It previously set the exit status, but the main wrapper paved over that
with an exit code of 0.

Closes #9761
2013-11-03 22:56:01 -08:00
Steven Fackler
ff859edb85 Ensure rustpkg test fails if tests failed
It previously set the exit status, but the main wrapper paved over that
with an exit code of 0.

Closes #9761
2013-11-03 22:23:47 -08:00
bors
556088cfb1 auto merge of #10251 : thestinger/rust/ptr, r=alexcritchton
This moves the per-architecture difference into the compiler.
2013-11-03 19:31:11 -08:00
Daniel Micay
67966fa9de simplify memcpy/memmove/memset intrinsics
This moves the per-architecture difference into the compiler.
2013-11-03 20:31:57 -05:00
bors
29359d0efa auto merge of #10252 : huonw/rust/docs, r=alexcrichton 2013-11-03 17:31:20 -08:00
bors
c4c2b38dae auto merge of #10248 : nibrahim/rust/docformatting, r=pcwalton
The code block shows up inline without proper formatting without this
newline.

Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
2013-11-03 16:06:05 -08:00
Alex Crichton
f19d083362 Fill out the remaining functionality in io::file
This adds bindings to the remaining functions provided by libuv, all of which
are useful operations on files which need to get exposed somehow.

Some highlights:

* Dropped `FileReader` and `FileWriter` and `FileStream` for one `File` type
* Moved all file-related methods to be static methods under `File`
* All directory related methods are still top-level functions
* Created `io::FilePermission` types (backed by u32) that are what you'd expect
* Created `io::FileType` and refactored `FileStat` to use FileType and
  FilePermission
* Removed the expanding matrix of `FileMode` operations. The mode of reading a
  file will not have the O_CREAT flag, but a write mode will always have the
  O_CREAT flag.

Closes #10130
Closes #10131
Closes #10121
2013-11-03 15:15:42 -08:00
Alex Crichton
9c1851019f Remove all blocking std::os blocking functions
This commit moves all thread-blocking I/O functions from the std::os module.
Their replacements can be found in either std::rt::io::file or in a hidden
"old_os" module inside of native::file. I didn't want to outright delete these
functions because they have a lot of special casing learned over time for each
OS/platform, and I imagine that these will someday get integrated into a
blocking implementation of IoFactory. For now, they're moved to a private module
to prevent bitrot and still have tests to ensure that they work.

I've also expanded the extensions to a few more methods defined on Path, most of
which were previously defined in std::os but now have non-thread-blocking
implementations as part of using the current IoFactory.

The api of io::file is in flux, but I plan on changing it in the next commit as
well.

Closes #10057
2013-11-03 15:15:42 -08:00
Alex Crichton
7bf58c2baa Modify IoFactory's fs_mkdir, and add fs_rename
The invocation for making a directory should be able to specify a mode to make
the directory with (instead of defaulting to one particular mode). Additionally,
libuv and various OSes implement efficient versions of renaming files, so this
operation is exposed as an IoFactory call.
2013-11-03 15:15:41 -08:00
Alex Crichton
d7b6502784 Move rt::io traits into the prelude
These traits belong here, and were simply waiting for the std::io traits to get
removed. It's time they take their rightful positions!
2013-11-03 15:15:41 -08:00
Huon Wilson
da43676e39 docs: Replace std::iterator with std::iter. 2013-11-04 10:01:00 +11:00
bors
702767db65 auto merge of #10219 : alexcrichton/rust/drop-invoke, r=pcwalton
This commit changes drop glue generated for structs to use the invoke LLVM
instruction instead of call. What this means is that if the user destructor
triggers an unwinding, then the fields of the struct will still ge dropped.

This is not an attempt to support failing while failing, as that's mostly a
problem of runtime support. This is more of an issue of soundness in making sure
that destructors are appropriately run. The test included fails before this
commit, and only has one call to fail!(), yet it doesn't destroy its struct
fields.
2013-11-03 11:16:17 -08:00
Noufal Ibrahim
c118b89ad9 Fixed formatting.
The code block shows up inline without proper formatting without this
newline.

Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
2013-11-03 22:44:15 +05:30
bors
dc079e1596 auto merge of #10143 : chris-morgan/rust/filename-consistency, r=huonw
New standards have arisen in recent months, mostly for the use of
rustpkg, but the main Rust codebase has not been altered to match these
new specifications. This changeset rectifies most of these issues.

- Renamed the crate source files `src/libX/X.rs` to `lib.rs`, for
  consistency with current styles; this affects extra, rustc, rustdoc,
  rustpkg, std, syntax.

- Renamed `X/X.rs` to `X/mod.rs,` as is now recommended style, for
  `std::num` and `std::terminfo`.

- Shifted `src/libstd/str/ascii.rs` out of the otherwise unused `str`
  directory, to be consistent with its import path of `std::ascii`;
  libstd is flat at present so it's more appropriate thus.

While this removes some `#[path = "..."]` directives, it does not remove
all of them, and leaves certain other inconsistencies, such as `std::u8`
et al. which are actually stored in `src/libstd/num/` (one subdirectory
down). No quorum has been reached on this issue, so I felt it best to
leave them all alone at present. #9208 deals with the possibility of
making libstd more hierarchical (such as changing the crate to match the
current filesystem structure, which would make the module path
`std::num::u8`).

There is one thing remaining in which this repository is not
rustpkg-compliant: rustpkg would have `src/std/` et al. rather than
`src/libstd/` et al. I have not endeavoured to change that at this point
as it would guarantee prompt bitrot and confusion. A change of that
magnitude needs to be discussed first.
2013-11-03 05:01:02 -08:00
Chris Morgan
0369a41f0e Rename files to match current recommendations.
New standards have arisen in recent months, mostly for the use of
rustpkg, but the main Rust codebase has not been altered to match these
new specifications. This changeset rectifies most of these issues.

- Renamed the crate source files `src/libX/X.rs` to `lib.rs`, for
  consistency with current styles; this affects extra, rustc, rustdoc,
  rustpkg, rustuv, std, syntax.

- Renamed `X/X.rs` to `X/mod.rs,` as is now recommended style, for
  `std::num` and `std::terminfo`.

- Shifted `src/libstd/str/ascii.rs` out of the otherwise unused `str`
  directory, to be consistent with its import path of `std::ascii`;
  libstd is flat at present so it's more appropriate thus.

While this removes some `#[path = "..."]` directives, it does not remove
all of them, and leaves certain other inconsistencies, such as `std::u8`
et al. which are actually stored in `src/libstd/num/` (one subdirectory
down). No quorum has been reached on this issue, so I felt it best to
leave them all alone at present. #9208 deals with the possibility of
making libstd more hierarchical (such as changing the crate to match the
current filesystem structure, which would make the module path
`std::num::u8`).

There is one thing remaining in which this repository is not
rustpkg-compliant: rustpkg would have `src/std/` et al. rather than
`src/libstd/` et al. I have not endeavoured to change that at this point
as it would guarantee prompt bitrot and confusion. A change of that
magnitude needs to be discussed first.
2013-11-03 23:49:01 +11:00