Commit Graph

61731 Commits

Author SHA1 Message Date
bors
4d6019d07a Auto merge of #39457 - bvinc:master, r=alexcrichton
Dont segfault if btree range is not in order

This is a first attempt to fix issue #33197.  The issue is that the BTree iterator uses next_unchecked for fast iteration, but it can be tricked into running off the end of the tree and segfaulting if range is called with a maximum that is less than the minimum.

Since a user defined Ord should not determine the safety of BTreeMap, and we still want fast iteration, I've implemented the idea of @gereeter and walk the tree simultaneously searching for both keys to make sure that if our keys diverge, the min key is to the left of our max key.  I currently panic if that is not the case.

Open questions:

1.  Do we want to panic in this error case or do we want to return an empty iterator?  The drain API panics if the range is bad, but drain is given a range of index values, while this is a generic key type.  Panicking is brittle and returning an empty iterator is probably the most flexible and matches what people would want it to do... but artificially returning a BTreeMap::Range with start==end seems like a pretty weird and unnatural thing to do, although it's doable since those fields are not accessible.

The same question for other weird cases:
2.  (Included(101), Excluded(100)) on a map that contains [1,2,3].  Both BTree edges end up on the same part of the map, but comparing the keys shows the range is backwards.
3.  (Excluded(5), Excluded(5)).  The keys are equal but BTree edges end up backwards if the map contains 5.
4.  (Included(5), Excluded(5)).  Should naturally produce an empty iterator, right?
2017-02-15 22:02:36 +00:00
Shawn Walker-Salas
087c2337c1 use bash when invoking dist shell scripts on solaris
Partially fixes #25845
2017-02-15 12:51:26 -08:00
Jakob Demler
97451996e6 fixed whitespace issues 2017-02-15 21:21:31 +01:00
Colm Seale
cf20d8e23c static recursion test added to compile-fail test suite
Issue #39059
    r? @est31
2017-02-15 20:13:24 +00:00
Yamakaky
d50e4cc064
Improve backtrace formating while panicking.
- `RUST_BACKTRACE=full` prints all the informations (old behaviour)
- `RUST_BACKTRACE=(0|no)` disables the backtrace.
- `RUST_BACKTRACE=<everything else>` (including `1`) shows a simplified
  backtrace, without the function addresses and with cleaned filenames
  and symbols. Also removes some unneded frames at the beginning and the
  end.

Fixes #37783.

PR is #38165.
2017-02-15 14:24:37 -05:00
Simonas Kazlauskas
4a3c66ad2f [MIR] Make InlineAsm a Statement
Previously InlineAsm was an Rvalue, but its semantics doesn’t really match the semantics of an
Rvalue – rather it behaves more like a Statement.
2017-02-15 21:21:36 +02:00
Michal Nazarewicz
8685adb26b book: binary prefixed are defined by IEC and not in SI
Binary prefixes (such as Gi for ‘gibi-’ in GiB) are defined by
International Electrotechnical Commission (IEC) and not in the
International System of Units (SI).
2017-02-15 17:05:53 +01:00
Jeff Muizelaar
4ba6e1b688 Remove obsolete documentation about drop-flags 2017-02-15 11:03:59 -05:00
Michal Nazarewicz
b6a1618332 book: don’t use GNU extensions in the example unnecessarily
The use of a GNU C extension for bloc expressions is immaterial to the
actual problem with C macros that the section tries to show so don’t
use it and instead use a plain C way of writing the macro.
2017-02-15 15:57:57 +01:00
Jakob Demler
9a39994ee3 add bash to error-messages 2017-02-15 15:31:52 +01:00
bors
62eb6056d3 Auto merge of #39781 - nrc:save-impls, r=nikomatsakis
save-analysis: emit info about impls and super-traits in JSON
2017-02-15 13:48:09 +00:00
Benoît CORTIER
c8292fcd6a Correct a typo in procedural macros chapter of the Book. 2017-02-15 13:44:52 +01:00
Dmitry Guzeev
577497b541 Fix typo 2017-02-15 15:13:31 +03:00
Jakob Demler
5189c4f8c1 custom attributes and error reporting docs for procedural macros 2017-02-15 12:59:01 +01:00
king6cong
b821313327 sys/mod doc update and mod import order adjust 2017-02-15 18:42:18 +08:00
bors
e0044bd389 Auto merge of #39594 - clarcharr:cstr_box, r=aturon
Conversions between CStr, OsStr, Path and boxes

