]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoAdd tests for collections to work with ZSTs
Keith Yeung [Sun, 17 Jan 2016 17:26:01 +0000 (12:26 -0500)]
Add tests for collections to work with ZSTs

8 years agoAuto merge of #30975 - Manishearth:rollup, r=Manishearth
bors [Sun, 17 Jan 2016 12:23:57 +0000 (12:23 +0000)]
Auto merge of #30975 - Manishearth:rollup, r=Manishearth

- Successful merges: #30938, #30940, #30943, #30949, #30952, #30957, #30959
- Failed merges:

8 years agoRollup merge of #30959 - bluss:bench-resolution, r=Gankro
Manish Goregaokar [Sun, 17 Jan 2016 11:55:48 +0000 (17:25 +0530)]
Rollup merge of #30959 - bluss:bench-resolution, r=Gankro

test: Increase resolution of MB/s stat for bench runs close to 1 second

MB/s was based on the number of iterations performed in a second, when
the iteration duration nears 1 second (1e9 ns), the resolution of the
MB/s stat decreases.

8 years agoRollup merge of #30957 - GuillaumeGomez:patch-3, r=apasel422
Manish Goregaokar [Sun, 17 Jan 2016 11:55:48 +0000 (17:25 +0530)]
Rollup merge of #30957 - GuillaumeGomez:patch-3, r=apasel422

r? @Manishearth

8 years agoRollup merge of #30952 - jonastepe:nomicon_vec_zst_code_fix, r=Gankro
Manish Goregaokar [Sun, 17 Jan 2016 11:55:48 +0000 (17:25 +0530)]
Rollup merge of #30952 - jonastepe:nomicon_vec_zst_code_fix, r=Gankro

* Moved semicolon to the right place in the `let` statement in the ZST section.
* Fixed the missing ZST additions for `RawValIter<T>` from this section in the final code section.

8 years agoRollup merge of #30949 - MrMormon:patch-1, r=alexcrichton
Manish Goregaokar [Sun, 17 Jan 2016 11:55:48 +0000 (17:25 +0530)]
Rollup merge of #30949 - MrMormon:patch-1, r=alexcrichton

‌ ‌▲
▲‌ ▲

8 years agoRollup merge of #30943 - alexcrichton:stabilize-1.7, r=aturon
Manish Goregaokar [Sun, 17 Jan 2016 11:55:47 +0000 (17:25 +0530)]
Rollup merge of #30943 - alexcrichton:stabilize-1.7, r=aturon

This commit stabilizes and deprecates the FCP (final comment period) APIs for
the upcoming 1.7 beta release. The specific APIs which changed were:

Stabilized

* `Path::strip_prefix` (renamed from `relative_from`)
* `path::StripPrefixError` (new error type returned from `strip_prefix`)
* `Ipv4Addr::is_loopback`
* `Ipv4Addr::is_private`
* `Ipv4Addr::is_link_local`
* `Ipv4Addr::is_multicast`
* `Ipv4Addr::is_broadcast`
* `Ipv4Addr::is_documentation`
* `Ipv6Addr::is_unspecified`
* `Ipv6Addr::is_loopback`
* `Ipv6Addr::is_unique_local`
* `Ipv6Addr::is_multicast`
* `Vec::as_slice`
* `Vec::as_mut_slice`
* `String::as_str`
* `String::as_mut_str`
* `<[T]>::clone_from_slice` - the `usize` return value is removed
* `<[T]>::sort_by_key`
* `i32::checked_rem` (and other signed types)
* `i32::checked_neg` (and other signed types)
* `i32::checked_shl` (and other signed types)
* `i32::checked_shr` (and other signed types)
* `i32::saturating_mul` (and other signed types)
* `i32::overflowing_add` (and other signed types)
* `i32::overflowing_sub` (and other signed types)
* `i32::overflowing_mul` (and other signed types)
* `i32::overflowing_div` (and other signed types)
* `i32::overflowing_rem` (and other signed types)
* `i32::overflowing_neg` (and other signed types)
* `i32::overflowing_shl` (and other signed types)
* `i32::overflowing_shr` (and other signed types)
* `u32::checked_rem` (and other unsigned types)
* `u32::checked_shl` (and other unsigned types)
* `u32::saturating_mul` (and other unsigned types)
* `u32::overflowing_add` (and other unsigned types)
* `u32::overflowing_sub` (and other unsigned types)
* `u32::overflowing_mul` (and other unsigned types)
* `u32::overflowing_div` (and other unsigned types)
* `u32::overflowing_rem` (and other unsigned types)
* `u32::overflowing_neg` (and other unsigned types)
* `u32::overflowing_shl` (and other unsigned types)
* `u32::overflowing_shr` (and other unsigned types)
* `ffi::IntoStringError`
* `CString::into_string`
* `CString::into_bytes`
* `CString::into_bytes_with_nul`
* `From<CString> for Vec<u8>`
* `From<CString> for Vec<u8>`
* `IntoStringError::into_cstring`
* `IntoStringError::utf8_error`
* `Error for IntoStringError`

