]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoRollup merge of #37636 - karpinski:issue-34915, r=nikomatsakis
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:19 +0000 (20:51 +0200)]
Rollup merge of #37636 - karpinski:issue-34915, r=nikomatsakis

Marking the 'no-stack-check' codegen option as deprecated (Issue #34915)

Attempts to finish resolving issue #34915. Based on pull request #35156, which was closed due to inactivity.

7 years agoRollup merge of #37627 - GuillaumeGomez:missing_urls_bis, r=frewsxcv
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:18 +0000 (20:51 +0200)]
Rollup merge of #37627 - GuillaumeGomez:missing_urls_bis, r=frewsxcv

Add missing urls and few local rewrites

r? @steveklabnik

7 years agoRollup merge of #37622 - ollie27:cstring, r=alexcrichton
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:18 +0000 (20:51 +0200)]
Rollup merge of #37622 - ollie27:cstring, r=alexcrichton

Slightly optimise CString

Avoid a reallocation in CString::from and CStr::to_owned.

7 years agoRollup merge of #37614 - keeperofdakeys:proc_macro, r=jseyfried
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:18 +0000 (20:51 +0200)]
Rollup merge of #37614 - keeperofdakeys:proc_macro, r=jseyfried

macros 1.1: Allow proc_macro functions to declare attributes to be mark as used

This PR allows proc macro functions to declare attribute names that should be marked as used when attached to the deriving item. There are a few questions for this PR.

- Currently this uses a separate attribute named `#[proc_macro_attributes(..)]`, is this the best choice?
- In order to make this work, the `check_attribute` function had to be modified to not error on attributes marked as used. This is a pretty large change in semantics, is there a better way to do this?
- I've got a few clones where I don't know if I need them (like turning `item` into a `TokenStream`), can these be avoided?
- Is switching to `MultiItemDecorator` the right thing here?

Also fixes https://github.com/rust-lang/rust/issues/37563.

7 years agoRollup merge of #37524 - alexcrichton:vendor, r=brson
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:17 +0000 (20:51 +0200)]
Rollup merge of #37524 - alexcrichton:vendor, r=brson

Vendor all rustbuild dependencies in this repo

This commit vendors all crates.io dependencies into the rust-lang/rust repository using the `cargo-vendor` tool. This is done in an effort to make rustbuild distro-ready by ensuring that our source tarballs are self-contained units which don't need extraneous network downloads.

A new `src/vendor` directory is created with all vendored crates, and Cargo, when using rustbuild, is configured to use this directory. Over time we can deduplicate this directory with the actual src tree (e.g. src/librustc_serialize, src/liblibc, src/libgetopts, ...). For now though that's left to a separate commit.

7 years agoRollup merge of #37472 - joshtriplett:doc-fmt-write-io-write, r=brson
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:17 +0000 (20:51 +0200)]
Rollup merge of #37472 - joshtriplett:doc-fmt-write-io-write, r=brson

Document convention for using both fmt::Write and io::Write

Using a trait's methods (like `Write::write_fmt` as used in `writeln!` and other macros) requires importing that trait directly (not just the module containing it).  Both `fmt::Write` and `io::Write` provide compatible `Write::write_fmt` methods, and code can use `writeln!` and other macros on both an object implementing `fmt::Write` (such as a `String`) and an object implementing `io::Write` (such as `Stderr`).  However, importing both `Write` traits produces an error due to the name conflict.

The convention I've seen renames both of them on import, to `FmtWrite` and `IoWrite` respectively.  Document that convention in the Rust documentation for `write!` and `writeln!`, with examples.

7 years agoRollup merge of #37432 - achanda:send_to, r=alexcrichton
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:16 +0000 (20:51 +0200)]
Rollup merge of #37432 - achanda:send_to, r=alexcrichton

Clarify that send_to might panic in certain cases

Closes #34202

r? @alexcrichton

7 years agoRollup merge of #37428 - estebank:generic-type-error-span, r=sanxiyn
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:16 +0000 (20:51 +0200)]
Rollup merge of #37428 - estebank:generic-type-error-span, r=sanxiyn

Point to type argument span when used as trait

Given the following code:

``` rust
struct Foo<T: Clone>(T);

use std::ops::Add;

impl<T: Clone, Add> Add for Foo<T> {
  type Output = usize;

  fn add(self, rhs: Self) -> Self::Output {
    unimplemented!();
  }
}
```

present the following output:

``` nocode
error[E0404]: `Add` is not a trait
 --> file3.rs:5:21
  |
5 | impl<T: Clone, Add> Add for Okok<T> {
  |                ---  ^^^ expected trait, found type parameter
  |                |
  |                type parameter defined here
```

Fixes #35987.

7 years agoRollup merge of #37370 - estebank:signature-2-empire-strikes-back, r=nikomatsakis
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:16 +0000 (20:51 +0200)]
Rollup merge of #37370 - estebank:signature-2-empire-strikes-back, r=nikomatsakis

Include type of missing trait methods in error

Provide either a span pointing to the original definition of missing
trait items, or a message with the inferred definitions.

Fixes #24626. Follow up to PR #36371.

If PR #37369 lands, missing trait items that present a multiline span will be able to show the entirety of the item definition on the error itself, instead of just the first line.

7 years agoRollup merge of #37250 - liigo:rustdoc-unsafe-fns, r=steveklabnik
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:15 +0000 (20:51 +0200)]
Rollup merge of #37250 - liigo:rustdoc-unsafe-fns, r=steveklabnik

rustdoc: mark unsafe fns in module page with superscript icons

Note: I'v changed the mark style. Now use superscript ⚠(U+26A0) (the old one is '[Unsafe]' literal).
Basically per https://botbot.me/mozilla/rust-docs/2016-10-19/?msg=75112017&page=1

