]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoRollup merge of #26388 - frewsxcv:regression-tests-21622, r=alexcrichton
Manish Goregaokar [Fri, 19 Jun 2015 12:11:09 +0000 (17:41 +0530)]
Rollup merge of #26388 - frewsxcv:regression-tests-21622, r=alexcrichton

Closes #21622

9 years agoAuto merge of #26413 - alexcrichton:from-raw-fd-prelude, r=sfackler
bors [Thu, 18 Jun 2015 23:28:41 +0000 (23:28 +0000)]
Auto merge of #26413 - alexcrichton:from-raw-fd-prelude, r=sfackler

These were just left out by mistake!

9 years agostd: Add FromRaw{Fd,Handle,Socket} to os preludes
Alex Crichton [Thu, 18 Jun 2015 23:14:50 +0000 (16:14 -0700)]
std: Add FromRaw{Fd,Handle,Socket} to os preludes

These were just left out by mistake!

9 years agoAuto merge of #26147 - arielb1:assoc-trans, r=nikomatsakis
bors [Thu, 18 Jun 2015 21:34:04 +0000 (21:34 +0000)]
Auto merge of #26147 - arielb1:assoc-trans, r=nikomatsakis

Fixes #25700

r? @nikomatsakis

9 years agoNormalize associated types in closure signatures
Ariel Ben-Yehuda [Tue, 9 Jun 2015 21:09:37 +0000 (00:09 +0300)]
Normalize associated types in closure signatures

Fixes #25700.

9 years agoAuto merge of #26192 - alexcrichton:features-clean, r=aturon
bors [Thu, 18 Jun 2015 19:14:52 +0000 (19:14 +0000)]
Auto merge of #26192 - alexcrichton:features-clean, r=aturon

This commit shards the all-encompassing `core`, `std_misc`, `collections`, and `alloc` features into finer-grained components that are much more easily opted into and tracked. This reflects the effort to push forward current unstable APIs to either stabilization or removal. Keeping track of unstable features on a much more fine-grained basis will enable the library subteam to quickly analyze a feature and help prioritize internally about what APIs should be stabilized.

A few assorted APIs were deprecated along the way, but otherwise this change is just changing the feature name associated with each API. Soon we will have a dashboard for keeping track of all the unstable APIs in the standard library, and I'll also start making issues for each unstable API after performing a first-pass for stabilization.

9 years agoSimplify and type_known_to_meet_builtin_bound and make it more correct when
Ariel Ben-Yehuda [Tue, 9 Jun 2015 18:33:28 +0000 (21:33 +0300)]
Simplify and type_known_to_meet_builtin_bound and make it more correct when
associated types are involved.

9 years agoFix libstd tests
Alex Crichton [Fri, 12 Jun 2015 17:49:39 +0000 (10:49 -0700)]
Fix libstd tests

9 years agoAuto merge of #26385 - nham:fix_25396, r=alexcrichton
bors [Thu, 18 Jun 2015 16:17:04 +0000 (16:17 +0000)]
Auto merge of #26385 - nham:fix_25396, r=alexcrichton

Currently in the E0252 message, traits and modules are all called types (as in "a type named `Foo` has already been imported", even when `Foo` was a trait or module). This commit changes that to additionally detect when the import in question is a trait or module and report it accordingly.

Fixes #25396.

9 years agoAuto merge of #26392 - oli-obk:unused_functions, r=dotdash
bors [Thu, 18 Jun 2015 12:06:25 +0000 (12:06 +0000)]
Auto merge of #26392 - oli-obk:unused_functions, r=dotdash

These aren't used anywhere and to my current knowledge it's unlikely that they are going to be used in the future

9 years agoremove unused functions from trans and llvm
Oliver Schneider [Thu, 18 Jun 2015 11:23:41 +0000 (13:23 +0200)]
remove unused functions from trans and llvm

9 years agoAuto merge of #26358 - nham:fix_24081, r=alexcrichton
bors [Thu, 18 Jun 2015 10:30:46 +0000 (10:30 +0000)]
Auto merge of #26358 - nham:fix_24081, r=alexcrichton

Previously, it said "import `Foo` conflicts with existing submodule" even
when it was a type alias, enum, or trait. The message now says the conflict
is with "type in this module" in the case of the first two, and "trait in
this module" for the last one.

Fixes #24081.

9 years agoAuto merge of #26389 - Manishearth:rollup, r=Manishearth
bors [Thu, 18 Jun 2015 08:54:35 +0000 (08:54 +0000)]
Auto merge of #26389 - Manishearth:rollup, r=Manishearth

- Successful merges: #26314, #26342, #26348, #26349, #26369, #26387
- Failed merges:

9 years agoRollup merge of #26387 - frewsxcv:regression-tests-25180, r=eddyb
Manish Goregaokar [Thu, 18 Jun 2015 08:08:10 +0000 (13:38 +0530)]
Rollup merge of #26387 - frewsxcv:regression-tests-25180, r=eddyb

Closes #25180