Deprecated

* `Path::relative_from` - renamed to `strip_prefix`
* `Path::prefix` - use `components().next()` instead
* `os::unix::fs` constants - moved to the `libc` crate
* `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize
* `IntoCow` - conflicts with `Into` and may come back later
* `i32::{BITS, BYTES}` (and other integers) - not pulling their weight
* `DebugTuple::formatter` - will be removed
* `sync::Semaphore` - not used enough and confused with system semaphores

Closes #23284
cc #27709 (still lots more methods though)
Closes #27712
Closes #27722
Closes #27728
Closes #27735
Closes #27729
Closes #27755
Closes #27782
Closes #27798

8 years agoRollup merge of #30940 - tshepang:extraneous-playpen-whitespace, r=steveklabnik
Manish Goregaokar [Sun, 17 Jan 2016 11:55:47 +0000 (17:25 +0530)]
Rollup merge of #30940 - tshepang:extraneous-playpen-whitespace, r=steveklabnik

8 years agoRollup merge of #30938 - dotdash:zst_void, r=eddyb
Manish Goregaokar [Sun, 17 Jan 2016 11:55:47 +0000 (17:25 +0530)]
Rollup merge of #30938 - dotdash:zst_void, r=eddyb

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

8 years agoAuto merge of #30931 - oli-obk:trans_disr_newtype, r=arielb1
bors [Sun, 17 Jan 2016 10:31:47 +0000 (10:31 +0000)]
Auto merge of #30931 - oli-obk:trans_disr_newtype, r=arielb1

This is groundwork for #30587 (typestrong constant integrals), but imo it's a change that in itself is good, too, since we don't just juggle `u64`s around anymore.

`ty::Disr` will be changed to a `ConstInt` in #30587

8 years agoAuto merge of #30928 - sfackler:any-unsized, r=aturon
bors [Sun, 17 Jan 2016 08:40:01 +0000 (08:40 +0000)]
Auto merge of #30928 - sfackler:any-unsized, r=aturon

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.

r? @aturon

8 years agoAuto merge of #30426 - gereeter:btree-rewrite, r=Gankro
bors [Sun, 17 Jan 2016 06:47:55 +0000 (06:47 +0000)]
Auto merge of #30426 - gereeter:btree-rewrite, r=Gankro

Despite being over 700 lines shorter, this implementation should use less memory than the previous one and is faster on at least insertions and iteration, the latter improving approximately 5x.

Technically a [breaking-change] due to removal of deprecated functions.

cc @apasel422 @Gankro @goyox86

Fixes #27865.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/rust-lang/rust/30426)
<!-- Reviewable:end -->

8 years agoBTreeMap: Add a test for clone
Jonathan S [Sun, 17 Jan 2016 04:55:56 +0000 (22:55 -0600)]
BTreeMap: Add a test for clone

8 years agoRewrite BTreeMap to use parent pointers.
Jonathan S [Thu, 17 Dec 2015 00:48:11 +0000 (18:48 -0600)]
Rewrite BTreeMap to use parent pointers.

8 years agoAuto merge of #30567 - steffengy:master, r=alexcrichton
bors [Sat, 16 Jan 2016 23:30:30 +0000 (23:30 +0000)]
Auto merge of #30567 - steffengy:master, r=alexcrichton

Add support to use functions exported using vectorcall.
This essentially only allows to pass a new LLVM calling convention
from rust to LLVM.

```rust
extern "vectorcall" fn abc(param: c_void);
```

references
----
http://llvm.org/docs/doxygen/html/CallingConv_8h_source.html
https://msdn.microsoft.com/en-us/library/dn375768.aspx

8 years agotest: Increase resolution of MB/s stat for bench runs close to 1 second
Ulrik Sverdrup [Sat, 16 Jan 2016 16:34:42 +0000 (17:34 +0100)]
test: Increase resolution of MB/s stat for bench runs close to 1 second

MB/s was based on the number of iterations performed in a second, when
the iteration duration nears 1 second (1e9 ns), the resolution of the
MB/s stat decreases.

8 years agoAuto merge of #30624 - Ticki:specialization, r=alexcrichton
bors [Sat, 16 Jan 2016 21:38:39 +0000 (21:38 +0000)]
Auto merge of #30624 - Ticki:specialization, r=alexcrichton

Part of #30520. Completes #24214

8 years agoFixed indent from tabs to spaces
Jonas Tepe [Sat, 16 Jan 2016 19:51:55 +0000 (20:51 +0100)]
Fixed indent from tabs to spaces

8 years agostd: Stabilize APIs for the 1.7 release
Alex Crichton [Fri, 15 Jan 2016 18:07:52 +0000 (10:07 -0800)]
std: Stabilize APIs for the 1.7 release

This commit stabilizes and deprecates the FCP (final comment period) APIs for
the upcoming 1.7 beta release. The specific APIs which changed were:

Stabilized

* `Path::strip_prefix` (renamed from `relative_from`)
* `path::StripPrefixError` (new error type returned from `strip_prefix`)
* `Ipv4Addr::is_loopback`
* `Ipv4Addr::is_private`
* `Ipv4Addr::is_link_local`
* `Ipv4Addr::is_multicast`
* `Ipv4Addr::is_broadcast`
* `Ipv4Addr::is_documentation`
* `Ipv6Addr::is_unspecified`
* `Ipv6Addr::is_loopback`
* `Ipv6Addr::is_unique_local`
* `Ipv6Addr::is_multicast`
* `Vec::as_slice`
* `Vec::as_mut_slice`
* `String::as_str`
* `String::as_mut_str`
* `<[T]>::clone_from_slice` - the `usize` return value is removed
* `<[T]>::sort_by_key`
* `i32::checked_rem` (and other signed types)
* `i32::checked_neg` (and other signed types)
* `i32::checked_shl` (and other signed types)
* `i32::checked_shr` (and other signed types)
* `i32::saturating_mul` (and other signed types)
* `i32::overflowing_add` (and other signed types)
* `i32::overflowing_sub` (and other signed types)
* `i32::overflowing_mul` (and other signed types)
* `i32::overflowing_div` (and other signed types)
* `i32::overflowing_rem` (and other signed types)
* `i32::overflowing_neg` (and other signed types)
* `i32::overflowing_shl` (and other signed types)
* `i32::overflowing_shr` (and other signed types)
* `u32::checked_rem` (and other unsigned types)
* `u32::checked_neg` (and other unsigned types)
* `u32::checked_shl` (and other unsigned types)
* `u32::saturating_mul` (and other unsigned types)
* `u32::overflowing_add` (and other unsigned types)
* `u32::overflowing_sub` (and other unsigned types)
* `u32::overflowing_mul` (and other unsigned types)
* `u32::overflowing_div` (and other unsigned types)
* `u32::overflowing_rem` (and other unsigned types)
* `u32::overflowing_neg` (and other unsigned types)
* `u32::overflowing_shl` (and other unsigned types)
* `u32::overflowing_shr` (and other unsigned types)
* `ffi::IntoStringError`
* `CString::into_string`
* `CString::into_bytes`
* `CString::into_bytes_with_nul`
* `From<CString> for Vec<u8>`
* `From<CString> for Vec<u8>`
* `IntoStringError::into_cstring`
* `IntoStringError::utf8_error`
* `Error for IntoStringError`

Deprecated

* `Path::relative_from` - renamed to `strip_prefix`
* `Path::prefix` - use `components().next()` instead
* `os::unix::fs` constants - moved to the `libc` crate
* `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize
* `IntoCow` - conflicts with `Into` and may come back later
* `i32::{BITS, BYTES}` (and other integers) - not pulling their weight
* `DebugTuple::formatter` - will be removed
* `sync::Semaphore` - not used enough and confused with system semaphores