![unsafe-fn-icon](https://cloud.githubusercontent.com/assets/346530/19633650/7f6e1eea-99e6-11e6-8d09-31aec83e46a5.png)

![unsafe-fn](https://cloud.githubusercontent.com/assets/346530/19472050/39daded2-9558-11e6-9148-3cb12afd1c9a.png)

7 years agoRollup merge of #37229 - nnethercote:FxHasher, r=nikomatsakis
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:15 +0000 (20:51 +0200)]
Rollup merge of #37229 - nnethercote:FxHasher, r=nikomatsakis

Replace FNV with a faster hash function.

Hash table lookups are very hot in rustc profiles and the time taken within `FnvHash` itself is a big part of that. Although FNV is a simple hash, it processes its input one byte at a time. In contrast, Firefox has a homespun hash function that is also simple but works on multiple bytes at a time. So I tried it out and the results are compelling:

```
futures-rs-test  4.326s vs  4.212s --> 1.027x faster (variance: 1.001x, 1.007x)
helloworld       0.233s vs  0.232s --> 1.004x faster (variance: 1.037x, 1.016x)
html5ever-2016-  5.397s vs  5.210s --> 1.036x faster (variance: 1.009x, 1.006x)
hyper.0.5.0      5.018s vs  4.905s --> 1.023x faster (variance: 1.007x, 1.006x)
inflate-0.1.0    4.889s vs  4.872s --> 1.004x faster (variance: 1.012x, 1.007x)
issue-32062-equ  0.347s vs  0.335s --> 1.035x faster (variance: 1.033x, 1.019x)
issue-32278-big  1.717s vs  1.622s --> 1.059x faster (variance: 1.027x, 1.028x)
jld-day15-parse  1.537s vs  1.459s --> 1.054x faster (variance: 1.005x, 1.003x)
piston-image-0. 11.863s vs 11.482s --> 1.033x faster (variance: 1.060x, 1.002x)
regex.0.1.30     2.517s vs  2.453s --> 1.026x faster (variance: 1.011x, 1.013x)
rust-encoding-0  2.080s vs  2.047s --> 1.016x faster (variance: 1.005x, 1.005x)
syntex-0.42.2   32.268s vs 31.275s --> 1.032x faster (variance: 1.014x, 1.022x)
syntex-0.42.2-i 17.629s vs 16.559s --> 1.065x faster (variance: 1.013x, 1.021x)
```

(That's a stage1 compiler doing debug builds. Results for a stage2 compiler are similar.)

The attached commit is not in a state suitable for landing because I changed the implementation of FnvHasher without changing its name (because that would have required touching many lines in the compiler). Nonetheless, it is a good place to start discussions.

Profiles show very clearly that this new hash function is a lot faster to compute than FNV. The quality of the new hash function is less clear -- it seems to do better in some cases and worse in others (judging by the number of instructions executed in `Hash{Map,Set}::get`).

CC @brson, @arthurprs

7 years agoRollup merge of #37134 - GuillaumeGomez:display_tag, r=steveklabnik
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:15 +0000 (20:51 +0200)]
Rollup merge of #37134 - GuillaumeGomez:display_tag, r=steveklabnik

Print more tags in rustdoc

r? @steveklabnik

cc @frewsxcv

A little screenshot:

<img width="1440" alt="screen shot 2016-10-13 at 01 41 53" src="https://cloud.githubusercontent.com/assets/3050060/19331745/873cd71e-90e6-11e6-88f8-715668366a3f.png">

7 years agoRollup merge of #36868 - petrochenkov:adtstab, r=nikomatsakis
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:15 +0000 (20:51 +0200)]
Rollup merge of #36868 - petrochenkov:adtstab, r=nikomatsakis

Partially stabilize RFC 1506 "Clarify relationships between ADTs"

Lifted restrictions on tuple structs/variants are stabilized, i.e. `S{..}` can be used with any structs and empty tuple structs are permitted without feature gate.
Numeric fields in struct expressions/patterns `S { 0: a, 1: b }` are **NOT** stabilized.
This was implemented 1.5 months ago in Rust 1.12, but this is a tiny technical change that could probably go even without RFC/stabilization period.

cc https://github.com/rust-lang/rust/issues/35626 https://github.com/rust-lang/rust/pull/36871
r? @nikomatsakis

7 years agoAuto merge of #37657 - steveklabnik:rollup, r=steveklabnik
bors [Wed, 9 Nov 2016 13:35:23 +0000 (05:35 -0800)]
Auto merge of #37657 - steveklabnik:rollup, r=steveklabnik

Rollup of 8 pull requests

- Successful merges: #35102, #37425, #37483, #37588, #37601, #37610, #37650, #37652
- Failed merges:

7 years agoAuto merge of #37651 - alexcrichton:fix-deps, r=alexcrichton
bors [Wed, 9 Nov 2016 09:15:20 +0000 (01:15 -0800)]
Auto merge of #37651 - alexcrichton:fix-deps, r=alexcrichton

rustbuild: Fix dependencies of check-error-index

This depends on the error index actually existing rather than just the tool to
generate the error index.

7 years agoClarify that send_to might return an error in certain cases
Abhishek Chanda [Thu, 27 Oct 2016 14:23:19 +0000 (15:23 +0100)]
Clarify that send_to might return an error in certain cases

Closes #34202

7 years agoPoint to type argument span when used as trait
Esteban Küber [Thu, 27 Oct 2016 03:51:49 +0000 (20:51 -0700)]
Point to type argument span when used as trait

Given the following code:

```rust
struct Foo<T: Clone>(T);

use std::ops::Add;

impl<T: Clone, Add> Add for Foo<T> {
    type Output = usize;

    fn add(self, rhs: Self) -> Self::Output {
      unimplemented!();
    }
}
```

present the following output:

```nocode
error[E0404]: `Add` is not a trait
 --> file3.rs:5:21
  |
5 | impl<T: Clone, Add> Add for Okok<T> {
  |                ---  ^^^ expected trait, found type parameter
  |                |
  |                type parameter defined here
```

7 years agorustbuild: Fix check-error-index step
Alex Crichton [Tue, 8 Nov 2016 17:59:46 +0000 (09:59 -0800)]
rustbuild: Fix check-error-index step

If it ran too soon there wasn't a `test` directory lying around but we'll need
one!

7 years agoRollup merge of #37652 - SimonSapin:arc-count-doc, r=alexcrichton
Steve Klabnik [Tue, 8 Nov 2016 21:20:58 +0000 (16:20 -0500)]
Rollup merge of #37652 - SimonSapin:arc-count-doc, r=alexcrichton

More proeminent warning in Arc::{strong,weak}_count docs.

CC https://github.com/rust-lang/rust/issues/28356#issuecomment-259212258

