about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2015-01-17Make Index trait example clearerVolker Mische-12/+10
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-17Fix typo.Ms2ger-1/+1
2015-01-17Intpocalypse, book edition.Steve Klabnik-185/+187
Fix all usage of int/uint/i/u in the book.
2015-01-17Evaluate # fn in docsSteve Klabnik-102/+95
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-17Remove segmented stack info from the FFI chapter of the book.Steve Klabnik-23/+0
Fixes #20071.
2015-01-17Replace obsolete constructions in into examplesAndrew Barchuk-12/+12
Replace deprecated integer suffixes. Remove integer type notations altogether where possible. Replace uses of deprecated `range()` function with range notation.
2015-01-17Remove Thread::detach() call from intro exampleAndrew Barchuk-1/+1
The mentioned method are no longer part of Thread. Spawned threads are detached by default as of now.
2015-01-17Fix intro concurrency examples compilation warnsAndrew Barchuk-5/+5
* 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-17Revert stability for Bitv and BitvSetSimonas Kazlauskas-4/+4
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-17Add enum discriminats to the reference.Steve Klabnik-0/+21
Fixes #15755
2015-01-17Add note about libc::exit's unsafety.Steve Klabnik-0/+21
Fixes #19245.
2015-01-17auto merge of #21233 : huonw/rust/simd-size, r=Aatchbors-114/+359
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-17auto merge of #21205 : alexcrichton/rust/issue-21202, r=nikomatsakisbors-1564/+1647
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-17auto merge of #21132 : sfackler/rust/wait_timeout, r=alexcrichtonbors-97/+343
**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-17Feature gate SIMD in FFI, due to unknown ABIs.Huon Wilson-2/+64
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-17Add comprehensive test for no-ICE behaviour of SIMD FFI.Huon Wilson-0/+114
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-16auto merge of #21008 : huonw/rust/trait-suggestions, r=nikomatsakisbors-106/+495
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-16auto merge of #21113 : alexcrichton/rust/plug-a-hole, r=brsonbors-78/+145
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-16Rewrite Condvar::wait_timeout and make it publicSteven Fackler-97/+343
**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-16rustc: Fix a leak in dependency= pathsAlex Crichton-78/+145
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-16rustc_resolve: Correctly record privacy of methodsAlex Crichton-4/+45
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-16rustc: Move the privacy pass to its own crateAlex Crichton-1561/+1603
2015-01-16auto merge of #21162 : apasel422/rust/issue-16530, r=huonwbors-6/+20
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-16auto merge of #20972 : FlaPer87/rust/oibit-send-and-friends, r=nikomatsakisbors-105/+676
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-16Prefer implemented traits in suggestions.Huon Wilson-31/+148
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-16Put vector types in regs for arm & mips FFI.Huon Wilson-3/+6
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-16Support SSE with integer types in x86-64 FFI.Huon Wilson-10/+10
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-16Add `Type::int_width` for retrieving integer's bit width.Huon Wilson-77/+41
2015-01-16Support SSE types in extern {} better.Huon Wilson-10/+102
This seems to work on x86-64, but I am not able to test on other platforms. cc #20043
2015-01-16fix pretty test falloutFlavio Percoco-6/+2
2015-01-16Docs falloutFlavio Percoco-2/+3
2015-01-16populate impls *before* clonning the impls vecFlavio Percoco-6/+6
2015-01-16fix latest changes falloutFlavio Percoco-2/+0
2015-01-16addressed commentsFlavio Percoco-78/+45
2015-01-16Allow negative impls just for Send and SyncFlavio Percoco-0/+32
2015-01-16Don't use NoSend/NoSync in testsFlavio Percoco-41/+59
2015-01-16Fix coherence for negative implementationsFlavio Percoco-2/+27
2015-01-16add a run-pass test that used to failFlavio Percoco-0/+29
2015-01-16Don't use NoSend/NoSync in libstdFlavio Percoco-0/+163
2015-01-16Don't use NoSend/NoSync in liballocFlavio Percoco-0/+160
2015-01-16Remove NoSend/NoSyncFlavio Percoco-0/+2
2015-01-16Check for negative impls for `Send` and `Sync`Flavio Percoco-31/+87
2015-01-16Don't assemble bound impls if candidate's ambiguousFlavio Percoco-1/+1
2015-01-16Negative impls are considered safeFlavio Percoco-6/+58
2015-01-16push_impls_of_trait is not needed, use mapFlavio Percoco-19/+9
2015-01-16Add test for missing default implFlavio Percoco-0/+20
2015-01-16Record negative trait_impls separatedlyFlavio Percoco-2/+64
2015-01-16Merge pull request #21214 from sleepynate/spacing-in-bookbors-3/+3
Fix commented graphs in src/doc/trpl/ownership.md Reviewed-by: huonw
2015-01-16Merge pull request #21211 from fenhl/patch-1bors-1/+1
Fix std::sync::condvar::Condvar::notify_one docs Reviewed-by: alexcrichton
2015-01-16Merge pull request #21181 from nick29581/save-fixbors-19/+36
Two minor fixes for save-analysis Reviewed-by: huonw