Closes #23284
cc #27709 (still lots more methods though)
Closes #27712
Closes #27722
Closes #27728
Closes #27735
Closes #27729
Closes #27755
Closes #27782
Closes #27798

8 years agoAuto merge of #30934 - oli-obk:simplify_const_eval, r=alexcrichton
bors [Sat, 16 Jan 2016 17:57:01 +0000 (17:57 +0000)]
Auto merge of #30934 - oli-obk:simplify_const_eval, r=alexcrichton

the `None` and the `DefVariant` paths were unused anyway.

8 years agoAuto merge of #30533 - nikomatsakis:fulfillment-tree, r=aturon
bors [Sat, 16 Jan 2016 16:03:22 +0000 (16:03 +0000)]
Auto merge of #30533 - nikomatsakis:fulfillment-tree, r=aturon

This PR introduces an `ObligationForest` data structure that the fulfillment context can use to track what's going on, instead of the current flat vector. This enables a number of improvements:

1. transactional support, at least for pushing new obligations
2. remove the "errors will be reported" hack -- instead, we only add types to the global cache once their entire subtree has been proven safe. Before, we never knew when this point was reached because we didn't track the subtree.
   - this in turn allows us to limit coinductive reasoning to structural traits, which sidesteps #29859
3. keeping the backtrace should allow for an improved error message, where we give the user full context
    - we can also remove chained obligation causes

