Commit Graph

52000 Commits

Author SHA1 Message Date
Ulrik Sverdrup
a6c27be0b1 slice: Use doc(hidden) on private traits
This should avoid the trait impls showing up in rustdoc.
2016-04-06 12:19:19 +02:00
Ulrik Sverdrup
28c4d12c03 Add test for [u8]'s Ord (and fix the old test for ord)
The old test for Ord used no asserts, and appeared to have a wrong test. (!).
2016-04-05 14:06:20 +02:00
Ulrik Sverdrup
5d56e1daed Specialize equality for [T] and comparison for [u8]
Where T is a type that can be compared for equality bytewise, we can use
memcmp. We can also use memcmp for PartialOrd, Ord for [u8] and by
extension &str.

This is an improvement for example for the comparison [u8] == [u8] that
used to emit a loop that compared the slices byte by byte.

One worry here could be that this introduces function calls to memcmp
in contexts where it should really inline the comparison or even
optimize it out, but llvm takes care of recognizing memcmp specifically.
2016-04-05 14:06:20 +02:00
bors
a09f386e8d Auto merge of #32579 - michaelwoerister:stable-symbol-name-fix, r=eddyb
Fix typo in TxCtxt::crate_disambiguator() and add test case.

r? @nikomatsakis

Fixes #32554
2016-04-02 23:34:58 -07:00
Michael Woerister
c2ede7e185 Add run-make test for stable symbol-name generation. 2016-04-03 00:44:17 -04:00
bors
080edd9957 Auto merge of #32633 - frewsxcv:map-values-mut, r=alexcrichton
Implement `values_mut` on `{BTree, Hash}Map`

https://github.com/rust-lang/rust/issues/32551
2016-04-02 19:36:58 -07:00
bors
5ab11d72ca Auto merge of #32667 - dotdash:def_dec, r=nagisa
Stop accepting declarations when looking for definitions

eternally_available linkage isn't legal for declarations anyway, so the
check for an externally_available declaration should never succeed, so
let's remove it.
2016-04-02 15:52:00 -07:00
bors
3ec71b033a Auto merge of #32598 - alexcrichton:rustbuild-osx, r=aturon
rustbuild: Fix compile on OSX for 10.7

This commit should help configure our OSX rustbuild builder for targeting 10.7.
A key part of this is using `libc++` instead of `libstdc++` as apparently it's
more filled out and otherwise LLVM's cmake configuration would fail.
2016-04-02 10:30:03 -07:00
bors
1af79cf34e Auto merge of #32562 - ben0x539:bug-macro, r=nikomatsakis
librustc: Add bug!(), bug_span!() macros as unified entry points for internal compiler errors

The macros pass `file!()`, `line!()` and `format_args!(...)` on to a cold, never-inlined function, ultimately calling `session::{span_,}bug_fmt` via the tcx in tls or, failing that, panicking directly.

cc @eddyb
r? @nikomatsakis
2016-04-02 05:14:25 -07:00
bors
f2285bdaf5 Auto merge of #32549 - respeccing:rust_backtrace_disabled, r=alexcrichton
allow RUST_BACKTRACE=0 to act as if unset

**UPDATE:** `RUST_BACKTRACE=0` to act as if the env. var is unset! (now `0` is what `disabled` was for, below)

When RUST_BACKTRACE is set to "disabled" then this acts as if the env. var is unset. So, either make sure `RUST_BACKTRACE` is not set OR set it to `disabled` to achieve the same effect.

Sample usage:

