Commit Graph

37216 Commits

Author SHA1 Message Date
Eduard Burtescu
89b80faa8e Register new snapshots. 2015-01-17 16:37:34 -08:00
Jeff Belgum
08e712ebe9 add append to vec with tests 2015-01-17 16:15:21 -08:00
Alfie John
8da284a045 docs: typo 2015-01-17 23:31:13 +00:00
bors
f4f10dba29 auto merge of #21300 : steveklabnik/rust/rollup, r=steveklabnik
manual rollup to fix some conflicts and diagnose why the test is failing...
2015-01-17 20:31:08 +00:00
Steve Klabnik
6553c0f5eb Fix more rollup problems 2015-01-17 15:25:42 -05:00
Earl St Sauver
6ab95bdd62 s/deriving/derives in Comments/Docs
There are a large number of places that incorrectly refer
to deriving in comments, instead of derives.

Fixes #20984
2015-01-17 11:08:02 -08:00
Steve Klabnik
69e9b462e9 fix rollup 2015-01-17 13:58:54 -05:00
Kang Seonghoon
39e19ccdb6 tests: Tidy and allows multi-line htmldocck commands. 2015-01-18 03:23:52 +09:00
Kang Seonghoon
de6f520192 tests: Add htmldocck.py script for the use of Rustdoc tests.
The script is intended as a tool for doing every sort of verifications
amenable to Rustdoc's HTML output. For example, link checkers would go
to this script. It already parses HTML into a document tree form (with
a slight caveat), so future tests can make use of it.

As an example, relevant `rustdoc-*` run-make tests have been updated
to use `htmldocck.py` and got their `verify.sh` removed. In the future
they may go to a dedicated directory with htmldocck running by default.
The detailed explanation of test scripts is provided as a docstring of
htmldocck.

cc #19723
2015-01-18 02:42:15 +09:00
Benjamin Peterson
35d46fabaf remove test_find_equiv, since find_equiv doesn't exist anymore 2015-01-17 11:29:24 -05:00
Alfie John
2c64023e3e docs: grammar fix 2015-01-17 10:51:53 -05:00
Nick Howell
0c26524134 doc: Remove extra whitespace in the middle of lines to provide alignment
"Idiomatic code should not use extra whitespace in the middle of a line to provide alignment."
http://aturon.github.io/style/whitespace.html

I realize the linked page still needs an RFC, but the docs should be written in accordance with the guidelines nevertheless.
2015-01-17 10:51:53 -05:00
Alex Crichton
34fa70fba5 std: Move the bitflags! macro to a gated crate
In accordance with [collections reform part 2][rfc] this macro has been moved to
an external [bitflags crate][crate] which is [available though
crates.io][cratesio]. Inside the standard distribution the macro has been moved
to a crate called `rustc_bitflags` for current users to continue using.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0509-collections-reform-part-2.md
[crate]: https://github.com/rust-lang/bitflags
[cratesio]: http://crates.io/crates/bitflags

The major user of `bitflags!` in terms of a public-facing possibly-stable API
today is the `FilePermissions` structure inside of `std::io`. This user,
however, will likely no longer use `bitflags!` after I/O reform has landed. To
prevent breaking APIs today, this structure remains as-is.

Current users of the `bitflags!` macro should add this to their `Cargo.toml`:

    bitflags = "0.1"

and this to their crate root:

    #[macro_use] extern crate bitflags;

Due to the removal of a public macro, this is a:

[breaking-change]
2015-01-17 10:51:07 -05:00
Steve Klabnik
02968389dc Beef up Copy documentation
Fixes #21249
Fixes #11540
2015-01-17 10:51:07 -05:00
Steve Klabnik
433ea0bd55 Add C -> Rust example to FFI chapter of the book.
Fixes #10489.
2015-01-17 10:51:07 -05:00
Steve Klabnik
d1ab3799bd Update syntax of ignored test. 2015-01-17 10:51:07 -05:00
Steve Klabnik
d5091c9cc9 Fix up titles of TRPL chapters 2015-01-17 10:51:07 -05:00
Volker Mische
f12e60a5c8 Make Index trait example clearer
The example of the `Index` and `IndexMut` trait contained too much `Foo`.
It now contains a bit more `Bar` to make things clearer which parts are
defining the type of the index.
2015-01-17 10:51:07 -05:00
Ms2ger
0109ceaf82 Fix typo. 2015-01-17 10:51:07 -05:00
Corey Farwell
f979f91ae2 Bump LICENSE copyright year 2015-01-17 10:51:07 -05:00
Steve Klabnik
899ffcf62a Intpocalypse, book edition.
Fix all usage of int/uint/i/u in the book.
2015-01-17 10:51:07 -05:00
Steve Klabnik
078bd498b9 Evaluate # fn in docs
I searched for times when we were hiding functions with # in the documentation,
and fixed them to not use it unless neccesary.

I also made random improvements whenever I changed something. For example,
I changed Example to Examples, for consistency.

Fixes #13423
2015-01-17 10:49:49 -05:00
Steve Klabnik
a03701defa Remove segmented stack info from the FFI chapter of the book.
Fixes #20071.
2015-01-17 10:49:49 -05:00
Andrew Barchuk
5f1ba93ad2 Replace obsolete constructions in into examples
Replace deprecated integer suffixes. Remove integer type notations
altogether where possible. Replace uses of deprecated `range()`
function with range notation.
2015-01-17 10:49:49 -05:00
Andrew Barchuk
f77208972a Remove Thread::detach() call from intro example
The mentioned method are no longer part of Thread. Spawned threads are
detached by default as of now.
2015-01-17 10:49:49 -05:00
Andrew Barchuk
9ed27df180 Fix intro concurrency examples compilation warns
* Use range notation instead of deprecated `range()`

* Remove deprecated `u` integer suffixes used in ranges

* Replace deprecated `i` integer suffixes with `is` for vector numbers

`Thread::spawn()` still gives "use of unstable item" warning which I
hadn't found a way to fix.
2015-01-17 10:49:49 -05:00
Simonas Kazlauskas
873ae555e9 Revert stability for Bitv and BitvSet
The collections were promoted to stable by mistake and do not match RFC 509.
This reverts the stability back to unstable.

[breaking-change] since previously stable API became unstable.

Fixes #21193
2015-01-17 10:49:49 -05:00
Steve Klabnik
a2e277edf4 Add enum discriminats to the reference.
Fixes #15755
2015-01-17 10:49:49 -05:00
Steve Klabnik
868669f420 Add note about libc::exit's unsafety.
Fixes #19245.
2015-01-17 10:49:49 -05:00
bors
89c4e3792d auto merge of #21233 : huonw/rust/simd-size, r=Aatch
This stops the compiler ICEing on the use of SIMD types in FFI signatures. It emits correct code for LLVM intrinsics, but I am quite unsure about the ABI handling in general so I've added a new feature gate `simd_ffi` to try to ensure people don't use it without realising there's a non-trivial risk of codegen brokenness.

Closes #20043.
2015-01-17 10:58:43 +00:00
bors
3e6eaeb69f auto merge of #21205 : alexcrichton/rust/issue-21202, r=nikomatsakis
Loading methods from external crates was erroneously using the type's privacy
for each method instead of each method's privacy. This commit fixes that.

Closes #21202

This commit also moves privacy to its own crate because I thought that was where the bug was. Turns out it wasn't, but it helped me iterate at least!
2015-01-17 08:51:38 +00:00
bors
378fb5846d auto merge of #21132 : sfackler/rust/wait_timeout, r=alexcrichton
**The implementation is a direct adaptation of libcxx's condition_variable implementation.**

I also added a wait_timeout_with method, which matches the second overload in C++'s condition_variable. The implementation right now is kind of dumb but it works. There is an outstanding issue with it: as is it doesn't support the use case where a user doesn't care about poisoning and wants to continue through poison.