9 years agoRollup merge of #26369 - IvanUkhov:collections, r=eddyb
Manish Goregaokar [Thu, 18 Jun 2015 08:08:10 +0000 (13:38 +0530)]
Rollup merge of #26369 - IvanUkhov:collections, r=eddyb

9 years agoRollup merge of #26349 - petrochenkov:bitwise, r=steveklabnik
Manish Goregaokar [Thu, 18 Jun 2015 08:08:10 +0000 (13:38 +0530)]
Rollup merge of #26349 - petrochenkov:bitwise, r=steveklabnik

I'm surprised that bitwise operators `&`, `|` and `^` are implemented for `bool` arguments, because inspection of boolean's bits is not something that should be encouraged and because `&&` -> `&` is a common typo, but if they are implemented, then their behavior should be documented.

9 years agoRollup merge of #26348 - eefriedman:unused-interiorsafety, r=luqmana
Manish Goregaokar [Thu, 18 Jun 2015 08:08:09 +0000 (13:38 +0530)]
Rollup merge of #26348 - eefriedman:unused-interiorsafety, r=luqmana

9 years agoRollup merge of #26342 - steveklabnik:quix_reference_fix, r=alexcrichton
Manish Goregaokar [Thu, 18 Jun 2015 08:08:09 +0000 (13:38 +0530)]
Rollup merge of #26342 - steveklabnik:quix_reference_fix, r=alexcrichton

https://github.com/rust-lang/rust/pull/26323/files#r32503568

9 years agoRollup merge of #26314 - steveklabnik:gh26312, r=bluss
Manish Goregaokar [Thu, 18 Jun 2015 08:08:09 +0000 (13:38 +0530)]
Rollup merge of #26314 - steveklabnik:gh26312, r=bluss

Fixes #26312

9 years agoAuto merge of #26364 - frewsxcv:regression-tests-22864, r=bluss
bors [Thu, 18 Jun 2015 07:19:32 +0000 (07:19 +0000)]
Auto merge of #26364 - frewsxcv:regression-tests-22864, r=bluss

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

9 years agoAuto merge of #26340 - bluss:bench-sigfix, r=alexcrichton
bors [Thu, 18 Jun 2015 04:52:28 +0000 (04:52 +0000)]
Auto merge of #26340 - bluss:bench-sigfix, r=alexcrichton

test: Fix a bug in bench result formatting

It would skip the middle part if it was 0, displaying a number a 1000
times too small. The MB/s number next to it gave it away.

Fixed it looks like this:

```
test h ... bench:   1,000,129 ns/iter (+/- 4,730)
```

9 years agoAuto merge of #26336 - dotdash:raw_ptr_coercions, r=nrc
bors [Thu, 18 Jun 2015 03:16:40 +0000 (03:16 +0000)]
Auto merge of #26336 - dotdash:raw_ptr_coercions, r=nrc

Unlike coercing from reference to unsafe pointer, coercing between two
unsafe pointers doesn't need an AutoDerefRef, because there is no region
that regionck would need to know about.

In unoptimized libcore, this reduces the number of "auto_deref" allocas
from 174 to 4.

9 years agoAdd regression test for #21622
Corey Farwell [Thu, 18 Jun 2015 02:46:33 +0000 (19:46 -0700)]
Add regression test for #21622

Closes #21622

9 years agoAdd regression test for #25180
Corey Farwell [Thu, 18 Jun 2015 02:37:27 +0000 (19:37 -0700)]
Add regression test for #25180

Closes #25180

9 years agoFix the E0252 error message to use better names for things.
Nick Hamann [Thu, 18 Jun 2015 00:41:55 +0000 (19:41 -0500)]
Fix the E0252 error message to use better names for things.

Currently in the E0252 message, traits and modules are all called types
(as in "a type named `Foo` has already been imported", even when `Foo` was
a trait or module). This commit changes that to additionally detect when
the import in question is a trait or module and report it accordingly.

Fixes #25396.

9 years agoAuto merge of #26347 - nagisa:macro-exp, r=nrc
bors [Thu, 18 Jun 2015 00:26:23 +0000 (00:26 +0000)]
Auto merge of #26347 - nagisa:macro-exp, r=nrc

r? @nrc, because breakage was caused by https://github.com/rust-lang/rust/pull/25318

9 years agoAuto merge of #26326 - nikomatsakis:optimize-fulfillment-cache-in-tcx, r=pcwalton
bors [Wed, 17 Jun 2015 22:50:17 +0000 (22:50 +0000)]
Auto merge of #26326 - nikomatsakis:optimize-fulfillment-cache-in-tcx, r=pcwalton

When we successfully resolve a trait reference with no type/lifetime parameters, like `i32: Foo` or `Box<u32>: Sized`, this is in fact globally true. This patch adds a simple global to the tcx to cache such cases. The main advantage of this is really about caching things like `Box<Vec<Foo>>: Sized`. It also points to the need to revamp our caching infrastructure -- the current caches make selection cost cheaper, but we still wind up paying a high cost in the confirmation process, and in particular unrolling out dependent obligations. Moreover, we should probably do caching more uniformly and with a key that takes the where-clauses into account. But that's for later.

