Commit Graph

50655 Commits

Author SHA1 Message Date
Joshua Olson
797e6fc41b added link for issue mentioned in readme
‌ ‌ ▲
▲‌ ▲
2016-01-15 20:50:03 -07:00
bors
c42ccb8b49 Auto merge of #30896 - petrochenkov:vkindmeta, r=alexcrichton
Also add tests for use of empty structs in cross-crate scenarios

Some tests are commented out, they depend on fixes from  https://github.com/rust-lang/rust/pull/30882
2016-01-16 03:11:47 +00:00
bors
e7e4ecc522 Auto merge of #30740 - bluss:ascii-is-the-best, r=brson
Add fast path for ASCII in UTF-8 validation

This speeds up the ASCII case (and long stretches of ASCII in otherwise
mixed UTF-8 data) when checking UTF-8 validity.

Benchmark results suggest that on purely ASCII input, we can improve
throughput (megabytes verified / second) by a factor of 13 to 14 (smallish input).
On XML and mostly English language input (en.wikipedia XML dump),
throughput improves by a factor 7 (large input).

On mostly non-ASCII input, performance increases slightly or is the
same.

The UTF-8 validation is rewritten to use indexed access; since all
access is preceded by a (mandatory for validation) length check, bounds
checks are statically elided by LLVM and this formulation is in fact the best
for performance. A previous version had losses due to slice to iterator
conversions.

A large credit to Björn Steinbrink who improved this patch immensely,
writing this second version.

Benchmark results on x86-64 (Sandy Bridge) compiled with -C opt-level=3.

Old code is `regular`, this PR is called `fast`.

Datasets:

- `ascii` is just ASCII (2.5 kB)
- `cyr` is cyrillic script with ascii spaces (5 kB)
- `dewik10` is 10MB of a de.wikipedia XML dump
- `enwik8` is 100MB of an en.wikipedia XML dump
- `jawik10` is 10MB of a ja.wikipedia XML dump

```
test from_utf8_ascii_fast        ... bench:         140 ns/iter (+/- 4) = 18221 MB/s
test from_utf8_ascii_regular     ... bench:       1,932 ns/iter (+/- 19) = 1320 MB/s
test from_utf8_cyr_fast          ... bench:      10,025 ns/iter (+/- 245) = 511 MB/s
test from_utf8_cyr_regular       ... bench:      10,944 ns/iter (+/- 795) = 468 MB/s
test from_utf8_dewik10_fast      ... bench:   6,017,909 ns/iter (+/- 105,755) = 1740 MB/s
test from_utf8_dewik10_regular   ... bench:  11,669,493 ns/iter (+/- 264,045) = 891 MB/s
test from_utf8_enwik8_fast       ... bench:  14,085,692 ns/iter (+/- 1,643,316) = 7000 MB/s
test from_utf8_enwik8_regular    ... bench:  93,657,410 ns/iter (+/- 5,353,353) = 1000 MB/s
test from_utf8_jawik10_fast      ... bench:  29,154,073 ns/iter (+/- 4,659,534) = 340 MB/s
test from_utf8_jawik10_regular   ... bench:  29,112,917 ns/iter (+/- 2,475,123) = 340 MB/s
```

