Commit graph

37136 commits

Author SHA1 Message Date
Paul Collier
3c32cd1be2 libsyntax: 0u -> 0us, 0i -> 0is 2015-01-18 19:43:44 -08:00
Paul Collier
591337431d libsyntax: int types -> isize 2015-01-18 19:43:44 -08:00
Paul Collier
7a24b3a4d7 libsyntax: int => i32 in appropriate places 2015-01-18 19:43:44 -08:00
Paul Collier
d5c83652b3 libsyntax: rename functions from uint to usize 2015-01-17 20:47:30 -08:00
Paul Collier
a32249d447 libsyntax: uint types to usize 2015-01-17 23:45:29 +00: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
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
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
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
Huon Wilson
3d59a476e5 Support SSE types in extern {} better.
This seems to work on x86-64, but I am not able to test on other
platforms.

cc #20043
2015-01-16 22:49:39 +11:00
Flavio Percoco
cb85223903 fix pretty test fallout 2015-01-16 11:47:48 +01:00
Flavio Percoco
7cd762a967 Docs fallout 2015-01-16 08:18:57 +01:00
Flavio Percoco
2adc8b529a populate impls *before* clonning the impls vec 2015-01-16 08:18:56 +01:00
Flavio Percoco
59775bb955 fix latest changes fallout 2015-01-16 08:18:56 +01:00
Flavio Percoco
aa642b3486 addressed comments 2015-01-16 08:18:56 +01:00
Flavio Percoco
038aa0e8e9 Allow negative impls just for Send and Sync 2015-01-16 08:18:56 +01:00
Flavio Percoco
921ba5a09f Don't use NoSend/NoSync in tests 2015-01-16 08:18:56 +01:00
Flavio Percoco
094397a88b Fix coherence for negative implementations 2015-01-16 08:18:56 +01:00
Flavio Percoco
9d42581cf9 add a run-pass test that used to fail 2015-01-16 08:18:56 +01:00
Flavio Percoco
c6ab9a6370 Don't use NoSend/NoSync in libstd 2015-01-16 08:18:56 +01:00
Flavio Percoco
bb04121138 Don't use NoSend/NoSync in liballoc 2015-01-16 08:18:56 +01:00
Flavio Percoco
388e30f78e Remove NoSend/NoSync 2015-01-16 08:18:56 +01:00
Flavio Percoco
9eec782774 Check for negative impls for Send and Sync 2015-01-16 08:18:56 +01:00
Flavio Percoco
5aab863ba2 Don't assemble bound impls if candidate's ambiguous 2015-01-16 08:18:56 +01:00
Flavio Percoco
39fe05f58c Negative impls are considered safe 2015-01-16 08:18:55 +01:00
Flavio Percoco
e644ca0d6a push_impls_of_trait is not needed, use map 2015-01-16 08:18:55 +01:00
Flavio Percoco
199e0cd804 Add test for missing default impl 2015-01-16 08:18:55 +01:00
Flavio Percoco
683d20c3c5 Record negative trait_impls separatedly 2015-01-16 08:18:55 +01:00
bors
f3d71be65c Merge pull request #21214 from sleepynate/spacing-in-book
Fix commented graphs in src/doc/trpl/ownership.md

Reviewed-by: huonw
2015-01-16 06:31:03 +00:00
bors
ea9b00fdad Merge pull request #21211 from fenhl/patch-1
Fix std::sync::condvar::Condvar::notify_one docs

Reviewed-by: alexcrichton
2015-01-16 06:31:02 +00:00
bors
317da0bf2a Merge pull request #21181 from nick29581/save-fix
Two minor fixes for save-analysis

Reviewed-by: huonw
2015-01-16 06:31:02 +00:00
bors
b565501ad8 auto merge of #21213 : alexcrichton/rust/rollup, r=alexcrichton 2015-01-16 03:02:54 +00:00
Alex Crichton
42198c18f4 Test fixes and rebase conflicts 2015-01-15 18:53:30 -08:00
nathan dotz
3626a308f3 Fix commented graphs in src/doc/trpl/ownership.md 2015-01-15 18:15:18 -05:00
Fenhl
5f34815a22 Fix sync::condvar::Condvar::notify_one docs 2015-01-15 22:43:12 +00:00
bors
8903c21d61 auto merge of #21052 : nick29581/rust/methods-ext, r=sfackler
Allows modifiers to be used on methods, associated types, etc.

r? @sfackler
2015-01-15 22:42:58 +00:00
Alex Crichton
5f32992b31 rollup merge of #21206: steveklabnik/expressions
Suggested here: http://stackoverflow.com/a/27962076/24817
2015-01-15 14:12:08 -08:00