]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoRollup merge of #39118 - jseyfried:token_tree_based_parser, r=nrc
Alex Crichton [Thu, 19 Jan 2017 23:49:34 +0000 (15:49 -0800)]
Rollup merge of #39118 - jseyfried:token_tree_based_parser, r=nrc

Refactor the parser to consume token trees

This is groundwork for efficiently parsing attribute proc macro invocations, bang macro invocations, and `TokenStream`-based attributes and fragment matchers.

This improves parsing performance by 8-15% and expansion performance by 0-5% on a sampling of the compiler's crates.

r? @nrc

7 years agoRollup merge of #39114 - alexcrichton:fix-osx-image, r=brson
Alex Crichton [Thu, 19 Jan 2017 23:49:33 +0000 (15:49 -0800)]
Rollup merge of #39114 - alexcrichton:fix-osx-image, r=brson

travis: Tweak OSX image configuration

Somewhere between https://travis-ci.org/rust-lang/rust/jobs/192352185 and
https://travis-ci.org/rust-lang/rust/jobs/192440181 it looks like our
configuration for a newer OSX image was lost as LLDB has reverted itself back to
350. This fix appeared to work for the libc crate so let's see if we can
configure it to work for the rust repo as well.

7 years agoRollup merge of #39112 - alexcrichton:i586-msvc, r=nikomatsakis
Alex Crichton [Thu, 19 Jan 2017 23:49:32 +0000 (15:49 -0800)]
Rollup merge of #39112 - alexcrichton:i586-msvc, r=nikomatsakis

appveyor: Test/Dist i586 MSVC

This is a target that we're shipping today, so this commit adds this matrix
entry to AppVeyor. This reuses the existing i686 MSVC matrix entry as it's
currently finishing about a half hour under two hours, which should hopefully
give it enough extra time to run this test suite.

cc #38531

7 years agoRollup merge of #39111 - alexcrichton:more-cross-targets, r=brson
Alex Crichton [Thu, 19 Jan 2017 23:49:31 +0000 (15:49 -0800)]
Rollup merge of #39111 - alexcrichton:more-cross-targets, r=brson

travis: Expand the `cross` linux image

This expands the `cross` travis matrix entry with a few more targets that our
nightlies are building:

* x86_64-rumprun-netbsd
* arm-unknown-linux-musleabi
* arm-unknown-linux-musleabihf
* armv7-unknown-linux-musleabihf
* mips-unknown-linux-musl
* mipsel-unknown-linux-musl

This commit doesn't compile custom toolchains like our current cross-image does,
but instead compiles musl manually and then compiles libunwind manually (like
x86_64) for use for the ARM targets and just uses openwrt toolchains for the
mips targets.

cc #38531

7 years agoRollup merge of #39077 - jseyfried:crate_var_imports, r=nrc
Alex Crichton [Thu, 19 Jan 2017 23:49:30 +0000 (15:49 -0800)]
Rollup merge of #39077 - jseyfried:crate_var_imports, r=nrc

Improve the warning cycle for `use $crate;`

Fixes #39049.
r? @nrc

7 years agoRollup merge of #39068 - alexcrichton:more-small-tests, r=brson
Alex Crichton [Thu, 19 Jan 2017 23:49:29 +0000 (15:49 -0800)]
Rollup merge of #39068 - alexcrichton:more-small-tests, r=brson

travis: Add i586 linux and i686 musl

This commit expands the existing x86_64-musl entry in the Travis matrix to also
build/test i586-unknown-linux-gnu and i686-unknown-linux-musl.

cc #38531
Closes #35599
Closes #39053

7 years agoRollup merge of #38966 - brson:relnotes, r=brson
Alex Crichton [Thu, 19 Jan 2017 23:49:26 +0000 (15:49 -0800)]
Rollup merge of #38966 - brson:relnotes, r=brson

1.15 release notes

