Commit Graph

41992 Commits

Author SHA1 Message Date
Felix S. Klock II
2ae82fcd95 Regression test for issue 24687.
use visible characters for the multibyte character filler.
2015-04-29 10:53:09 +02:00
jooert
f99658d7c7 Adapt benchmark tests to unit test guidelines
Since #24783, the style guidelines recommend that unit tests should live in a submodule `tests` rather than `test` to not clash with the possible use of libtest. This is especially important for benchmark tests as they require libtest. Fixes #24923.
2015-04-29 10:36:43 +02:00
Felix S. Klock II
ecd3572f49 Fix zero-normalization of the pos of a MultiByteChar.
Fix #24687
2015-04-29 10:21:29 +02:00
bors
26c7635ccf Auto merge of #24893 - robinst:issue-24407-E0013, r=nrc
Part of #24407.
2015-04-29 07:37:58 +00:00
Nick Cameron
de2a4c0113 save-analysis: fix impl functions 2015-04-29 19:21:18 +12:00
Nick Cameron
7bfb5ed826 Reviewer changes 2015-04-29 18:56:13 +12:00
Nick Cameron
bb26aadaf3 Tidy up 2015-04-29 17:26:22 +12:00
Nick Cameron
88f840bdea debuginfo: extract adt.rs 2015-04-29 17:26:22 +12:00
Nick Cameron
9756349d11 debuginfo: extract metadata.rs 2015-04-29 17:26:22 +12:00
Nick Cameron
024e86fad5 debuginfo: extract types.rs 2015-04-29 17:26:22 +12:00
Nick Cameron
488694cf0d debuginfo: extract namespace.rs 2015-04-29 17:26:22 +12:00
Nick Cameron
5b53de1775 debuginfo: extract create.rs 2015-04-29 17:26:22 +12:00
Nick Cameron
a015547894 debuginfo: extract utils.rs 2015-04-29 17:26:22 +12:00
Nick Cameron
5753c8d6ca debuginfo: extract gdb.rs 2015-04-29 17:23:36 +12:00
Nick Cameron
5993ae86b8 debuginfo: pull out docs 2015-04-29 17:23:36 +12:00
Nick Cameron
39e2e649cb Tidy up word-wrapping in debuginfo 2015-04-29 17:23:36 +12:00
Nick Cameron
3f025fe7b2 Move debuginfo.rs to its own directory 2015-04-29 17:23:36 +12:00
Tamir Duberstein
f7947bc936 Unstub some tests 2015-04-28 21:23:28 -07:00
Tamir Duberstein
8073af7399 Tests need not be public 2015-04-28 21:22:58 -07:00
Tamir Duberstein
cd5abe7635 Remove unused variable 2015-04-28 21:22:06 -07:00
bors
d4cedea80a Auto merge of #24681 - tamird:unignore-android, r=alexcrichton
There are still quite a few ignored Android tests kicking around, most of which were added in 445faca844, which has a pretty unfortunate commit message.

r? @alexcrichton
2015-04-29 04:09:45 +00:00
Corey Farwell
960f8006d2 Fix punctuation placement in doc-comment 2015-04-28 23:06:00 -04:00
bors
c48b499ea3 Auto merge of #24888 - tamird:snapshot, r=alexcrichton
r? @alexcrichton cc @brson
2015-04-29 02:16:01 +00:00
Carol Nichols
0ddee94cfe Move explanation that references lexical grammar to the grammar
Reword so that the references to things above/below are up to date and a
bit more specific.
2015-04-28 22:02:53 -04:00
Carol (Nichols || Goulding)
3e521bfd96 Add boolean literal to the grammar
To make this rule match the definition of Lit_ in
https://github.com/rust-lang/rust/blob/master/src/libsyntax/ast.rs
2015-04-28 21:46:49 -04:00
Nicholas Mazzuca
83814325b4 Add intrinsics for unchecked division and modulo
The "unchecked_" div and rem functions will give UB in case of rhs == 0, or,
in the signed versions, lhs == INT::min and rhs == -1
2015-04-28 18:20:30 -07:00
Tamir Duberstein
bd5afb406d Reference the correct issue 2015-04-28 17:52:38 -07:00
Tamir Duberstein
c6364abbc1 #10356: Warnings 2015-04-28 17:52:37 -07:00
Tamir Duberstein
54de911f35 #10381: Warnings 2015-04-28 17:51:43 -07:00
Tamir Duberstein
9768447b64 Reference the correct issue and clarify failure 2015-04-28 17:51:01 -07:00
Tamir Duberstein
41ff911ae8 #10393 & #13206: Warnings 2015-04-28 17:49:22 -07:00
Alex Crichton
0368abb0a4 std: Implement fs::DirBuilder
This is the last remaining portion of #24796
2015-04-28 17:38:26 -07:00
Tamir Duberstein
69abc12b00 Register new snapshots 2015-04-28 17:23:45 -07:00
bors
c4b23aec4c Auto merge of #24865 - bluss:range-size, r=alexcrichton
core: Fix size_hint for signed integer `Range<T>` iterators

