]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #10305 : thestinger/rust/align, r=alexcrichton
bors [Wed, 6 Nov 2013 04:41:07 +0000 (20:41 -0800)]
auto merge of #10305 : thestinger/rust/align, r=alexcrichton

Closes #10300

10 years agofix alignment of pthread_attr_t
Daniel Micay [Wed, 6 Nov 2013 01:00:35 +0000 (20:00 -0500)]
fix alignment of pthread_attr_t

Closes #10300

10 years agoauto merge of #10299 : alexcrichton/rust/osx-loader-path-fix, r=brson
bors [Wed, 6 Nov 2013 02:31:09 +0000 (18:31 -0800)]
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.

10 years agoClarify which errors are format string errors
Alex Crichton [Wed, 6 Nov 2013 01:59:40 +0000 (17:59 -0800)]
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

10 years agoauto merge of #10261 : ksh8281/rust/makecheck_debuginfo_arm-linux-androideabi, r...
bors [Wed, 6 Nov 2013 01:06:11 +0000 (17:06 -0800)]
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

10 years agoRe-arranging some things in btree.rs to accommodate testing.
niftynif [Wed, 6 Nov 2013 00:44:21 +0000 (19:44 -0500)]
Re-arranging some things in btree.rs to accommodate testing.

10 years agoAdd make check support(arm-linux-androideabi debuginfo)
sh8281.kim [Mon, 4 Nov 2013 06:53:01 +0000 (15:53 +0900)]
Add make check support(arm-linux-androideabi debuginfo)

10 years agoUse loader_path instead of executable_path for osx
Alex Crichton [Tue, 5 Nov 2013 22:17:30 +0000 (14:17 -0800)]
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.

10 years agoMake TypeContents consider the type `T` to be reachable via `*T` pointers
Niko Matsakis [Wed, 30 Oct 2013 00:29:59 +0000 (20:29 -0400)]
Make TypeContents consider the type `T` to be reachable via `*T` pointers

Fixes #9509

10 years agoRename misleading contains_managed to owns_managed
Niko Matsakis [Tue, 5 Nov 2013 19:50:33 +0000 (14:50 -0500)]
Rename misleading contains_managed to owns_managed

10 years agoRefactor TypeContents to be more scrutable. In particular, create coarser bits
Niko Matsakis [Tue, 29 Oct 2013 20:08:49 +0000 (16:08 -0400)]
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

10 years agoauto merge of #10290 : dbussink/rust/thread_in_rust, r=alexcrichton
bors [Tue, 5 Nov 2013 16:56:08 +0000 (08:56 -0800)]
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

10 years agoMove implementation for threads to Rust
Dirkjan Bussink [Tue, 5 Nov 2013 13:13:02 +0000 (14:13 +0100)]
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

10 years agoauto merge of #10285 : sfackler/rust/weird-derivings, r=huonw
bors [Tue, 5 Nov 2013 09:47:43 +0000 (01:47 -0800)]
auto merge of #10285 : sfackler/rust/weird-derivings, r=huonw

They seem to have been added by accident.

10 years agoauto merge of #10282 : sfackler/rust/rustpkg-test-cfg, r=alexcrichton
bors [Tue, 5 Nov 2013 08:07:20 +0000 (00:07 -0800)]
auto merge of #10282 : sfackler/rust/rustpkg-test-cfg, r=alexcrichton

Closes #10238

10 years agoauto merge of #10270 : alexcrichton/rust/no-super-buffer, r=brson
bors [Tue, 5 Nov 2013 06:47:00 +0000 (22:47 -0800)]
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.

10 years agoRemove #[deriving]s on impls
Steven Fackler [Tue, 5 Nov 2013 06:43:22 +0000 (22:43 -0800)]
Remove #[deriving]s on impls

They seem to have been added by accident.

10 years agoauto merge of #10064 : luqmana/rust/vvv, r=nikomatsakis
bors [Tue, 5 Nov 2013 05:02:07 +0000 (21:02 -0800)]
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!