```bash
$ rustc -o /tmp/a.out -- <(echo 'fn main(){ panic!() }') && RUST_BACKTRACE=disabled /tmp/a.out
!! executing '/home/zazdxscf/build/1nonpkgs/rust/rust//x86_64-unknown-linux-gnu/stage2/bin//rustc' with args: '-o /tmp/a.out -- /dev/fd/63'
thread '<main>' panicked at 'explicit panic', /dev/fd/63:1
note: Run with `RUST_BACKTRACE=1` for a backtrace.

$ rustc -o /tmp/a.out -- <(echo 'fn main(){ panic!() }') && RUST_BACKTRACE=1 /tmp/a.out
!! executing '/home/zazdxscf/build/1nonpkgs/rust/rust//x86_64-unknown-linux-gnu/stage2/bin//rustc' with args: '-o /tmp/a.out -- /dev/fd/63'
thread '<main>' panicked at 'explicit panic', /dev/fd/63:1
stack backtrace:
   1:     0x55709e8148c0 - sys::backtrace::tracing:👿:write::h140f24a0cfc189b98Ru
   2:     0x55709e816a5b - panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::closure.45165
   3:     0x55709e8166e8 - panicking::default_hook::hed419823688cb82aXoA
   4:     0x55709e810fff - sys_common::unwind::begin_unwind_inner::hbb9642f6e212d56fmHt
   5:     0x55709e810513 - sys_common::unwind::begin_unwind::h16232867470678019594
   6:     0x55709e810489 - main::hb524f9576270962feaa
   7:     0x55709e816314 - sys_common::unwind::try::try_fn::h1274188004693518534
   8:     0x55709e813dfb - __rust_try
   9:     0x55709e815dab - rt::lang_start::h712b1cd650781872ahA
  10:     0x55709e810679 - main
  11:     0x7efd1026859f - __libc_start_main
  12:     0x55709e810348 - _start
  13:                0x0 - <unknown>
```