There was an overflow bug in .size_hint() for signed iterators, which
produced an hilariously incorrect size or an overflow panic.

Incorrect size is a serious bug since the iterators are marked
ExactSizeIterator. (And leads to abort() on (-1i8..127).collect() when
the collection tries to preallocate too much).

> (-1i8..127).size_hint()
(18446744073709551488, Some(18446744073709551488))

Bug found using quickcheck.

Fixes #24851
2015-04-29 00:15:22 +00:00
J Bailey
abb61d99ad Extend the nullable pointer optimization to captured vars of closures 2015-04-28 19:24:16 -04:00
bors
8871c17b76 Auto merge of #24781 - bluss:vec-drain-range, r=alexcrichton
Implement Vec::drain(\<range type\>) from rust-lang/rfcs#574, tracking issue #23055.

This is a big step forward for vector usability. This is an introduction of an API for removing a range of *m* consecutive elements from a vector, as efficently as possible.

New features:

- Introduce trait `std::collections::range::RangeArgument` implemented by all four built-in range types.
- Change `Vec::drain()` to use `Vec::drain<R: RangeArgument>(R)`

Implementation notes:

- Use @Gankro's idea for memory safety: Use `set_len` on the source vector when creating the iterator, to make sure that the part of the vector that will be modified is unreachable. Fix up things in Drain's destructor — but even if it doesn't run, we don't expose any moved-out-from slots of the vector.
- This `.drain<R>(R)` very close to how it is specified in the RFC.
- Introduced as unstable
- Drain reuses the slice iterator — copying and pasting the same iterator pointer arithmetic again felt very bad
- The `usize` index as a range argument in the RFC is not included. The ranges trait would have to change to accomodate it.

Please help me with:

- Name and location of the new ranges trait.
- Design of the ranges trait
- Understanding Niko's comments about variance (Note: for a long time I was using a straight up &mut Vec in the iterator, but I changed this to permit reusing the slice iterator).