7 years agoRollup merge of #37650 - GuillaumeGomez:missing_urls_product, r=steveklabnik
Steve Klabnik [Tue, 8 Nov 2016 21:20:57 +0000 (16:20 -0500)]
Rollup merge of #37650 - GuillaumeGomez:missing_urls_product, r=steveklabnik

Add missing urls for Sum and Product traits

r? @steveklabnik

7 years agoRollup merge of #37610 - oldmanmike:unary-and-binary-tests, r=michaelwoerister
Steve Klabnik [Tue, 8 Nov 2016 21:20:57 +0000 (16:20 -0500)]
Rollup merge of #37610 - oldmanmike:unary-and-binary-tests, r=michaelwoerister

Add unary and binary tests for incr-comp

This is my draft of tests for unary and binary expressions as desired by #37520 for use in the test suite for hashes in incremental compilation. Feedback would be wonderful, if there's any changes I need to make I would appreciate the code review.

?r @michaelwoerister

7 years agoRollup merge of #37601 - brson:book-without-tiers, r=steveklabnik
Steve Klabnik [Tue, 8 Nov 2016 21:20:57 +0000 (16:20 -0500)]
Rollup merge of #37601 - brson:book-without-tiers, r=steveklabnik

book: Removed platform compatibility table, link to the forge

The content is duplicated, and it doesn't need to be in this location.
It's mostly trivia that doesn't apply to most of the audience.

The forge is up to date.

r? @steveklabnik cc @alexcrichton

7 years agoRollup merge of #37588 - GuillaumeGomez:missing_io_urls, r=frewsxcv
Steve Klabnik [Tue, 8 Nov 2016 21:20:57 +0000 (16:20 -0500)]
Rollup merge of #37588 - GuillaumeGomez:missing_io_urls, r=frewsxcv

Add missing urls on io structs

r? @steveklabnik

7 years agoRollup merge of #37483 - xfix:patch-1, r=steveklabnik
Steve Klabnik [Tue, 8 Nov 2016 21:20:56 +0000 (16:20 -0500)]
Rollup merge of #37483 - xfix:patch-1, r=steveklabnik

Match guessing game output to newest language version

Cargo now informs that it has finished, and there is new error format.

7 years agoRollup merge of #37425 - polo-language:doc, r=GuillaumeGomez
Steve Klabnik [Tue, 8 Nov 2016 21:20:56 +0000 (16:20 -0500)]
Rollup merge of #37425 - polo-language:doc, r=GuillaumeGomez

Add error note to illegal code snippet

Mark intentionally invalid code snippet in documentation as such with a comment. Similar comments used elsewhere in this file.

r? @steveklabnik

7 years agoRollup merge of #35102 - steveklabnik:ref_warning, r=aturon
Steve Klabnik [Tue, 8 Nov 2016 21:20:56 +0000 (16:20 -0500)]
Rollup merge of #35102 - steveklabnik:ref_warning, r=aturon

Make it clear that the reference isn't normative

Any time someone edits the reference, it has to be taken very seriously,
since it's the closest thing we have to a specification. This commit
adds language which indicates that this is not a normative document,
which makes it easier to make tweaks without worrying about forever
harming the future of Rust by painting ourselves in a corner.

r? @aturon

7 years agoAdd missing urls and few local rewrites
Guillaume Gomez [Mon, 7 Nov 2016 11:21:06 +0000 (12:21 +0100)]
Add missing urls and few local rewrites

7 years agoAuto merge of #37192 - cristicbz:rust-rc-into-raw, r=brson
bors [Tue, 8 Nov 2016 20:13:45 +0000 (12:13 -0800)]
Auto merge of #37192 - cristicbz:rust-rc-into-raw, r=brson

Add `{into,from}_raw` to Rc and Arc

These methods convert to and from a `*const T` for `Rc` and `Arc` similar to the way they work on `Box`. The only slight complication is that `from_raw` needs to offset the pointer back to find the beginning of the `RcBox`/`ArcInner`.

I felt this is a fairly small addition, filling in a gap (when compared to `Box`) so it wouldn't need an RFC. The motivation is primarily for FFI.