This PR is not 100% complete. In particular:

- [x] Currently, types that embed themselves like `struct Foo { f: Foo }` give an overflow when evaluating whether `Foo: Sized`. This is not a very user-friendly error message, and this is a common beginner error. I plan to special-case this scenario, I think.
- [x] I should do some perf. measurements. (Update: 2% regression.)
- [x] More tests targeting #29859
- [ ] The transactional support is not fully integrated, though that should be easy enough.
- [ ] The error messages are not taking advantage of the backtrace.

I'd certainly like to do 1 through 3 before landing, but 4 and 5 could come as separate PRs.

r? @aturon // good way to learn more about this part of the trait system
f? @arielb1 // already knows this part of the trait system :)

8 years agoFix typo
Guillaume Gomez [Sat, 16 Jan 2016 15:34:51 +0000 (16:34 +0100)]
Fix typo

8 years agouse a newtype for the variant discriminant instead of u64
Oliver 'ker' Schneider [Sat, 16 Jan 2016 15:03:09 +0000 (16:03 +0100)]
use a newtype for the variant discriminant instead of u64

8 years agoAdd regression tests for #29859. However #29859 is not fully fixed.
Niko Matsakis [Sat, 16 Jan 2016 10:28:18 +0000 (05:28 -0500)]
Add regression tests for #29859. However #29859 is not fully fixed.

8 years agoAuto merge of #30946 - antonblanchard:powerpc64_merge2, r=alexcrichton
bors [Sat, 16 Jan 2016 14:11:29 +0000 (14:11 +0000)]
Auto merge of #30946 - antonblanchard:powerpc64_merge2, r=alexcrichton

This brings in powerpc64 and powerpc64le support recently added.

8 years agosimplify some code
Oliver 'ker' Schneider [Sat, 16 Jan 2016 13:29:20 +0000 (14:29 +0100)]
simplify some code

8 years agoadded zst iterator additions to final code
Jonas Tepe [Sat, 16 Jan 2016 12:13:44 +0000 (13:13 +0100)]
added zst iterator additions to final code

8 years agoSemicolon was at wrong place in let statement
Jonas Tepe [Sat, 16 Jan 2016 12:07:46 +0000 (13:07 +0100)]
Semicolon was at wrong place in let statement

8 years agoAuto merge of #30939 - shepmaster:btreeset-insert-return-value, r=alexcrichton
bors [Sat, 16 Jan 2016 12:04:38 +0000 (12:04 +0000)]
Auto merge of #30939 - shepmaster:btreeset-insert-return-value, r=alexcrichton

8 years agoDocument `ObligationForest` better.
Niko Matsakis [Sat, 16 Jan 2016 10:21:01 +0000 (05:21 -0500)]
Document `ObligationForest` better.

8 years agoPacify tidy.
Niko Matsakis [Mon, 11 Jan 2016 20:56:21 +0000 (15:56 -0500)]
Pacify tidy.

8 years agoImplement a hacky version of the DAG support we ultimately want, leaving
Niko Matsakis [Mon, 11 Jan 2016 20:49:30 +0000 (15:49 -0500)]
Implement a hacky version of the DAG support we ultimately want, leaving
a FIXME for later.