This closes a bit of the inconsistencies between `CStr`, `OsStr`, `Path`, and `str`, allowing people to create boxed versions of DSTs other than `str` and `[T]`.

Full list of additions:
* `Default` for `Box<str>`, `Box<CStr>`, `Box<OsStr>`, and `Box<Path>` (note: `Default` for `PathBuf` is already implemented)
* `CString::into_boxed_c_str` (feature gated)
* `OsString::into_boxed_os_str` (feature gated)
* `Path::into_boxed_path` (feature gated)
* `From<&CStr> for Box<CStr>`
* `From<&OsStr> for Box<OsStr>`
* `From<&Path> for Box<Path>`

This also includes adding the internal methods:
* `sys::*::os_str::Buf::into_box`
* `sys::*::os_str::Slice::{into_box, empty_box}`
* `sys_common::wtf8::Wtf8Buf::into_box`
* `sys_common::wtf8::Wtf8::{into_box, empty_box}`
2017-02-15 10:22:34 +00:00
Luxko
938fed7f0f Update procedural-macros.md
Fix typo
2017-02-15 03:53:27 -06:00
Andrew Gaspar
a8b7b28bab Vec, LinkedList, VecDeque, String, and Option NatVis visualizations 2017-02-15 01:51:19 -08:00
bors
ea8c62919e Auto merge of #39560 - F001:retainHashMap, r=alexcrichton
std: Add retain method for HashMap and HashSet

Fix #36648

r? @bluss
2017-02-15 07:30:10 +00:00
king6cong
5156dedec8 make doc consistent with var name 2017-02-15 14:52:13 +08:00
est31
aebd94fd3c Stabilize field init shorthand
Closes #37340.
2017-02-15 07:11:13 +01:00
Alex Burka
e3384e08ca fix types in to_owned doctest 2017-02-14 23:07:51 -05:00
bors
025c328bf5 Auto merge of #39633 - steveklabnik:vendor-mdbook, r=alexcrichton
Port books to mdbook

Part of https://github.com/rust-lang/rust/issues/39588

blocked on https://github.com/rust-lang/rust/pull/39431

As a first step towards the bookshelf, we ~vendor mdbook in-tree and~ port our books to it. Eventually, both of these books will be moved out-of-tree, but the nightly book will rely on doing the same thing. As such, this intermediate step is useful.

r? @alexcrichton @brson

/cc @azerupi
2017-02-15 01:22:16 +00:00
bors
e8154a0925 Auto merge of #39818 - frewsxcv:rollup, r=frewsxcv
Rollup of 8 pull requests

- Successful merges: #39659, #39730, #39754, #39772, #39785, #39788, #39790, #39813
- Failed merges:
2017-02-14 22:46:10 +00:00
Clar Charr
963843b1b3 Conversions between CStr/OsStr/Path and boxes. 2017-02-14 14:18:43 -05:00
Sebastian Waisbrot
ca54fc76ae Show five traits implementation in help when there are exactly five 2017-02-14 12:11:07 -03:00
Corey Farwell
4a919cba5b Rollup merge of #39813 - sanxiyn:non-camel-case-variant, r=petrochenkov
Use check_variant for non_camel_case_types lint

This way we automatically consider lint attributes.

Fix #38452.
2017-02-14 10:07:37 -05:00
Corey Farwell
4246f37588 Rollup merge of #39790 - zackw:tidy-linelen-exempt-urls, r=alexcrichton
tidy: exempt URLs from the line length restriction