[Rundered](https://github.com/brson/rust/blob/relnotes/RELEASES.md#version-1150-2017-02-02).

Lots of good stuff this release!

Perf graphs: https://goo.gl/KSVFvF, https://goo.gl/K98g8M, https://goo.gl/H1gSoz, https://goo.gl/yZBV2p, https://goo.gl/ltURbb. Not much change 😿

r? @steveklabnik

7 years agoRollup merge of #38842 - abonander:proc_macro_attribute, r=jseyfried
Alex Crichton [Thu, 19 Jan 2017 23:49:23 +0000 (15:49 -0800)]
Rollup merge of #38842 - abonander:proc_macro_attribute, r=jseyfried

Implement `#[proc_macro_attribute]`

This implements `#[proc_macro_attribute]` as described in https://github.com/rust-lang/rfcs/pull/1566

The following major (hopefully non-breaking) changes are included:

* Refactor `proc_macro::TokenStream` to use `syntax::tokenstream::TokenStream`.
    * `proc_macro::tokenstream::TokenStream` no longer emits newlines between items, this can be trivially restored if desired
    * `proc_macro::TokenStream::from_str` does not try to parse an item anymore, moved to `impl MultiItemModifier for CustomDerive` with more informative error message

* Implement `#[proc_macro_attribute]`, which expects functions of the kind `fn(TokenStream, TokenStream) -> TokenStream`
    * Reactivated `#![feature(proc_macro)]` and gated `#[proc_macro_attribute]` under it
    * `#![feature(proc_macro)]` and `#![feature(custom_attribute)]` are mutually exclusive
    * adding `#![feature(proc_macro)]` makes the expansion pass assume that any attributes that are not built-in, or introduced by existing syntax extensions, are proc-macro attributes

* Fix `feature_gate::find_lang_feature_issue()` to not use `unwrap()`

    * This change wasn't necessary for this PR, but it helped debugging a problem where I was using the wrong feature string.

* Move "completed feature gate checking" pass to after "name resolution" pass

    * This was necessary for proper feature-gating of `#[proc_macro_attribute]` invocations when the `proc_macro` feature flag isn't set.

Prototype/Litmus Test: [Implementation](https://github.com/abonander/anterofit/blob/proc_macro/service-attr/src/lib.rs#L13) -- [Usage](https://github.com/abonander/anterofit/blob/proc_macro/service-attr/examples/post_service.rs#L35)

7 years agoRollup merge of #38761 - frewsxcv:thread-sleep-formatting, r=alexcrichton
Alex Crichton [Thu, 19 Jan 2017 23:49:22 +0000 (15:49 -0800)]
Rollup merge of #38761 - frewsxcv:thread-sleep-formatting, r=alexcrichton

Add 'platform-specific' section to `sleep_ms` to match `sleep`.

None

7 years agoAuto merge of #39062 - martinhath:placement-in-binaryheap, r=nagisa
bors [Fri, 20 Jan 2017 13:31:10 +0000 (13:31 +0000)]
Auto merge of #39062 - martinhath:placement-in-binaryheap, r=nagisa

Implement placement-in protocol for `BinaryHeap`

Related to #30172, and loosley based on #38551.

At the moment, this PR is in a pretty rough state, but I wanted to get some feedback to see if I'm going in the right direction.

I hope the Mentor label of #30172 is still applicable, even though it's a year old 😄

7 years agoAuto merge of #38955 - estebank:highlighted-diags, r=nikomatsakis
bors [Fri, 20 Jan 2017 09:33:10 +0000 (09:33 +0000)]
Auto merge of #38955 - estebank:highlighted-diags, r=nikomatsakis

Teach Diagnostics to highlight text

Support styled `Diagnostic` output:

<img width="469" alt="mismatched types error with colorized types in the note" src="https://cloud.githubusercontent.com/assets/1606434/21871227/93a84198-d815-11e6-88b1-0ede3c7e28ef.png">

Closes #37532 and #38901.

r? @nikomatsakis CC @jonathandturner @nagisa @nrc

7 years agoAuto merge of #38603 - arielb1:supertrait-self-3, r=nikomatsakis
bors [Fri, 20 Jan 2017 04:55:01 +0000 (04:55 +0000)]
Auto merge of #38603 - arielb1:supertrait-self-3, r=nikomatsakis

traits with self-containing supertraits are not object safe

This should be the last time I fix this function.

Fixes #38404.

7 years agoAuto merge of #39136 - keeperofdakeys:proc-macro-doc-test, r=alexcrichton
bors [Thu, 19 Jan 2017 21:15:12 +0000 (21:15 +0000)]
Auto merge of #39136 - keeperofdakeys:proc-macro-doc-test, r=alexcrichton

Stop warning when doc testing proc macro crates

Fixes #39064

Add the test option to the session struct that is passed
to phase_2_configure_and_expand function inside the
rustdoc test module.

This prevents the warning code from triggering when
parsing proc_macro_derive attributes, just like when
`--test` is normally invoked.

This change makes the warning disappear, but I'm not sure what else it might change. So this early PR is mainly to run the test suite, and to get feedback.

7 years agoAuto merge of #38465 - japaric:msp430-interrupt, r=eddyb
bors [Thu, 19 Jan 2017 18:32:12 +0000 (18:32 +0000)]
Auto merge of #38465 - japaric:msp430-interrupt, r=eddyb

calling convention for MSP430 interrupts

This calling convention is used to define interrup handlers on MSP430 microcontrollers. Usage looks like this:

``` rust
#[no_mangle]
#[link_section = "__interrupt_vector_10"]
pub static TIM0_VECTOR: unsafe extern "msp430-interrupt" fn() = tim0;

unsafe extern "msp430-interrupt" fn tim0() {
  P1OUT.write(0x00);
}
```

which generates the following assembly:

``` asm
Disassembly of section __interrupt_vector_10:

0000fff2 <TIM0_VECTOR>:
    fff2:       10 c0           interrupt service routine at 0xc010

Disassembly of section .text:

0000c010 <_ZN3msp4tim017h3193b957fd6a4fd4E>:
    c010:       c2 43 21 00     mov.b   #0,     &0x0021 ;r3 As==00
    c014:       00 13           reti
        ...
```

7 years agoAuto merge of #39180 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Thu, 19 Jan 2017 16:09:42 +0000 (16:09 +0000)]
Auto merge of #39180 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 11 pull requests

- Successful merges: #38457, #38922, #38970, #39039, #39091, #39115, #39121, #39149, #39150, #39151, #39165
- Failed merges:

7 years agoadd cfail test for the new feature gate
Jorge Aparicio [Thu, 19 Jan 2017 13:15:05 +0000 (08:15 -0500)]
add cfail test for the new feature gate

7 years agoRollup merge of #39165 - frewsxcv:slice, r=GuillaumeGomez
Guillaume Gomez [Thu, 19 Jan 2017 10:56:12 +0000 (11:56 +0100)]
Rollup merge of #39165 - frewsxcv:slice, r=GuillaumeGomez

A few improvements to the slice docs.

* Simplify `Option::iter_mut` doc example.
* Document 'empty' corner-cases for `slice::{starts_with, ends_with}`.
* Indicate 'true' as code-like.

7 years agoRollup merge of #39151 - canndrew:feature-gate-uninhabited-references, r=brson
Guillaume Gomez [Thu, 19 Jan 2017 10:56:11 +0000 (11:56 +0100)]
Rollup merge of #39151 - canndrew:feature-gate-uninhabited-references, r=brson

Feature gate `&Void`'s uninhabitedness.

Here's a totally crazy PR which should never be merged.

7 years agoRollup merge of #39150 - birkenfeld:slice-doc, r=GuillaumeGomez
Guillaume Gomez [Thu, 19 Jan 2017 10:56:09 +0000 (11:56 +0100)]
Rollup merge of #39150 - birkenfeld:slice-doc, r=GuillaumeGomez

collections: update docs of slice get() and friends

Resubmit of #38216.

r? @GuillaumeGomez

BTW, instead of closing a PR just because it is old and the team member who offered to fix it up did not have the time to do so, why not ping them instead? (cc @alexcrichton)

7 years agoRollup merge of #39149 - circuitfox:E0122-type-def-trait-bounds-where-clause, r=arielb1
Guillaume Gomez [Thu, 19 Jan 2017 10:56:08 +0000 (11:56 +0100)]
Rollup merge of #39149 - circuitfox:E0122-type-def-trait-bounds-where-clause, r=arielb1

E0122 should apply with where clauses

Fixes #39122

7 years agoRollup merge of #39121 - grimreaper:eax/thethe, r=apasel422
Guillaume Gomez [Thu, 19 Jan 2017 10:56:06 +0000 (11:56 +0100)]
Rollup merge of #39121 - grimreaper:eax/thethe, r=apasel422

minor typo fix

None

7 years agoRollup merge of #39115 - king6cong:master, r=nikomatsakis
Guillaume Gomez [Thu, 19 Jan 2017 10:56:06 +0000 (11:56 +0100)]
Rollup merge of #39115 - king6cong:master, r=nikomatsakis

consistent doc wording

7 years agoRollup merge of #39091 - richard-imaoka:E0491-long-explanation, r=GuillaumeGomez
Guillaume Gomez [Thu, 19 Jan 2017 10:56:04 +0000 (11:56 +0100)]
Rollup merge of #39091 - richard-imaoka:E0491-long-explanation, r=GuillaumeGomez

Add error explanation for E0491

Refs #32777

Please let me know if any question or anything doesn't look right about this.

7 years agoRollup merge of #39039 - michaelwoerister:ignore-gdb-version, r=nrc
Guillaume Gomez [Thu, 19 Jan 2017 10:56:03 +0000 (11:56 +0100)]
Rollup merge of #39039 - michaelwoerister:ignore-gdb-version, r=nrc

debuginfo: Ignore optimized enum tests for GDB versions that can't handle them.

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

r? @nrc
cc @Manishearth

7 years agoRollup merge of #38970 - apasel422:may-dangle, r=pnkfelix
Guillaume Gomez [Thu, 19 Jan 2017 10:56:02 +0000 (11:56 +0100)]
Rollup merge of #38970 - apasel422:may-dangle, r=pnkfelix

Deprecate `#[unsafe_destructor_blind_to_params]`

CC #34761

r? @pnkfelix

7 years agoRollup merge of #38922 - chris-morgan:fs-markdown-link-fix, r=steveklabnik
Guillaume Gomez [Thu, 19 Jan 2017 10:56:01 +0000 (11:56 +0100)]
Rollup merge of #38922 - chris-morgan:fs-markdown-link-fix, r=steveklabnik

Fix a couple of bad Markdown links

7 years agoRollup merge of #38457 - frewsxcv:include, r=GuillaumeGomez
Guillaume Gomez [Thu, 19 Jan 2017 10:56:00 +0000 (11:56 +0100)]
Rollup merge of #38457 - frewsxcv:include, r=GuillaumeGomez

Improvements to 'include' macro documentation.

None

7 years agoAuto merge of #38464 - clarcharr:ip_cmp, r=sfackler
bors [Thu, 19 Jan 2017 03:34:05 +0000 (03:34 +0000)]
Auto merge of #38464 - clarcharr:ip_cmp, r=sfackler

PartialEq and PartialOrd between IpAddr and Ipv[46]Addr.

PartialEq was rather useful, so, I figured that I'd implement it. I added PartialOrd for good measure.

7 years agocalling convention for MSP430 interrupts
Jorge Aparicio [Mon, 19 Dec 2016 04:45:20 +0000 (23:45 -0500)]
calling convention for MSP430 interrupts

This calling convention is used to define interrup handlers on MSP430
microcontrollers. Usage looks like this:

``` rust
#[no_mangle]
#[link_section = "__interrupt_vector_10"]
pub static TIM0_VECTOR: unsafe extern "msp430-interrupt" fn() = tim0;

unsafe extern "msp430-interrupt" fn tim0() {
  P1OUT.write(0x00);
}
```

which generates the following assembly:

``` asm
Disassembly of section __interrupt_vector_10:

0000fff2 <TIM0_VECTOR>:
    fff2:       10 c0           interrupt service routine at 0xc010

Disassembly of section .text:

0000c010 <_ZN3msp4tim017h3193b957fd6a4fd4E>:
    c010:       c2 43 21 00     mov.b   #0,     &0x0021 ;r3 As==00
    c014:       00 13           reti
        ...
```

7 years agoAuto merge of #38712 - clarcharr:duration_sum, r=sfackler
bors [Thu, 19 Jan 2017 01:09:46 +0000 (01:09 +0000)]
Auto merge of #38712 - clarcharr:duration_sum, r=sfackler

Sum for Duration

Implemented the `Sum` trait for `Duration`. Seems reasonable.

7 years agoA few improvements to the slice docs.
Corey Farwell [Wed, 18 Jan 2017 02:59:26 +0000 (21:59 -0500)]
A few improvements to the slice docs.

* Simplify `Option::iter_mut` doc example.
* Document 'empty' corner-cases for `slice::{starts_with, ends_with}`.
* Indicate 'true' as code-like.

7 years agoAdd doctest to the proc-macro derive-test
Josh [Wed, 18 Jan 2017 22:31:55 +0000 (09:31 +1100)]
Add doctest to the proc-macro derive-test

7 years agoStop warning when doc testing proc macro crates
Josh [Wed, 18 Jan 2017 21:31:29 +0000 (08:31 +1100)]
Stop warning when doc testing proc macro crates

Add the actually_rustdoc option to the session that
is passed  to phase_2_configure_and_expand function
inside the rustdoc test module.

This prevents the warning code from triggering when
parsing proc_macro_derive attributes, just like when
`--test` is normally invoked.

7 years agoFeature gate `&Void`'s uninhabitedness.
Andrew Cann [Wed, 18 Jan 2017 07:05:28 +0000 (15:05 +0800)]
Feature gate `&Void`'s uninhabitedness.

References to empty types are only considered empty if feature(never_type) is
enabled.

7 years agocollections: update docs of slice get() and friends
Georg Brandl [Wed, 7 Dec 2016 09:14:46 +0000 (10:14 +0100)]
collections: update docs of slice get() and friends

for the new SliceIndex trait.  Also made the docs of the unchecked
versions a bit clearer; they return a reference, not an "unsafe
pointer".

7 years agoE0122 should apply with where clauses
Chris Stankus [Wed, 18 Jan 2017 06:16:19 +0000 (00:16 -0600)]
E0122 should apply with where clauses

7 years agoAuto merge of #38168 - estebank:help-E0034, r=nrc
bors [Wed, 18 Jan 2017 04:45:25 +0000 (04:45 +0000)]
Auto merge of #38168 - estebank:help-E0034, r=nrc

E0034: provide disambiguated syntax for candidates

For a given file

```rust
trait A { fn foo(&self) {} }
trait B : A { fn foo(&self) {} }

fn bar<T: B>(a: &T) {
  a.foo()
}
```

provide the following output

```
error[E0034]: multiple applicable items in scope
 --> file.rs:6:5
  |
6 |   a.foo(1)
  |     ^^^ multiple `foo` found
  |
note: candidate #1 is defined in the trait `A`
 --> file.rs:2:11
  |
2 | trait A { fn foo(&self, a: usize) {} }
  |           ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to use it here write `A::foo(&a, 1)` instead
 --> file.rs:6:5
  |
6 |   a.foo(1)
  |     ^^^
note: candidate #2 is defined in the trait `B`
 --> file.rs:3:15
  |
3 | trait B : A { fn foo(&self, a: usize) {} }
  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to use it here write `B::foo(&a, 1)` instead
 --> file.rs:6:5
  |
6 |   a.foo(1)
  |     ^^^
```

Fix #37767.

7 years agoAuto merge of #39019 - nikomatsakis:issue-38919, r=eddyb
bors [Wed, 18 Jan 2017 02:20:03 +0000 (02:20 +0000)]
Auto merge of #39019 - nikomatsakis:issue-38919, r=eddyb

only consider value items when searching for methods, not types

Fixes #38919

r? @eddyb

7 years agotolerate `None` return from `get_line`
Niko Matsakis [Tue, 17 Jan 2017 22:56:03 +0000 (17:56 -0500)]
tolerate `None` return from `get_line`

7 years agomore complete error message
Niko Matsakis [Tue, 17 Jan 2017 22:55:49 +0000 (17:55 -0500)]
more complete error message

7 years agoTeach Diagnostics to highlight text
Esteban Küber [Wed, 11 Jan 2017 21:55:41 +0000 (13:55 -0800)]
Teach Diagnostics to highlight text

7 years ago1.15 release notes
Brian Anderson [Tue, 10 Jan 2017 00:44:02 +0000 (00:44 +0000)]
1.15 release notes

7 years agoAuto merge of #37972 - bluss:iter-find-is-on-a-roll, r=sfackler
bors [Tue, 17 Jan 2017 21:52:03 +0000 (21:52 +0000)]
Auto merge of #37972 - bluss:iter-find-is-on-a-roll, r=sfackler

Improve the slice iterator's searching methods

Improve all, any, find, position, rposition by explicitly unrolling the loop for the slice iterators.

- Introduce a few extension methods and functions for raw pointers make the new code easy to express
- Introduce helper methods `search_while, rsearch_while` that generalize all the searching methods

LLVM doesn't unroll the loop in `.find()` by default (clang is the same), so performance benefits a lot from explicit unrolling here. An iterator method without conditional exits (like `.fold()`) does not need this on the other hand.

One of the raw pointer extension methods is `fn post_inc(&mut self) -> Self` which is the rustic equivalent of “`ptr++`”, and it is a nice way to express the raw pointer loop (see commit 3).

Specific development notes about `search_while`: I tried both computing an end pointer "rounded" to 4, as well as the `ptrdistance >= 4` loop condition, ptrdistance was better. I tried handling the last 0-3 elements unrolled or with a while loop, the loop was better.

7 years agoFix fallout in `rustdoc`.
Jeffrey Seyfried [Tue, 17 Jan 2017 04:50:46 +0000 (04:50 +0000)]
Fix fallout in `rustdoc`.

7 years agoRemove the lookahead buffer.
Jeffrey Seyfried [Sat, 14 Jan 2017 11:13:45 +0000 (11:13 +0000)]
Remove the lookahead buffer.

7 years agoFix BinaryHeap place by only constructing vec::PlaceBack once
Martin Hafskjold Thoresen [Tue, 17 Jan 2017 17:58:49 +0000 (18:58 +0100)]
Fix BinaryHeap place by only constructing vec::PlaceBack once

7 years agoAuto merge of #39109 - michaelwoerister:incr-comp-cache-cleanup, r=nikomatsakis
bors [Tue, 17 Jan 2017 18:22:20 +0000 (18:22 +0000)]
Auto merge of #39109 - michaelwoerister:incr-comp-cache-cleanup, r=nikomatsakis

incr.comp.: Delete orphaned work-products.

The new partitioning scheme uncovered a hole in our incr. comp. cache directory garbage collection. So far, we relied on unneeded work products being deleted during the initial cache invalidation phase. However, we the new scheme, we get object files/work products that only contain code from upstream crates. Sometimes this code is not needed anymore (because all callers have been removed from the source) but because nothing that actually influences the contents of these work products had changed, we never deleted them from disk.

r? @nikomatsakis

7 years agoAuto merge of #39100 - Mark-Simulacrum:fix-stage1, r=eddyb
bors [Tue, 17 Jan 2017 14:38:29 +0000 (14:38 +0000)]
Auto merge of #39100 - Mark-Simulacrum:fix-stage1, r=eddyb

Fix stage 1 tests broken because i128 doesn't work in stage 1

Broken by https://github.com/rust-lang/rust/pull/38992.

7 years agoAdd error explanation for E0491
Richard S. Imaoka [Mon, 16 Jan 2017 00:32:09 +0000 (09:32 +0900)]
Add error explanation for E0491

7 years agoAuto merge of #39110 - petrochenkov:sum, r=eddyb
bors [Tue, 17 Jan 2017 12:31:15 +0000 (12:31 +0000)]
Auto merge of #39110 - petrochenkov:sum, r=eddyb

Merge ObjectSum and PolyTraitRef in AST/HIR + some other refactoring

`ObjectSum` and `PolyTraitRef` are the same thing (list of bounds), they exist separately only due to parser quirks. The second commit merges them.

The first commit replaces `Path` with `Ty` in (not yet supported) equality predicates. They are parsed as types anyway and arbitrary types can always be disguised as paths using aliases, so this doesn't add any new functionality.

The third commit uses `Vec` instead of `P<[T]>` in AST. AST is not immutable like HIR and `Vec`s are more convenient for it, unnecessary conversions are also avoided.

The last commit renames `parse_ty_sum` (which is used for parsing types in general) into `parse_ty`, and renames `parse_ty` (which is used restricted contexts where `+` is not permitted due to operator priorities or other reasons) into `parse_ty_no_plus`.

This is the first part of https://github.com/rust-lang/rust/issues/39085#issuecomment-272743755 and https://github.com/rust-lang/rust/issues/39080 focused on data changes and mechanical renaming, I'll submit a PR with parser changes a bit later.

r? @eddyb

7 years agoAuto merge of #39095 - nagisa:fix-ub-in-testhelp, r=alexcrichton
bors [Tue, 17 Jan 2017 10:10:32 +0000 (10:10 +0000)]
Auto merge of #39095 - nagisa:fix-ub-in-testhelp, r=alexcrichton

Fix UB in test helpers

Macro expansion producing defined has undefined behavior in C/C++.

7 years agominor typo fix
Eitan Adler [Tue, 17 Jan 2017 08:18:45 +0000 (00:18 -0800)]
minor typo fix

7 years agoAvoid interpolated token trees.
Jeffrey Seyfried [Sat, 14 Jan 2017 12:42:00 +0000 (12:42 +0000)]
Avoid interpolated token trees.

7 years agoClean up `ext::tt::transcribe`.
Jeffrey Seyfried [Sat, 14 Jan 2017 12:15:26 +0000 (12:15 +0000)]
Clean up `ext::tt::transcribe`.

7 years agoRefactor the parser to consume token trees.
Jeffrey Seyfried [Fri, 13 Jan 2017 04:49:20 +0000 (04:49 +0000)]
Refactor the parser to consume token trees.

7 years agoIntroduce `string_reader.parse_all_token_trees()`.
Jeffrey Seyfried [Thu, 12 Jan 2017 23:32:00 +0000 (23:32 +0000)]
Introduce `string_reader.parse_all_token_trees()`.

7 years agoGive the `StringReader` a `sess: &ParseSess`.
Jeffrey Seyfried [Tue, 17 Jan 2017 01:14:53 +0000 (01:14 +0000)]
Give the `StringReader` a `sess: &ParseSess`.

7 years agoAuto merge of #39050 - alexcrichton:travis-nightly, r=brson
bors [Tue, 17 Jan 2017 08:01:04 +0000 (08:01 +0000)]
Auto merge of #39050 - alexcrichton:travis-nightly, r=brson

travis: Pass --release-channel=nightly on deploy

This commit passes the `--release-channel=nightly` flag to all images which have
the `DEPLOY` flag set. This means that we'll name artifacts and the compiler
appropriately.

This reworks a bit how arguments are passed, but for now doesn't change what's
already being passed. Eventually we'll want to avoid enabling debug assertions
and llvm assertions for *all* releases, but I figure we can tackle that a little
bit more down the road.

7 years agoRename ObjectSum into TraitObject in AST/HIR
Vadim Petrochenkov [Tue, 17 Jan 2017 07:41:44 +0000 (10:41 +0300)]
Rename ObjectSum into TraitObject in AST/HIR

7 years agoMove "completed feature gate checking" pass to after "name resolution" pass so proc...
Austin Bonander [Mon, 16 Jan 2017 06:58:17 +0000 (22:58 -0800)]
Move "completed feature gate checking" pass to after "name resolution" pass so proc-macro-attribute feature gate check can use resolve

7 years agoFix `feature_gate::find_lang_feature_issue()` to not use `unwrap()`
Austin Bonander [Tue, 17 Jan 2017 01:59:11 +0000 (17:59 -0800)]
Fix `feature_gate::find_lang_feature_issue()` to not use `unwrap()`

7 years agoImplement `#[proc_macro_attribute]`
Austin Bonander [Mon, 9 Jan 2017 09:31:14 +0000 (01:31 -0800)]
Implement `#[proc_macro_attribute]`

* Add support for `#[proc_macro]`

* Reactivate `proc_macro` feature and gate `#[proc_macro_attribute]` under it

* Have `#![feature(proc_macro)]` imply `#![feature(use_extern_macros)]`,
error on legacy import of proc macros via `#[macro_use]`

7 years agotravis: Pass --release-channel=nightly on deploy
Alex Crichton [Fri, 13 Jan 2017 23:35:58 +0000 (15:35 -0800)]
travis: Pass --release-channel=nightly on deploy

This commit passes the `--release-channel=nightly` flag to all images which have
the `DEPLOY` flag set. This means that we'll name artifacts and the compiler
appropriately.

This reworks a bit how arguments are passed, but for now doesn't change what's
already being passed. Eventually we'll want to avoid enabling debug assertions
and llvm assertions for *all* releases, but I figure we can tackle that a little
bit more down the road.

7 years agoAuto merge of #39090 - solson:exprkind-array, r=eddyb
bors [Tue, 17 Jan 2017 05:55:56 +0000 (05:55 +0000)]
Auto merge of #39090 - solson:exprkind-array, r=eddyb

Rename ExprKind::Vec to Array in HIR and HAIR.

This is a clearer name since they represent `[a, b, c]` array literals.

r? @eddyb

7 years agoconsistent doc wording
king6cong [Tue, 17 Jan 2017 03:32:13 +0000 (11:32 +0800)]
consistent doc wording

7 years agoAuto merge of #39087 - nrc:qquote-empty-delim, r=jseyfried
bors [Tue, 17 Jan 2017 03:29:42 +0000 (03:29 +0000)]
Auto merge of #39087 - nrc:qquote-empty-delim, r=jseyfried

proc macros/qquote: Handle empty delimited tokens

r? @jseyfried

7 years agoRemove field `tokens_consumed` of `Parser`.
Jeffrey Seyfried [Tue, 17 Jan 2017 03:14:42 +0000 (03:14 +0000)]
Remove field `tokens_consumed` of `Parser`.

7 years agotravis: Expand the `cross` linux image
Alex Crichton [Mon, 16 Jan 2017 22:15:12 +0000 (14:15 -0800)]
travis: Expand the `cross` linux image

This expands the `cross` travis matrix entry with a few more targets that our
nightlies are building:

* x86_64-rumprun-netbsd
* arm-unknown-linux-musleabi
* arm-unknown-linux-musleabihf
* armv7-unknown-linux-musleabihf
* mips-unknown-linux-musl
* mipsel-unknown-linux-musl

This commit doesn't compile custom toolchains like our current cross-image does,
but instead compiles musl manually and then compiles libunwind manually (like
x86_64) for use for the ARM targets and just uses openwrt toolchains for the
mips targets.

7 years agotravis: Tweak OSX image configuration
Alex Crichton [Tue, 17 Jan 2017 02:43:38 +0000 (18:43 -0800)]
travis: Tweak OSX image configuration

Somewhere between https://travis-ci.org/rust-lang/rust/jobs/192352185 and
https://travis-ci.org/rust-lang/rust/jobs/192440181 it looks like our
configuration for a newer OSX image was lost as LLDB has reverted itself back to
350. This fix appeared to work for the libc crate so let's see if we can
configure it to work for the rust repo as well.

7 years agoappveyor: Test/Dist i586 MSVC
Alex Crichton [Tue, 17 Jan 2017 00:49:49 +0000 (16:49 -0800)]
appveyor: Test/Dist i586 MSVC

This is a target that we're shipping today, so this commit adds this matrix
entry to AppVeyor. This reuses the existing i686 MSVC matrix entry as it's
currently finishing about a half hour under two hours, which should hopefully
give it enough extra time to run this test suite.

7 years agoAuto merge of #38949 - GuillaumeGomez:fix_linker, r=nagisa
bors [Tue, 17 Jan 2017 00:50:52 +0000 (00:50 +0000)]
Auto merge of #38949 - GuillaumeGomez:fix_linker, r=nagisa

Fix linker failure on windows

Fixes #38933.

r? @ollie27

7 years agoignore-gdb-version: Address review comments.
Michael Woerister [Mon, 16 Jan 2017 23:22:38 +0000 (18:22 -0500)]
ignore-gdb-version: Address review comments.

7 years agosyntax: Rename parse_ty -> parse_ty_no_plus, parse_ty_sum -> parse_ty
Vadim Petrochenkov [Mon, 16 Jan 2017 23:13:41 +0000 (02:13 +0300)]
syntax: Rename parse_ty -> parse_ty_no_plus, parse_ty_sum -> parse_ty

7 years agoUse resizable Vec instead of P<[T]> in AST
Vadim Petrochenkov [Mon, 16 Jan 2017 22:54:59 +0000 (01:54 +0300)]
Use resizable Vec instead of P<[T]> in AST

7 years agoincr.comp.: Delete orphaned work-products.
Michael Woerister [Mon, 16 Jan 2017 22:54:20 +0000 (17:54 -0500)]
incr.comp.: Delete orphaned work-products.

7 years agoAST/HIR: Merge ObjectSum and PolyTraitRef
Vadim Petrochenkov [Mon, 16 Jan 2017 20:33:45 +0000 (23:33 +0300)]
AST/HIR: Merge ObjectSum and PolyTraitRef

7 years agoAuto merge of #39108 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Mon, 16 Jan 2017 22:21:51 +0000 (22:21 +0000)]
Auto merge of #39108 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 6 pull requests

- Successful merges: #38247, #39028, #39065, #39084, #39105, #39106
- Failed merges:

7 years agoRollup merge of #39106 - istankovic:patch-2, r=GuillaumeGomez
Guillaume Gomez [Mon, 16 Jan 2017 21:48:26 +0000 (22:48 +0100)]
Rollup merge of #39106 - istankovic:patch-2, r=GuillaumeGomez

libcollections: btree/set: fix a typo

7 years agoRollup merge of #39105 - istankovic:patch-1, r=sfackler
Guillaume Gomez [Mon, 16 Jan 2017 21:48:25 +0000 (22:48 +0100)]
Rollup merge of #39105 - istankovic:patch-1, r=sfackler

libcollections: btree/map: fix typos

7 years agoRollup merge of #39084 - sphela:book-update-patterns, r=steveklabnik
Guillaume Gomez [Mon, 16 Jan 2017 21:48:24 +0000 (22:48 +0100)]
Rollup merge of #39084 - sphela:book-update-patterns, r=steveklabnik

An update to patterns documentation

As it is written the current pattern page creates a lot of confusion, even for someone with previous rust experience. It's so hard because it introduces an entirely new language feature without explaining. Someone could update it within the span of a few minutes by just explaining the newly introduced feature.

```rust
match c {
    x => println!("x: {} c: {}", x, c),
}
```
No where in the book up to this point has it explained that identifiers match patterns with just a name create an irrefutable pattern. The page uses this feature without explanation, it just assumes that readers would immediately understand it. To confuse the issue even further the topic uses this feature to explain shadowing, placing two x's from different scopes and different meanings without ever explaining why there is shadowing.

What follows comes across as utterly nonsensical given everything the reader would know about Rust about this point:

```rust
the result:
x: c c: c
x: x
```

x is c? What? Yes even if you understand that x here is not the x in the previous scope why would x equal 'c' here? What previous chapter explained this? The previous chapter on 'matching' only mentions the catch all '_' and never in any shape or form mentioned that a name here creates an irrefutable pattern and binds a value.

There are numerous examples of people not understanding this section, not finding answers and looking for them online about `x: c c: c`:

https://github.com/rust-lang/book/issues/316

https://stackoverflow.com/questions/35563141/match-shadowing-example-in-the-patterns-section-of-the-rust-book-is-very-perplex

https://users.rust-lang.org/t/confusion-about-match-and-patterns/3937

https://www.bountysource.com/issues/38852461-question-on-patterns-section-shadowing-example-existing-book

And a [google search for `rust x: c c: c`](https://www.google.com/search?q=rust+%22x:+c+c:+c%22) finds many more people being tripped up, including people who speak a language other than English. I am confident that this page has resulted in questions on the irc channel more than once. Given rust already has a pretty big learning curve I recommend this be fixed.

I was asked to create PR from where I made this same case in the [rust book repository issue](https://github.com/rust-lang/book/issues/316) (I didn't realize this was a separate project).

7 years agoRollup merge of #39065 - frewsxcv:libstd-os-unix-ffi-docs, r=GuillaumeGomez
Guillaume Gomez [Mon, 16 Jan 2017 21:48:23 +0000 (22:48 +0100)]
Rollup merge of #39065 - frewsxcv:libstd-os-unix-ffi-docs, r=GuillaumeGomez

Add doc examples & description in `std::os::unix::ffi`.

None

7 years agoRollup merge of #39028 - frewsxcv:libstd-env-docs, r=brson
Guillaume Gomez [Mon, 16 Jan 2017 21:48:22 +0000 (22:48 +0100)]
Rollup merge of #39028 - frewsxcv:libstd-env-docs, r=brson

Minor improvements to docs in std::env structures/functions.

* Call functions "functions" instead of "methods".
* Link structures to their constructor functions
* Add other misc. documentation links

7 years agoRollup merge of #38247 - federicomenaquintero:assert-eq-argument-docs, r=GuillaumeGomez
Guillaume Gomez [Mon, 16 Jan 2017 21:48:21 +0000 (22:48 +0100)]
Rollup merge of #38247 - federicomenaquintero:assert-eq-argument-docs, r=GuillaumeGomez

Document the optional extra arguments to assert_eq!() / assert_ne!()

And clarify that those arguments in assert!() are in fact formattable.

7 years agolibcollections: btree/set: fix a typo
Ivan Stankovic [Mon, 16 Jan 2017 20:26:43 +0000 (21:26 +0100)]
libcollections: btree/set: fix a typo

7 years agolibcollections: btree/map: fix typos
Ivan Stankovic [Mon, 16 Jan 2017 20:24:18 +0000 (21:24 +0100)]
libcollections: btree/map: fix typos

7 years agoAuto merge of #39094 - nagisa:i128-fix-endianness, r=eddyb
bors [Mon, 16 Jan 2017 20:23:09 +0000 (20:23 +0000)]
Auto merge of #39094 - nagisa:i128-fix-endianness, r=eddyb

(Shot at) Fix endian bugs in i128 intrinsic impls

Attempt to fix the endianness issues on big-endian machines such as power pc. Could not test if it actually makes stuff work on the powerpc, because setting up cross-compiler for ppc seems to be nigh-impossible on arch.

7 years agoFix stage 0 and 1 tests broken because i128 doesn't work in stages less than 2
Mark Simulacrum [Mon, 16 Jan 2017 16:47:05 +0000 (09:47 -0700)]
Fix stage 0 and 1 tests broken because i128 doesn't work in stages less than 2

Broken by https://github.com/rust-lang/rust/pull/38992.

7 years agoAST/HIR: Replace Path with Type in WhereEqPredicate
Vadim Petrochenkov [Mon, 16 Jan 2017 18:32:13 +0000 (21:32 +0300)]
AST/HIR: Replace Path with Type in WhereEqPredicate

7 years agoAuto merge of #39102 - alexcrichton:netbsd-mirror, r=alexcrichton
bors [Mon, 16 Jan 2017 18:08:59 +0000 (18:08 +0000)]
Auto merge of #39102 - alexcrichton:netbsd-mirror, r=alexcrichton

travis: Mirror some NetBSD artifacts

This mirrors a few artifacts that have been flaky to download recently
on our own S3 bucket, which has historically been more reliable.

Closes #39097

7 years agotravis: Mirror some NetBSD artifacts
Alex Crichton [Mon, 16 Jan 2017 18:06:54 +0000 (10:06 -0800)]
travis: Mirror some NetBSD artifacts

This mirrors a few artifacts that have been flaky to download recently
on our own S3 bucket, which has historically been more reliable.

Closes #39097

7 years agoAuto merge of #39076 - ollie27:rustdoc_stab_prim, r=GuillaumeGomez
bors [Mon, 16 Jan 2017 13:22:29 +0000 (13:22 +0000)]
Auto merge of #39076 - ollie27:rustdoc_stab_prim, r=GuillaumeGomez

rustdoc: Give primitive types stability attributes

This is especially important for i128/u128 to make it clear they are
unstable in the docs.

7 years agoAuto merge of #39072 - radix:patch-1, r=GuillaumeGomez
bors [Mon, 16 Jan 2017 11:17:34 +0000 (11:17 +0000)]
Auto merge of #39072 - radix:patch-1, r=GuillaumeGomez

Minor improvement to strange grammar in E0525

Hi, I just ran into this error from rustc, and it had some strange grammar, so I cleaned it up a bit.

7 years agoFix UB in test helpers
Simonas Kazlauskas [Mon, 16 Jan 2017 09:46:00 +0000 (11:46 +0200)]
Fix UB in test helpers

Macro expansion producing defined has undefined behavior in C/C++.

7 years agoFix endian bugs in i128 intrinsic impls
Simonas Kazlauskas [Mon, 16 Jan 2017 09:32:38 +0000 (11:32 +0200)]
Fix endian bugs in i128 intrinsic impls

7 years agoAuto merge of #39071 - est31:master, r=GuillaumeGomez
bors [Mon, 16 Jan 2017 09:16:44 +0000 (09:16 +0000)]
Auto merge of #39071 - est31:master, r=GuillaumeGomez

Mark safe_suggestion and pushpop_unsafe as removed in feature_gate.rs

This removes two features from feature_gate.rs: `safe_suggestion` and `pushpop_unsafe`. Both had been removed in other places already, but were forgotten to be removed from feature_gate.rs.

* `safe_suggestion` was added in commit 164f0105bb65f31b89e5fb7f368c9e6f5833a3f8 and then removed again in commit c11fe553df269d6f47b4c48f5c47c08efdd373dc both in the same PR #38099.

* `pushpop_unsafe` was added in commit 1829fa5199bae5a192c771807c532badce14be37 and removed again in commit d399098fd82e0bf3ed61bbbbcdbb0b6adfa4c808

Removes two elements from the whitelist of non gate tested unstable lang features (issue #39059).

7 years agoRename ExprKind::Vec to Array in HIR and HAIR.
Scott Olson [Mon, 16 Jan 2017 07:36:10 +0000 (23:36 -0800)]
Rename ExprKind::Vec to Array in HIR and HAIR.

This is a clearer name since they represent [a, b, c] array literals.

7 years agoAuto merge of #39069 - GuillaumeGomez:missing_blank_space, r=Manishearth
bors [Mon, 16 Jan 2017 07:18:48 +0000 (07:18 +0000)]
Auto merge of #39069 - GuillaumeGomez:missing_blank_space, r=Manishearth

Fix missing blank space issue

r? @Manishearth

7 years agoRefactor `proc_macro::TokenStream` to use `syntax::tokenstream::TokenStream`; fix...
Austin Bonander [Sun, 8 Jan 2017 05:04:49 +0000 (21:04 -0800)]
Refactor `proc_macro::TokenStream` to use `syntax::tokenstream::TokenStream`; fix tests for changed semantics

7 years agoAuto merge of #38806 - comex:lint-attr-fix, r=nrc
bors [Mon, 16 Jan 2017 05:17:39 +0000 (05:17 +0000)]
Auto merge of #38806 - comex:lint-attr-fix, r=nrc

Fix lint attributes on non-item nodes.

Currently, late lint checking uses two HIR visitors: LateContext and
IdVisitor.  IdVisitor only overrides visit_id, and for each node searches
for builtin lints previously added to the session; LateContext overrides
a number of methods, and runs late lints.  When LateContext encounters an
item, it first has IdVisitor walk everything in it except nested items
(OnlyBodies), then recurses into it itself - i.e. there are two separate
walks.

Aside from apparently being unnecessary, this separation prevents lint
attributes (allow/deny/warn) on non-item HIR nodes from working
properly.  Test case:

```rust
// generates warning without this change
fn main() { #[allow(unreachable_code)] loop { break; break; } }
```

LateContext contains logic to merge attributes seen into the current lint
settings while walking (with_lint_attrs), but IdVisitor does not.  So
such attributes will affect late lints (because they are called from
LateContext), and if the node contains any items within it, they will
affect builtin lints within those items (because that IdVisitor is run
while LateContext is within the attributed node), but otherwise the
attributes will be ignored for builtin lints.

This change simply removes IdVisitor and moves its visit_id into
LateContext itself.  Hopefully this doesn't break anything...

Also added walk calls to visit_lifetime and visit_lifetime_def
respectively, so visit_lifetime_def will recurse into the lifetime and
visit_lifetime will recurse into the name.  In principle this could
confuse lint plugins.  This is "necessary" because walk_lifetime calls
visit_id on the lifetime; of course, an alternative would be directly
calling visit_id (which would require manually iterating over the
lifetimes in visit_lifetime_def), but that seems less clean.

7 years agotravis: Add i586 linux and i686 musl
Alex Crichton [Sat, 14 Jan 2017 00:22:47 +0000 (16:22 -0800)]
travis: Add i586 linux and i686 musl

This commit expands the existing x86_64-musl entry in the Travis matrix to also
build/test i586-unknown-linux-gnu and i686-unknown-linux-musl.

cc #38531
Closes #39053