8 years agoDetect cycles and specialize error reporting for Sized. It is important
Niko Matsakis [Sat, 9 Jan 2016 02:41:37 +0000 (21:41 -0500)]
Detect cycles and specialize error reporting for Sized. It is important
to get the `Sized` error usable, since that hits new users
frequently. Further work is needed for the error reporting for non-Sized
cycle cases; those currently just fallback to the old path. Also adjust tests.

8 years agoPermit coinductive match only for purely OIBIT backtraces.
Niko Matsakis [Thu, 7 Jan 2016 09:55:20 +0000 (04:55 -0500)]
Permit coinductive match only for purely OIBIT backtraces.
Better safe than sorry.

8 years agoFix bug in new stall checking code, it should consider integer variables
Niko Matsakis [Tue, 5 Jan 2016 10:29:40 +0000 (05:29 -0500)]
Fix bug in new stall checking code, it should consider integer variables
too.

8 years agofallout from removing the `errors_will_be_reported` flag
Niko Matsakis [Wed, 23 Dec 2015 00:51:29 +0000 (19:51 -0500)]
fallout from removing the `errors_will_be_reported` flag

8 years agoonly insert global predicates into the global cache once we've
Niko Matsakis [Wed, 23 Dec 2015 00:46:51 +0000 (19:46 -0500)]
only insert global predicates into the global cache once we've
completely proven them to be true

8 years agoenable coinductive reasoning for structural traits, this is
Niko Matsakis [Wed, 23 Dec 2015 00:44:48 +0000 (19:44 -0500)]
enable coinductive reasoning for structural traits, this is
potentially just a stopgap measure

8 years agoAuto merge of #30935 - ollie27:pad_int, r=alexcrichton
bors [Sat, 16 Jan 2016 10:12:40 +0000 (10:12 +0000)]
Auto merge of #30935 - ollie27:pad_int, r=alexcrichton

The function expects a value of true for zero but zero is not positive.

8 years agoAuto merge of #30930 - oli-obk:fix/30887, r=arielb1
bors [Sat, 16 Jan 2016 08:20:31 +0000 (08:20 +0000)]
Auto merge of #30930 - oli-obk:fix/30887, r=arielb1

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).

fixes #30887

r? @pnkfelix

8 years agoMake style more uniform, add tests for specialization of .last(), move tests to libco...
Ticki [Tue, 12 Jan 2016 13:35:04 +0000 (14:35 +0100)]
Make style more uniform, add tests for specialization of .last(), move tests to libcoretest

Remove unused import

Fold nth() method into the match expr

8 years agoOveride methods in iterator implementation for EscapeDefault, see #24214
Ticki [Tue, 22 Dec 2015 09:39:59 +0000 (10:39 +0100)]
Overide methods in iterator implementation for EscapeDefault, see #24214

Complete the tests

8 years agoAuto merge of #30908 - petrochenkov:backtrace, r=alexcrichton
bors [Sat, 16 Jan 2016 05:04:44 +0000 (05:04 +0000)]
Auto merge of #30908 - petrochenkov:backtrace, r=alexcrichton

@dhuseby @semarie Please, confirm that all Rust-specific changes in the second commit are still required.
(It would be ideal to have an unpatched copy of libbacktrace straight from the gcc repo.)

Fixes https://github.com/rust-lang/rust/issues/28447

r? @alexcrichton

8 years agoadded link for issue mentioned in readme
Joshua Olson [Sat, 16 Jan 2016 03:50:03 +0000 (20:50 -0700)]
added link for issue mentioned in readme

‌ ‌ ▲
▲‌ ▲

8 years agoAuto merge of #30896 - petrochenkov:vkindmeta, r=alexcrichton
bors [Sat, 16 Jan 2016 03:11:47 +0000 (03:11 +0000)]
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

8 years agoAuto merge of #30740 - bluss:ascii-is-the-best, r=brson
bors [Sat, 16 Jan 2016 01:18:48 +0000 (01:18 +0000)]
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>
8 years agoUpdate libc
Anton Blanchard [Fri, 15 Jan 2016 23:26:24 +0000 (23:26 +0000)]
Update libc

This brings in powerpc64 and powerpc64le support recently added.

8 years agoAuto merge of #30878 - brson:raw-pointer-derive, r=brson
bors [Fri, 15 Jan 2016 23:26:38 +0000 (23:26 +0000)]
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