The length of a URL is usually not under our control, and Markdown
provides no way to split a URL in the middle.  Therefore, comment
lines consisting _solely_ of a URL (possibly with a Markdown link
label in front) should be exempt from the line-length restriction.

Inline hyperlink destinations ( `[foo](http://...)` notation ) are
_not_ exempt, because it is my arrogant opinion that long lines of
that type make the source text illegible.

The patch adds dependencies on the `regex` and `lazy_static` crates
to the tidy utility.  This _appears_ to Just Work, but if you would
rather not have that dependency I am willing to provide a hand-written
parser instead.
2017-02-14 10:07:36 -05:00
Corey Farwell
376e24697f Rollup merge of #39788 - GuillaumeGomez:rustdoc-test-md-file, r=alexcrichton
Add filename when running rustdoc --test on a markdown file

r? @alexcrichton
2017-02-14 10:07:35 -05:00
Corey Farwell
8d17ef146b Rollup merge of #39785 - alexcrichton:no-thread-sanitizer, r=japaric
test: Remove sanitizer-thread test

Unfortunately it appears to spuriously fail so we can't gate on it
2017-02-14 10:07:34 -05:00
Corey Farwell
32b8f4ec98 Rollup merge of #39772 - cseale:staged_api_whitelist_removal, r=est31
Adding compile fail test for staged_api feature

Issue #39059
r? @est31

@est31 running the tests for this feature fails. Is that expected since this is the `compile-fail`suite?

I copied this test from the run-pass suite: `rust/src/test/run-pass/reachable-unnameable-type-alias.rs`. What are the differences between these suites in operation and why they are used?
2017-02-14 10:07:33 -05:00
Corey Farwell
c9737af4ed Rollup merge of #39754 - alexcrichton:less-assertions, r=brson
travis: Add builders without assertions

This commit adds three new builders, one OSX, one Linux, and one MSVC, which
will produce "nightlies" with LLVM assertions disabled. Currently all nightly
releases have LLVM assertions enabled to catch bugs before they reach the
beta/stable channels. The beta/stable channels, however, do not have LLVM
assertions enabled.

Unfortunately though projects like Servo are stuck on nightlies for the near
future at least and are also suffering very long compile times. The purpose of
this commit is to provide artifacts to these projects which are not distributed
through normal channels (e.g. rustup) but are provided for developers to use
locally if need be.

Logistically these builds will all be uploaded to `rustc-builds-alt` instead of
the `rustc-builds` folder of the `rust-lang-ci` bucket. These builds will stay
there forever (until cleaned out if necessary) and there are no plans to
integrate this with rustup and/or the official release process.
2017-02-14 10:07:31 -05:00
Corey Farwell
c2ea734734 Rollup merge of #39730 - jseyfried:fix_empty_seq_rep_ice, r=nrc
macros: fix ICE on certain sequence repetitions

Fixes #39709.
r? @nrc
2017-02-14 10:07:30 -05:00
Corey Farwell
651a5be270 Rollup merge of #39659 - zackw:asciiext-ctype, r=alexcrichton
Add equivalents of C's <ctype.h> functions to AsciiExt.

 * `is_ascii_alphabetic`
 * `is_ascii_uppercase`
 * `is_ascii_lowercase`
 * `is_ascii_alphanumeric`
 * `is_ascii_digit`
 * `is_ascii_hexdigit`
 * `is_ascii_punctuation`
 * `is_ascii_graphic`
 * `is_ascii_whitespace`
 * `is_ascii_control`

This addresses issue #39658.

