]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoRollup merge of #49229 - Centril:doc/format_args_display_debug, r=steveklabnik
kennytm [Sat, 24 Mar 2018 17:26:37 +0000 (01:26 +0800)]
Rollup merge of #49229 - Centril:doc/format_args_display_debug, r=steveklabnik

Document format_args! / Arguments<'a> behavior wrt. Display and Debug

This is a follow up PR to #49067 , this documents the behavior of `format_args!` (i.e: `Argument<'a>`) wrt. `Display` and `Debug`.

r? @steveklabnik

6 years agoRollup merge of #49203 - Eijebong:lets-cleanup-dependencies, r=Mark-Simulacrum
kennytm [Sat, 24 Mar 2018 17:26:36 +0000 (01:26 +0800)]
Rollup merge of #49203 - Eijebong:lets-cleanup-dependencies, r=Mark-Simulacrum

Bump racer and home

This removes 10 dependencies from the build :tada:

6 years agoRollup merge of #49194 - Zoxc:unsafe-generator, r=cramertj
kennytm [Sat, 24 Mar 2018 17:26:34 +0000 (01:26 +0800)]
Rollup merge of #49194 - Zoxc:unsafe-generator, r=cramertj

Make resuming generators unsafe instead of the creation of immovable generators

cc @withoutboats

Fixes #47787

6 years agoRollup merge of #49193 - davidtwco:issue-29893, r=alexcrichton
kennytm [Sat, 24 Mar 2018 17:26:33 +0000 (01:26 +0800)]
Rollup merge of #49193 - davidtwco:issue-29893, r=alexcrichton

Host compiler documentation

Fixes #29893. Rust Central Station PR: rust-lang/rust-central-station#40

r? @alexcrichton

6 years agoRollup merge of #49162 - tmandry:stabilize-termination-trait, r=nikomatsakis
kennytm [Sat, 24 Mar 2018 17:26:32 +0000 (01:26 +0800)]
Rollup merge of #49162 - tmandry:stabilize-termination-trait, r=nikomatsakis

Stabilize termination_trait, split out termination_trait_test

For #48453.

First time contribution, so I'd really appreciate any feedback on how this PR can be better.

Not sure exactly what kind of documentation update is needed. If there is no PR to update the reference, I can try doing that this week as I have time.

6 years agoRollup merge of #49122 - scottmcm:z-align-attr, r=cramertj
kennytm [Sat, 24 Mar 2018 17:26:30 +0000 (01:26 +0800)]
Rollup merge of #49122 - scottmcm:z-align-attr, r=cramertj

Add a -Z flag for LLVM align attributes on arguments

LLVM seems to still put the assume calls in when inlining, so this probably isn't in a place where it can be turned on by default, but it's interesting to experiment with.

For example, this makes `mem::swap::<u64x8>` be 8x `vmovaps ymm` instead of 16x `vmovups xmm`, on my cpu.

6 years agoRollup merge of #49121 - varkor:stabilise-from_utf8_error_as_bytes, r=bluss
kennytm [Sat, 24 Mar 2018 17:26:29 +0000 (01:26 +0800)]
Rollup merge of #49121 - varkor:stabilise-from_utf8_error_as_bytes, r=bluss

Stabilise FromUtf8Error::as_bytes

Closes #40895.

6 years agoRollup merge of #49120 - Zoxc:parallel-ci, r=alexcrichton
kennytm [Sat, 24 Mar 2018 17:26:28 +0000 (01:26 +0800)]
Rollup merge of #49120 - Zoxc:parallel-ci, r=alexcrichton

 Add a CI job for parallel rustc using x.py check

r? @alexcrichton

6 years agoRollup merge of #49089 - alexcrichton:fix-timings, r=Mark-Simulacrum
kennytm [Sat, 24 Mar 2018 17:26:27 +0000 (01:26 +0800)]
Rollup merge of #49089 - alexcrichton:fix-timings, r=Mark-Simulacrum

rustbuild: Tweak where timing information goes

This commit tweaks where timing and step information is printed out as part of
the build, ensuring that we do it as close to the location where work happens as
possible. In rustbuild various functions may perform long blocking work as
dependencies are assembled, so if we print out timing information early on we
may accidentally time more than just the step we were intending to time!

6 years agoRollup merge of #49076 - bobdavelisafrank:filetype-metadata-docfix, r=bluss
kennytm [Sat, 24 Mar 2018 17:26:25 +0000 (01:26 +0800)]
Rollup merge of #49076 - bobdavelisafrank:filetype-metadata-docfix, r=bluss

Fix Issue #48345, is_file, is_dir, and is_symlink note mutual exclusion

The methods on the structures `fs::FileType` and `fs::Metadata` of (respectively) `is_file`, `is_dir`, and `is_symlink` had some ambiguity in documentation, where it was not noted whether files will pass those tests exclusively or not. It is now written that the tests are mutually exclusive.

Fixes #48345.

6 years agoRollup merge of #49046 - Zoxc:error-summary, r=michaelwoerister
kennytm [Sat, 24 Mar 2018 17:26:24 +0000 (01:26 +0800)]
Rollup merge of #49046 - Zoxc:error-summary, r=michaelwoerister

Always print `aborting due to n previous error(s)`

r? @michaelwoerister

6 years agoAuto merge of #49251 - nikomatsakis:issue-15872-elision-impl-header, r=cramertj
bors [Sat, 24 Mar 2018 13:23:17 +0000 (13:23 +0000)]
Auto merge of #49251 - nikomatsakis:issue-15872-elision-impl-header, r=cramertj