For me, this shows up as a reasonably nice win (20%) on Servo's script crate (when built in dev mode). This is not as big as my initial measurements suggested, I think because I was building my rustc with more debugging enabled at the time. I've not yet done follow-up profiling and so forth to see where the new hot spots are. Bootstrap times seem to be largely unaffected.

cc @pcwalton

This is technically a [breaking-change] in that functions with unsatisfiable where-clauses may now yield errors where before they may have been accepted. Even before, these functions could never have been *called* by actual code. In the future, such functions will probably become illegal altogether, but in this commit they are still accepted, so long as they do not rely on the unsatisfiable where-clauses. As before, the functions still cannot be called in any case.

9 years agoAuto merge of #26321 - srwalter:remove-i386-textrel, r=alexcrichton
bors [Wed, 17 Jun 2015 20:04:19 +0000 (20:04 +0000)]
Auto merge of #26321 - srwalter:remove-i386-textrel, r=alexcrichton

This prevents a relocation in the text section.  Text relocations are
incompatible with hardened kernels.

https://github.com/rust-lang/rust/issues/5714

9 years agoAuto merge of #26315 - steveklabnik:gh26287, r=alexcrichton
bors [Wed, 17 Jun 2015 18:09:10 +0000 (18:09 +0000)]
Auto merge of #26315 - steveklabnik:gh26287, r=alexcrichton

The font can make this hard to read, and we don't even strictly need
the annotation, so let's just remove it

Fixes #26287

9 years agoAuto merge of #26062 - eefriedman:cleanup-cached, r=nikomatsakis
bors [Wed, 17 Jun 2015 16:14:30 +0000 (16:14 +0000)]
Auto merge of #26062 - eefriedman:cleanup-cached, r=nikomatsakis

Using the wrong landing pad has obvious bad effects, like dropping a value
twice.

Testcase written by Alex Crichton.

Fixes #25089.

9 years agoAdd comment about stabilizing CString::from_ptr
Alex Crichton [Thu, 11 Jun 2015 18:26:16 +0000 (11:26 -0700)]
Add comment about stabilizing CString::from_ptr

This naming needs to consider the raw vs ptr naming of
Box/CStr/CString/slice/etc.

9 years agostd: Stabilize vec_map::Entry::or_insert{,_with}
Alex Crichton [Thu, 11 Jun 2015 18:15:19 +0000 (11:15 -0700)]
std: Stabilize vec_map::Entry::or_insert{,_with}

These functions mirror the other Entry APIs of other maps, and were mistakenly
just not stabilized the first time around.

9 years agostd: Hide some internal functions more aggressively
Alex Crichton [Thu, 11 Jun 2015 16:56:13 +0000 (09:56 -0700)]
std: Hide some internal functions more aggressively

* Add `#[doc(hidden)]`
* Rename away from `Error::description`

9 years agostd: Update stable since for `core::char`
Alex Crichton [Thu, 11 Jun 2015 16:54:43 +0000 (09:54 -0700)]
std: Update stable since for `core::char`

Also add `#[doc(hidden)]` to a few internal functions.

9 years agoMore test fixes and fallout of stability changes
Alex Crichton [Thu, 11 Jun 2015 02:33:04 +0000 (19:33 -0700)]
More test fixes and fallout of stability changes

9 years agostd: Move free-functions to associated functions
Alex Crichton [Thu, 11 Jun 2015 02:14:35 +0000 (19:14 -0700)]
std: Move free-functions to associated functions

This commit moves the free functions in the `rc`, `arc`, and `boxed` modules to
associated functions on their respective types, following the recent trend
towards this pattern. The previous free functions are all left in-place with
`#[deprecated]` pointers towards the new locations.

This commit also deprecates `arc::get_mut` and `Arc::make_unique` with no
replacement as they are racy in the face of weak pointers.

9 years agostd: Deprecate the `thunk` module
Alex Crichton [Thu, 11 Jun 2015 02:06:45 +0000 (19:06 -0700)]
std: Deprecate the `thunk` module

This has been replaced with `FnBox`

9 years agostd: Deprecate the `scoped` feature
Alex Crichton [Thu, 11 Jun 2015 02:04:51 +0000 (19:04 -0700)]
std: Deprecate the `scoped` feature

The `thread::scoped` function will never be stabilized as-is and the API will
likely change significantly if it does, so this function is deprecated for
removal.

9 years agostd: Deprecate the `future` feature
Alex Crichton [Thu, 11 Jun 2015 01:56:10 +0000 (18:56 -0700)]
std: Deprecate the `future` feature

This commit deprecates the `sync::Future` type to be developed outside in
crates.io instead.

9 years agostd: Deprecate the `exit_status` feature
Alex Crichton [Thu, 11 Jun 2015 01:54:35 +0000 (18:54 -0700)]
std: Deprecate the `exit_status` feature

These two functions should be replaceable with the `process::exit` function.