(I'll create an issue and update a PR with the issue number if reviewers agree with the change in principle **Edit: done #37197**)

~~Edit: This was initially `{into,from}_raw` but concerns were raised about the possible footgun if mixed with the methods of the same name of `Box`.~~

Edit: This was went from `{into,from}_raw` to `{into,from}_inner_raw` then back to `{into,from}_raw` during review.

7 years agoPartially stabilize RFC 1506 "Clarify relationships between ADTs"
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Partially stabilize RFC 1506 "Clarify relationships between ADTs"

7 years agoMore proeminent warning in Arc::{strong,weak}_count docs.
Simon Sapin [Tue, 8 Nov 2016 19:15:20 +0000 (20:15 +0100)]
More proeminent warning in Arc::{strong,weak}_count docs.

7 years agoAdd missing urls for Sum and Product traits
Guillaume Gomez [Tue, 8 Nov 2016 17:33:04 +0000 (18:33 +0100)]
Add missing urls for Sum and Product traits

7 years agoSlightly optimise CString
Oliver Middleton [Tue, 8 Nov 2016 16:55:24 +0000 (16:55 +0000)]
Slightly optimise CString

Avoid a reallocation in CString::from and CStr::to_owned.

7 years agorustbuild: Tweak for vendored dependencies
Alex Crichton [Tue, 1 Nov 2016 20:46:38 +0000 (13:46 -0700)]
rustbuild: Tweak for vendored dependencies

A few changes are included here:

* The `winapi` and `url` dependencies were dropped. The source code for these
  projects is pretty weighty, and we're about to vendor them, so let's not
  commit to that intake just yet. If necessary we can vendor them later but for
  now it shouldn't be necessary.

* The `--frozen` flag is now always passed to Cargo, obviating the need for
  tidy's `cargo_lock` check.

* Tidy was updated to not check the vendor directory

Closes #34687

7 years agorustbuild: Vendor all dependencies
Alex Crichton [Tue, 1 Nov 2016 21:58:36 +0000 (14:58 -0700)]
rustbuild: Vendor all dependencies

This commit vendors all dependencies when using rustbuild to ensure that we
don't hit the network during a build and can build as a self-contained unit.

7 years agoAdding a deprecation warning for no-stack-check codegen option.
karpinski [Mon, 7 Nov 2016 17:38:47 +0000 (18:38 +0100)]
Adding a deprecation warning for no-stack-check codegen option.

7 years agoChange description of no-stack-check (#34915)
abhijeetbhagat [Mon, 1 Aug 2016 07:41:53 +0000 (13:11 +0530)]
Change description of no-stack-check (#34915)

7 years agoRevert "Point macros 1.1 errors to the input item"
Josh Driver [Tue, 8 Nov 2016 12:33:33 +0000 (23:03 +1030)]
Revert "Point macros 1.1 errors to the input item"

This reverts commit 3784067edcbcd0614f6c4c88f6445ca17ae27ff6.
Any errors in the derived output now point at the derive attribute
instead of the item.

7 years agoAllow proc_macro functions to whitelist specific attributes
Josh Driver [Tue, 8 Nov 2016 11:15:02 +0000 (21:45 +1030)]
Allow proc_macro functions to whitelist specific attributes

By using a second attribute `attributes(Bar)` on
proc_macro_derive, whitelist any attributes with
the name `Bar` in the deriving item. This allows
a proc_macro function to use custom attribtues
without a custom attribute error or unused attribute
lint.

7 years agoAuto merge of #36843 - petrochenkov:dotstab, r=nikomatsakis
bors [Tue, 8 Nov 2016 10:06:45 +0000 (02:06 -0800)]
Auto merge of #36843 - petrochenkov:dotstab, r=nikomatsakis

Stabilize `..` in tuple (struct) patterns

I'd like to nominate `..` in tuple and tuple struct patterns for stabilization.
This feature is a relatively small extension to existing stable functionality and doesn't have known blockers.
The feature first appeared in Rust 1.10 6 months ago.
An example of use: https://github.com/rust-lang/rust/pull/36203

Closes https://github.com/rust-lang/rust/issues/33627
r? @nikomatsakis

7 years agoReplace FnvHasher use with FxHasher.
Nicholas Nethercote [Tue, 8 Nov 2016 03:02:55 +0000 (14:02 +1100)]
Replace FnvHasher use with FxHasher.

This speeds up compilation by 3--6% across most of rustc-benchmarks.

7 years agoAdd FxHasher, a faster alternative to FnvHasher.
Nicholas Nethercote [Tue, 8 Nov 2016 03:01:38 +0000 (14:01 +1100)]
Add FxHasher, a faster alternative to FnvHasher.

7 years agoRename KNOWN_ATTRS to BUILT_ATTRS, and create KNOWN_ATTRS
Josh Driver [Mon, 7 Nov 2016 22:00:26 +0000 (08:30 +1030)]
Rename KNOWN_ATTRS to BUILT_ATTRS, and create KNOWN_ATTRS

KNOWN_ATTRIBUTES should really be named BUILT_ATTRIBUTES,
while KNOWN_ATTRIBUTES should be used to mark attributes
as known, similar to USED_ATTRIBUTES.

7 years agoAuto merge of #36365 - matthew-piziak:silent-overflow, r=eddyb
bors [Mon, 7 Nov 2016 19:48:16 +0000 (11:48 -0800)]
Auto merge of #36365 - matthew-piziak:silent-overflow, r=eddyb

fix silent overflows on `Step` impls

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

r? @eddyb

7 years agoFix typos and redundant code
oldmanmike [Mon, 7 Nov 2016 18:59:48 +0000 (13:59 -0500)]
Fix typos and redundant code

7 years agoApply changes recommended in code review
oldmanmike [Mon, 7 Nov 2016 17:42:20 +0000 (12:42 -0500)]
Apply changes recommended in code review

Said code review and recommendations can be found here:
https://github.com/rust-lang/rust/pull/37610

7 years agoAuto merge of #37625 - xen0n:rustbuild-mips, r=alexcrichton
bors [Mon, 7 Nov 2016 16:39:16 +0000 (08:39 -0800)]
Auto merge of #37625 - xen0n:rustbuild-mips, r=alexcrichton

rustbuild: support MIPS host builds

There is a *little* code duplication, but primarily for sake of "match exhaustiveness". Let's blame Linux/MIPS for not exposing endianness explicitly in `uname -m` (that's user-space interface and as such is frozen).

Currently the build won't work as we have to wait for a new stage0 for the MIPS host compilers, but this paves the way to self-hosted Rust on MIPS. The cross-compiled MIPS binaries are confirmed to work on the Loongson 3A2000 (MIPS64r2-compatible) so we have plenty of confidence that they'll work on other MIPS platforms too, as Linux/MIPS user-space ABI is consistent across machines of the same bitness.

r? @alexcrichton

7 years agoAuto merge of #37624 - xen0n:remove-bogus-mipsel-arches, r=alexcrichton
bors [Mon, 7 Nov 2016 12:14:00 +0000 (04:14 -0800)]
Auto merge of #37624 - xen0n:remove-bogus-mipsel-arches, r=alexcrichton

Remove mention of mipsel target_arch

This is the only remaining instance in rustc. All others were in the libc repo, removed with rust-lang/libc#445.

Actually there's more to clean in `libsyntax/abi.rs`, but let's save that for another commit...

7 years agoAuto merge of #37605 - dsprenkels:arc-max-refcount, r=alexcrichton
bors [Mon, 7 Nov 2016 07:05:58 +0000 (23:05 -0800)]
Auto merge of #37605 - dsprenkels:arc-max-refcount, r=alexcrichton

Fix Arc::clone()'s MAX_REFCOUNT check (off-by-one)

Before, the strong count of an `Arc` could be set to
`MAX_REFCOUNT + 1`, because when this happened, `old_size` would
be exactly `MAX_REFCOUNT`. `Arc::clone()` would not abort.

This commit changes the check in `Arc::clone()` to also abort if
the old value is equal to `MAX_REFCOUNT`, because then the new
value will be equal to `MAX_REFCOUNT + 1`.

A test would require allocating memory for `isize::MAX` pointers.
This would probably crash any machine, so no test is submitted
with this commit.

7 years agorustbuild: support MIPS host builds
Wang Xuerui [Mon, 7 Nov 2016 06:29:15 +0000 (14:29 +0800)]
rustbuild: support MIPS host builds

There is a *little* code duplication, but primarily for sake of "match
exhaustiveness". Let's blame Linux/MIPS for not exposing endianness
explicitly in `uname -m` (that's user-space interface and as such is
frozen).

Currently the build won't work as we have to wait for a new stage0 for
the MIPS host compilers, but this paves the way to self-hosted Rust on
MIPS. The cross-compiled MIPS binaries are confirmed to work on the
Loongson 3A2000 (MIPS64r2-compatible) so we have plenty of confidence
that they'll work on other MIPS platforms too, as Linux/MIPS user-space
ABI is consistent across machines of the same bitness.

7 years agoRemove mention of mipsel target_arch
Wang Xuerui [Mon, 7 Nov 2016 06:11:13 +0000 (14:11 +0800)]
Remove mention of mipsel target_arch

The `mipsel` `target_arch` was introduced with the initial MIPSel
support (rust-lang/rust@82ec1aef293ddc5c6373bd7f5ec323fafbdf7901),
but was subsequently removed with implementation of the Flexible Target
Specification (Rust RFC 0131,
rust-lang/rust@3a8f4ec32a80d372db2d02c76acba0276c4effd0).
This is the only remaining instance in rustc. All others are in the libc
repo, and are fixed in rust-lang/libc@b3676593f6930c32d947c59e210789bbfcb30960.

7 years agoAuto merge of #37506 - jseyfried:improve_shadowing_checks, r=nrc
bors [Mon, 7 Nov 2016 03:12:28 +0000 (19:12 -0800)]
Auto merge of #37506 - jseyfried:improve_shadowing_checks, r=nrc

macros: improve shadowing checks

This PR improves macro-expanded shadowing checks to work with out-of-(pre)order expansion.

Out-of-order expansion became possible in #37084, so this technically a [breaking-change] for nightly.
The regression test from this PR is an example of code that would break.

r? @nrc

7 years agoAuto merge of #37619 - TimNN:aarch64-fuchsia-abi-blacklist, r=alexcrichton
bors [Sun, 6 Nov 2016 23:59:45 +0000 (15:59 -0800)]
Auto merge of #37619 - TimNN:aarch64-fuchsia-abi-blacklist, r=alexcrichton

use arm abi blacklist for aarch64 fuchsia

r? @alexcrichton

7 years agoSet attributes hidden by default
Guillaume Gomez [Sun, 6 Nov 2016 20:06:20 +0000 (21:06 +0100)]
Set attributes hidden by default

7 years agoAuto merge of #37617 - pweyck:force-static-llvm-linking, r=alexcrichton
bors [Sun, 6 Nov 2016 20:47:14 +0000 (12:47 -0800)]
Auto merge of #37617 - pweyck:force-static-llvm-linking, r=alexcrichton

Force static linking of LLVM

Run `llvm-config` with `--link-static` if available, to force static linking of LLVM.
This option was added in LLVM 3.8.

This is my first pull request, any feedback is welcome!

Fixes #36854
See also: #36996

7 years agoImprove attributes display and allow expansion
Guillaume Gomez [Sun, 6 Nov 2016 20:03:08 +0000 (21:03 +0100)]
Improve attributes display and allow expansion

7 years agouse arm abi blacklist for aarch64 fuchsia
Tim Neumann [Sun, 6 Nov 2016 19:41:42 +0000 (20:41 +0100)]
use arm abi blacklist for aarch64 fuchsia

7 years agoAdd a comment to `Arc::MAX_REFCOUNT`
Daan Sprenkels [Fri, 4 Nov 2016 21:50:54 +0000 (22:50 +0100)]
Add a comment to `Arc::MAX_REFCOUNT`

The constant name `MAX_REFCOUNT` suggests that the value is a
_hard_ limit on the amount of references to an `Arc`. This is
a more soft limit however. This commit adds a comment to the
constant to annotate this.

See also: PR #37605

7 years agoSet possibility to hide attributes
Guillaume Gomez [Sun, 6 Nov 2016 19:06:01 +0000 (20:06 +0100)]
Set possibility to hide attributes

7 years agoPrint more tags in rustdoc
Guillaume Gomez [Wed, 12 Oct 2016 23:40:02 +0000 (01:40 +0200)]
Print more tags in rustdoc

7 years agoAuto merge of #37616 - jneem:master, r=alexcrichton
bors [Sun, 6 Nov 2016 17:34:15 +0000 (09:34 -0800)]
Auto merge of #37616 - jneem:master, r=alexcrichton

Add test for issue 18060.

Closes #18060

7 years agoForce static linking of LLVM
pweyck [Sun, 6 Nov 2016 10:45:21 +0000 (11:45 +0100)]
Force static linking of LLVM

Run llvm-config with "--link-static" if available, to force static linking of LLVM.
This option was added in LLVM 3.8.

Fixes #36854
See also: #36996

7 years agoAdd test for issue 18060.
Joe Neeman [Sun, 6 Nov 2016 15:27:36 +0000 (16:27 +0100)]
Add test for issue 18060.

7 years agoAuto merge of #37404 - eddyb:lazy-4, r=nikomatsakis
bors [Sun, 6 Nov 2016 14:22:38 +0000 (06:22 -0800)]
Auto merge of #37404 - eddyb:lazy-4, r=nikomatsakis

[4/n] rustc: harden against InferOk having obligations in more cases.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37402) | [next](https://github.com/rust-lang/rust/pull/37408)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments._

<hr>

This adds more asserts that `InferOk` results have no obligations, pending completion of #32730.

Each of these could accidentally drop obligations on the floor if they start getting produced by unification, and a future change does just that, in order to produce a "shallow success" (hopefully leading to ambiguities during trait selection), _without_ the possibility of an eventual success - mostly guarded by ICEs for now.

7 years agorustc: harden against InferOk having obligations in more cases.
Eduard Burtescu [Mon, 3 Oct 2016 23:19:40 +0000 (02:19 +0300)]
rustc: harden against InferOk having obligations in more cases.

7 years agoAuto merge of #37386 - johnthagen:Self-reference-example, r=GuillaumeGomez
bors [Sun, 6 Nov 2016 10:28:58 +0000 (02:28 -0800)]
Auto merge of #37386 - johnthagen:Self-reference-example, r=GuillaumeGomez

Add example using Self to reference

When I first came across `Self` I had a hard time finding references to it in the docs (and it's also been asked about on [StackOverflow](http://stackoverflow.com/questions/32304595/whats-the-difference-between-self-and-self).

I hope this example provides someone who comes across it for the first time a little more help.  If there is a better way to show an example actually using `Self`, I'm happy to modify this.  It was just the simplest place to start I could see.

7 years agoAuto merge of #37597 - alexcrichton:rollup, r=alexcrichton
bors [Sun, 6 Nov 2016 05:34:25 +0000 (22:34 -0700)]
Auto merge of #37597 - alexcrichton:rollup, r=alexcrichton

Rollup of 24 pull requests

- Successful merges: #37255, #37317, #37408, #37410, #37422, #37427, #37470, #37501, #37537, #37556, #37557, #37564, #37565, #37566, #37569, #37574, #37577, #37579, #37583, #37585, #37586, #37587, #37589, #37596
- Failed merges: #37521, #37547

7 years agoOnly test docs and such for the host
Alex Crichton [Sat, 5 Nov 2016 21:22:19 +0000 (14:22 -0700)]
Only test docs and such for the host

7 years agoAdd unary and binary tests for incr-comp
oldmanmike [Sun, 6 Nov 2016 01:31:57 +0000 (21:31 -0400)]
Add unary and binary tests for incr-comp

7 years agoUse From trait as an example usage of Self.
johnthagen [Sat, 5 Nov 2016 22:21:17 +0000 (18:21 -0400)]
Use From trait as an example usage of Self.

7 years agoInclude type of missing trait methods in error
Esteban Küber [Mon, 24 Oct 2016 01:54:31 +0000 (18:54 -0700)]
Include type of missing trait methods in error

Provide either a span pointing to the original definition of missing
trait items, or a message with the inferred definitions.

7 years agoMerge branch 'gdb-next-gen' of https://github.com/TimNN/rust into rollup
Alex Crichton [Sat, 5 Nov 2016 17:51:34 +0000 (10:51 -0700)]
Merge branch 'gdb-next-gen' of https://github.com/TimNN/rust into rollup

7 years agoFix tests from the rollup
Alex Crichton [Sat, 5 Nov 2016 00:44:53 +0000 (17:44 -0700)]
Fix tests from the rollup

7 years agoMerge branch 'selfgate' of https://github.com/petrochenkov/rust into rollup
Alex Crichton [Fri, 4 Nov 2016 23:55:08 +0000 (16:55 -0700)]
Merge branch 'selfgate' of https://github.com/petrochenkov/rust into rollup

7 years agoMerge branch 'new-rustbuild' into rollup
Alex Crichton [Fri, 4 Nov 2016 23:53:48 +0000 (16:53 -0700)]
Merge branch 'new-rustbuild' into rollup

7 years agoRollup merge of #37596 - est31:master, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:33 +0000 (16:49 -0700)]
Rollup merge of #37596 - est31:master, r=alexcrichton

Add error when proc_macro_derive is used not on functions

Fixes #37590

7 years agoRollup merge of #37589 - raphlinus:fuchsia_random, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:33 +0000 (16:49 -0700)]
Rollup merge of #37589 - raphlinus:fuchsia_random, r=alexcrichton

std: Track change to cprng syscall signature (Fuchsia)

The mx_cprng_draw syscall has changed signature to separate the status
and size return values, rather than multiplexing them into a single
value with errors interpreted as a negative value. This patch tracks
that change.

7 years agoRollup merge of #37587 - ollie27:to_mut, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:33 +0000 (16:49 -0700)]
Rollup merge of #37587 - ollie27:to_mut, r=alexcrichton

Remove recursive call from Cow::to_mut

It seems to prevent it from being inlined.

7 years agoRollup merge of #37586 - TimNN:fix-37559, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:32 +0000 (16:49 -0700)]
Rollup merge of #37586 - TimNN:fix-37559, r=alexcrichton

fix #37559: update compiler-rt

Fixes #37559

r? @alexcrichton

7 years agoRollup merge of #37585 - leodasvacas:change_into_to_from, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:32 +0000 (16:49 -0700)]
Rollup merge of #37585 - leodasvacas:change_into_to_from, r=alexcrichton

Change `Into<Vec<u8>> for String` and `Into<OsString> for PathBuf` to From

Fixes #37561. First contribution, happy with any and all feedback!

7 years agoRollup merge of #37583 - michaelwoerister:hir-stats, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:32 +0000 (16:49 -0700)]
Rollup merge of #37583 - michaelwoerister:hir-stats, r=alexcrichton

Add `-Z hir-stats` for collecting statistics on HIR and AST

The data collected will be printed to the commandline and looks like the following:

```
// stats for libcore

PRE EXPANSION AST STATS

Name                Accumulated Size         Count     Item Size
----------------------------------------------------------------
TypeBinding                    2_280            57            40
Mod                            3_560            89            40
PathListItem                   6_516           181            36
Variant                        7_872            82            96
LifetimeDef                   21_280           380            56
StructField                   22_880           260            88
Lifetime                      23_800         1_190            20
Local                         30_192           629            48
ForeignItem                   31_504           179           176
Arm                           42_880           670            64
Mac                           46_960           587            80
FnDecl                        57_792         1_204            48
TraitItem                     69_504           362           192
TyParamBound                  98_280           945           104
Block                        108_384         2_258            48
Stmt                         144_720         3_618            40
ImplItem                     230_272         1_028           224
Item                         467_456         1_826           256
Pat                          517_776         4_623           112
Attribute                    745_680        15_535            48
Ty                         1_114_848         9_954           112
PathSegment                1_218_528        16_924            72
Expr                       3_082_408        20_279           152
----------------------------------------------------------------
Total                      8_095_372

POST EXPANSION AST STATS

Name                Accumulated Size         Count     Item Size
----------------------------------------------------------------
MacroDef                       1_056            12            88
Mod                            3_400            85            40
TypeBinding                    4_280           107            40
PathListItem                   6_516           181            36
Variant                        7_872            82            96
StructField                   24_904           283            88
ForeignItem                   31_504           179           176
TraitItem                     69_504           362           192
Local                         85_008         1_771            48
Arm                          100_288         1_567            64
Lifetime                     123_980         6_199            20
LifetimeDef                  126_728         2_263            56
TyParamBound                 297_128         2_857           104
FnDecl                       305_856         6_372            48
Block                        481_104        10_023            48
Stmt                         535_120        13_378            40
Item                       1_469_952         5_742           256
Attribute                  1_629_840        33_955            48
ImplItem                   1_732_864         7_736           224
Pat                        2_360_176        21_073           112
PathSegment                5_888_448        81_784            72
Ty                         6_237_168        55_689           112
Expr                      12_013_320        79_035           152
----------------------------------------------------------------
Total                     33_536_016

HIR STATS

Name                Accumulated Size         Count     Item Size
----------------------------------------------------------------
MacroDef                         864            12            72
Mod                            2_720            85            32
TypeBinding                    3_424           107            32
PathListItem                   5_068           181            28
Variant                        6_560            82            80
StructField                   20_376           283            72
ForeignItem                   27_208           179           152
WherePredicate                43_776           684            64
TraitItem                     52_128           362           144
Decl                          68_992         2_156            32
Local                         89_184         1_858            48
Arm                           94_368         1_966            48
LifetimeDef                  108_624         2_263            48
Lifetime                     123_980         6_199            20
Stmt                         168_000         4_200            40
TyParamBound                 251_416         2_857            88
FnDecl                       254_880         6_372            40
Block                        583_968        12_166            48
Item                       1_240_272         5_742           216
ImplItem                   1_361_536         7_736           176
Attribute                  1_620_480        33_760            48
Pat                        2_073_120        21_595            96
Path                       2_385_856        74_558            32
Ty                         4_455_040        55_688            80
PathSegment                5_587_904        87_311            64
Expr                       7_588_992        79_052            96
----------------------------------------------------------------
Total                     28_218_736
```

7 years agoRollup merge of #37579 - liigo:defaulthasher, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:32 +0000 (16:49 -0700)]
Rollup merge of #37579 - liigo:defaulthasher, r=alexcrichton

reference full path DefaultHasher

Since `DefaultHasher` does not in scope, it's not obvious where to find it.

7 years agoRollup merge of #37577 - nnethercote:shrink-Expr-slightly, r=eddyb
Alex Crichton [Fri, 4 Nov 2016 23:49:31 +0000 (16:49 -0700)]
Rollup merge of #37577 - nnethercote:shrink-Expr-slightly, r=eddyb

Shrink `hir::Expr` slightly

r? @eddyb

7 years agoRollup merge of #37574 - ollie27:cow_add, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:31 +0000 (16:49 -0700)]
Rollup merge of #37574 - ollie27:cow_add, r=alexcrichton

Fix issues with the Add/AddAssign impls for Cow<str>

* Correct the stability attributes.
* Make Add and AddAssign actually behave the same.
* Use String::with_capacity when allocating a new string.
* Fix the tests.

7 years agoRollup merge of #37569 - jseyfried:improve_expansion_perf, r=eddyb
Alex Crichton [Fri, 4 Nov 2016 23:49:31 +0000 (16:49 -0700)]
Rollup merge of #37569 - jseyfried:improve_expansion_perf, r=eddyb

macros: improve expansion performance

This PR fixes that regression, further improves performance on recursive, `tt`-heavy workloads, and makes a variety of other improvements to parsing and expansion performance.

Expansion performance improvements:

| Test case      | Run-time | Memory usage |
| -------------- | -------- | ------------ |
| libsyntax      | 8%       | 10%          |
| librustc       | 15%      | 6%           |
| librustc_trans | 30%      | 6%           |
| #37074         | 20%      | 15%          |
| #34630         | 40%      | 8%           |

r? @eddyb

7 years agoRollup merge of #37566 - brson:env, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:31 +0000 (16:49 -0700)]
Rollup merge of #37566 - brson:env, r=alexcrichton

Set RUSTC_BOOTSTRAP to some value.

Environment variables on windows can't be empty.

7 years agoRollup merge of #37565 - mglagla:peek_use_as_ref, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:31 +0000 (16:49 -0700)]
Rollup merge of #37565 - mglagla:peek_use_as_ref, r=alexcrichton

Peekable::peek(): Use Option::as_ref()

Replace the match expression in .peek() with Option::as_ref() since it's the same functionality.

7 years agoRollup merge of #37564 - Mark-Simulacrum:sized-ice, r=eddyb
Alex Crichton [Fri, 4 Nov 2016 23:49:30 +0000 (16:49 -0700)]
Rollup merge of #37564 - Mark-Simulacrum:sized-ice, r=eddyb

Fix ICE when querying DefId on Def::Err.

Also moves computations into check that `kind_id` is `Ok(_)`, which is in theory an optimization, though I expect it's minor.

Fixes #37534.

r? @eddyb.

7 years agoRollup merge of #37557 - TimNN:fix-36954, r=eddyb
Alex Crichton [Fri, 4 Nov 2016 23:49:30 +0000 (16:49 -0700)]
Rollup merge of #37557 - TimNN:fix-36954, r=eddyb

Use DefId's in const eval for cross-crate const fn's

Fixes #36954.

r? @eddyb

cc @raphaelcohn

7 years agoRollup merge of #37556 - dinfuehr:main_frame_pointer, r=eddyb
Alex Crichton [Fri, 4 Nov 2016 23:49:30 +0000 (16:49 -0700)]
Rollup merge of #37556 - dinfuehr:main_frame_pointer, r=eddyb

set frame pointer elimination attribute for main

The rustc-generated function `main` should respect the same config for
frame pointer elimination as the rest of code.

7 years agoRollup merge of #37537 - GuillaumeGomez:error_kind_doc, r=steveklabnik
Alex Crichton [Fri, 4 Nov 2016 23:49:30 +0000 (16:49 -0700)]
Rollup merge of #37537 - GuillaumeGomez:error_kind_doc, r=steveklabnik

Add missing urls for ErrorKind's variants

r? @steveklabnik

7 years agoRollup merge of #37501 - alexcrichton:windows-subsystem, r=brson
Alex Crichton [Fri, 4 Nov 2016 23:49:29 +0000 (16:49 -0700)]
Rollup merge of #37501 - alexcrichton:windows-subsystem, r=brson

rustc: Add knowledge of Windows subsystems.

This commit is an implementation of [RFC 1665] which adds support for the
`#![windows_subsystem]` attribute. This attribute allows specifying either the
"windows" or "console" subsystems on Windows to the linker.

[RFC 1665]: https://github.com/rust-lang/rfcs/blob/master/text/1665-windows-subsystem.md

Previously all Rust executables were compiled as the "console" subsystem which
meant that if you wanted a graphical application it would erroneously pop up a
console whenever opened. When compiling an application, however, this is
undesired behavior and the "windows" subsystem is used instead to have control
over user interactions.

This attribute is validated, but ignored on all non-Windows platforms.

cc #37499

7 years agoRollup merge of #37470 - arthurprs:sip-smaller, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:29 +0000 (16:49 -0700)]
Rollup merge of #37470 - arthurprs:sip-smaller, r=alexcrichton

Don't reuse RandomState seeds

cc #36481

7 years agoRollup merge of #37427 - nnethercote:opt-IchHasher, r=michaelwoerister
Alex Crichton [Fri, 4 Nov 2016 23:49:29 +0000 (16:49 -0700)]
Rollup merge of #37427 - nnethercote:opt-IchHasher, r=michaelwoerister

Reduce the number of bytes hashed by IchHasher.

IchHasher uses blake2b hashing, which is expensive, so the fewer bytes hashed
the better. There are two big ways to reduce the number of bytes hashed.
- Filenames in spans account for ~66% of all bytes (for builds with debuginfo).
  The vast majority of spans have the same filename for the start of the span
  and the end of the span, so hashing the filename just once in those cases is
  a big win.
- u32 and u64 and usize values account for ~25%--33% of all bytes (for builds
  with debuginfo). The vast majority of these are small, i.e. fit in a u8, so
  shrinking them down before hashing is also a big win.

This PR implements these two optimizations. I'm certain the first one is safe.
I'm about 90% sure that the second one is safe.

Here are measurements of the number of bytes hashed when doing
debuginfo-enabled builds of stdlib and
rustc-benchmarks/syntex-0.42.2-incr-clean.

```
                    stdlib   syntex-incr
                    ------   -----------
original       156,781,386   255,095,596
half-SawSpan   106,744,403   176,345,419
short-ints      45,890,534   118,014,227
no-SawSpan[*]    6,831,874    45,875,714

[*] don't hash the SawSpan at all. Not part of this PR, just implemented for
    comparison's sake.
```

For debug builds of syntex-0.42.2-incr-clean, the two changes give a 1--2%
speed-up.

7 years agoRollup merge of #37422 - bluss:wrapping-offset, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:29 +0000 (16:49 -0700)]
Rollup merge of #37422 - bluss:wrapping-offset, r=alexcrichton

Add .wrapping_offset() methods

.wrapping_offset() exposes the arith_offset intrinsic in the core
module (as methods on raw pointers, next to offset). This is the
first step in making it possible to stabilize the interface later.

`arith_offset` is a useful tool for developing iterators for two
reasons:
1. `arith_offset` is used by the slice's iterator, the most important
   iterator in libcore, and it is natural that Rust users need the same
   power available to implement similar iterators.
2. It is a good way to implement raw pointer iterations with step
   greater than one.

The name seems to fit the style of methods like "wrapping_add".

7 years agoAuto merge of #37470 - arthurprs:sip-smaller, r=alexcrichton
bors [Sat, 5 Nov 2016 11:32:04 +0000 (04:32 -0700)]
Auto merge of #37470 - arthurprs:sip-smaller, r=alexcrichton

Don't reuse RandomState seeds

cc #36481

7 years agoignore gdb check for android
Tim Neumann [Sat, 5 Nov 2016 09:23:55 +0000 (10:23 +0100)]
ignore gdb check for android

7 years agoAuto merge of #37427 - nnethercote:opt-IchHasher, r=michaelwoerister
bors [Sat, 5 Nov 2016 08:10:57 +0000 (01:10 -0700)]
Auto merge of #37427 - nnethercote:opt-IchHasher, r=michaelwoerister

Reduce the number of bytes hashed by IchHasher.

IchHasher uses blake2b hashing, which is expensive, so the fewer bytes hashed
the better. There are two big ways to reduce the number of bytes hashed.
- Filenames in spans account for ~66% of all bytes (for builds with debuginfo).
  The vast majority of spans have the same filename for the start of the span
  and the end of the span, so hashing the filename just once in those cases is
  a big win.
- u32 and u64 and usize values account for ~25%--33% of all bytes (for builds
  with debuginfo). The vast majority of these are small, i.e. fit in a u8, so
  shrinking them down before hashing is also a big win.

This PR implements these two optimizations. I'm certain the first one is safe.
I'm about 90% sure that the second one is safe.

Here are measurements of the number of bytes hashed when doing
debuginfo-enabled builds of stdlib and
rustc-benchmarks/syntex-0.42.2-incr-clean.

```
                    stdlib   syntex-incr
                    ------   -----------
original       156,781,386   255,095,596
half-SawSpan   106,744,403   176,345,419
short-ints      45,890,534   118,014,227
no-SawSpan[*]    6,831,874    45,875,714

[*] don't hash the SawSpan at all. Not part of this PR, just implemented for
    comparison's sake.
```

For debug builds of syntex-0.42.2-incr-clean, the two changes give a 1--2%
speed-up.

7 years agobook: Removed platform compatibility table, link to the forge
Brian Anderson [Sat, 5 Nov 2016 06:24:18 +0000 (23:24 -0700)]
book: Removed platform compatibility table, link to the forge

The content is duplicated, and it doesn't need to be in this location.
It's mostly trivia that doesn't apply to most of the audience.

The forge is up to date.

7 years agoAdd `{into,from}_raw` to Rc and Arc
Cristi Cobzarenco [Sat, 15 Oct 2016 15:32:14 +0000 (16:32 +0100)]
Add `{into,from}_raw` to Rc and Arc

7 years agoAuto merge of #37422 - bluss:wrapping-offset, r=alexcrichton
bors [Sat, 5 Nov 2016 00:48:07 +0000 (17:48 -0700)]
Auto merge of #37422 - bluss:wrapping-offset, r=alexcrichton

Add .wrapping_offset() methods

.wrapping_offset() exposes the arith_offset intrinsic in the core
module (as methods on raw pointers, next to offset). This is the
first step in making it possible to stabilize the interface later.

`arith_offset` is a useful tool for developing iterators for two
reasons:
1. `arith_offset` is used by the slice's iterator, the most important
   iterator in libcore, and it is natural that Rust users need the same
   power available to implement similar iterators.
2. It is a good way to implement raw pointer iterations with step
   greater than one.

The name seems to fit the style of methods like "wrapping_add".