10 years agort: Convert timezone to utf-8 on Windows
klutzy [Tue, 5 Nov 2013 04:20:04 +0000 (13:20 +0900)]
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.

10 years agoAdd tests for variadic foreign functions.
Luqman Aden [Mon, 4 Nov 2013 21:34:07 +0000 (16:34 -0500)]
Add tests for variadic foreign functions.

10 years agolibsyntax/librustc: Allow calling variadic foreign functions.
Luqman Aden [Fri, 25 Oct 2013 05:56:34 +0000 (01:56 -0400)]
libsyntax/librustc: Allow calling variadic foreign functions.

10 years agoAllow --cfg on rustpkg test
Steven Fackler [Tue, 5 Nov 2013 04:33:42 +0000 (20:33 -0800)]
Allow --cfg on rustpkg test

Closes #10238

10 years agoauto merge of #10182 : alexcrichton/rust/typeid-intrinsic, r=nikomatsakis
bors [Tue, 5 Nov 2013 03:21:50 +0000 (19:21 -0800)]
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).

10 years agoauto merge of #10276 : alexcrichton/rust/fix-debug-info, r=jdm
bors [Tue, 5 Nov 2013 01:22:03 +0000 (17:22 -0800)]
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.

10 years agoRelax the constraints on a debuginfo test
Alex Crichton [Tue, 5 Nov 2013 01:11:44 +0000 (17:11 -0800)]
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.

10 years agoAdded skeleton implementation of a B-tree with a few bells and
niftynif [Tue, 5 Nov 2013 00:45:49 +0000 (19:45 -0500)]
Added skeleton implementation of a B-tree with a few bells and
whistles.  No major functionality added yet (such as insertion and
removal).

10 years agoStop extra buffering when stdout isn't a tty
Alex Crichton [Mon, 4 Nov 2013 23:45:46 +0000 (15:45 -0800)]
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.

10 years agoauto merge of #10179 : alexcrichton/rust/rt-improvements, r=cmr
bors [Mon, 4 Nov 2013 20:21:11 +0000 (12:21 -0800)]
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.

10 years agoMove io::file to io::fs and fns out of File
Alex Crichton [Thu, 31 Oct 2013 22:15:30 +0000 (15:15 -0700)]
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

10 years agoauto merge of #10260 : alexcrichton/rust/fix-temp-name, r=thestinger
bors [Mon, 4 Nov 2013 08:06:18 +0000 (00:06 -0800)]
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).

10 years agoFix the temporary name of the object file created
Alex Crichton [Mon, 4 Nov 2013 07:30:06 +0000 (23:30 -0800)]
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).

10 years agoauto merge of #10254 : sfackler/rust/rustpkg-test-failure, r=alexcrichton
bors [Mon, 4 Nov 2013 06:56:01 +0000 (22:56 -0800)]
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

10 years agoEnsure rustpkg test fails if tests failed
Steven Fackler [Sun, 3 Nov 2013 23:23:34 +0000 (15:23 -0800)]
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

10 years agoauto merge of #10251 : thestinger/rust/ptr, r=alexcritchton
bors [Mon, 4 Nov 2013 03:31:11 +0000 (19:31 -0800)]
auto merge of #10251 : thestinger/rust/ptr, r=alexcritchton

This moves the per-architecture difference into the compiler.

10 years agosimplify memcpy/memmove/memset intrinsics
Daniel Micay [Sun, 3 Nov 2013 21:54:58 +0000 (16:54 -0500)]
simplify memcpy/memmove/memset intrinsics

This moves the per-architecture difference into the compiler.

10 years agoauto merge of #10252 : huonw/rust/docs, r=alexcrichton
bors [Mon, 4 Nov 2013 01:31:20 +0000 (17:31 -0800)]
auto merge of #10252 : huonw/rust/docs, r=alexcrichton

10 years agoauto merge of #10248 : nibrahim/rust/docformatting, r=pcwalton
bors [Mon, 4 Nov 2013 00:06:05 +0000 (16:06 -0800)]
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>
10 years agoFill out the remaining functionality in io::file
Alex Crichton [Wed, 30 Oct 2013 06:31:07 +0000 (23:31 -0700)]
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