Some programs(eg. [vim's syntactic](https://github.com/scrooloose/syntastic) used by [rust.vim](https://github.com/rust-lang/rust.vim)) cannot unset the env. var RUST_BACKTRACE if it's already set(eg. in .bashrc) but [they can set it to some value](cb5533e159/system/Z575/OSes/gentoo/on_baremetal/filesystem_now/gentoo/home/zazdxscf/build/1nonpkgs/rust.vim/upd (L17)), and I needed to ensure the env. var is unset in order to avoid this issue: https://github.com/rust-lang/rust/issues/29293

**EDIT:** Sample usage 2:

```bash
$ export RUST_BACKTRACE=1

$ rustc -o /tmp/a.out -- <(echo 'fn main(){ panic!() }') && /tmp/a.out
!! executing '/home/zazdxscf/build/1nonpkgs/rust/rust//x86_64-unknown-linux-gnu/stage2/bin//rustc' with args: '-o /tmp/a.out -- /dev/fd/63'
thread '<main>' panicked at 'explicit panic', /dev/fd/63:1
stack backtrace:
   1:     0x55c2696738c0 - sys::backtrace::tracing:👿:write::h140f24a0cfc189b98Ru
   2:     0x55c269675a5b - panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::closure.45165
   3:     0x55c2696756e8 - panicking::default_hook::hed419823688cb82aXoA
   4:     0x55c26966ffff - sys_common::unwind::begin_unwind_inner::hbb9642f6e212d56fmHt
   5:     0x55c26966f513 - sys_common::unwind::begin_unwind::h16023941661074805588
   6:     0x55c26966f489 - main::hb524f9576270962feaa
   7:     0x55c269675314 - sys_common::unwind::try::try_fn::h1274188004693518534
   8:     0x55c269672dfb - __rust_try
   9:     0x55c269674dab - rt::lang_start::h712b1cd650781872ahA
  10:     0x55c26966f679 - main
  11:     0x7f593d58459f - __libc_start_main
  12:     0x55c26966f348 - _start
  13:                0x0 - <unknown>

$ rustc -o /tmp/a.out -- <(echo 'fn main(){ panic!() }') && RUST_BACKTRACE=disabled /tmp/a.out
!! executing '/home/zazdxscf/build/1nonpkgs/rust/rust//x86_64-unknown-linux-gnu/stage2/bin//rustc' with args: '-o /tmp/a.out -- /dev/fd/63'
thread '<main>' panicked at 'explicit panic', /dev/fd/63:1
note: Run with `RUST_BACKTRACE=1` for a backtrace.

```
2016-04-02 01:47:59 -07:00
bors
211c35afcb Auto merge of #32334 - tbu-:pr_ipv6_octets, r=aturon
Add functions to convert IPv6 addresses from and to octets

See also #32313.
2016-04-01 20:38:52 -07:00
bors
18172d1375 Auto merge of #32666 - Manishearth:rollup, r=Manishearth
Rollup of 11 pull requests

- Successful merges: #32622, #32629, #32640, #32641, #32642, #32645, #32647, #32649, #32652, #32654, #32656
- Failed merges:
2016-04-01 17:06:04 -07:00
Corey Farwell
2084f2ed77 Implement values_mut on BTreeMap.
https://github.com/rust-lang/rust/issues/32551
2016-04-01 18:36:08 -04:00
Corey Farwell
5972b22b7c Implement values_mut on HashMap.
https://github.com/rust-lang/rust/issues/32551
2016-04-01 18:35:54 -04:00
Manish Goregaokar
45c4769920 Rollup merge of #32656 - tbu-:pr_ty_outdated_comment, r=alexcrichton
Remove incorrect comment about `PartialEq` implementation
2016-04-02 01:23:26 +05:30
Manish Goregaokar
55dbffe6df Rollup merge of #32654 - tbu-:pr_doc_joinhandleext, r=sfackler
Fix a typo in the doc comment of `std::os::unix:🧵:JoinHandleExt`
2016-04-02 01:23:25 +05:30
Manish Goregaokar
cf0a01a161 Rollup merge of #32652 - VFLashM:refcell_ref_coercion, r=alexcrichton
Added missing refcell ref/refmut coercions to unsized

Ref/RefMut should be coercible to unsized.
This commit adds a unit test and two missing CoerceUnsized implementations.
2016-04-02 01:23:23 +05:30
bors
c8b8eb1fda Auto merge of #32544 - alexcrichton:rustbuild-dist-libtest, r=brson
rustbuild: Fix dist for non-host targets

The `rust-std` package that we produce is expected to have not only the standard
library but also libtest for compiling unit tests. Unfortunately this does not
currently happen due to the way rustbuild is structured.

There are currently two main stages of compilation in rustbuild, one for the
standard library and one for the compiler. This is primarily done to allow us to
fill in the sysroot right after the standard library has finished compiling to
continue compiling the rest of the crates. Consequently the entire compiler does
not have to explicitly depend on the standard library, and this also should
allow us to pull in crates.io dependencies into the build in the future because
they'll just naturally build against the std we just produced.

These phases, however, do not represent a cross-compiled build. Target-only
builds also require libtest, and libtest is currently part of the
all-encompassing "compiler build". There's unfortunately no way to learn about
just libtest and its dependencies (in a great and robust fashion) so to ensure
that we can copy the right artifacts over this commit introduces a new build
step, libtest.

The new libtest build step has documentation, dist, and link steps as std/rustc
already do. The compiler now depends on libtest instead of libstd, and all
compiler crates can now assume that test and its dependencies are implicitly
part of the sysroot (hence explicit dependencies being removed). This makes the
build a tad less parallel as in theory many rustc crates can be compiled in
parallel with libtest, but this likely isn't where we really need parallelism
either (all the time is still spent in the compiler).

All in all this allows the `dist-std` step to depend on both libstd and libtest,
so `rust-std` packages produced by rustbuild should start having both the
standard library and libtest.

Closes #32523
2016-04-01 12:52:08 -07:00
Michael Woerister
6bd7299964 Fix typo in TxCtxt::crate_disambiguator(). 2016-04-01 13:56:40 -04:00
Alex Crichton
3d6340ffe2 rustbuild: Fix dist for non-host targets
The `rust-std` package that we produce is expected to have not only the standard
library but also libtest for compiling unit tests. Unfortunately this does not
currently happen due to the way rustbuild is structured.

There are currently two main stages of compilation in rustbuild, one for the
standard library and one for the compiler. This is primarily done to allow us to
fill in the sysroot right after the standard library has finished compiling to
continue compiling the rest of the crates. Consequently the entire compiler does
not have to explicitly depend on the standard library, and this also should
allow us to pull in crates.io dependencies into the build in the future because
they'll just naturally build against the std we just produced.

These phases, however, do not represent a cross-compiled build. Target-only
builds also require libtest, and libtest is currently part of the
all-encompassing "compiler build". There's unfortunately no way to learn about
just libtest and its dependencies (in a great and robust fashion) so to ensure
that we can copy the right artifacts over this commit introduces a new build
step, libtest.

The new libtest build step has documentation, dist, and link steps as std/rustc
already do. The compiler now depends on libtest instead of libstd, and all
compiler crates can now assume that test and its dependencies are implicitly
part of the sysroot (hence explicit dependencies being removed). This makes the
build a tad less parallel as in theory many rustc crates can be compiled in
parallel with libtest, but this likely isn't where we really need parallelism
either (all the time is still spent in the compiler).

All in all this allows the `dist-std` step to depend on both libstd and libtest,
so `rust-std` packages produced by rustbuild should start having both the
standard library and libtest.

Closes #32523
2016-04-01 10:18:36 -07:00
Björn Steinbrink
4b9ddf4573 Stop accepting declarations when looking for definitions
eternally_available linkage isn't legal for declarations anyway, so the
check for an externally_available declaration should never succeed, so
let's remove it.
2016-04-01 15:24:56 +02:00
Manish Goregaokar
e004ce1a32 Rollup merge of #32645 - asomers:master, r=alexcrichton
Register new FreeBSD snapshot

Actual file is at https://people.freebsd.org/~asomers/rust/rust-stage0-2016-03-18-235d774-freebsd-x86_64-390b9a9f60f3d0d6a52c04d939a0355f572d03b3.tar.bz2
2016-04-01 18:44:49 +05:30
Manish Goregaokar
c2fe137823 Rollup merge of #32642 - Amanieu:doc_fixes, r=apasel422
Fix formatting in the documentation for AtomicIsize::compare_exchange_weak
2016-04-01 18:44:49 +05:30
Manish Goregaokar
a72568efb6 Rollup merge of #32641 - tbu-:pr_e0277, r=pnkfelix
Improve E0277 error message in a generic context

This now mentions that you can restrict type parameters to be able to
call functions of traits.
2016-04-01 18:44:49 +05:30
Manish Goregaokar
d611cc080c Rollup merge of #32640 - jseyfried:remove_println, r=Manishearth
Remove accidental `println!`

This removes a use of `println!` added in #32358 that appears to accidental.
r? @Manishearth
2016-04-01 18:44:48 +05:30
Manish Goregaokar
70ae2a1cff Rollup merge of #32629 - mbrubeck:nomicon-version, r=steveklabnik
Update Rust version in the Rustonomicon Vec chapter

I verified that the final code compiles in Rust 1.9.0-nightly.

r? @steveklabnik
2016-04-01 18:44:48 +05:30
Manish Goregaokar
d7429f1378 Rollup merge of #32622 - tyoc213:rust-beginners, r=alexcrichton
Book: in beginner guide change irc channel #rust → #rust-beginners

I also would like to add the reference on the first README.md

Some like

```
 most popular channel is [#rust], a venue for general discussion about
-Rust, and a good place to ask for help.
+Rust. And a good place to ask for help would be [#rust-beginners].

 [IRC]: https://en.wikipedia.org/wiki/Internet_Relay_Chat
 [#rust]: irc://irc.mozilla.org/rust
+[#rust-beginners]: irc://irc.mozilla.org/rust-beginners
```

So In the first page would be the two options for #rust or #rust-beginners
2016-04-01 18:44:48 +05:30
bors
b0d31707cc Auto merge of #32643 - Amanieu:arc_compare_exchange, r=alexcrichton
Change Arc to use compare_exchange instead of compare_and_swap

This should slightly improve code generation on architectures with a weak memory model like ARM.
2016-04-01 01:46:06 -07:00
bors
53498eca50 Auto merge of #32635 - gereeter:hashmap-iter-variance, r=alexcrichton
Make HashMap, HashSet, and their iterators properly covariant

See #30642. `Drain` is the only type left invariant.
2016-03-31 23:31:58 -07:00
bors
3b342fae8e Auto merge of #32586 - seanmonstar:speialize-to-string, r=alexcrichton
specialize ToString for str

If there was some conditional compiling we could do, such that this impl only exists in nightly, and is turned off in beta/stable, I think that'd be an improvement here, as we could test specialization out without affecting stable builds.
2016-03-31 21:18:29 -07:00
bors
a2f0cc6b0c Auto merge of #32550 - tbu-:pr_ref_cell_as_unsafe_cell, r=alexcrichton
Remove `unsafe` qualifier from `RefCell::as_unsafe_cell`

This method is no longer unsafe because the field of `UnsafeCell` is no
longer public.
2016-03-31 17:52:25 -07:00
bors
e1195c24bb Auto merge of #32506 - petrochenkov:use, r=Manishearth
syntax: Extra diagnostics for `_` used in an identifier position

Closes https://github.com/rust-lang/rust/issues/32501
2016-03-31 14:08:44 -07:00
Emanuel Czirai
e1d2eda7f3 allow RUST_BACKTRACE=0 to act as if unset
/# This is a combination of 16 commits.
/# The first commit's message is:
allow RUST_BACKTRACE=disabled to act as if unset

When RUST_BACKTRACE is set to "disabled" then this acts as if the env.
var is unset.

/# This is the 2nd commit message:

case insensitive "DiSaBLeD" RUST_BACKTRACE value

previously it expected a lowercase "disabled" to treat the env. var as
unset

/# This is the 3rd commit message:

RUST_BACKTRACE=0 acts as if unset

previously RUST_BACKTRACE=disabled was doing the same thing

/# This is the 4th commit message:

RUST_BACKTRACE=0|n|no|off acts as if unset

previously only RUST_BACKTRACE=0 acted as if RUST_BACKTRACE was unset
Now added more options (case-insensitive): 'n','no' and 'off'
eg. RUST_BACKTRACE=oFF

/# This is the 5th commit message:

DRY on the value of 2

DRY=don't repeat yourself
Because having to remember to keep the two places of '2' in sync is not
ideal, even though this is a simple enough case.

/# This is the 6th commit message:

Revert "DRY on the value of 2"

This reverts commit 95a0479d5cf72a2b2d9d21ec0bed2823ed213fef.

Nevermind this DRY on 2, because we already have a RY on 1,
besides the code is less readable this way...

/# This is the 7th commit message:

attempt to document unsetting RUST_BACKTRACE

/# This is the 8th commit message:

curb allocations when checking for RUST_BACKTRACE

this means we don't check for case-insensitivity anymore

/# This is the 9th commit message:

as decided, RUST_BACKTRACE=0 turns off backtrace

/# This is the 10th commit message:

RUST_TEST_NOCAPTURE=0 acts as if unset

(that is, capture is on)

Any other value acts as if nocapture is enabled (that is, capture is off)

/# This is the 11th commit message:

update other RUST_TEST_NOCAPTURE occurrences

apparently only one place needs updating

/# This is the 12th commit message:

update RUST_BACKTRACE in man page

/# This is the 13th commit message:

handle an occurrence of RUST_BACKTRACE

/# This is the 14th commit message:

ensure consistency with new rules for backtrace

/# This is the 15th commit message:

a more concise comment for RUST_TEST_NOCAPTURE

/# This is the 16th commit message:

update RUST_TEST_NOCAPTURE in man page
2016-03-31 23:02:59 +02:00
Benjamin Herr
33cc0ed1f0 librustc: excise Session's now-unused bug methods 2016-03-31 22:06:52 +02:00
Benjamin Herr
89fcc00581 librustc_const_eval: use bug!(), span_bug!() 2016-03-31 22:06:52 +02:00
Benjamin Herr
c59ea491ea librustc_trans: use bug!(), span_bug!() 2016-03-31 22:06:52 +02:00
Benjamin Herr
35e160364d librustc_typeck: use bug!(), span_bug!() 2016-03-31 22:06:52 +02:00
Benjamin Herr
4bb767965c librustc_save_analysis: remove duplicate macro def 2016-03-31 22:06:52 +02:00
Benjamin Herr
37f8429f3d librustc_save_analysis: use bug!(), span_bug!() 2016-03-31 22:06:52 +02:00
Benjamin Herr
d05f726eed librustc_resolve: use bug!(), span_bug!() 2016-03-31 22:06:52 +02:00
Benjamin Herr
487219ccb1 librustc_privacy: use bug!(), span_bug!() 2016-03-31 22:06:52 +02:00
Benjamin Herr
676f6c3116 librustc_passes: use bug!(), span_bug!() 2016-03-31 22:04:23 +02:00
Benjamin Herr
0305537652 librustc_metadata: use bug!(), span_bug!() 2016-03-31 22:04:23 +02:00
Benjamin Herr
8aaf6eee2f librustc_mir: use bug!(), span_bug!() 2016-03-31 22:04:23 +02:00
Benjamin Herr
cc8159b0ed librustc_lint: use bug!(), span_bug!() 2016-03-31 22:04:23 +02:00
Benjamin Herr
065dcd0702 librustc_borrowck: use bug!(), span_bug!() 2016-03-31 22:04:23 +02:00
Benjamin Herr
e3a7a66f1a librustc: replace panic!() with bug!() 2016-03-31 22:04:23 +02:00
Benjamin Herr
2fa867a203 librustc: replace unimplemented!() with bug!() 2016-03-31 22:04:23 +02:00
Benjamin Herr
dfd0e937ac librustc: replace unreachable! with bug!() 2016-03-31 22:04:23 +02:00
Benjamin Herr
bcdaccfbbe librustc: replace span_bug calls with span_bug!() 2016-03-31 22:04:23 +02:00