Co-authored-by: Björn Steinbrink <bsteinbr@gmail.com>
2016-01-16 01:18:48 +00:00
Anton Blanchard
745e30fc6b Update libc
This brings in powerpc64 and powerpc64le support recently added.
2016-01-15 23:29:05 +00:00
bors
cee9463d24 Auto merge of #30878 - brson:raw-pointer-derive, r=brson
This adds back the raw_pointer_derive lint as a 'removed' lint, so that its removal does not cause errors (#30346) but warnings.

In the process I discovered regressions in the code for renamed and removed lints, which didn't appear to have any tests. The addition of a second lint pass (ast vs. hir) meant that attributes were being inspected twice, renamed and removed warnings printed twice. I restructured the code so these tests are only done once and added tests. Unfortunately it makes the patch more complicated for the needed beta backport.

r? @nikomatsakis
2016-01-15 23:26:38 +00:00
bors
683af0d9e0 Auto merge of #30446 - michaelwu:associated-const-type-params-pt1, r=nikomatsakis
This provides limited support for using associated consts on type parameters. It generally works on things that can be figured out at trans time. This doesn't work for array lengths or match arms. I have another patch to make it work in const expressions.

CC @eddyb @nikomatsakis
2016-01-15 21:33:58 +00:00
bors
f4befa6712 Auto merge of #30890 - nagisa:mir-tuple-adts, r=nikomatsakis
This PR changes translation of tuple-like ADTs from being calls to being proper aggregates. This change is done in hope to make code generation better. Namely, now we can avoid:

1. Call overhead;
2. Generating landingpads in presence of cleanups (we know for sure constructing ADTs can’t panic);
3. And probably much more, gaining better MIR introspectablilty.

Along with that a few serious deficiencies with translation of ADTs and switches have been fixed as well (commits 2 and 3).

r? @nikomatsakis
cc @tsion
2016-01-15 19:44:33 +00:00
Simonas Kazlauskas
7d6da8e421 Add some tests for non-trivial ADTs
These tests test building and matching some non-trivial ADT configurations such as C-like enums and
packed structs.
2016-01-15 20:27:57 +02:00
Simonas Kazlauskas
52ffeda8c8 Fix type retrieval for Switch translation
Previously it would go through def_id and retrieve a type that’s not always correct, monomorphized,
etc.
2016-01-15 20:27:57 +02:00
Simonas Kazlauskas
ac16d323c9 Fix translation for all other discriminated ADTs
Again.
2016-01-15 20:27:53 +02:00
Paul Dicker
9c569189c8 Addressed comments 2016-01-15 19:04:53 +01:00
bors
dd51c3a7c1 Auto merge of #30773 - fhahn:test-fix, r=alexcrichton
In my PR for #21659 I accidentally used `// | help` as test annotation. This PR updates it to `//~| help`. I also found and updated 2 other tests with the same issue.
2016-01-15 17:31:08 +00:00
Björn Steinbrink
f10af2e5fa Translate zero-sized return types as void
The only way to get a value for a zero-sized type is `undef`, so
there's really no point in actually having a return type other than
void for such types. Also, while the comment in return_type_is_void
mentioned something about aiding C ABI support, @eddyb correctly
pointed out on IRC that there is no such thing as a zero-sized type in
C. And even with clang, which allows empty structs, those get
translated as void return types as well.

Fixes #28766
2016-01-15 18:29:29 +01:00
Tshepang Lekhonkhobe
61e3918189 rustdoc: remove extraneous whitespace inserted in playpen links 2016-01-15 19:26:34 +02:00
Vadim Petrochenkov
ccb4b35897 Preserve struct/variant kinds in metadata
Add tests for use of empty structs in cross-crate scenarios
2016-01-15 19:57:53 +03:00
Jake Goulding
ac06fee5a3 BTreeSet::insert returns false when key already exists 2016-01-15 11:50:13 -05:00
Vadim Petrochenkov
55e2b7e1b4 libbacktrace: Reapply Rust-specific changes
New:
Fix for https://github.com/rust-lang/rust/issues/28447

Merged:
openbsd support: fcb30a0b67
bitrig integration: cd8f31759f

Not merged:
d4fc3ec208
@Diggsey says this change was unintended (https://github.com/rust-lang/rust/pull/30666#issuecomment-168616892)
2016-01-15 19:24:50 +03:00
Simonas Kazlauskas
4b17e2b71a Generate ADTs for tuple-like constructors instead
Previously we would generate regular calls for these, which is likely to result in worse LLVM code,
especially in presence of cleanups – we needn’t unecessarilly generate landing pads to construct an
ADT!
2016-01-15 18:06:49 +02:00
bors
e51661b888 Auto merge of #30898 - petrochenkov:tvarfstab, r=alexcrichton
This wasn't done in https://github.com/rust-lang/rust/pull/29083 because attributes weren't parsed on fields of tuple variant back then.

r? @alexcrichton
2016-01-15 15:39:39 +00:00
Oliver Middleton
b31df789f7 Rename is_positive argument in fmt::Formatter::pad_integral
The function expects a value of true for zero but zero is not positive.
2016-01-15 14:46:19 +00:00
Oliver Schneider
1471d932a9 move const block checks before lowering step
this makes sure the checks run before typeck (which might use the constant or const
function to calculate an array length) and gives prettier error messages in case of for
loops and such (since they aren't expanded yet).
2016-01-15 13:16:54 +01:00
bors
1f4e317e45 Auto merge of #30929 - Manishearth:rollup, r=Manishearth
- Successful merges: #30591, #30781, #30836, #30864, #30896, #30898, #30908, #30921, #30925
- Failed merges:
2016-01-15 11:59:11 +00:00
Manish Goregaokar
4f8d584aa5 Rollup merge of #30925 - semarie:blksize_t, r=alexcrichton
make `os::raw::tests::unix` test to pass again

r? @alexcrichton
2016-01-15 17:28:29 +05:30
Manish Goregaokar
22cbdd4b89 Rollup merge of #30864 - jseyfried:no_record_exports, r=nrc 2016-01-15 17:28:29 +05:30
Manish Goregaokar
d9d902ef99 Rollup merge of #30836 - Luke-Nukem:master, r=steveklabnik
Ref issue [30825](https://github.com/rust-lang/rust/issues/30825)

This commit should suffice to add a concise introduction to the concept of crates.
My only worry, is that it is maybe too concise; but, the book seems to be written with the understanding that the new Rust user is coming from another language, and so will understand what a Library or Code Package is.
2016-01-15 17:28:28 +05:30
Manish Goregaokar
56cae9f507 Rollup merge of #30787 - nikomatsakis:future-incompatible-lint, r=brson
There is now more structure to the report, so that you can specify e.g. an RFC/PR/issue number and other explanatory details.

Example message:

```
type-parameter-invalid-lint.rs:14:8: 14:9 error: defaults for type parameters are only allowed on type definitions, like `struct` or `enum`
type-parameter-invalid-lint.rs:14 fn avg<T=i32>(_: T) {}
                                         ^
type-parameter-invalid-lint.rs:14:8: 14:9 warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
type-parameter-invalid-lint.rs:14:8: 14:9 note: for more information, see PR 30742 <https://github.com/rust-lang/rust/pull/30724>
type-parameter-invalid-lint.rs:11:9: 11:28 note: lint level defined here
type-parameter-invalid-lint.rs:11 #![deny(future_incompatible)]
                                          ^~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
```

r? @brson

I would really like feedback also on the specific messages!

Fixes #30746
2016-01-15 17:28:28 +05:30
Manish Goregaokar
8637da87b6 Rollup merge of #30781 - dhuseby:add_dragonflybsd_snapshot_3391630, r=alexcrichton
@alexcrichton please upload the following snapshots:

https://github.com/dhuseby/rust-manual-snapshots/raw/master/rust-stage0-2015-12-18-3391630-dragonfly-x86_64-e74d79488e88ac2de3bd03afd5959d2ae6e2b628.tar.bz2

thanks!
2016-01-15 17:28:28 +05:30
Manish Goregaokar
7208d25003 Rollup merge of #30776 - antonblanchard:powerpc64_merge, r=alexcrichton
This adds support for big endian and little endian PowerPC64.
make check runs clean apart from one big endian backtrace issue.
2016-01-15 17:28:28 +05:30
Manish Goregaokar
ad83ea6a65 Rollup merge of #30591 - SimonSapin:patch-15, r=aturon
The first line (paragraph?) of a doc-comment is what rustdoc shows when listing items of a module.

What makes `Instant` and `SystemTime` different is important enough to be there. (Though feel free to bikeshed the wording.)
2016-01-15 17:28:28 +05:30
Steven Fackler
5d2275d53e Implement Any for unsized types
This is a bit weird since unsized types can't be used in trait objects,
but Any is *also* used as pure marker trait since Reflect isn't stable.
There are many cases (e.g. TypeMap) where all you need is a TypeId.
2016-01-14 23:02:32 -08:00
bors
a70a60a02b Auto merge of #30763 - gchp:issue/30033, r=nagisa
This is achieved by adding the scan_back method. This method looks back
through the source_text of the StringReader until it finds the target
char, returning it's offset in the source. We use this method to find
the offset of the opening single quote, and use that offset as the start
of the error.

Given this code:

```rust
fn main() {
    let _ = 'abcd';
}
```

The compiler would give a message like:

```
error: character literal may only contain one codepoint: ';
let _ = 'abcd';
             ^~
```
With this change, the message now displays:

```
error: character literal may only contain one codepoint: 'abcd';
let _ = 'abcd';
        ^~~~~~~
```

Fixes #30033
2016-01-15 06:38:26 +00:00
bors
d8869d3487 Auto merge of #30711 - nrc:json-errs, r=huonw
The compiler can emit errors and warning in JSON format. This is a more easily machine readable form then the usual error output.

Closes #10492, closes #14863.
2016-01-15 01:52:01 +00:00
Nick Cameron
82f8e5ce84 Address reviewer comments
[breaking-change]

`OptLevel` variants are no longer `pub use`ed by rust::session::config. If you are using these variants, you must change your code to prefix the variant name with `OptLevel`.
2016-01-15 14:49:25 +13:00
Luke Jones
52786de3ed Clarify what a crate is, within the "Getting Started" chapter.
* ref: Issue #30825
Small punctuation change in "Crates and Modules".
2016-01-15 14:18:50 +13:00
Thomas Wickham
6cda8e4eaa Doc:std::convert: be more specific + typo 2016-01-15 01:24:33 +01:00
Jeffrey Seyfried
a353490e6f resolve: Remove record_exports, fixes #4953 2016-01-14 22:51:58 +00:00
Michael Wu
a4f91e5fed Support generic associated consts 2016-01-14 17:35:55 -05:00
bors
2fb0c5ebcf Auto merge of #30916 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #30712, #30895, #30902, #30903, #30909, #30910, #30911, #30912, #30914
- Failed merges:
2016-01-14 22:23:59 +00:00
Brian Anderson
ca81d3dddc rustc: Fix bugs in renamed and removed lints and re-add raw_pointer_derive
cc #30346
2016-01-14 22:20:39 +00:00
Nick Cameron
11dcb48c6a Add a test
And fix bustage in make check
2016-01-15 10:24:12 +13:00
Nick Cameron
b976d9e666 Implement JSON error emission
[breaking-change]

syntax::errors::Handler::new has been renamed to with_tty_emitter

Many functions which used to take a syntax::errors::ColorConfig, now take a rustc::session::config::ErrorOutputType. If you previously used ColorConfig::Auto as a default, you should now use ErrorOutputType::default().
2016-01-15 10:24:12 +13:00
Nick Cameron
fd46c78f8f Add an --output option for specifying an error emitter 2016-01-15 10:24:12 +13:00
Nick Cameron
acfccc515b Add a JSON error emitter 2016-01-15 10:20:30 +13:00
bors
c12c42de0a Auto merge of #30913 - brson:nogold, r=alexcrichton
This reverts commit 34dc0e0739.

cc #30783 #30784 #29974

r? @alexcrichton
2016-01-14 20:32:13 +00:00
Steve Klabnik
6ab39ff098 Rollup merge of #30914 - tshepang:easier-description, r=steveklabnik
This function returns the size on the stack, not that of the value
that may be allocated on the heap.
2016-01-14 14:58:35 -05:00
Steve Klabnik
9ffb84a784 Rollup merge of #30912 - tshepang:remove-distraction, r=steveklabnik 2016-01-14 14:58:35 -05:00
Steve Klabnik
9b10d0e1e5 Rollup merge of #30911 - tshepang:missing-word, r=Manishearth
Also, whitespace fixes
2016-01-14 14:58:35 -05:00
Steve Klabnik
958bff100a Rollup merge of #30910 - tshepang:improve-description, r=steveklabnik 2016-01-14 14:58:35 -05:00
Steve Klabnik
b3950b7ca5 Rollup merge of #30909 - tshepang:a-better-name, r=steveklabnik
For a moment, I got confused by thinking the summary was referring to the same `x`
2016-01-14 14:58:34 -05:00
Steve Klabnik
f1a0fd127a Rollup merge of #30903 - steveklabnik:no_std_stable, r=alexcrichton
This feature is partially stabilized, so describe each part in the appropriate place.

r? @alexcrichton @brson

It would be nice to backport this to beta, since this is the first release where this is true. I try really hard to not do doc backports, but this isn't very large, and might be worth making an exception, I dunno.
2016-01-14 14:58:34 -05:00