r? @alexcrichton @aturon
2015-01-17 03:51:34 +00:00
Tim Parenti
fbcc34f483 Grammar tweak to old guide stub documents.
Removes extra "the" from the phrase "the the Rust Programming Language
book", which isn't particularly grammatical.
2015-01-16 22:25:22 -05:00
Huon Wilson
ada312ffbb Address nits in trait suggestions. 2015-01-17 12:47:49 +11:00
Huon Wilson
c8e0e9549d Feature gate SIMD in FFI, due to unknown ABIs.
I don't know if this handling of SIMD types is correct for the C ABI on
all platforms, so lets add an even finer feature gate than just the
`simd` one.

The `simd` one can be used with (relatively) little risk of complete
nonsense, the reason for it is that it is likely that things will
change. Using the types in FFI with an incorrect ABI will at best give
absolute nonsense results, but possibly cause serious breakage too, so
this is a step up in badness, hence a new feature gate.
2015-01-17 11:55:46 +11:00
Huon Wilson
4f08de84c9 Add comprehensive test for no-ICE behaviour of SIMD FFI.
This just compiles a test using SIMD in FFI (mostly importing LLVM
intrinsics) for almost all rustc's supported platforms, but not linking
it or running it, so there's absolutely no guarantee that this is correct.
2015-01-17 11:55:46 +11:00
Alex Crichton
38cb91e66c syntax: Feature gate #[start] and #[main]
These two attributes are used to change the entry point into a Rust program, but
for now they're being put behind feature gates until we have a chance to think
about them a little more. The #[start] attribute specifically may have its
signature changed.

This is a breaking change to due the usage of these attributes generating errors
by default now. If your crate is using these attributes, add this to your crate
root:

    #![feature(start)] // if you're using the #[start] attribute
    #![feature(main)]  // if you're using the #[main] attribute

cc #20064
2015-01-16 14:59:03 -08:00
bors
ed530d7a3b auto merge of #21008 : huonw/rust/trait-suggestions, r=nikomatsakis
For a call like `foo.bar()` where the method `bar` can't be resolved,
the compiler will search for traits that have methods with name `bar` to
give a more informative error, providing a list of possibilities.

Closes #7643.
2015-01-16 22:41:16 +00:00
Daniil Smirnov
89de6926b5 Fixes join_multicast on Windows #20381 2015-01-17 01:37:07 +03:00
bors
653e6880c9 auto merge of #21113 : alexcrichton/rust/plug-a-hole, r=brson
With the addition of separate search paths to the compiler, it was intended that
applications such as Cargo could require a `--extern` flag per `extern crate`
directive in the source. The system can currently be subverted, however, due to
the `existing_match()` logic in the crate loader.

When loading crates we first attempt to match an `extern crate` directive
against all previously loaded crates to avoid reading metadata twice. This "hit
the cache if possible" step was erroneously leaking crates across the search
path boundaries, however. For example:

    extern crate b;
    extern crate a;

If `b` depends on `a`, then it will load crate `a` when the `extern crate b`
directive is being processed. When the compiler reaches `extern crate a` it will
use the previously loaded version no matter what. If the compiler was not
invoked with `-L crate=path/to/a`, it will still succeed.

This behavior is allowing `extern crate` declarations in Cargo without a
corresponding declaration in the manifest of a dependency, which is considered
a bug.

This commit fixes this problem by keeping track of the origin search path for a
crate. Crates loaded from the dependency search path are not candidates for
crates which are loaded from the crate search path.
2015-01-16 19:17:30 +00:00
Steven Fackler
08f6380a9f Rewrite Condvar::wait_timeout and make it public
**The implementation is a direct adaptation of libcxx's
condition_variable implementation.**