10 years agoRemove all blocking std::os blocking functions
Alex Crichton [Sat, 26 Oct 2013 00:04:37 +0000 (17:04 -0700)]
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

10 years agoModify IoFactory's fs_mkdir, and add fs_rename
Alex Crichton [Fri, 25 Oct 2013 23:50:08 +0000 (16:50 -0700)]
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.

10 years agoMove rt::io traits into the prelude
Alex Crichton [Fri, 25 Oct 2013 23:48:26 +0000 (16:48 -0700)]
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!

10 years agodocs: Replace std::iterator with std::iter.
Huon Wilson [Sun, 3 Nov 2013 23:01:00 +0000 (10:01 +1100)]
docs: Replace std::iterator with std::iter.

10 years agoauto merge of #10219 : alexcrichton/rust/drop-invoke, r=pcwalton
bors [Sun, 3 Nov 2013 19:16:17 +0000 (11:16 -0800)]
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.

10 years agoFixed formatting.
Noufal Ibrahim [Sun, 3 Nov 2013 17:11:17 +0000 (22:41 +0530)]
Fixed formatting.

The code block shows up inline without proper formatting without this
newline.

Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
10 years agoauto merge of #10143 : chris-morgan/rust/filename-consistency, r=huonw
bors [Sun, 3 Nov 2013 13:01:02 +0000 (05:01 -0800)]
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.

10 years agoRename files to match current recommendations.
Chris Morgan [Tue, 29 Oct 2013 06:22:49 +0000 (17:22 +1100)]
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.

10 years agoauto merge of #10244 : thestinger/rust/abort, r=alexcrichton
bors [Sun, 3 Nov 2013 07:46:01 +0000 (00:46 -0700)]
auto merge of #10244 : thestinger/rust/abort, r=alexcrichton

The function is marked `noreturn`, so it shouldn't have this.

10 years agoreplace RetVoid with Unreachable to fix lint
Daniel Micay [Sun, 3 Nov 2013 06:28:32 +0000 (01:28 -0500)]
replace RetVoid with Unreachable to fix lint

The function is marked `noreturn`, so it shouldn't return.

10 years agoauto merge of #10242 : thestinger/rust/inline_dtor, r=alexcrichton
bors [Sun, 3 Nov 2013 06:26:00 +0000 (23:26 -0700)]
auto merge of #10242 : thestinger/rust/inline_dtor, r=alexcrichton

Closes #7793

10 years agoauto merge of #10199 : alexcrichton/rust/no-propagate, r=brson
bors [Sun, 3 Nov 2013 05:16:02 +0000 (22:16 -0700)]
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!

10 years agoGrammar error and vim syntax highlighting mistake fixed.
Matt Carberry [Sun, 3 Nov 2013 04:34:29 +0000 (21:34 -0700)]
Grammar error and vim syntax highlighting mistake fixed.

10 years agoStatically link libuv to librustuv
Alex Crichton [Thu, 31 Oct 2013 06:57:27 +0000 (23:57 -0700)]
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.

10 years agoAdded octal literal support.
Matt Carberry [Sun, 3 Nov 2013 04:26:29 +0000 (21:26 -0700)]
Added octal literal support.

10 years agofix cross-crate destructor inlining
Daniel Micay [Thu, 31 Oct 2013 23:44:25 +0000 (19:44 -0400)]
fix cross-crate destructor inlining

Closes #7793

10 years agoauto merge of #10235 : mletterle/rust/issue-9226, r=jdm
bors [Sun, 3 Nov 2013 01:22:18 +0000 (18:22 -0700)]
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

10 years agoUpdated debugging metadata for ty_nil and ty_bot
Michael Letterle [Sat, 2 Nov 2013 18:38:25 +0000 (14:38 -0400)]
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