support elision in impl headers

You can now do things like:

```
impl MyTrait<'_> for &u32 { ... }
```

Each `'_` or elided lifetime is a fresh parameter. `'_` and elision are still not permitted in associated type values. (Plausibly we could support that if there is a single input lifetime.) The original lifetime elision RFC was a bit unclear on this point: [as documented here, I think this is the correct interpretation, both because it fits existing impls and it's most analogous to the behavior in fns](https://github.com/rust-lang/rust/issues/15872#issuecomment-338700138).

We do not support elision with deprecated forms:

```
impl MyTrait for std::cell::Ref<u32> { } // ERROR
```

Builds on the in-band lifetime stuff.

r? @cramertj

Fixes #15872

6 years agoAuto merge of #48552 - kennytm:lower-unstable-priority, r=nikomatsakis
bors [Sat, 24 Mar 2018 04:43:24 +0000 (04:43 +0000)]
Auto merge of #48552 - kennytm:lower-unstable-priority, r=nikomatsakis

Lower the priority of unstable methods when picking a candidate.

Previously, when searching for the impl of a method, we do not consider the stability of the impl. This leads to lots of insta-inference-regressions due to method ambiguity when a popular name is chosen. This has happened multiple times in Rust's history e.g.

* `f64::from_bits` #40470
* `Ord::{min, max}` #42496
* `Ord::clamp` #44095 (eventually got reverted due to these breakages)
* `Iterator::flatten` #48115 (recently added)

This PR changes the probing order so that unstable items are considered last. If a stable item is found, the unstable items will not be considered (but a future-incompatible warning will still be emitted), thus allowing stable code continue to function without using qualified names.

Once the unstable feature is stabilized, the ambiguity error will still be emitted, but the user can also use newly stable std methods, while the current situation is that downstream user is forced to update the code without any immediate benefit.

(I hope that we could bring back `Ord::clamp` if this PR is merged.)

6 years agoAuto merge of #48482 - davidtwco:issue-47184, r=nikomatsakis
bors [Sat, 24 Mar 2018 02:08:22 +0000 (02:08 +0000)]
Auto merge of #48482 - davidtwco:issue-47184, r=nikomatsakis

NLL should identify and respect the lifetime annotations that the user wrote

Part of #47184.

r? @nikomatsakis

6 years agoAuto merge of #49311 - SimonSapin:bootstrap-vs-rustflags-the-return, r=Mark-Simulacrum
bors [Fri, 23 Mar 2018 23:08:13 +0000 (23:08 +0000)]
Auto merge of #49311 - SimonSapin:bootstrap-vs-rustflags-the-return, r=Mark-Simulacrum

Use the same RUSTFLAGS for building and testing `bootstrap`

This avoids recompiling the whole dependency graph twice for every `./x.py test` run.

Fixes #49215

6 years agoTrack IsSuggestion in ProbeContext. Don't warn stability for suggestions.
kennytm [Fri, 23 Mar 2018 18:32:20 +0000 (02:32 +0800)]
Track IsSuggestion in ProbeContext. Don't warn stability for suggestions.

6 years agoFiled a proper tracking issue.
kennytm [Sat, 10 Mar 2018 17:58:57 +0000 (01:58 +0800)]
Filed a proper tracking issue.

6 years agoSpecialize future-incompatibility warning for UNSTABLE_NAME_COLLISION.
kennytm [Sat, 3 Mar 2018 11:27:49 +0000 (19:27 +0800)]
Specialize future-incompatibility warning for UNSTABLE_NAME_COLLISION.

6 years agoChanged `check_stability` to take an `Option<NodeId>` instead of `NodeId`.
kennytm [Sat, 3 Mar 2018 09:02:01 +0000 (17:02 +0800)]
Changed `check_stability` to take an `Option<NodeId>` instead of `NodeId`.

This clarifies the intent of whether to emit deprecated lint or not.

6 years agoWhen picking a candidate, consider the unstable ones last.
kennytm [Mon, 26 Feb 2018 13:34:06 +0000 (21:34 +0800)]
When picking a candidate, consider the unstable ones last.

If there is potential ambiguity after stabilizing those candidates, a
warning will be emitted.

6 years agoProvide a proper span when demanding for the return type of `box x`.
kennytm [Wed, 28 Feb 2018 21:16:44 +0000 (05:16 +0800)]
Provide a proper span when demanding for the return type of `box x`.

6 years agoUse the same RUSTFLAGS for building and testing `bootstrap`
Simon Sapin [Fri, 23 Mar 2018 18:55:41 +0000 (19:55 +0100)]
Use the same RUSTFLAGS for building and testing `bootstrap`

Fixes #49215

6 years agoAuto merge of #49308 - alexcrichton:rollup, r=alexcrichton
bors [Fri, 23 Mar 2018 18:38:16 +0000 (18:38 +0000)]
Auto merge of #49308 - alexcrichton:rollup, r=alexcrichton

Rollup of 15 pull requests

- Successful merges: #48265, #48528, #48552, #48624, #48883, #48909, #49028, #49030, #49102, #49160, #49169, #49203, #49262, #49272, #49295
- Failed merges: #48942, #49035

6 years agoTest fixes
Alex Crichton [Fri, 23 Mar 2018 14:46:20 +0000 (07:46 -0700)]
Test fixes

6 years agoImproved comments for UserAssertTy statement.
David Wood [Fri, 23 Mar 2018 17:48:03 +0000 (17:48 +0000)]
Improved comments for UserAssertTy statement.

6 years agoMerge branch '49001_epoch' of https://github.com/klnusbaum/rust into rollup
Alex Crichton [Fri, 23 Mar 2018 14:32:15 +0000 (07:32 -0700)]
Merge branch '49001_epoch' of https://github.com/klnusbaum/rust into rollup

6 years agoMerge branch 'master' of https://github.com/Lymia/rust into rollup
Alex Crichton [Fri, 23 Mar 2018 14:31:15 +0000 (07:31 -0700)]
Merge branch 'master' of https://github.com/Lymia/rust into rollup

6 years agoRollup merge of #49295 - csmoe:nll_test_48238, r=alexcrichton
Alex Crichton [Fri, 23 Mar 2018 14:27:28 +0000 (09:27 -0500)]
Rollup merge of #49295 - csmoe:nll_test_48238, r=alexcrichton

Add test for issue-48238

Fixes #48238
test case made from comments in #48238

6 years agoRollup merge of #49272 - semarie:cat-and-grep-gnu, r=alexcrichton
Alex Crichton [Fri, 23 Mar 2018 14:27:27 +0000 (09:27 -0500)]
Rollup merge of #49272 - semarie:cat-and-grep-gnu, r=alexcrichton

Use GNU version of fgrep/egrep tool if available

It is mostly for BSD system. Some tests (run-make/issue-35164 and
run-make/cat-and-grep-sanity-check) are failing with BSD
fgrep, whereas they pass with gnu version (gfgrep).

6 years agoRollup merge of #49262 - oli-obk:fixed_size_array_len, r=estebank
Alex Crichton [Fri, 23 Mar 2018 14:27:26 +0000 (09:27 -0500)]
Rollup merge of #49262 - oli-obk:fixed_size_array_len, r=estebank

Produce nice array lengths on a best effort basis

fixes #49208

r? @estebank

6 years agoRollup merge of #49169 - sanxiyn:doc-only, r=aturon
Alex Crichton [Fri, 23 Mar 2018 14:27:23 +0000 (09:27 -0500)]
Rollup merge of #49169 - sanxiyn:doc-only, r=aturon

Document only-X test header

This was added in #47487 without documentation.

6 years agoRollup merge of #49160 - estebank:issue-47457-missing-fields, r=oli-obk
Alex Crichton [Fri, 23 Mar 2018 14:27:22 +0000 (09:27 -0500)]
Rollup merge of #49160 - estebank:issue-47457-missing-fields, r=oli-obk

Reduce the diagnostic spam when multiple fields are missing in pattern

Fix #47457.

6 years agoRollup merge of #49102 - glandium:decimal, r=aturon
Alex Crichton [Fri, 23 Mar 2018 14:27:21 +0000 (09:27 -0500)]
Rollup merge of #49102 - glandium:decimal, r=aturon

Remove core::fmt::num::Decimal

Before ebf9e1aaf6, it was used for Display::fmt, but ebf9e1aaf6 replaced
that with a faster implementation, and nothing else uses it.

6 years agoRollup merge of #49030 - Zoxc:misc, r=michaelwoerister
Alex Crichton [Fri, 23 Mar 2018 14:27:19 +0000 (09:27 -0500)]
Rollup merge of #49030 - Zoxc:misc, r=michaelwoerister

Misc changes from my parallel rustc branch

r? @michaelwoerister

6 years agoRollup merge of #49028 - QuietMisdreavus:the-dark-forbidden-corners-of-rustdoc, r...
Alex Crichton [Fri, 23 Mar 2018 14:27:18 +0000 (09:27 -0500)]
Rollup merge of #49028 - QuietMisdreavus:the-dark-forbidden-corners-of-rustdoc, r=frewsxcv

add an "unstable features" chapter to the rustdoc book

There are several rustdoc features that currently are undocumented, but also don't fit with the rest of the Rustdoc Book since they're also unstable. Some of these have corresponding feature gates and chapters in the Unstable Book, but many don't, and i wanted a place to talk about them officially.

Goal: talk about everything rustdoc can do that needs nightly

- [x] Feature gates (extensions to the doc attribute that can be caught by the compiler)
  - [x] doc(cfg)
  - [x] doc(masked)
  - [x] doc(spotlight)
  - [x] doc(include)
- [x] Command-line flags (features that require a CLI flag to use, where the flag itself is a `-Z` command or otherwise requires `-Z unstable-options` before rustdoc will accept it)
  - [x] markdown-before-content/markdown-after-content
  - [x] playground-url
  - [x] display-warnings
  - [x] crate-version
  - [x] linker
  - [x] sort-modules-by-appearance
  - [x] themes/theme-checker
  - [x] resource-suffix
  - [x] `-Z force-unstable-if-unmarked`
- [x] Nightly-gated functionality (features that are gated by requiring a nightly build without needing a CLI flag or a feature gate to unlock)
  - [x] intra-links
  - [x] error numbers for `compile_fail` doctests

6 years agoRollup merge of #48909 - RalfJung:type_alias_bounds, r=petrochenkov
Alex Crichton [Fri, 23 Mar 2018 14:27:16 +0000 (09:27 -0500)]
Rollup merge of #48909 - RalfJung:type_alias_bounds, r=petrochenkov

Improve lint for type alias bounds

First of all, I learned just today that I was wrong assuming that the bounds in type aliases are entirely ignored: It turns out they are used to resolve associated types in type aliases. So:
```rust
type T1<U: Bound> = U::Assoc; // compiles
type T2<U> = U::Assoc; // fails
type T3<U> = <U as Bound>::Assoc; // "correct" way to write this, maybe?
```
I am sorry for creating this mess.

This PR changes the wording of the lint accordingly. Moreover, since just removing the bound is no longer always a possible fix, I tried to detect cases like `T1` above and show a helpful message to the user:
```
warning: bounds on generic parameters are not enforced in type aliases
  --> $DIR/type-alias-bounds.rs:57:12
   |
LL | type T1<U: Bound> = U::Assoc; //~ WARN not enforced in type aliases
   |            ^^^^^
   |
   = help: the bound will not be checked when the type alias is used, and should be removed
help: use absolute paths (i.e., <T as Trait>::Assoc) to refer to associated types in type aliases
  --> $DIR/type-alias-bounds.rs:57:21
   |
LL | type T1<U: Bound> = U::Assoc; //~ WARN not enforced in type aliases
   |                     ^^^^^^^^
```
I am not sure if I got this entirely right. Ideally, we could provide a suggestion involving the correct trait and type name -- however, while I have access to the HIR in the lint, I do not know how to get access to the resolved name information, like which trait `Assoc` belongs to above. The lint does not even run if that resolution fails, so I assume that information is available *somewhere*...

This is a follow-up for (parts of) https://github.com/rust-lang/rust/pull/48326. Also see https://github.com/rust-lang/rust/issues/21903.

This changes the name of a lint, but that lint was just merged to master yesterday and has never even been on beta.

6 years agoRollup merge of #48883 - alexcrichton:wasm-custom-sections, r=nikomatsakis
Alex Crichton [Fri, 23 Mar 2018 14:27:14 +0000 (09:27 -0500)]
Rollup merge of #48883 - alexcrichton:wasm-custom-sections, r=nikomatsakis

rustc: Add a `#[wasm_custom_section]` attribute

This commit is an implementation of adding custom sections to wasm artifacts in
rustc. The intention here is to expose the ability of the wasm binary format to
contain custom sections with arbitrary user-defined data. Currently neither our
version of LLVM nor LLD supports this so the implementation is currently custom
to rustc itself.

The implementation here is to attach a `#[wasm_custom_section = "foo"]`
attribute to any `const` which has a type like `[u8; N]`. Other types of
constants aren't supported yet but may be added one day! This should hopefully
be enough to get off the ground with *some* custom section support.

The current semantics are that any constant tagged with `#[wasm_custom_section]`
section will be *appended* to the corresponding section in the final output wasm
artifact (and this affects dependencies linked in as well, not just the final
crate). This means that whatever is interpreting the contents must be able to
interpret binary-concatenated sections (or each constant needs to be in its own
custom section).

To test this change the existing `run-make` test suite was moved to a
`run-make-fulldeps` folder and a new `run-make` test suite was added which
applies to all targets by default. This test suite currently only has one test
which only runs for the wasm target (using a node.js script to use `WebAssembly`
in JS to parse the wasm output).

6 years agoRollup merge of #48624 - bdrewery:freebsd-posix-spawn, r=alexcrichton
Alex Crichton [Fri, 23 Mar 2018 14:27:10 +0000 (09:27 -0500)]
Rollup merge of #48624 - bdrewery:freebsd-posix-spawn, r=alexcrichton

Command: Support posix_spawn() on FreeBSD/OSX/GNU Linux

6 years agoRollup merge of #48265 - SimonSapin:nonzero, r=KodrAus
Alex Crichton [Fri, 23 Mar 2018 14:27:06 +0000 (09:27 -0500)]
Rollup merge of #48265 - SimonSapin:nonzero, r=KodrAus

Add 12 num::NonZero* types for primitive integers, deprecate core::nonzero

RFC: https://github.com/rust-lang/rfcs/pull/2307
Tracking issue: ~~https://github.com/rust-lang/rust/issues/27730~~ https://github.com/rust-lang/rust/issues/49137
Fixes https://github.com/rust-lang/rust/issues/27730

6 years agoFixed issues with incremental tests.
David Wood [Fri, 23 Mar 2018 14:04:08 +0000 (14:04 +0000)]
Fixed issues with incremental tests.

6 years agoUpdated MIR with UserAssertTy in mir-opt tests.
David Wood [Fri, 23 Mar 2018 10:07:18 +0000 (10:07 +0000)]
Updated MIR with UserAssertTy in mir-opt tests.

6 years agoadd test for issue-48238
csmoe [Fri, 23 Mar 2018 06:40:56 +0000 (14:40 +0800)]
add test for issue-48238

6 years agoAuto merge of #49285 - nrc:update, r=alexcrichton
bors [Fri, 23 Mar 2018 05:43:00 +0000 (05:43 +0000)]
Auto merge of #49285 - nrc:update, r=alexcrichton

Update RLS and Rustfmt

Fixes broken RLS tests/build

r? @alexcrichton

6 years agoAdded flag to disable user type assertion.
David Wood [Thu, 22 Mar 2018 22:48:39 +0000 (22:48 +0000)]
Added flag to disable user type assertion.

6 years agoDebug logs for replace_bound_regions_with_nll_infer_vars
Niko Matsakis [Thu, 22 Mar 2018 18:50:42 +0000 (14:50 -0400)]
Debug logs for replace_bound_regions_with_nll_infer_vars

6 years agoUpdate RLS and Rustfmt
Nick Cameron [Thu, 22 Mar 2018 21:07:49 +0000 (10:07 +1300)]
Update RLS and Rustfmt

Fixes broken RLS tests/build

6 years agoTemporarily only adding UserAssertTy on binding patterns.
David Wood [Wed, 21 Mar 2018 19:47:08 +0000 (19:47 +0000)]
Temporarily only adding UserAssertTy on binding patterns.

6 years agoSwitched from canonicalize_query to canonicalize_response
David Wood [Tue, 20 Mar 2018 01:59:52 +0000 (01:59 +0000)]
Switched from canonicalize_query to canonicalize_response

6 years agoUserAssertTy can handle inference variables.
David Wood [Thu, 15 Mar 2018 18:49:10 +0000 (18:49 +0000)]
UserAssertTy can handle inference variables.

This commit modifies the UserAssertTy statement to take a canonicalized
type rather than a regular type so that we can handle the case where the
user provided type contains a inference variable.

6 years agoNo longer visiting user_assert_ty statements in constraint generation.
David Wood [Tue, 13 Mar 2018 14:52:23 +0000 (14:52 +0000)]
No longer visiting user_assert_ty statements in constraint generation.

6 years agoAdded comment in renumberer about UserAssertTy.
David Wood [Tue, 13 Mar 2018 14:16:53 +0000 (14:16 +0000)]
Added comment in renumberer about UserAssertTy.

6 years agoUpdated test with expected error message.
David Wood [Tue, 13 Mar 2018 14:16:14 +0000 (14:16 +0000)]
Updated test with expected error message.

6 years agoAdded override in renumberer for UserAssertTy.
David Wood [Sat, 10 Mar 2018 23:07:13 +0000 (23:07 +0000)]
Added override in renumberer for UserAssertTy.

6 years agoChanged location to at_self from at_successor.
David Wood [Fri, 2 Mar 2018 14:33:21 +0000 (14:33 +0000)]
Changed location to at_self from at_successor.

6 years agoAdded initial processing of UserAssertTy statements.
David Wood [Thu, 1 Mar 2018 14:31:14 +0000 (14:31 +0000)]
Added initial processing of UserAssertTy statements.

6 years agoKilling UserAssertTy in CleanupPostBorrowck pass.
David Wood [Fri, 23 Feb 2018 20:54:18 +0000 (20:54 +0000)]
Killing UserAssertTy in CleanupPostBorrowck pass.

6 years agoAdded UserAssertTy statement.
David Wood [Fri, 23 Feb 2018 20:52:05 +0000 (20:52 +0000)]
Added UserAssertTy statement.

6 years agoAdded initial test for #47184
David Wood [Fri, 23 Feb 2018 17:28:34 +0000 (17:28 +0000)]
Added initial test for #47184

6 years agopermit `'_` and `&T` in impl headers
Niko Matsakis [Wed, 21 Mar 2018 21:12:39 +0000 (17:12 -0400)]
permit `'_` and `&T` in impl headers

Deprecated forms of elision are not supported.

6 years agodistinguish the three cases where elision occurs
Niko Matsakis [Wed, 21 Mar 2018 20:59:28 +0000 (16:59 -0400)]
distinguish the three cases where elision occurs

6 years agochange in-band array to store hir::LifetimeName
Niko Matsakis [Wed, 21 Mar 2018 20:30:09 +0000 (16:30 -0400)]
change in-band array to store hir::LifetimeName

6 years agoadd new test for `dyn<Trait + '_>` used in a struct
Niko Matsakis [Wed, 21 Mar 2018 10:31:39 +0000 (06:31 -0400)]
add new test for `dyn<Trait + '_>` used in a struct

`'_` is illegal in structs; this currently gets a duplicate error

6 years agoadd a helper function `maybe_collect_in_band_lifetime`
Niko Matsakis [Wed, 21 Mar 2018 08:57:57 +0000 (04:57 -0400)]
add a helper function `maybe_collect_in_band_lifetime`

6 years agomake `parent_id` not optional
Niko Matsakis [Wed, 21 Mar 2018 08:45:21 +0000 (04:45 -0400)]
make `parent_id` not optional

It'd be pretty buggy if `None` were supplied anyway; we'd skip over
in-band lifetimes completely!

6 years agochange `with_in_scope_lifetime_defs` to take an iterator
Niko Matsakis [Wed, 21 Mar 2018 08:27:35 +0000 (04:27 -0400)]
change `with_in_scope_lifetime_defs` to take an iterator

6 years agorustfmt lowering.rs
Niko Matsakis [Wed, 21 Mar 2018 08:24:27 +0000 (04:24 -0400)]
rustfmt lowering.rs

6 years agoRemove std/test documentation from compiler docs.
David Wood [Thu, 22 Mar 2018 20:49:05 +0000 (20:49 +0000)]
Remove std/test documentation from compiler docs.

6 years agorustc: Add a `#[wasm_import_module]` attribute
Alex Crichton [Sat, 10 Feb 2018 22:28:17 +0000 (14:28 -0800)]
rustc: Add a `#[wasm_import_module]` attribute

This commit adds a new attribute to the Rust compiler specific to the wasm
target (and no other targets). The `#[wasm_import_module]` attribute is used to
specify the module that a name is imported from, and is used like so:

    #[wasm_import_module = "./foo.js"]
    extern {
        fn some_js_function();
    }

Here the import of the symbol `some_js_function` is tagged with the `./foo.js`
module in the wasm output file. Wasm-the-format includes two fields on all
imports, a module and a field. The field is the symbol name (`some_js_function`
above) and the module has historically unconditionally been `"env"`. I'm not
sure if this `"env"` convention has asm.js or LLVM roots, but regardless we'd
like the ability to configure it!

The proposed ES module integration with wasm (aka a wasm module is "just another
ES module") requires that the import module of wasm imports is interpreted as an
ES module import, meaning that you'll need to encode paths, NPM packages, etc.
As a result, we'll need this to be something other than `"env"`!

Unfortunately neither our version of LLVM nor LLD supports custom import modules
(aka anything not `"env"`). My hope is that by the time LLVM 7 is released both
will have support, but in the meantime this commit adds some primitive
encoding/decoding of wasm files to the compiler. This way rustc postprocesses
the wasm module that LLVM emits to ensure it's got all the imports we'd like to
have in it.

Eventually I'd ideally like to unconditionally require this attribute to be
placed on all `extern { ... }` blocks. For now though it seemed prudent to add
it as an unstable attribute, so for now it's not required (as that'd force usage
of a feature gate). Hopefully it doesn't take too long to "stabilize" this!

cc rust-lang-nursery/rust-wasm#29

6 years agorustc: Add a `#[wasm_custom_section]` attribute
Alex Crichton [Fri, 9 Mar 2018 17:26:15 +0000 (09:26 -0800)]
rustc: Add a `#[wasm_custom_section]` attribute

This commit is an implementation of adding custom sections to wasm artifacts in
rustc. The intention here is to expose the ability of the wasm binary format to
contain custom sections with arbitrary user-defined data. Currently neither our
version of LLVM nor LLD supports this so the implementation is currently custom
to rustc itself.

The implementation here is to attach a `#[wasm_custom_section = "foo"]`
attribute to any `const` which has a type like `[u8; N]`. Other types of
constants aren't supported yet but may be added one day! This should hopefully
be enough to get off the ground with *some* custom section support.

The current semantics are that any constant tagged with `#[wasm_custom_section]`
section will be *appended* to the corresponding section in the final output wasm
artifact (and this affects dependencies linked in as well, not just the final
crate). This means that whatever is interpreting the contents must be able to
interpret binary-concatenated sections (or each constant needs to be in its own
custom section).

To test this change the existing `run-make` test suite was moved to a
`run-make-fulldeps` folder and a new `run-make` test suite was added which
applies to all targets by default. This test suite currently only has one test
which only runs for the wasm target (using a node.js script to use `WebAssembly`
in JS to parse the wasm output).

6 years agoAuto merge of #49210 - oli-obk:pango_crash, r=eddyb
bors [Thu, 22 Mar 2018 20:02:14 +0000 (20:02 +0000)]
Auto merge of #49210 - oli-obk:pango_crash, r=eddyb

Fix the conversion between bit representations and i128 representations

fixes #49181

the `Discr` type now encodes the bit representation instead of `i128` or `u128` casted to `u128`.

r? @eddyb

6 years agoOnly generate documentation for local rustc crates.
David Wood [Thu, 22 Mar 2018 14:57:28 +0000 (14:57 +0000)]
Only generate documentation for local rustc crates.

6 years agoAuto merge of #49264 - kennytm:rollup, r=kennytm
bors [Thu, 22 Mar 2018 16:58:57 +0000 (16:58 +0000)]
Auto merge of #49264 - kennytm:rollup, r=kennytm

Rollup of 23 pull requests

- Successful merges: #48374, #48596, #48759, #48939, #49029, #49069, #49093, #49109, #49117, #49140, #49158, #49188, #49189, #49209, #49211, #49216, #49225, #49231, #49234, #49242, #49244, #49105, #49038
- Failed merges:

6 years agoCommand::env_saw_path() may be unused on platforms not using posix_spawn()
Bryan Drewery [Thu, 22 Mar 2018 16:49:20 +0000 (09:49 -0700)]
Command::env_saw_path() may be unused on platforms not using posix_spawn()

6 years agoClarify description of raw_identifiers feature flag.
Lymia Aluysia [Thu, 22 Mar 2018 15:35:49 +0000 (10:35 -0500)]
Clarify description of raw_identifiers feature flag.

6 years agoClean up raw identifier handling when recovering tokens from AST.
Lymia Aluysia [Thu, 22 Mar 2018 15:34:51 +0000 (10:34 -0500)]
Clean up raw identifier handling when recovering tokens from AST.

6 years agoRollup merge of #49038 - canndrew:replace-infallible-with-never, r=SimonSapin
kennytm [Thu, 22 Mar 2018 15:22:38 +0000 (23:22 +0800)]
Rollup merge of #49038 - canndrew:replace-infallible-with-never, r=SimonSapin

replace `convert::Infallible` with `!`

6 years agoRollup merge of #49105 - SimonSapin:from_utf8_lossy_example, r=alexcrichton
kennytm [Thu, 22 Mar 2018 15:20:11 +0000 (23:20 +0800)]
Rollup merge of #49105 - SimonSapin:from_utf8_lossy_example, r=alexcrichton

Add an example of lossy decoding to str::Utf8Error docs

CC https://github.com/rust-lang/rust/issues/33906

6 years agoRevert "Temporarily disable dist-ing RLS, Rustfmt and Clippy."
kennytm [Thu, 22 Mar 2018 09:52:57 +0000 (17:52 +0800)]
Revert "Temporarily disable dist-ing RLS, Rustfmt and Clippy."

This reverts commit 9f792e199bc53a75afdad72547a151a0bc86ec5d.

6 years agoRollup merge of #49244 - varkor:type_dependent_defs_ExprMethodCall, r=estebank
kennytm [Thu, 22 Mar 2018 09:51:41 +0000 (17:51 +0800)]
Rollup merge of #49244 - varkor:type_dependent_defs_ExprMethodCall, r=estebank

Fix type_dependent_defs ICE on method calls

Fixes #49241.

6 years agoRollup merge of #49242 - Mrowqa:typaram-attrs, r=petrochenkov
kennytm [Thu, 22 Mar 2018 09:51:40 +0000 (17:51 +0800)]
Rollup merge of #49242 - Mrowqa:typaram-attrs, r=petrochenkov

Pass attributes to hir::TyParam

Required by https://github.com/servo/servo/pull/20264
Discussed here: https://gitter.im/servo/servo?at=5aafdcd1012ff2bf681da97a

CC @nikomatsakis

6 years agoRollup merge of #49234 - kennytm:revert-fix-dpl-788, r=alexcrichton
kennytm [Thu, 22 Mar 2018 09:51:38 +0000 (17:51 +0800)]
Rollup merge of #49234 - kennytm:revert-fix-dpl-788, r=alexcrichton

dpl 1.9.5 has been released, revert #49217.

dpl 1.9.5 has been released which includes travis-ci/dpl#789, so we could move back to the standard Travis settings before that `s3-eager-autoload` branch is removed.

6 years agoRollup merge of #49231 - gnzlbg:fix_vec_fminmax, r=rkruppe
kennytm [Thu, 22 Mar 2018 09:51:37 +0000 (17:51 +0800)]
Rollup merge of #49231 - gnzlbg:fix_vec_fminmax, r=rkruppe

fix vector fmin/fmax non-fast/fast intrinsics NaN handling

This bugs shows up in release mode tests of `stdsimd`: https://github.com/rust-lang-nursery/stdsimd/pull/391 . The intrinsics are thoroughly tested there for roundoff errors, NaN, and overflow behavior.

The problem was that the non-fast intrinsics where specifying `NoNaNs == true`, which meant that they don't support NaNs. This is incorrect, the non-fast intrinsics should handle NaNs properly.

Also, the "fast" intrinsics where specifying `NoNaNs == false` which meant that they support NaNs and then fast-math, which probably disables this support. This was not intended either.

I've added a comment specifying what the boolean flags do.

6 years agoRollup merge of #49225 - QuietMisdreavus:all-the-features-all-the-time, r=alexcrichton
kennytm [Thu, 22 Mar 2018 09:51:36 +0000 (17:51 +0800)]
Rollup merge of #49225 - QuietMisdreavus:all-the-features-all-the-time, r=alexcrichton

whitelist every target feature for rustdoc

When https://github.com/rust-lang-nursery/stdsimd/pull/367 was attempted to be upstreamed, it failed to document on non-x86 targets because it made every intrinsic visible, even the ones on foreign arches. This change makes it so that whenever rustdoc asks for the target feature whitelist, it gets a list of every feature known to every arch in `rustc_trans/llvm_util.rs`.

Before pushing, i temporarily updated the `stdsimd` submodule to include the `doc(cfg)` change, generated documentation for `aarch64-unknown-linux-gnu`, and it completed without a problem. The generated `core::arch` docs contained complete submodules for all main arches.

6 years agoRollup merge of #49216 - bjorn3:patch-1, r=estebank
kennytm [Thu, 22 Mar 2018 09:51:35 +0000 (17:51 +0800)]
Rollup merge of #49216 - bjorn3:patch-1, r=estebank

Don't check interpret_interner when accessing a static to fix miri mutable statics

Mutable statics don't work in my PR to fix the standalone [miri](https://github.com/solson/miri), as init_static didn't get called when the interpret_interner already contained a entry for the static, which is always immutable.

cc solson/miri#364

6 years agoRollup merge of #49211 - varkor:chalk-lowering-Implemented-From-Env, r=nikomatsakis
kennytm [Thu, 22 Mar 2018 09:51:34 +0000 (17:51 +0800)]
Rollup merge of #49211 - varkor:chalk-lowering-Implemented-From-Env, r=nikomatsakis

Implement Chalk lowering rule "Implemented-From-Env"

This extends the Chalk lowering pass with the "Implemented-From-Env" rule for generating program clauses from a trait definition as part of #49177.

r? @nikomatsakis

6 years agoRollup merge of #49209 - Zoxc:run-make-last, r=Mark-Simulacrum
kennytm [Thu, 22 Mar 2018 09:51:32 +0000 (17:51 +0800)]
Rollup merge of #49209 - Zoxc:run-make-last, r=Mark-Simulacrum

Run the `run-make` tests last, so more tests run on Windows when `make` is unavailable

Just https://github.com/rust-lang/rust/pull/47996 again.

r? @Mark-Simulacrum

6 years agoRollup merge of #49189 - GuillaumeGomez:fix-implied-shortcut-links, r=QuietMisdreavus
kennytm [Thu, 22 Mar 2018 09:51:30 +0000 (17:51 +0800)]
Rollup merge of #49189 - GuillaumeGomez:fix-implied-shortcut-links, r=QuietMisdreavus

Fix automatic urls with backticks

Fixes #49164.

r? @QuietMisdreavus

6 years agoRollup merge of #49188 - memoryleak47:macro_use_doctest, r=QuietMisdreavus
kennytm [Thu, 22 Mar 2018 09:51:29 +0000 (17:51 +0800)]
Rollup merge of #49188 - memoryleak47:macro_use_doctest, r=QuietMisdreavus

Put `#[macro_use] extern crate <crate>` before fn main() in doctests

Closes #49174.

6 years agoRollup merge of #49158 - varkor:compiletest-triples, r=rkruppe
kennytm [Thu, 22 Mar 2018 09:51:27 +0000 (17:51 +0800)]
Rollup merge of #49158 - varkor:compiletest-triples, r=rkruppe

Make compiletest do exact matching on triples

This avoids the issues of the previous substring matching, ensuring `ARCH_TABLE` and `OS_TABLE` will no longer contain redundant entries. Fixes #48893.

r? @rkruppe

6 years agoRollup merge of #49140 - semarie:rustdoc-test-path, r=alexcrichton
kennytm [Thu, 22 Mar 2018 09:51:26 +0000 (17:51 +0800)]
Rollup merge of #49140 - semarie:rustdoc-test-path, r=alexcrichton

Allow test target to pass without installing

explicitly pass -L target-lib to rustdoc

on OpenBSD, without it, it fails on several tests with:
```
error[E0463]: can't find crate for `std`
```

6 years agoRollup merge of #49117 - nivkner:fixme_fixup3, r=estebank
kennytm [Thu, 22 Mar 2018 09:51:25 +0000 (17:51 +0800)]
Rollup merge of #49117 - nivkner:fixme_fixup3, r=estebank

address some FIXME whose associated issues were marked as closed

part of #44366

6 years agoRollup merge of #49109 - SimonSapin:deprecate-asciiext, r=alexcrichton
kennytm [Thu, 22 Mar 2018 09:51:24 +0000 (17:51 +0800)]
Rollup merge of #49109 - SimonSapin:deprecate-asciiext, r=alexcrichton

Deprecate the AsciiExt trait in favor of inherent methods

The trait and some of its methods are stable and will remain.
Some of the newer methods are unstable and can be removed later.

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

6 years agoRollup merge of #49093 - Zoxc:speedup, r=aidanhs
kennytm [Thu, 22 Mar 2018 09:51:22 +0000 (17:51 +0800)]
Rollup merge of #49093 - Zoxc:speedup, r=aidanhs

Update submodules in parallel

6 years agoRollup merge of #49069 - wesleywiser:incr_soa, r=michaelwoerister
kennytm [Thu, 22 Mar 2018 09:51:21 +0000 (17:51 +0800)]
Rollup merge of #49069 - wesleywiser:incr_soa, r=michaelwoerister

Convert SerializedDepGraph to be a struct-of-arrays

Fixes #47326

I did not try the "`mem::swap()` to avoid copying the arrays" idea because that would leave the DepGraph in an incorrect state and that doesn't seem like a good idea for me.

r? @michaelwoerister

6 years agoRollup merge of #49029 - GuillaumeGomez:atomic-docs, r=QuietMisdreavus
kennytm [Thu, 22 Mar 2018 09:51:20 +0000 (17:51 +0800)]
Rollup merge of #49029 - GuillaumeGomez:atomic-docs, r=QuietMisdreavus

Make Atomic doc examples specific to each type

Fixes #49018.

r? @QuietMisdreavus

6 years agoRollup merge of #48939 - wesleywiser:incr_query_wf_checking, r=michaelwoerister
kennytm [Thu, 22 Mar 2018 09:51:19 +0000 (17:51 +0800)]
Rollup merge of #48939 - wesleywiser:incr_query_wf_checking, r=michaelwoerister

Querify WF-checking so it can be cached

r? @michaelwoerister

6 years agoUse GNU version of fgrep/egrep tool if available
Sébastien Marie [Thu, 22 Mar 2018 10:27:59 +0000 (11:27 +0100)]
Use GNU version of fgrep/egrep tool if available

It is mostly for BSD system. Some tests (run-make/issue-35164 and
run-make/cat-and-grep-sanity-check) are failing with BSD
fgrep, whereas they pass with gnu version (gfgrep).

6 years agoFix the conversion between bit representations and i128 representations
Oliver Schneider [Thu, 22 Mar 2018 11:38:40 +0000 (12:38 +0100)]
Fix the conversion between bit representations and i128 representations

6 years agoRollup merge of #48759 - QuietMisdreavus:simd-feature-docs, r=GuillaumeGomez
kennytm [Thu, 22 Mar 2018 09:51:16 +0000 (17:51 +0800)]
Rollup merge of #48759 - QuietMisdreavus:simd-feature-docs, r=GuillaumeGomez

rustdoc: expose #[target_feature] attributes as doc(cfg) flags

This change exposes `#[target_feature(enable = "feat")]` attributes on an item as if they were also `#[doc(cfg(target_feature = "feat"))]` attributes. This gives them a banner on their documentation listing which feature is required to use the item. It also modifies the rendering code for doc(cfg) tags to handle `target_feature` tags. I made it print just the feature name on "short" printings (as in the function listing on a module page), and use "target feature `feat`" in the full banner on the item page itself.

This way, the function listing in `std::arch` shows which feature is required for each function:

![image](https://user-images.githubusercontent.com/5217170/37003222-f41b9d66-2091-11e8-9656-8719e5b34832.png)

![image](https://user-images.githubusercontent.com/5217170/37003234-feb1a7a2-2091-11e8-94de-6d1d76a2d3ee.png)

6 years agoRollup merge of #48596 - GuillaumeGomez:invalid-code-block-start, r=QuietMisdreavus
kennytm [Thu, 22 Mar 2018 09:51:15 +0000 (17:51 +0800)]
Rollup merge of #48596 - GuillaumeGomez:invalid-code-block-start, r=QuietMisdreavus

Add warning for invalid start of code blocks in rustdoc

Follow up of #48382.

Still two things to consider:
 1. Adding test for rustdoc output (but where? In UI or in rustdoc tests?).
 2. Try to fix the span issue.

r? @QuietMisdreavus