8 years agoAuto merge of #30446 - michaelwu:associated-const-type-params-pt1, r=nikomatsakis
bors [Fri, 15 Jan 2016 21:33:58 +0000 (21:33 +0000)]
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

8 years agoAuto merge of #30890 - nagisa:mir-tuple-adts, r=nikomatsakis
bors [Fri, 15 Jan 2016 19:44:33 +0000 (19:44 +0000)]
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

8 years agoAdd some tests for non-trivial ADTs
Simonas Kazlauskas [Thu, 14 Jan 2016 01:23:13 +0000 (03:23 +0200)]
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.

8 years agoFix type retrieval for Switch translation
Simonas Kazlauskas [Thu, 14 Jan 2016 01:22:02 +0000 (03:22 +0200)]
Fix type retrieval for Switch translation

Previously it would go through def_id and retrieve a type that’s not always correct, monomorphized,
etc.

8 years agoFix translation for all other discriminated ADTs
Simonas Kazlauskas [Thu, 14 Jan 2016 00:55:46 +0000 (02:55 +0200)]
Fix translation for all other discriminated ADTs

Again.

8 years agoAuto merge of #30773 - fhahn:test-fix, r=alexcrichton
bors [Fri, 15 Jan 2016 17:31:08 +0000 (17:31 +0000)]
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.

8 years agoTranslate zero-sized return types as void
Björn Steinbrink [Fri, 15 Jan 2016 16:34:38 +0000 (17:34 +0100)]
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

8 years agorustdoc: remove extraneous whitespace inserted in playpen links
Tshepang Lekhonkhobe [Thu, 14 Jan 2016 21:40:23 +0000 (23:40 +0200)]
rustdoc: remove extraneous whitespace inserted in playpen links

8 years agoPreserve struct/variant kinds in metadata
Vadim Petrochenkov [Thu, 14 Jan 2016 11:26:50 +0000 (14:26 +0300)]
Preserve struct/variant kinds in metadata

Add tests for use of empty structs in cross-crate scenarios

8 years agoBTreeSet::insert returns false when key already exists
Jake Goulding [Fri, 15 Jan 2016 16:49:43 +0000 (11:49 -0500)]
BTreeSet::insert returns false when key already exists

8 years agolibbacktrace: Reapply Rust-specific changes
Vadim Petrochenkov [Fri, 15 Jan 2016 16:24:50 +0000 (19:24 +0300)]
libbacktrace: Reapply Rust-specific changes

New:
Fix for https://github.com/rust-lang/rust/issues/28447

Merged:
openbsd support: https://github.com/rust-lang/rust/commit/fcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae
bitrig integration: https://github.com/rust-lang/rust/commit/cd8f31759fd04b9ce9c903fa00cae81dc5bba546

Not merged:
https://github.com/rust-lang/rust/commit/d4fc3ec208186f0a9de8d05a6802c95b07e058fd
@Diggsey says this change was unintended (https://github.com/rust-lang/rust/pull/30666#issuecomment-168616892)

8 years agoGenerate ADTs for tuple-like constructors instead
Simonas Kazlauskas [Thu, 14 Jan 2016 00:19:55 +0000 (02:19 +0200)]
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!

8 years agoAuto merge of #30898 - petrochenkov:tvarfstab, r=alexcrichton
bors [Fri, 15 Jan 2016 15:39:39 +0000 (15:39 +0000)]
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

8 years agoRename is_positive argument in fmt::Formatter::pad_integral
Oliver Middleton [Fri, 15 Jan 2016 14:46:19 +0000 (14:46 +0000)]
Rename is_positive argument in fmt::Formatter::pad_integral

The function expects a value of true for zero but zero is not positive.

8 years agomove const block checks before lowering step
Oliver Schneider [Fri, 15 Jan 2016 12:16:54 +0000 (13:16 +0100)]
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).

8 years agoAuto merge of #30929 - Manishearth:rollup, r=Manishearth
bors [Fri, 15 Jan 2016 11:59:11 +0000 (11:59 +0000)]
Auto merge of #30929 - Manishearth:rollup, r=Manishearth

- Successful merges: #30591, #30781, #30836, #30864, #30896, #30898, #30908, #30921, #30925
- Failed merges:

8 years agoRollup merge of #30925 - semarie:blksize_t, r=alexcrichton
Manish Goregaokar [Fri, 15 Jan 2016 11:58:29 +0000 (17:28 +0530)]
Rollup merge of #30925 - semarie:blksize_t, r=alexcrichton