10 years agoauto merge of #10165 : dcrewi/rust/missing-doc-on-private-trait, r=cmr
bors [Sat, 2 Nov 2013 19:11:18 +0000 (12:11 -0700)]
auto merge of #10165 : dcrewi/rust/missing-doc-on-private-trait, r=cmr

Fixes #10069.

10 years agoauto merge of #10217 : alexcrichton/rust/less-reachable, r=pcwalton
bors [Sat, 2 Nov 2013 18:01:16 +0000 (11:01 -0700)]
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).

10 years agoauto merge of #10233 : sfackler/rust/private-module, r=alexcrichton
bors [Sat, 2 Nov 2013 10:11:10 +0000 (03:11 -0700)]
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.

10 years agoauto merge of #10230 : alexcrichton/rust/snapshots, r=brson
bors [Sat, 2 Nov 2013 09:01:25 +0000 (02:01 -0700)]
auto merge of #10230 : alexcrichton/rust/snapshots, r=brson

Closes #2240

10 years agoauto merge of #10229 : brson/rust/warnings, r=thestinger
bors [Sat, 2 Nov 2013 07:51:12 +0000 (00:51 -0700)]
auto merge of #10229 : brson/rust/warnings, r=thestinger

In Rust we don't like capital letters.

10 years agoauto merge of #10225 : Jurily/rust/master, r=alexcrichton
bors [Sat, 2 Nov 2013 06:36:10 +0000 (23:36 -0700)]
auto merge of #10225 : Jurily/rust/master, r=alexcrichton

10 years agoRustdoc: Properly strip private modules
Steven Fackler [Sat, 2 Nov 2013 06:32:58 +0000 (23:32 -0700)]
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.

10 years agoauto merge of #10232 : brson/rust/destdir, r=thestinger
bors [Sat, 2 Nov 2013 04:56:13 +0000 (21:56 -0700)]
auto merge of #10232 : brson/rust/destdir, r=thestinger

10 years agoStatically link sundown to librustdoc
Alex Crichton [Thu, 31 Oct 2013 06:22:04 +0000 (23:22 -0700)]
Statically link sundown to librustdoc

Closes #10103

10 years agoStop propagating link arguments across crates
Alex Crichton [Thu, 31 Oct 2013 05:54:27 +0000 (22:54 -0700)]
Stop propagating link arguments across crates

This is a fairly brittle modle that doesn't scale well across many crates. It's
unlikely that all of the downstream crates will have all of the original native
dependencies of all the upstream crates. In the case that FFI functions are
reachable, then it should be the responsibility of the downstream crate to link
against the correct library, or the upstream crate should prevent the functions
from being reachable.

10 years agoauto merge of #10222 : nibrahim/rust/docfix, r=brson
bors [Sat, 2 Nov 2013 03:46:18 +0000 (20:46 -0700)]
auto merge of #10222 : nibrahim/rust/docfix, r=brson

Earlier versions of pandoc don't have the `default.html5` template file. When `make docs` is run, the build process fails with this message.

    pandoc: doc/rust.html
    pandoc: /usr/share/pandoc-1.8.2.1/templates/default.html5: openFile: does not exist (No such file or directory)

    node.js:201
            throw e; // process.nextTick error, or 'error' event on first tick
                  ^
    Error: write EPIPE
        at errnoException (net.js:670:11)
        at Object.afterWrite [as oncomplete] (net.js:503:19)
    make: *** [doc/rust.html] Error 1

10 years agoFix installation with DESTDIR
Brian Anderson [Sat, 2 Nov 2013 03:23:22 +0000 (20:23 -0700)]
Fix installation with DESTDIR

10 years agoauto merge of #10223 : huonw/rust/gamma, r=cmr
bors [Sat, 2 Nov 2013 01:36:42 +0000 (18:36 -0700)]
auto merge of #10223 : huonw/rust/gamma, r=cmr