9 years agostd: Deprecate the io::BufStream type
Alex Crichton [Thu, 11 Jun 2015 01:52:57 +0000 (18:52 -0700)]
std: Deprecate the io::BufStream type

Questions about the utility of this type has caused it to move to crates.io in
the `bufstream` crate, so this type can be deprecated.

9 years agostd: Stabilize the `str_matches` feature
Alex Crichton [Thu, 11 Jun 2015 01:49:26 +0000 (18:49 -0700)]
std: Stabilize the `str_matches` feature

This commit stabilizes the `str::{matches, rmatches}` functions and iterators,
but renames the unstable feature for the `str::{matches,rmatches}_indices`
function to `str_match_indices` due to the comment present on the functions
about the iterator's return value.

9 years agostd: Stabilize the `iter_{once,empty}` features
Alex Crichton [Thu, 11 Jun 2015 01:45:48 +0000 (18:45 -0700)]
std: Stabilize the `iter_{once,empty}` features

This commit stabilizes these two iterator primitives as they have gone through
the RFC process and had some time to bake now.

9 years agostd: Stabilize the `once_new` feature
Alex Crichton [Thu, 11 Jun 2015 01:44:11 +0000 (18:44 -0700)]
std: Stabilize the `once_new` feature

This function follows the well-established "constructor" pattern and the
initialization constant will likely be deprecated in favor of it once `const_fn`
is stabilized.

9 years agostd: Stabilize the sync_poison feature
Alex Crichton [Thu, 11 Jun 2015 01:43:08 +0000 (18:43 -0700)]
std: Stabilize the sync_poison feature

These accessor/constructor methods for a `PoisonError` are quite standard for a
wrapper type and enable manipulation of the underlying type.

9 years agostd: Deprecate Vec::from_raw_buf
Alex Crichton [Thu, 11 Jun 2015 01:40:20 +0000 (18:40 -0700)]
std: Deprecate Vec::from_raw_buf

This function is more naturally expressed as slice::from_raw_buf plus a call to
to_vec.

9 years agostd: Deprecate all permutation-related slice methods
Alex Crichton [Thu, 11 Jun 2015 01:33:55 +0000 (18:33 -0700)]
std: Deprecate all permutation-related slice methods

These methods have been unstable for quite some time, and it's not clear that
these should remain in the standard library.

9 years agostd: Stabilize the remaining wrapping_* functions
Alex Crichton [Thu, 11 Jun 2015 01:31:15 +0000 (18:31 -0700)]
std: Stabilize the remaining wrapping_* functions

This commit stabilizes the remaining `wrapping_*` functions on the primitive
integer types as they follow the same conventions as other wrapping methods are
were likely just initially unstable to be conservative.

9 years agostd: Deprecate f{32,64}::consts::PI_2
Alex Crichton [Thu, 11 Jun 2015 01:27:58 +0000 (18:27 -0700)]
std: Deprecate f{32,64}::consts::PI_2

These constants have been unstable for some time now already

9 years agostd: Remove two internal `str_internals` functions
Alex Crichton [Thu, 11 Jun 2015 01:10:12 +0000 (18:10 -0700)]
std: Remove two internal `str_internals` functions

These were just exposed to be used elsewhere at some point, but neither is
currently being used so just make them private again.

9 years agostd: Deprecate the IntSliceExt trait
Alex Crichton [Thu, 11 Jun 2015 01:06:12 +0000 (18:06 -0700)]
std: Deprecate the IntSliceExt trait

This trait has seen very little usage and while safe, may not belong in the
standard library.

9 years agostd: Deprecate result::fold
Alex Crichton [Thu, 11 Jun 2015 01:04:49 +0000 (18:04 -0700)]
std: Deprecate result::fold

This function has seen very little use and it seems better to explore this
functionality through iterator adaptors instead of specialized functions.

9 years agostd: Deprecate the copy_{,mut_}lifetime functions
Alex Crichton [Thu, 11 Jun 2015 01:03:13 +0000 (18:03 -0700)]
std: Deprecate the copy_{,mut_}lifetime functions

Unsafe patterns such as `slice::from_raw_parts` and `CStr::from_ptr` have shown
that dealing with lifetimes, while useful, is often a hindrance. Consequently
these functions are rarely called today and are being deprecated.

9 years agostd: Deprecate iter::{Unfold, Iterate}
Alex Crichton [Thu, 11 Jun 2015 01:01:59 +0000 (18:01 -0700)]
std: Deprecate iter::{Unfold, Iterate}

Neither of these iterators has seen enough usage to justify their position in
the standard library, so these unstable iterators are being slated for deletion.

9 years agostd: Deprecate the RandomAccessIterator trait
Alex Crichton [Thu, 11 Jun 2015 00:59:02 +0000 (17:59 -0700)]
std: Deprecate the RandomAccessIterator trait

This trait has not proven itself over time as being core and fundamentally
useful to iterators, so it's being deprecated to allow time to iterate on it out
of tree.

9 years agoFallout in tests and docs from feature renamings
Alex Crichton [Wed, 10 Jun 2015 20:33:52 +0000 (13:33 -0700)]
Fallout in tests and docs from feature renamings

