Commit Graph

23654 Commits

Author SHA1 Message Date
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
klutzy
e63ffc1d16 rt: Convert timezone to utf-8 on Windows
Previously #9418 fixed utf-8 assertion issue by wcsftime,
but the function didn't work as expected: it follows the locale
set by setlocale(), not the system code page.
This patch fixes it by manual multibyte-to-unicode conversion.
2013-11-05 13:54:09 +09: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
niftynif
e6dde28c95 Added skeleton implementation of a B-tree with a few bells and
whistles.  No major functionality added yet (such as insertion and
removal).
2013-11-04 19:45:49 -05: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
bors
318e1da4a7 auto merge of #10244 : thestinger/rust/abort, r=alexcrichton
The function is marked `noreturn`, so it shouldn't have this.
2013-11-03 00:46:01 -07:00
Daniel Micay
ddbd89b33e replace RetVoid with Unreachable to fix lint
The function is marked `noreturn`, so it shouldn't return.
2013-11-03 01:39:36 -05:00
bors
4910b7ac28 auto merge of #10242 : thestinger/rust/inline_dtor, r=alexcrichton
Closes #7793
2013-11-02 23:26:00 -07:00
bors
b5c1b48048 auto merge of #10199 : alexcrichton/rust/no-propagate, r=brson
This commit removes the propagation of `link_args` attributes across crates. The first commit message has the reasons as to why. Additionally, this starts statically linking some C/C++ helper libraries that we have to their respective crates instead of throwing then in librustrt and then having everything depend on librustrt.

The major downside of this movement is that we're losing the ability to control visible symbols. I couldn't figure out a way to internalize symbols from a static library during the linking process, so everyone who links to librustdoc will be able to use its sundown implementation (not exactly ideal). I'm not entirely sure how to fix this (beyond generating a list of all public symbols, including rust ones, and passing that to the linker), but we may have a much easier time with this once we start using llvm's linker toolchain.

There's certainly a lot more possibilities in where this can go, but I didn't want to go too deep just yet. The main idea here is to stop propagating linker arguments and then see how we're able to start statically linking libraries as a result.

r? @catamorphism, you're going to be working on linking soon, so feel free to completely throw this away for something else!
2013-11-02 22:16:02 -07:00
Matt Carberry
66abb92a47 Grammar error and vim syntax highlighting mistake fixed. 2013-11-02 21:34:29 -07:00
Alex Crichton
0ce1b2f04d Statically link libuv to librustuv
Similarly to the previous commit, libuv is only used by this library, so there's
no need for it to be linked into librustrt and available to all crates by
default.
2013-11-02 21:28:17 -07:00
Matt Carberry
519b86b8a8 Added octal literal support. 2013-11-02 21:26:29 -07:00
Daniel Micay
e58270219f fix cross-crate destructor inlining
Closes #7793
2013-11-02 23:55:23 -04:00
bors
a248e34fc7 auto merge of #10235 : mletterle/rust/issue-9226, r=jdm
ty_nil will now report as "()" in gdb
ty_bot will now report as "!" in gdb

Added test to confirm basic types debugging metadata.

This fixes #9226
2013-11-02 18:22:18 -07:00
Michael Letterle
ca2f3028e9 Updated debugging metadata for ty_nil and ty_bot
ty_nil will now report as "()" in gdb
ty_bot will now report as "!" in gdb

Added test to confirm basic types debugging metadata.

This fixes #9226
2013-11-02 19:35:35 -04:00
bors
e0c01ca153 auto merge of #10165 : dcrewi/rust/missing-doc-on-private-trait, r=cmr
Fixes #10069.
2013-11-02 12:11:18 -07:00
bors
3899f8da6b auto merge of #10217 : alexcrichton/rust/less-reachable, r=pcwalton
Previously, all functions called by a reachable function were considered
reachable, but this is only the case if the original function was possibly
inlineable (if it's type generic or #[inline]-flagged).
2013-11-02 11:01:16 -07:00
bors
22dfdc927b auto merge of #10233 : sfackler/rust/private-module, r=alexcrichton
A private module will survive the strip-private pass if it contains
trait implementations, which aren't stripped until a separate pass in
render.
2013-11-02 03:11:10 -07:00
bors
95b18335da auto merge of #10230 : alexcrichton/rust/snapshots, r=brson
Closes #2240
2013-11-02 02:01:25 -07:00
bors
9ec4c1851a auto merge of #10229 : brson/rust/warnings, r=thestinger
In Rust we don't like capital letters.
2013-11-02 00:51:12 -07:00
bors
6879c8b382 auto merge of #10225 : Jurily/rust/master, r=alexcrichton 2013-11-01 23:36:10 -07:00
Steven Fackler
ea9432ef00 Rustdoc: Properly strip private modules
A private module will survive the strip-private pass if it contains
trait implementations, which aren't stripped until a separate pass in
render.
2013-11-01 23:32:58 -07:00