Implements the [Gamma distribution](https://en.wikipedia.org/wiki/Gamma_distribution), using the algorithm described by Marsaglia & Tsang 2000[1]. I added tests checking that the mean and variance of this implementation is as expected for a range of values of the parameters in https://github.com/huonw/random-tests/commit/5d87c00a0fb69c8fa173593714cef76ddfddb651 (they pass locally, but obviously won't even build on Travis until this is merged).

Also, moves `std::rand::distributions` to a subfolder, and performs a minor clean-up of the benchmarking (makes the number of iterations shared by the whole `std::rand` subtree).

[1]: George Marsaglia and Wai Wan Tsang. 2000. "A Simple Method for Generating Gamma Variables" *ACM Trans. Math. Softw.* 26, 3 (September 2000), 363-372. DOI:[10.1145/358407.358414](http://doi.acm.org/10.1145/358407.358414).

10 years agoRegister new snapshots
Alex Crichton [Fri, 1 Nov 2013 20:46:30 +0000 (13:46 -0700)]
Register new snapshots

Closes #2240

10 years agoauto merge of #10215 : brson/rust/rustctask, r=thestinger
bors [Fri, 1 Nov 2013 23:16:26 +0000 (16:16 -0700)]
auto merge of #10215 : brson/rust/rustctask, r=thestinger

10 years agoUse consistent capitalization in makefile errors
Brian Anderson [Fri, 1 Nov 2013 22:28:12 +0000 (15:28 -0700)]
Use consistent capitalization in makefile errors

In Rust we don't like capital letters.

10 years agoBump required pandoc version to 1.9.
Noufal Ibrahim [Fri, 1 Nov 2013 05:06:13 +0000 (10:36 +0530)]
Bump required pandoc version to 1.9.

Earlier versions of pandoc don't have the default.html5 and thus,
building the docs fail.

Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
10 years agoauto merge of #10220 : luqmana/rust/con, r=brson
bors [Fri, 1 Nov 2013 19:46:21 +0000 (12:46 -0700)]
auto merge of #10220 : luqmana/rust/con, r=brson

Previously we were actually overwriting `CFG_{HOST,TARGET,BUILD}` with `CFG_{HOST,TARGET,BUILD}_TRIPLE(S)` since configure tested for the legacy one by checking if it was empty which would never be the case. That meant it wouldn't split up multiple triples and just treat it as one long triple.

This pull also fixes the rules that were changed when librustuv was added to use the right CFG_ vars and removes the legacy flags.

10 years agoRemove unnecessary unwind messages
Alex Crichton [Fri, 1 Nov 2013 18:20:01 +0000 (11:20 -0700)]
Remove unnecessary unwind messages

Now that the type_id intrinsic is working across crates, all of these
unnecessary messages can be removed to have the failure type for a task truly be
~Any and only ~Any

10 years agoauto merge of #10204 : alexcrichton/rust/better-names, r=brson
bors [Fri, 1 Nov 2013 18:31:32 +0000 (11:31 -0700)]
auto merge of #10204 : alexcrichton/rust/better-names, r=brson

Tests now have the same name as the test that they're running (to allow for
easier diagnosing of failure sources), and the main task is now specially named
`<main>` instead of `<unnamed>`.

Closes #10195
Closes #10073

10 years agoconfigure: Remove legacy triple flags.
Luqman Aden [Fri, 1 Nov 2013 18:21:48 +0000 (14:21 -0400)]
configure: Remove legacy triple flags.

10 years agoAdd a type_id intrinsic
Alex Crichton [Wed, 30 Oct 2013 23:32:33 +0000 (16:32 -0700)]
Add a type_id intrinsic

Closes #9913

10 years agoauto merge of #10119 : Kimundi/rust/option_and_generic, r=alexcrichton
bors [Fri, 1 Nov 2013 16:36:25 +0000 (09:36 -0700)]
auto merge of #10119 : Kimundi/rust/option_and_generic, r=alexcrichton

This takes the last reforms on the `Option` type and applies them to `Result` too. For that, I reordered and grouped the functions in both modules, and also did some refactorings:

- Added `as_ref` and `as_mut` adapters to `Result`.
- Renamed `Result::map_move` to `Result::map` (same for `_err` variant), deleted other map functions.
- Made the `.expect()` methods be generic over anything you can
  fail with.
- Updated some doc comments to the line doc comment style
- Cleaned up and extended standard trait implementations on `Option` and `Result`
- Removed legacy implementations in the `option` and `result` module

10 years agoGive test and main tasks better names
Alex Crichton [Fri, 1 Nov 2013 16:16:11 +0000 (09:16 -0700)]
Give test and main tasks better names

Tests now have the same name as the test that they're running (to allow for
easier diagnosing of failure sources), and the main task is now specially named
<main> instead of <unnamed>.