Previous PR and discussion: #23071
2015-04-28 22:13:42 +00:00
Nicholas
b2a38c3b91 Correct the entry point in librustc/README.md 2015-04-28 14:40:03 -07:00
bors
cadc67e8fd Auto merge of #24777 - alexcrichton:musl, r=brson
These commits build on [some great work on reddit](http://www.reddit.com/r/rust/comments/33boew/weekend_experiment_link_rust_programs_against/) for adding MUSL support to the compiler. This goal of this PR is to enable a `--target x86_64-unknown-linux-musl` argument to the compiler to work A-OK. The outcome here is that there are 0 compile-time dependencies for a MUSL-targeting build *except for a linker*. Currently this also assumes that MUSL is being used for statically linked binaries so there is no support for dynamically linked binaries with MUSL.

MUSL support largely just entailed munging around with the linker and where libs are located, and the major highlights are:

* The entirety of `libc.a` is included in `liblibc.rlib` (statically included as an archive).
* The entirety of `libunwind.a` is included in `libstd.rlib` (like with liblibc).
* The target specification for MUSL passes a number of ... flavorful options! Each option is documented in the relevant commit.
* The entire test suite currently passes with MUSL as a target, except for:
  * Dynamic linking tests are all ignored as it's not supported with MUSL
  * Stack overflow detection is not working MUSL yet (I'm not sure why)
* There is a language change included in this PR to add a `target_env` `#[cfg]` directive. This is used to conditionally build code for only MUSL (or for linux distros not MUSL). I highly suspect that this will also be used by Windows to target MSVC instead of a MinGW-based toolchain.

To build a compiler targeting MUSL you need to follow these steps:

1. Clone the current MUSL repo from `git://git.musl-libc.org/musl`. Build this as usual and install it.
2. Clone and build LLVM's [libcxxabi](http://libcxxabi.llvm.org/) library. Only the `libunwind.a` artifact is needed. I have tried using upstream libunwind's source repo but I have not gotten unwinding to work with it unfortunately. Move `libunwind.a` adjacent to MUSL's `libc.a`
3. Configure a Rust checkout with `--target=x86_64-unknown-linux-musl --musl-root=$MUSL_ROOT` where `MUSL_ROOT` is where you installed MUSL in step 1.

I hope to improve building a copy of libunwind as it's still a little sketchy and difficult to do today, but other than that everything should "just work"! This PR is not intended to include 100% comprehensive support for MUSL, as future modifications will probably be necessary.
2015-04-28 20:12:59 +00:00
inrustwetrust
ed4c05e597 Clarify Once::call_once memory ordering guarantees in docs 2015-04-28 21:07:21 +02:00
Simonas Kazlauskas
82b43568a6 Clarify offset rules a bit 2015-04-28 20:56:52 +03:00
bors
441b3f0c26 Auto merge of #24906 - pnkfelix:fsk-fix-24895, r=alexcrichton
dropck: Remove `Copy` from special-cased traits

Fix #24895.

[breaking-change]

What does this break?  Basically, code that implements `Drop` and is
using `T:Copy` for one of its type parameters and is relying on the
Drop Check rule not applying to it.

Here is an example:

```rust
#![allow(dead_code,unused_variables,unused_assignments)]
struct D<T:Copy>(T);
impl<T:Copy> Drop for D<T> { fn drop(&mut self) { } }

trait UserT { fn c(&self) { } }
impl<T:Copy> UserT for T { }
struct E<T:UserT>(T);
impl<T:UserT> Drop for E<T> { fn drop(&mut self) { } }

// This one will start breaking.
fn foo() { let (d2, d1); d1 = D(34); d2 = D(&d1); }

#[cfg(this_one_does_and_should_always_break)]
fn bar() { let (e2, e1); e1 = E(34); e2 = E(&e1); }

fn main() {
    foo();
}
```
2015-04-28 17:12:36 +00:00
Alex Crichton
247842b741 test: Fix some tests to run with musl
There were a few test cases to fix:

* Dynamic libraries are not supported with MUSL right now, so all of those
  related test which force or require dylibs are ignored.
* Looks like the default stack for MUSL is smaller than glibc, so a few stack
  allocations in benchmarks were boxed up (shouldn't have a perf impact).
* Some small linkage tweaks here and there
* Out-of-stack detection does not currently work with MUSL
2015-04-28 09:35:22 -07:00
Felix S. Klock II
1f79348293 regression test for Issue 24895. 2015-04-28 17:51:08 +02:00
Felix S. Klock II
b892264ea4 Fix #24895.
[breaking-change]

What does this break?  Basically, code that implements `Drop` and is
using `T:Copy` for one of its type parameters and is relying on the
Drop Check rule not applying to it.

Here is an example:

```rust
#![allow(dead_code,unused_variables,unused_assignments)]
struct D<T:Copy>(T);
impl<T:Copy> Drop for D<T> { fn drop(&mut self) { } }

trait UserT { fn c(&self) { } }
impl<T:Copy> UserT for T { }
struct E<T:UserT>(T);
impl<T:UserT> Drop for E<T> { fn drop(&mut self) { } }

// This one will start breaking.
fn foo() { let (d2, d1); d1 = D(34); d2 = D(&d1); }

#[cfg(this_one_does_and_should_always_break)]
fn bar() { let (e2, e1); e1 = E(34); e2 = E(&e1); }

fn main() {
    foo();
}
```
2015-04-28 17:47:16 +02:00
Steve Klabnik
97199bcb5d remove stability note from std::net
This is served by stability markers.
2015-04-28 11:18:10 -04:00
Felix S. Klock II
0930d383cb rename schedule_drop_{enum,adt}_contents. 2015-04-28 17:01:26 +02:00
bors
d8b64c7fb2 Auto merge of #24891 - tcard:patch-1, r=steveklabnik
`Type` should be `Trait` to match the next example line.

r? @steveklabnik
2015-04-28 14:21:22 +00:00
Robin Stocker
6cdb57d4b6 Add error explanation for E0013 2015-04-28 20:46:24 +10:00
Brendan Graetz
1335be33e4 =BG= change definition to use 'statics' as well as 'constants' 2015-04-28 20:22:26 +10:00
Brendan Graetz
8933253f2b =BG= Add detailed error message for E0265
This error indicates that a constant references itself.
All constants need to resolve to a value in an acyclic manner.

For example, neither of the following can be sensibly compiled:

```
const X: u32 = X;
```

```
const X: u32 = Y;
const Y: u32 = X;
```
2015-04-28 20:09:38 +10:00