make `os::raw::tests::unix` test to pass again

r? @alexcrichton

8 years agoRollup merge of #30864 - jseyfried:no_record_exports, r=nrc
Manish Goregaokar [Fri, 15 Jan 2016 11:58:29 +0000 (17:28 +0530)]
Rollup merge of #30864 - jseyfried:no_record_exports, r=nrc

8 years agoRollup merge of #30836 - Luke-Nukem:master, r=steveklabnik
Manish Goregaokar [Fri, 15 Jan 2016 11:58:28 +0000 (17:28 +0530)]
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.

8 years agoRollup merge of #30787 - nikomatsakis:future-incompatible-lint, r=brson
Manish Goregaokar [Fri, 15 Jan 2016 11:58:28 +0000 (17:28 +0530)]
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

8 years agoRollup merge of #30781 - dhuseby:add_dragonflybsd_snapshot_3391630, r=alexcrichton
Manish Goregaokar [Fri, 15 Jan 2016 11:58:28 +0000 (17:28 +0530)]
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!

8 years agoRollup merge of #30776 - antonblanchard:powerpc64_merge, r=alexcrichton
Manish Goregaokar [Fri, 15 Jan 2016 11:58:28 +0000 (17:28 +0530)]
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.

8 years agoRollup merge of #30591 - SimonSapin:patch-15, r=aturon
Manish Goregaokar [Fri, 15 Jan 2016 11:58:28 +0000 (17:28 +0530)]
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.)

8 years agoImplement Any for unsized types
Steven Fackler [Fri, 15 Jan 2016 07:02:32 +0000 (23:02 -0800)]
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.

8 years agoAuto merge of #30763 - gchp:issue/30033, r=nagisa
bors [Fri, 15 Jan 2016 06:38:26 +0000 (06:38 +0000)]
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

8 years agoAuto merge of #30711 - nrc:json-errs, r=huonw
bors [Fri, 15 Jan 2016 01:52:01 +0000 (01:52 +0000)]
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.

8 years agoAddress reviewer comments
Nick Cameron [Wed, 6 Jan 2016 20:23:01 +0000 (09:23 +1300)]
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`.

8 years agoClarify what a crate is, within the "Getting Started" chapter.
Luke Jones [Tue, 12 Jan 2016 06:05:03 +0000 (19:05 +1300)]
Clarify what a crate is, within the "Getting Started" chapter.
* ref: Issue #30825
Small punctuation change in "Crates and Modules".

8 years agoresolve: Remove record_exports, fixes #4953
Jeffrey Seyfried [Tue, 12 Jan 2016 04:55:21 +0000 (04:55 +0000)]
resolve: Remove record_exports, fixes #4953

8 years agoSupport generic associated consts
Michael Wu [Tue, 4 Aug 2015 02:16:24 +0000 (22:16 -0400)]
Support generic associated consts

8 years agoAuto merge of #30916 - steveklabnik:rollup, r=steveklabnik
bors [Thu, 14 Jan 2016 22:23:59 +0000 (22:23 +0000)]
Auto merge of #30916 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #30712, #30895, #30902, #30903, #30909, #30910, #30911, #30912, #30914
- Failed merges:

8 years agorustc: Fix bugs in renamed and removed lints and re-add raw_pointer_derive
Brian Anderson [Wed, 13 Jan 2016 18:54:06 +0000 (18:54 +0000)]
rustc: Fix bugs in renamed and removed lints and re-add raw_pointer_derive

cc #30346

8 years agoAdd a test
Nick Cameron [Tue, 5 Jan 2016 01:35:22 +0000 (14:35 +1300)]
Add a test

And fix bustage in make check

8 years agoImplement JSON error emission
Nick Cameron [Thu, 31 Dec 2015 05:47:14 +0000 (18:47 +1300)]
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().

8 years agoAdd an --output option for specifying an error emitter
Nick Cameron [Thu, 31 Dec 2015 03:50:06 +0000 (16:50 +1300)]
Add an --output option for specifying an error emitter

8 years agoAdd a JSON error emitter
Nick Cameron [Thu, 31 Dec 2015 01:43:42 +0000 (14:43 +1300)]
Add a JSON error emitter

8 years agoAuto merge of #30913 - brson:nogold, r=alexcrichton
bors [Thu, 14 Jan 2016 20:32:13 +0000 (20:32 +0000)]
Auto merge of #30913 - brson:nogold, r=alexcrichton

This reverts commit 34dc0e0739e19811850f82f1e45b61ba97adc96e.

cc #30783 #30784 #29974

r? @alexcrichton

8 years agoRollup merge of #30914 - tshepang:easier-description, r=steveklabnik
Steve Klabnik [Thu, 14 Jan 2016 19:58:35 +0000 (14:58 -0500)]
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.

8 years agoRollup merge of #30912 - tshepang:remove-distraction, r=steveklabnik
Steve Klabnik [Thu, 14 Jan 2016 19:58:35 +0000 (14:58 -0500)]
Rollup merge of #30912 - tshepang:remove-distraction, r=steveklabnik

8 years agoRollup merge of #30911 - tshepang:missing-word, r=Manishearth
Steve Klabnik [Thu, 14 Jan 2016 19:58:35 +0000 (14:58 -0500)]
Rollup merge of #30911 - tshepang:missing-word, r=Manishearth

Also, whitespace fixes

8 years agoRollup merge of #30910 - tshepang:improve-description, r=steveklabnik
Steve Klabnik [Thu, 14 Jan 2016 19:58:35 +0000 (14:58 -0500)]
Rollup merge of #30910 - tshepang:improve-description, r=steveklabnik

8 years agoRollup merge of #30909 - tshepang:a-better-name, r=steveklabnik
Steve Klabnik [Thu, 14 Jan 2016 19:58:34 +0000 (14:58 -0500)]
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`