Lightly tested on x86-64-linux.  tidy complains about the URLs in the documentation making lines too long, I don't know what to do about that.
2017-02-14 10:07:29 -05:00
Oliver Schneider
80ac32330f make more types public 2017-02-14 16:02:53 +01:00
Oliver Schneider
6ba7065af1 enable tools to use test runners programmatically 2017-02-14 14:48:26 +01:00
Seo Sanghyeon
255b5ed842 Use check_variant for non_camel_case_types lint 2017-02-14 19:46:48 +09:00
Josh
4be5783748 Add notes about capacity effects to Vec::truncate() 2017-02-14 19:31:46 +10:30
Ralf Jung
044ed10fee Remove Copy bound from some Cell trait impls
Contributes to #39264
2017-02-14 09:46:06 +01:00
bors
48bc08247a Auto merge of #39728 - eddyb:vendeur-tres-bien, r=alexcrichton
Automate vendoring by invoking cargo-vendor when building src dist tarballs.

This avoids #39633 bringing the `src/vendor` checked into git by #37524, past 200,000 lines of code.

I believe the strategy of having rustbuild run `cargo vendor` during the `dist src` step is sound.

However, the only way to be sure `cargo-vendor` exists is to run `cargo install --force cargo-vendor`, which will recompile it every time (not passing `--force` means you can't tell between "already exists" and "build error"). ~~This is quite suboptimal and I'd like to somehow do it in each `Dockerfile` that would need it.~~

* [ ] Cache `CARGO_HOME` (i.e. `~/.cargo`) between CI runs
  * `bin/cargo-vendor` and the actual caches are the relevant bits
* [x] Do not build `cargo-vendor` all the time
  * ~~Maybe detect `~/.cargo/bin/cargo-vendor` already exists?~~
  * ~~Could also try to build it in a `Dockerfile` but do we have `cargo`/`rustc` there?~~
  * Final solution: check `cargo install --list` for a line starting with `cargo-vendor `

cc @rust-lang/tools
2017-02-14 07:06:25 +00:00
bors
55013cddef Auto merge of #38981 - sdleffler:patch-1, r=alexcrichton
Add PartialOrd, Ord derivations to TypeId

I want to be able to sort a `Vec` of types which contain `TypeId`s, so an `Ord` derivation would be very useful to me. `Hash` and `PartialEq`/`Eq` already exist, so the missing `PartialOrd` and `Ord` derivations feel like an oversight to me.
2017-02-14 04:29:26 +00:00
bors
61b93bd811 Auto merge of #38561 - nagisa:rdrandseed, r=alexcrichton
Add intrinsics & target features for rd{rand,seed}

One question is whether or not we want to map feature name `rdrnd` to `rdrand` instead.

EDIT: as for use case, I would like to port my rdrand crate from inline assembly to these intrinsics.
2017-02-14 01:26:10 +00:00
Colm Seale
07b3a8bd60 Adding compile fail test for staged_api feature
Issue #39059
r? @est31
2017-02-14 00:03:17 +00:00
Eduard-Mihai Burtescu
d29f0bc8fa Automatically vendor Cargo deps when building the source tarballs. 2017-02-14 01:52:03 +02:00
Zack Weinberg
162240c744 Add feature annotations to the doctests for ascii_ctype. 2017-02-13 18:44:43 -05:00
bors
0af0b580c2 Auto merge of #39787 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests

- Successful merges: #39716, #39758, #39759, #39774, #39784
- Failed merges:
2017-02-13 20:45:26 +00:00
Zack Weinberg
ff4758c2a0 Replace regex-based parser for URL lines with open-coded one. 2017-02-13 15:44:51 -05:00
Ralf Jung
51a2e2fd82 Allow more Cell methods for non-Copy types
Contributes to #39264
2017-02-13 19:50:54 +01:00
Steve Klabnik
cacb3bc9c7 fix up linkchecker
1. skip png files
2. skip fragments for the book and nomicon, as these are added by JS
3. Actually print the filename for errors
2017-02-13 13:41:27 -05:00
Steve Klabnik
7f1d1c6d9a Fix up links
mdbook and rustdoc generate links differently, so we need to change all
these links.
2017-02-13 13:41:24 -05:00