]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoICH: Add test case for call expressions.
Michael Woerister [Thu, 10 Nov 2016 16:55:31 +0000 (11:55 -0500)]
ICH: Add test case for call expressions.

7 years agoAuto merge of #37463 - jseyfried:refactor_macro_reexports, r=nrc
bors [Thu, 10 Nov 2016 10:05:45 +0000 (02:05 -0800)]
Auto merge of #37463 - jseyfried:refactor_macro_reexports, r=nrc

macros: improve reexports

This PR
- avoids building multiple module graphs for a crate that is referenced by multiple `extern crate` items,
- registers `#[no_link] extern crate`s to avoid loading the same crate metadata twice,
- stability checks `#[no_link] extern crate`s,
  - [breaking-chage]: `#[no_link] #[macro_use] extern crate syntax;` is allowed on stable today
- fixes `$crate` in `#[macro_reexport]`ed macros,
  - [breaking-change] for `#[feature(macro_reexport)]` (technically)
- allows selective macro importing (i.e. `#[macro_use(foo, bar)]`) from custom derive crates, and
- refactors the crate metadata to support re-exported macros in arbitrary modules (not yet needed).

r? @nrc

7 years agoFix fallout in `librustdoc`.
Jeffrey Seyfried [Sat, 29 Oct 2016 07:31:07 +0000 (07:31 +0000)]
Fix fallout in `librustdoc`.

7 years agoImprove macro reexports.
Jeffrey Seyfried [Fri, 28 Oct 2016 06:52:45 +0000 (06:52 +0000)]
Improve macro reexports.

7 years agoAdd variants `Def::Macro` and `Namespace::MacroNS`.
Jeffrey Seyfried [Tue, 25 Oct 2016 22:05:02 +0000 (22:05 +0000)]
Add variants `Def::Macro` and `Namespace::MacroNS`.

7 years agoRegister and stability check `#[no_link]` crates.
Jeffrey Seyfried [Fri, 28 Oct 2016 05:56:06 +0000 (05:56 +0000)]
Register and stability check `#[no_link]` crates.

7 years agoRefactor `explicitly_linked: bool` -> `dep_kind: DepKind`.
Jeffrey Seyfried [Thu, 27 Oct 2016 09:18:45 +0000 (09:18 +0000)]
Refactor `explicitly_linked: bool` -> `dep_kind: DepKind`.

7 years agoClean up `CrateSource`.
Jeffrey Seyfried [Thu, 27 Oct 2016 05:03:11 +0000 (05:03 +0000)]
Clean up `CrateSource`.

7 years agoAvoid building multiple reduced graphs for a crate
Jeffrey Seyfried [Fri, 28 Oct 2016 05:17:06 +0000 (05:17 +0000)]
Avoid building multiple reduced graphs for a crate
that is referenced by multiple `extern crate` items.

7 years agoAuto merge of #37680 - tshepang:typo, r=alexcrichton
bors [Thu, 10 Nov 2016 06:43:19 +0000 (22:43 -0800)]
Auto merge of #37680 - tshepang:typo, r=alexcrichton

doc: fix typo

7 years agoTreat `extern crate`s more like imports (pure refactoring).
Jeffrey Seyfried [Fri, 28 Oct 2016 03:40:58 +0000 (03:40 +0000)]
Treat `extern crate`s more like imports (pure refactoring).

7 years agonit: clean up some redundant code.
Jeffrey Seyfried [Wed, 26 Oct 2016 05:45:19 +0000 (05:45 +0000)]
nit: clean up some redundant code.

7 years agodoc: fix typos
Tshepang Lekhonkhobe [Thu, 10 Nov 2016 03:15:56 +0000 (05:15 +0200)]
doc: fix typos

7 years agoAuto merge of #37678 - eddyb:rollup, r=eddyb
bors [Thu, 10 Nov 2016 02:22:47 +0000 (18:22 -0800)]
Auto merge of #37678 - eddyb:rollup, r=eddyb

Rollup of 5 pull requests

- Successful merges: #37402, #37412, #37661, #37664, #37667
- Failed merges:

7 years agoRollup merge of #37667 - alexcrichton:fix-llvm-version, r=japaric
Eduard-Mihai Burtescu [Thu, 10 Nov 2016 01:46:29 +0000 (03:46 +0200)]
Rollup merge of #37667 - alexcrichton:fix-llvm-version, r=japaric

rustc_llvm: Require 3.9 for --link-static

Apparently stock Ubuntu 16.04 includes LLVM 3.8 which doesn't have this flag.

7 years agoRollup merge of #37664 - est31:master, r=nrc
Eduard-Mihai Burtescu [Thu, 10 Nov 2016 01:46:28 +0000 (03:46 +0200)]
Rollup merge of #37664 - est31:master, r=nrc