8 years agoRollup merge of #30903 - steveklabnik:no_std_stable, r=alexcrichton
Steve Klabnik [Thu, 14 Jan 2016 19:58:34 +0000 (14:58 -0500)]
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.

8 years agoRollup merge of #30902 - tomaka:patch-1, r=steveklabnik
Steve Klabnik [Thu, 14 Jan 2016 19:58:34 +0000 (14:58 -0500)]
Rollup merge of #30902 - tomaka:patch-1, r=steveklabnik

8 years agoRollup merge of #30895 - gchp:contrib, r=alexcrichton
Steve Klabnik [Thu, 14 Jan 2016 19:58:34 +0000 (14:58 -0500)]
Rollup merge of #30895 - gchp:contrib, r=alexcrichton

'B' labels are for blockers, not issues which belong elsewhere.

Prompted by this comment on Reddit:
https://www.reddit.com/r/rust/comments/40nzkd/contributing_to_the_rust_compiler_a_short_guide/cyxcjtd

8 years agoRollup merge of #30712 - LawrenceWoodman:patch-3, r=steveklabnik
Steve Klabnik [Thu, 14 Jan 2016 19:58:34 +0000 (14:58 -0500)]
Rollup merge of #30712 - LawrenceWoodman:patch-3, r=steveklabnik

This also repeats the case analysis used.

8 years agodoc: this is more easy to read, and less prone mis-interpretation
Tshepang Lekhonkhobe [Thu, 14 Jan 2016 19:37:43 +0000 (21:37 +0200)]
doc: this is more easy to read, and less prone mis-interpretation

This function returns the size on the stack, not that of the value
that may be allocated on the heap.

8 years agoRevert "Link with ld.gold by default"
Brian Anderson [Thu, 14 Jan 2016 19:20:11 +0000 (19:20 +0000)]
Revert "Link with ld.gold by default"

This reverts commit 34dc0e0739e19811850f82f1e45b61ba97adc96e.

8 years agoupdate blksize_t in raw to reflect libc change under openbsd
Sébastien Marie [Thu, 14 Jan 2016 19:15:19 +0000 (20:15 +0100)]
update blksize_t in raw to reflect libc change under openbsd

8 years agodoc: that suffix serves as mere distraction
Tshepang Lekhonkhobe [Thu, 14 Jan 2016 19:08:15 +0000 (21:08 +0200)]
doc: that suffix serves as mere distraction

8 years agodoc: add missing word
Tshepang Lekhonkhobe [Thu, 14 Jan 2016 18:56:37 +0000 (20:56 +0200)]
doc: add missing word

Also, whitespace fixes

8 years agodoc: "x" is used as variable name on this API, so avoid using it here
Tshepang Lekhonkhobe [Thu, 14 Jan 2016 18:54:49 +0000 (20:54 +0200)]
doc: "x" is used as variable name on this API, so avoid using it here