9 years agostd: Split the `std_misc` feature
Alex Crichton [Wed, 10 Jun 2015 01:15:22 +0000 (18:15 -0700)]
std: Split the `std_misc` feature

9 years agocollections: Split the `collections` feature
Alex Crichton [Tue, 9 Jun 2015 21:39:23 +0000 (14:39 -0700)]
collections: Split the `collections` feature

This commit also deprecates the `as_string` and `as_slice` free functions in the
`string` and `vec` modules.

9 years agoalloc: Split apart the global `alloc` feature
Alex Crichton [Tue, 9 Jun 2015 18:52:41 +0000 (11:52 -0700)]
alloc: Split apart the global `alloc` feature

9 years agocore: Split apart the global `core` feature
Alex Crichton [Tue, 9 Jun 2015 18:18:03 +0000 (11:18 -0700)]
core: Split apart the global `core` feature

This commit shards the broad `core` feature of the libcore library into finer
grained features. This split groups together similar APIs and enables tracking
each API separately, giving a better sense of where each feature is within the
stabilization process.

A few minor APIs were deprecated along the way:

* Iterator::reverse_in_place
* marker::NoCopy

9 years agoAuto merge of #25961 - sanxiyn:dead-variant-2, r=huonw
bors [Wed, 17 Jun 2015 13:30:31 +0000 (13:30 +0000)]
Auto merge of #25961 - sanxiyn:dead-variant-2, r=huonw

Rebase of #21468.

Fix #25960.

9 years agocollections: fix a couple of typos
Ivan Ukhov [Wed, 17 Jun 2015 13:09:18 +0000 (09:09 -0400)]
collections: fix a couple of typos

9 years agoAdd a test
Seo Sanghyeon [Wed, 3 Jun 2015 15:39:35 +0000 (00:39 +0900)]
Add a test

9 years agoAuto merge of #26261 - tshepang:more-brief-example, r=huonw
bors [Wed, 17 Jun 2015 11:54:25 +0000 (11:54 +0000)]
Auto merge of #26261 - tshepang:more-brief-example, r=huonw

Also, it feels more suitable to use hex to represent unicode

9 years agoAuto merge of #26126 - Nashenas88:sync-send-libcore-iter, r=huonw
bors [Wed, 17 Jun 2015 10:19:14 +0000 (10:19 +0000)]
Auto merge of #26126 - Nashenas88:sync-send-libcore-iter, r=huonw

This addresses an item in #22709. SizeHint in libcore/iter.rs also implements Iterator, but it's implementation is not accessible and is only used to send size hints to extend (it appears to be a performance improvement to avoid unnecessary memory reallocations). The is the only implementation of Iterator within libcore/iter.rs that is not/cannot be tested in this PR.

9 years agoAuto merge of #26025 - alexcrichton:update-llvm, r=brson
bors [Wed, 17 Jun 2015 06:56:15 +0000 (06:56 +0000)]
Auto merge of #26025 - alexcrichton:update-llvm, r=brson

This commit updates the LLVM submodule in use to the current HEAD of the LLVM
repository. This is primarily being done to start picking up unwinding support
for MSVC, which is currently unimplemented in the revision of LLVM we are using.
Along the way a few changes had to be made:

* As usual, lots of C++ debuginfo bindings in LLVM changed, so there were some
  significant changes to our RustWrapper.cpp
* As usual, some pass management changed in LLVM, so clang was re-scrutinized to
  ensure that we're doing the same thing as clang.
* Some optimization options are now passed directly into the
  `PassManagerBuilder` instead of through CLI switches to LLVM.
* The `NoFramePointerElim` option was removed from LLVM, favoring instead the
  `no-frame-pointer-elim` function attribute instead.
* The `LoopVectorize` option of the LLVM optimization passes has been disabled
  as it causes a divide-by-zero exception to happen in LLVM for zero-sized
  types. This is reported as https://llvm.org/bugs/show_bug.cgi?id=23763

Additionally, LLVM has picked up some new optimizations which required fixing an
existing soundness hole in the IR we generate. It appears that the current LLVM
we use does not expose this hole. When an enum is moved, the previous slot in
memory is overwritten with a bit pattern corresponding to "dropped". When the
drop glue for this slot is run, however, the switch on the discriminant can
often start executing the `unreachable` block of the switch due to the
discriminant now being outside the normal range. This was patched over locally
for now by having the `unreachable` block just change to a `ret void`.

9 years agorustc: Update LLVM
Alex Crichton [Thu, 14 May 2015 19:10:43 +0000 (12:10 -0700)]
rustc: Update LLVM

This commit updates the LLVM submodule in use to the current HEAD of the LLVM
repository. This is primarily being done to start picking up unwinding support
for MSVC, which is currently unimplemented in the revision of LLVM we are using.
Along the way a few changes had to be made:

* As usual, lots of C++ debuginfo bindings in LLVM changed, so there were some
  significant changes to our RustWrapper.cpp