Document the question mark operator in reference and the book's syntax index

The question mark operator will be stabilized for the Rust 1.13 release (unfortunately). Even though I don't like the operator, it still should be documented in the syntax index in the book and in the reference.

Maybe there are people who also want to change the book's chapters on error handling, depending on their views of what idiomatic error handling is, now that the operator is stable, but I don't want to and I'd prefer to keep this PR focused on the reference and syntax index only.

Please also apply this PR to the beta branch of rust.

7 years agoRollup merge of #37661 - brson:qmarkstab, r=nikomatsakis
Eduard-Mihai Burtescu [Thu, 10 Nov 2016 01:46:28 +0000 (03:46 +0200)]
Rollup merge of #37661 - brson:qmarkstab, r=nikomatsakis

question_mark was stabilized in 1.13

7 years agoRollup merge of #37412 - eddyb:lazy-6, r=nikomatsakis
Eduard-Mihai Burtescu [Thu, 10 Nov 2016 01:46:28 +0000 (03:46 +0200)]
Rollup merge of #37412 - eddyb:lazy-6, r=nikomatsakis

[6/n] rustc: transition HIR function bodies from Block to Expr.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37408) | [next](https://github.com/rust-lang/rust/pull/37676)) 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>

The main change here is that functions and closures both use `Expr` instead of `Block` for their bodies.
For closures this actually allows a honest representation of brace-less closure bodies, e.g. `|x| x + 1` is now distinguishable from `|x| { x + 1 }`, therefore this PR is `[syntax-breaking]` (cc @Manishearth).

Using `Expr` allows more logic to be shared between constant bodies and function bodies, with some small such changes already part of this PR, and eventually easing #35078 and per-body type tables.

Incidentally, there used to be some corners cut here and there and as such I had to (re)write divergence tracking for type-checking so that it is capable of understanding basic structured control-flow:

``` rust
fn a(x: bool) -> i32 {
    // match also works (as long as all arms diverge)
    if x { panic!("true") } else { return 1; }
    0 // "unreachable expression" after this PR
}
```

And since liveness' "not all control paths return a value" moved to type-checking we can have nice things:

``` rust
// before & after:
fn b() -> i32 { 0; } // help: consider removing this semicolon

// only after this PR
fn c() -> i32 { { 0; } } // help: consider removing this semicolon
fn d() { let x: i32 = { 0; }; } // help: consider removing this semicolon
fn e() { f({ 0; }); } // help: consider removing this semicolon
```

7 years agoRollup merge of #37402 - eddyb:lazy-3, r=nikomatsakis
Eduard-Mihai Burtescu [Thu, 10 Nov 2016 01:46:27 +0000 (03:46 +0200)]
Rollup merge of #37402 - eddyb:lazy-3, r=nikomatsakis

[3/n] rustc: unify and simplify managing associated items.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37401) | [next](https://github.com/rust-lang/rust/pull/37404)) 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>

`ImplOrTraitItem`/`impl_or_trait_item` have been renamed to `AssociatedItem`/`associated_item`.

The common fields from (what used to be) `ty::ImplOrTraitItem`'s variants have been pulled out, leaving only an `AssociatedKind` C-like enum to distinguish between methods, constants and types.

The type information has been removed from `AssociatedItem`, and as such the latter can now be computed on-demand from the local HIR map, i.e. an extern-crate-enabled `TraitItem | ImplItem`.
It may be moved to HIR in the future, if we intend to start using HIR types cross-crate.

`ty::ExplicitSelfCategory` has been moved to `rustc_typeck` and is produced on-demand from the signature of the method, and a `method_has_self_argument` field on `AssociatedItem`, which is used to indicate that the first argument is a sugary "method receiver" and as such, method call syntax can be used.

7 years agorustc: unify and simplify managing associated items.
Eduard Burtescu [Thu, 10 Nov 2016 00:06:34 +0000 (02:06 +0200)]
rustc: unify and simplify managing associated items.

7 years agotests: fix fallout in pretty-printing output exact-match tests.
Eduard Burtescu [Wed, 26 Oct 2016 07:43:34 +0000 (10:43 +0300)]
tests: fix fallout in pretty-printing output exact-match tests.

7 years agotests: fix fallout in flowgraph graphviz comparison dot files.
Eduard Burtescu [Wed, 26 Oct 2016 04:39:04 +0000 (07:39 +0300)]
tests: fix fallout in flowgraph graphviz comparison dot files.

7 years agorustc_typeck: correctly track "always-diverges" and "has-type-errors".
Eduard Burtescu [Tue, 25 Oct 2016 23:28:20 +0000 (02:28 +0300)]
rustc_typeck: correctly track "always-diverges" and "has-type-errors".

7 years agorustc: use an Expr instead of a Block for function bodies.
Eduard Burtescu [Tue, 25 Oct 2016 23:27:14 +0000 (02:27 +0300)]
rustc: use an Expr instead of a Block for function bodies.

7 years agosyntax: don't fake a block around closures' bodies during parsing.
Eduard Burtescu [Tue, 25 Oct 2016 23:17:29 +0000 (02:17 +0300)]
syntax: don't fake a block around closures' bodies during parsing.

7 years agoAuto merge of #37603 - arielb1:max-slice-length, r=nikomatsakis
bors [Wed, 9 Nov 2016 23:13:58 +0000 (15:13 -0800)]
Auto merge of #37603 - arielb1:max-slice-length, r=nikomatsakis

_match: correct max_slice_length logic

The logic used to be wildly wrong, but before the HAIR patch its wrongness was in most cases hidden by another bug.

Fixes #37598.

r? @nikomatsakis

7 years agoAuto merge of #37670 - eddyb:rollup, r=eddyb
bors [Wed, 9 Nov 2016 19:58:25 +0000 (11:58 -0800)]
Auto merge of #37670 - eddyb:rollup, r=eddyb

Rollup of 15 pull requests

- Successful merges: #36868, #37134, #37229, #37250, #37370, #37428, #37432, #37472, #37524, #37614, #37622, #37627, #37636, #37644, #37654
- Failed merges: #37463, #37542, #37645

7 years agoRollup merge of #37654 - michaelwoerister:test-let-ich, r=nikomatsakis
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:19 +0000 (20:51 +0200)]
Rollup merge of #37654 - michaelwoerister:test-let-ich, r=nikomatsakis