Closes #10195
Closes #10073

10 years agoFix typo in to_digit
Gyorgy Andrasek [Fri, 1 Nov 2013 16:13:43 +0000 (17:13 +0100)]
Fix typo in to_digit

10 years agoauto merge of #10218 : alexcrichton/rust/stdio-flush-safe, r=cmr
bors [Fri, 1 Nov 2013 15:26:24 +0000 (08:26 -0700)]
auto merge of #10218 : alexcrichton/rust/stdio-flush-safe, r=cmr

The previous method was unsound because you could very easily create two mutable
pointers which alias the same location (not sound behavior). This hides the
function which does so and then exports an explicit flush() function (with
documentation about how it works).

10 years agoFixed unused import warning in tests
Marvin Löbel [Fri, 1 Nov 2013 14:37:29 +0000 (15:37 +0100)]
Fixed unused import warning in tests

10 years agoRemoved legacy implementations
Marvin Löbel [Fri, 1 Nov 2013 13:36:43 +0000 (14:36 +0100)]
Removed legacy implementations

10 years agoCleaned up the option and result module in more detail
Marvin Löbel [Fri, 1 Nov 2013 11:25:36 +0000 (12:25 +0100)]
Cleaned up the option and result module in more detail

Made both types implement more standard traits in a nicer way

Derived more traits

10 years agoReordered the methods in std::Option and std::Result
Marvin Löbel [Thu, 31 Oct 2013 22:09:24 +0000 (23:09 +0100)]
Reordered the methods in std::Option and std::Result

Cleaned up the source in a few places

Renamed `map_move` to `map`, removed other `map` methods

Added `as_ref` and `as_mut` adapters to `Result`

Added `fmt::Default` impl

10 years agoauto merge of #10213 : telotortium/rust/rand-fill_bytes-stack-overflow, r=huonw
bors [Fri, 1 Nov 2013 12:21:24 +0000 (05:21 -0700)]
auto merge of #10213 : telotortium/rust/rand-fill_bytes-stack-overflow, r=huonw

Fix the implementation of `std::rand::Rng::fill_bytes()` for
`std::rand::reseeding::ReseedingRng` to call the `fill_bytes()` method
of the underlying RNG rather than itself, which causes infinite
recursion.

Fixes #10202.

10 years agostd::rand: share the benchmark counter among the whole module tree.
Huon Wilson [Fri, 1 Nov 2013 10:33:13 +0000 (21:33 +1100)]
std::rand: share the benchmark counter among the whole module tree.

10 years agostd::rand: Implement the Gamma distribution.
Huon Wilson [Fri, 1 Nov 2013 02:34:08 +0000 (13:34 +1100)]
std::rand: Implement the Gamma distribution.

10 years agoauto merge of #10205 : brson/rust/unnamed_addr, r=thestinger
bors [Fri, 1 Nov 2013 11:06:23 +0000 (04:06 -0700)]
auto merge of #10205 : brson/rust/unnamed_addr, r=thestinger

10 years agostd::rand: Move distributions to a subfolder.
Huon Wilson [Fri, 1 Nov 2013 00:25:20 +0000 (11:25 +1100)]
std::rand: Move distributions to a subfolder.

10 years agoauto merge of #10203 : kud1ing/rust/ios, r=alexcrichton
bors [Fri, 1 Nov 2013 09:26:23 +0000 (02:26 -0700)]
auto merge of #10203 : kud1ing/rust/ios, r=alexcrichton