pthread_cond_timedwait uses the non-monotonic system clock. It's
possible to change the clock to a monotonic via pthread_cond_attr, but
this is incompatible with static initialization. To deal with this, we
calculate the timeout using the system clock, and maintain a separate
record of the start and end times with a monotonic clock to be used for
calculation of the return value.
2015-01-16 09:17:37 -08:00
Alex Crichton
cbeb77ec7a rustc: Fix a leak in dependency= paths
With the addition of separate search paths to the compiler, it was intended that
applications such as Cargo could require a `--extern` flag per `extern crate`
directive in the source. The system can currently be subverted, however, due to
the `existing_match()` logic in the crate loader.

When loading crates we first attempt to match an `extern crate` directive
against all previously loaded crates to avoid reading metadata twice. This "hit
the cache if possible" step was erroneously leaking crates across the search
path boundaries, however. For example:

    extern crate b;
    extern crate a;

If `b` depends on `a`, then it will load crate `a` when the `extern crate b`
directive is being processed. When the compiler reaches `extern crate a` it will
use the previously loaded version no matter what. If the compiler was not
invoked with `-L crate=path/to/a`, it will still succeed.

This behavior is allowing `extern crate` declarations in Cargo without a
corresponding declaration in the manifest of a dependency, which is considered
a bug.

This commit fixes this problem by keeping track of the origin search path for a
crate. Crates loaded from the dependency search path are not candidates for
crates which are loaded from the crate search path.

As a result of this fix, this is a likely a breaking change for a number of
Cargo packages. If the compiler starts informing that a crate can no longer be
found, it likely means that the dependency was forgotten in your Cargo.toml.

[breaking-change]
2015-01-16 08:48:16 -08:00
Alex Crichton
8115222607 rustc_resolve: Correctly record privacy of methods
Loading methods from external crates was erroneously using the type's privacy
for each method instead of each method's privacy. This commit fixes that.

Closes #21202
2015-01-16 08:39:56 -08:00
Alex Crichton
a9decbdc44 rustc: Move the privacy pass to its own crate 2015-01-16 08:38:24 -08:00
bors
210f0dcf00 auto merge of #21162 : apasel422/rust/issue-16530, r=huonw
This fixes #16530 by hashing nullary structs [the same way as the empty tuple] (https://github.com/rust-lang/rust/blob/master/src/libcore/hash/mod.rs#L185). Other approaches are possible, but this was the simplest.
2015-01-16 16:21:06 +00:00
bors
ee2bfae011 auto merge of #20972 : FlaPer87/rust/oibit-send-and-friends, r=nikomatsakis
This PR adds rules for negative implementations. It follows pretty much what the [RFC](https://github.com/rust-lang/rfcs/blob/master/text/0019-opt-in-builtin-traits.md) says with 1 main difference:

Instead of positive implementations override negative implementations, this have been implemented in a way that a negative implementation of `Trait` for `T` will overlap with a positive implementation, causing a coherence error.

@nikomatsakis r?

cc #13231

[breaking-change]
2015-01-16 13:10:59 +00:00
Huon Wilson
0a55aacc07 Prefer implemented traits in suggestions.
If `a.method();` can't be resolved, we first look for implemented traits
globally and suggest those. If there are no such traits found, we only
then fall back to suggesting from the unfiltered list of traits.
2015-01-16 22:54:19 +11:00
Huon Wilson
9e83ae931c Put vector types in regs for arm & mips FFI.
This seems to match what clang does on arm, but I cannot do any
experimentation with mips, but it matches how the LLVM intrinsics are
defined in any case...
2015-01-16 22:49:40 +11:00
Huon Wilson
7d4f358de7 Support SSE with integer types in x86-64 FFI.
Unlike the intrinics in C, this types the SSE values base on integer
size. This matches the LLVM intrinsics which have concrete vector types
(`<4 x i32>` etc.), and is no loss of expressivity: if one is using a C
function that really takes an untyped integral SSE value, just give it
whatever Rust type makes most sense.
2015-01-16 22:49:40 +11:00
Huon Wilson
5edbe1f5dd Add Type::int_width for retrieving integer's bit width. 2015-01-16 22:49:39 +11:00