ICH: Add tests for let- and match-expressions.

r? @nikomatsakis

7 years agoRollup merge of #37644 - nrc:save-derive-span, r=eddyb
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:19 +0000 (20:51 +0200)]
Rollup merge of #37644 - nrc:save-derive-span, r=eddyb

save-analysis: don't choke on stripped doc attributes

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 agorustc_llvm: Require 3.9 for --link-static
Alex Crichton [Wed, 9 Nov 2016 17:12:38 +0000 (09:12 -0800)]
rustc_llvm: Require 3.9 for --link-static

Apparently stock Ubuntu 16.04 includes LLVM 3.8 which doesn't have this flag.

7 years agoAuto merge of #36520 - estebank:dataless-enum, r=brson
bors [Wed, 9 Nov 2016 16:51:23 +0000 (08:51 -0800)]
Auto merge of #36520 - estebank:dataless-enum, r=brson

Reword error when data-less enum variant called as function

Given a file like:

``` rust
enum Test {
    Variant,
    Variant2 {a: u32},
}

fn main(){
    let x = Test::Variant("Hello");
    let y = Test::Variant2("World");
}
```

Both errors now look similar:

``` bash
error[E0423]: `Test::Variant2` is the name of a struct or struct variant, but this expression uses it like a function name
  --> file3.rs:10:13
   |
10 |     let y = Test::Variant2("Hello");
   |             ^^^^^^^^^^^^^^ struct called like a function
   |
   = help: did you mean to write: `Test::Variant2 { /* fields */ }`?

error: `Test::Variant` is the name of a data-less enum, but this expression uses it like a function name
 --> file3.rs:9:13
  |
9 |     let x = Test::Variant("World");
  |             ^^^^^^^^^^^^^^^^^^^^^^ data-less enum called like a function
  |
  = help: did you mean to write: `Test::Variant`?
note: defined here
 --> file3.rs:2:5
  |
2 |     Variant,
  |     ^^^^^^^

error: aborting due to previous error
```

Re: #28533

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 agoDocument the question mark operator
est31 [Wed, 9 Nov 2016 06:23:57 +0000 (07:23 +0100)]
Document the question mark operator

7 years agoquestion_mark was stabilized in 1.13
Brian Anderson [Wed, 9 Nov 2016 02:35:36 +0000 (02:35 +0000)]
question_mark was stabilized in 1.13

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 agoICH: Add test case for match-expressions
Michael Woerister [Tue, 8 Nov 2016 20:41:53 +0000 (15:41 -0500)]
ICH: Add test case for match-expressions

7 years agoICH: Add test case for let-expressions.
Michael Woerister [Tue, 8 Nov 2016 20:01:14 +0000 (15:01 -0500)]
ICH: Add test case for let-expressions.

7 years agoadd more comment
Ariel Ben-Yehuda [Tue, 8 Nov 2016 20:55:57 +0000 (22:55 +0200)]
add more comment

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 agosave-analysis: don't choke on stripped doc attributes
Nick Cameron [Tue, 8 Nov 2016 02:28:00 +0000 (15:28 +1300)]
save-analysis: don't choke on stripped doc attributes

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.