This is based on the work by @dobkeratops, updated and extended to work for Xcode 5.

This gets you going. I will add separate PRs for compilation/linking fixes.
See also https://github.com/mozilla/rust/wiki/Doc-building-for-ios

10 years agoauto merge of #10196 : huonw/rust/fix-zig, r=alexcrichton
bors [Fri, 1 Nov 2013 08:16:22 +0000 (01:16 -0700)]
auto merge of #10196 : huonw/rust/fix-zig, r=alexcrichton

The code was using (in the notation of Doornik 2005) `f(x_{i+1}) -
f(x_{i+2})` rather than `f(x_i) - f(x_{i+1})`. This corrects that, and
removes the F_DIFF tables which caused this problem in the first place.

They `F_DIFF` tables are a micro-optimisation (in theory, they could
easily be a micro-pessimisation): that `if` gets hit about 1% of the
time for Exp/Normal, and the rest of the condition involves RNG calls
and a floating point `exp`, so it is unlikely that saving a single FP
subtraction will be very useful (especially as more tables means more
memory reads and higher cache pressure, as well as taking up space in
the binary (although only ~2k in this case)).

Closes #10084. Notably, unlike that issue suggests, this wasn't a
problem with the Exp tables. It affected Normal too, but since it is
symmetric, there was no bias in the mean (as the bias was equal on the
positive and negative sides and so cancelled out) but it was visible as
a variance slightly lower than it should be.

New plot:

![exp-density](https://f.cloud.github.com/assets/1203825/1445796/42218dfe-422a-11e3-9f98-2cd146b82b46.png)

I've started writing some tests in [huonw/random-tests](https://github.com/huonw/random-tests) (not in the main repo because they can and do fail occasionally, due to randomness, but it is on Travis and Rust-CI so it will hopefully track the language), unsurprisingly, they're [currently failing](https://travis-ci.org/huonw/random-tests/builds/13313987) (note that both exp and norm are failing, the former due to both mean and variance the latter due to just variance), but pass at the 0.01 level reliably with this change.

(Currently the only test is essentially a quantitative version of the plots I've been showing, which is run on the `f64` `Rand` instance (uniform 0 to 1), and the Normal and Exp distributions.)

10 years agoconfigure: Fix passing multiple target and host triples.
Luqman Aden [Fri, 1 Nov 2013 07:09:04 +0000 (03:09 -0400)]
configure: Fix passing multiple target and host triples.

10 years agoDrop struct fields if the user destructor fails
Alex Crichton [Fri, 1 Nov 2013 06:31:11 +0000 (23:31 -0700)]
Drop struct fields if the user destructor fails

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.

10 years agoauto merge of #10187 : pcwalton/rust/remove-mocks, r=pcwalton
bors [Fri, 1 Nov 2013 05:26:24 +0000 (22:26 -0700)]
auto merge of #10187 : pcwalton/rust/remove-mocks, r=pcwalton

r? @alexcrichton

10 years agoProvide a sound method of flushing stdout
Alex Crichton [Fri, 1 Nov 2013 05:09:48 +0000 (22:09 -0700)]
Provide a sound method of flushing stdout

The previous method was unsound because you could very easily create two mutable
pointers which alias the same location (not sound behavior). This hides the
function which does so and then exports an explicit flush() function (with
documentation about how it works).

10 years agoReduce the aggressiveness of reachability
Alex Crichton [Fri, 1 Nov 2013 03:47:23 +0000 (20:47 -0700)]
Reduce the aggressiveness of reachability

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).

10 years agoauto merge of #10181 : brson/rust/managed_boxes, r=thestinger
bors [Fri, 1 Nov 2013 03:36:17 +0000 (20:36 -0700)]
auto merge of #10181 : brson/rust/managed_boxes, r=thestinger

10 years agoName the rustc task 'rustc'
Brian Anderson [Fri, 1 Nov 2013 03:08:17 +0000 (20:08 -0700)]
Name the rustc task 'rustc'