* As usual, some pass management changed in LLVM, so clang was re-scrutinized to
  ensure that we're doing the same thing as clang.
* Some optimization options are now passed directly into the
  `PassManagerBuilder` instead of through CLI switches to LLVM.
* The `NoFramePointerElim` option was removed from LLVM, favoring instead the
  `no-frame-pointer-elim` function attribute instead.

Additionally, LLVM has picked up some new optimizations which required fixing an
existing soundness hole in the IR we generate. It appears that the current LLVM
we use does not expose this hole. When an enum is moved, the previous slot in
memory is overwritten with a bit pattern corresponding to "dropped". When the
drop glue for this slot is run, however, the switch on the discriminant can
often start executing the `unreachable` block of the switch due to the
discriminant now being outside the normal range. This was patched over locally
for now by having the `unreachable` block just change to a `ret void`.

9 years agoAdd regression tests for #22864
Corey Farwell [Wed, 17 Jun 2015 02:45:14 +0000 (19:45 -0700)]
Add regression tests for #22864

Fixes #22864

9 years agoAuto merge of #22681 - mzabaluev:extend-faster, r=huonw
bors [Wed, 17 Jun 2015 00:44:25 +0000 (00:44 +0000)]
Auto merge of #22681 - mzabaluev:extend-faster, r=huonw

Instead of a fast branch with a sized iterator falling back to a potentially poorly optimized iterate-and-push loop, a single efficient loop can serve all cases.

In my benchmark runs, I see some good gains, but also some regressions, possibly due to different inlining choices by the compiler. YMMV.

9 years agoFix error message for E0256 in certain cases.
Nick Hamann [Tue, 16 Jun 2015 21:53:37 +0000 (16:53 -0500)]
Fix error message for E0256 in certain cases.

Previously, it said "import `Foo` conflicts with existing submodule" even
when it was a type alias, enum, or trait. The message now says the conflict
is with "type in this module" in the case of the first two, and "trait in
this module" for the last one.

Fixes #24081.

9 years agoAuto merge of #26280 - Marwes:deriving_discriminant, r=pcwalton
bors [Tue, 16 Jun 2015 22:20:15 +0000 (22:20 +0000)]
Auto merge of #26280 - Marwes:deriving_discriminant, r=pcwalton

PR for #26128.

Improves codegen in deriving by utilizing the discriminant_value intrinsic.

I have a more detailed comment on the changes in a comment on the issue [here](https://github.com/rust-lang/rust/issues/26128#issuecomment-111509863)

### Old
```
running 7 tests
test large_c_like       ... bench:   2,694,129 ns/iter (+/- 5,170)
test large_c_like_ord   ... bench:   2,723,521 ns/iter (+/- 9,098)
test test1_partial_eq   ... bench:   2,439,317 ns/iter (+/- 2,135)
test test1_partial_ord  ... bench:   2,499,114 ns/iter (+/- 55,766)
test test2_partial_eq   ... bench:   3,562,815 ns/iter (+/- 45,590)
test test2_partial_ord  ... bench:   3,398,306 ns/iter (+/- 22,180)
test test_match_success ... bench:   1,509,267 ns/iter (+/- 1,982)
```

### New
```
running 7 tests
test large_c_like       ... bench:     286,509 ns/iter (+/- 474)
test large_c_like_ord   ... bench:     286,666 ns/iter (+/- 8,756)
test test1_partial_eq   ... bench:     286,584 ns/iter (+/- 2,789)
test test1_partial_ord  ... bench:     286,470 ns/iter (+/- 516)
test test2_partial_eq   ... bench:   2,228,997 ns/iter (+/- 34,191)
test test2_partial_ord  ... bench:   1,731,699 ns/iter (+/- 21,756)
test test_match_success ... bench:   1,509,630 ns/iter (+[- 3,765)
```

[Benchmark](https://gist.github.com/Marwes/7c0b3468d0cae972a2b4)

9 years agoDocument behavior of bitwise operators with boolean arguments
Vadim Petrochenkov [Tue, 16 Jun 2015 21:44:40 +0000 (00:44 +0300)]
Document behavior of bitwise operators with boolean arguments

9 years agoRemove unused type InteriorSafety.
Eli Friedman [Tue, 16 Jun 2015 20:04:01 +0000 (13:04 -0700)]
Remove unused type InteriorSafety.

9 years agoAuto merge of #25952 - alexcrichton:fix-scoped-tls, r=aturon
bors [Tue, 16 Jun 2015 20:00:46 +0000 (20:00 +0000)]
Auto merge of #25952 - alexcrichton:fix-scoped-tls, r=aturon

Currently the compiler has no knowledge of `#[thread_local]` which forces users
to take on two burdens of unsafety:

* The lifetime of the borrow of a `#[thread_local]` static is **not** `'static`
* Types in `static`s are required to be `Sync`

The thread-local modules mostly curb these facets of unsafety by only allowing
very limited scopes of borrows as well as allowing all types to be stored in a
thread-local key (regardless of whether they are `Sync`) through an `unsafe
impl`.

Unfortunately these measures have the consequence of being able to take the
address of the key itself and send it to another thread, allowing the same key
to be accessed from two different threads. This is clearly unsafe, and this
commit fixes this problem with the same trick used by `LocalKey`, which is to
have an indirect function call to find the address of the *current thread's*
thread local. This way the address of thread local keys can safely be sent among
threads as their lifetime truly is `'static`.

This commit will reduce the performance of cross-crate scoped thread locals as
it now requires an indirect function call, but this can likely be overcome in a
future commit.

Closes #25894

9 years agoRemove superfluous variable
Simonas Kazlauskas [Tue, 16 Jun 2015 19:29:41 +0000 (22:29 +0300)]
Remove superfluous variable

9 years agoAdd a test for issue 26322
Simonas Kazlauskas [Tue, 16 Jun 2015 18:49:01 +0000 (21:49 +0300)]
Add a test for issue 26322

9 years agoFix file!(), line!() and column!() macros
Simonas Kazlauskas [Tue, 16 Jun 2015 18:47:09 +0000 (21:47 +0300)]
Fix file!(), line!() and column!() macros

These used to return wrong results in case they were expanded inside compiler’s
iternal syntax sugar (closures, if-let) expansions

Fixes #26322

9 years agoAuto merge of #24738 - joliv:patch-2, r=steveklabnik
bors [Tue, 16 Jun 2015 17:08:36 +0000 (17:08 +0000)]
Auto merge of #24738 - joliv:patch-2, r=steveklabnik

The "unit value" is a value of the "unit type," not the "unit value type." Regardless of correctness, this straight syntax is easier to grok.

Part of #16676

Sorry if something's off here, it's my first pull request to rust!

9 years agoFix merge errors
Niko Matsakis [Tue, 16 Jun 2015 16:08:37 +0000 (12:08 -0400)]
Fix merge errors

9 years agoOne more consistency fix in the reference
Steve Klabnik [Tue, 16 Jun 2015 15:29:20 +0000 (11:29 -0400)]
One more consistency fix in the reference

https://github.com/rust-lang/rust/pull/26323/files#r32503568

9 years agoAvoid deref/ref cycles for no-op coercions between unsafe pointers
Björn Steinbrink [Tue, 16 Jun 2015 08:53:06 +0000 (10:53 +0200)]
Avoid deref/ref cycles for no-op coercions between unsafe pointers

Unlike coercing from reference to unsafe pointer, coercing between two
unsafe pointers doesn't need an AutoDerefRef, because there is no region
that regionck would need to know about.

In unoptimized libcore, this reduces the number of "auto_deref" allocas
from 174 to 4.

9 years agotest: Fix a bug in bench result formatting
Ulrik Sverdrup [Tue, 16 Jun 2015 11:10:27 +0000 (13:10 +0200)]
test: Fix a bug in bench result formatting

It would skip the middle part if it was 0, displaying a number a 1000
times too small. The MB/s number next to it gave it away.

Fixed it looks like this:

```
test h ... bench:   1,000,129 ns/iter (+/- 4,730)
```

9 years agoAuto merge of #26323 - steveklabnik:gh26320, r=alexcrichton
bors [Tue, 16 Jun 2015 10:40:33 +0000 (10:40 +0000)]
Auto merge of #26323 - steveklabnik:gh26320, r=alexcrichton

Fixes #26320

9 years agoAuto merge of #26318 - steveklabnik:gh26268, r=alexcrichton
bors [Tue, 16 Jun 2015 08:20:57 +0000 (08:20 +0000)]
Auto merge of #26318 - steveklabnik:gh26268, r=alexcrichton

Fixes #26268

9 years agoAuto merge of #26317 - steveklabnik:gh25956, r=alexcrichton
bors [Tue, 16 Jun 2015 06:44:56 +0000 (06:44 +0000)]
Auto merge of #26317 - steveklabnik:gh25956, r=alexcrichton

It isn't really neccesary, but is pretty dense.

Fixes #25956

9 years agoAuto merge of #24719 - :patch-1, r=steveklabnik
bors [Tue, 16 Jun 2015 05:08:13 +0000 (05:08 +0000)]
Auto merge of #24719 - :patch-1, r=steveklabnik

9 years agoAdd unit type info and update associated link
joliv [Tue, 16 Jun 2015 03:04:55 +0000 (23:04 -0400)]
Add unit type info and update associated link

Fixes #25244

9 years agoAuto merge of #26313 - steveklabnik:fix_str_docs, r=alexcrichton
bors [Tue, 16 Jun 2015 01:57:34 +0000 (01:57 +0000)]
Auto merge of #26313 - steveklabnik:fix_str_docs, r=alexcrichton

Because these structures are created by a macro, the doc comments
don't quite work: the leading /// isn't stripped. Instead, just
use #[doc] so that they render correctly.

9 years agoAuto merge of #26311 - jooert:fix25855, r=steveklabnik
bors [Mon, 15 Jun 2015 23:48:39 +0000 (23:48 +0000)]
Auto merge of #26311 - jooert:fix25855, r=steveklabnik

Use result of the computation to prevent the compiler from optimising
too much. Change `_x` to `x` and therefore remove the paragraph about
the underscore.

Fixes #25855.

r? @steveklabnik

9 years agoThis new caching sometimes suppresses duplicate errors that occur in
Niko Matsakis [Mon, 15 Jun 2015 21:30:34 +0000 (17:30 -0400)]
This new caching sometimes suppresses duplicate errors that occur in
different parts of the crate, so modify the test cases that were relying
on that to test distinct types etc.

9 years agoRather than expanding the where-clauses in the environment over and over
Niko Matsakis [Mon, 11 May 2015 21:02:56 +0000 (17:02 -0400)]
Rather than expanding the where-clauses in the environment over and over
again, do it once and then just remember the expanded form. At the same
time, filter globally nameable predicates out of the environment, since
they can cause cache errors (and they are not necessary in any case).

9 years agoAdd a (somewhat hacky) cache to the tcx that tracks "global" trait refs
Niko Matsakis [Tue, 9 Jun 2015 21:02:18 +0000 (17:02 -0400)]
Add a (somewhat hacky) cache to the tcx that tracks "global" trait refs
that are known to have been satisfied *somewhere*. This means that if
one fn finds that `SomeType: Foo`, then every other fn can just consider
that to hold.

Unfortunately, there are some complications:

1. If `SomeType: Foo` includes dependent conditions, those conditions
   may trigger an error. This error will be repored in the first fn
   where `SomeType: Foo` is evaluated, but not in the other fns, which
   can lead to uneven error reporting (which is sometimes confusing).

2. This kind of caching can be unsound in the presence of
   unsatisfiable where clauses. For example, suppose that the first fn
   has a where-clause like `i32: Bar<u32>`, which in fact does not
   hold. This will "fool" trait resolution into thinking that `i32:
   Bar<u32>` holds. This is ok currently, because it means that the
   first fn can never be calle (since its where clauses cannot be
   satisfied), but if the first fn's successful resolution is cached, it
   can allow other fns to compile that should not. This problem is fixed
   in the next commit.

9 years agoAuto merge of #26282 - arielb1:probe-leak, r=nikomatsakis
bors [Mon, 15 Jun 2015 21:27:43 +0000 (21:27 +0000)]
Auto merge of #26282 - arielb1:probe-leak, r=nikomatsakis

It can introduce obligations to the fulfillment context, which would
incorrectly still remain after the probe finished.

Fixes #25679.

r? @eddyb

9 years agoSignificantly simplify generic example
Steve Klabnik [Mon, 15 Jun 2015 20:06:01 +0000 (16:06 -0400)]
Significantly simplify generic example

Fixes #26320

9 years agoAuto merge of #26275 - arielb1:unconstrained-projection, r=nikomatsakis
bors [Mon, 15 Jun 2015 19:52:15 +0000 (19:52 +0000)]
Auto merge of #26275 - arielb1:unconstrained-projection, r=nikomatsakis

Fixes #26262

Because this rejects code that previously compiled, this is a [breaking-change]

r? @nikomatsakis

9 years agosrc/rt/arch/i386/morestack.S: call rust_stack_exhausted via plt
Steven Walter [Mon, 15 Jun 2015 15:35:47 +0000 (11:35 -0400)]
src/rt/arch/i386/morestack.S: call rust_stack_exhausted via plt

This prevents a relocation in the text section.  Text relocations are
incompatible with hardened kernels.

https://github.com/rust-lang/rust/issues/5714

9 years agoAuto merge of #26293 - mihneadb:rustdoc-search-orphan-methods, r=alexcrichton
bors [Mon, 15 Jun 2015 18:17:22 +0000 (18:17 +0000)]
Auto merge of #26293 - mihneadb:rustdoc-search-orphan-methods, r=alexcrichton

In https://github.com/rust-lang/rust/pull/23289, I did not include the type information for searching for orphan methods (methods that are defined in a module and implemented in another - doing this causes rustdoc sometimes to first find the impl before the actual type).

This PR fixes this. By merging this, searches for `char -> bool` will also find `is_alphabetic`, for example (which otherwise was only found for `charext -> bool`).

cc @alexcrichton

9 years agoClarify that the following will error
Steve Klabnik [Mon, 15 Jun 2015 17:18:07 +0000 (13:18 -0400)]
Clarify that the following will error

Fixes #26268

9 years agoRemove confusing paragraph from Trait Objects
Steve Klabnik [Mon, 15 Jun 2015 17:16:16 +0000 (13:16 -0400)]
Remove confusing paragraph from Trait Objects

It isn't really neccesary, but is pretty dense.

Fixes #25956

9 years agoUpdate example in "Rust Inside Other Languages"
Johannes Oertel [Mon, 15 Jun 2015 15:03:42 +0000 (17:03 +0200)]
Update example in "Rust Inside Other Languages"

Use result of the computation to prevent the compiler from optimising
too much. Change `_x` to `x` and therefore remove the paragraph about
the underscore.

Fixes #25855.