]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoRollup merge of #41749 - frewsxcv:option-simplify-types, r=GuillaumeGomez
Corey Farwell [Fri, 5 May 2017 01:35:30 +0000 (21:35 -0400)]
Rollup merge of #41749 - frewsxcv:option-simplify-types, r=GuillaumeGomez

Simplify types in `std::option` doc comment example.

None

7 years agoRollup merge of #41746 - tommyip:master, r=petrochenkov
Corey Farwell [Fri, 5 May 2017 01:35:29 +0000 (21:35 -0400)]
Rollup merge of #41746 - tommyip:master, r=petrochenkov

Remove use of `Self: Sized` from libsyntax

The bound is not required for compiling but it prevents using `next_token()` from a trait object.

Fixes #33506.

7 years agoRollup merge of #41741 - rap2hpoutre:patch-3, r=steveklabnik
Corey Farwell [Fri, 5 May 2017 01:35:28 +0000 (21:35 -0400)]
Rollup merge of #41741 - rap2hpoutre:patch-3, r=steveklabnik

join method returns a thread::Result

Join method returns a std::thread::Result, not a std::result::Result: https://doc.rust-lang.org/std/thread/struct.JoinHandle.html#method.join Maybe I misunderstood something.

I have seen this mistake(?) because I wanted to tackle this issue https://github.com/rust-lang/rust/issues/29378 (about Result). It's still one of my first PR. Sorry if I missed something.

7 years agoAuto merge of #41739 - TimNN:update-llvm, r=aturon
bors [Thu, 4 May 2017 18:46:17 +0000 (18:46 +0000)]
Auto merge of #41739 - TimNN:update-llvm, r=aturon

Update llvm to pull in various backports

Fixes #41672
Fixes #41630
Fixes #41685

7 years agoSimplify types in `std::option` doc comment example.
Corey Farwell [Thu, 4 May 2017 15:53:24 +0000 (11:53 -0400)]
Simplify types in `std::option` doc comment example.

7 years agoAuto merge of #41268 - mmatyas:test_on_device, r=alexcrichton
bors [Thu, 4 May 2017 14:50:33 +0000 (14:50 +0000)]
Auto merge of #41268 - mmatyas:test_on_device, r=alexcrichton

Run non-native tests on real device

After #40733, I've made some hacks to the QEMU client-server tools to allow running the tests on a real device when cross compiling Rust. The address and port of the remote server can be set using an environment variable.

I've made this mainly for local testing purposes, if you're interested in merging this, I'd clean it a bit more (eg. renaming the functions from `qemu-` to something else). I'm not asking for CI integration or adding ARM boards to the build system; it's just that I used these modifications and I was wondering if you'd find them useful too.

7 years agoRemove use of `Self: Sized` from libsyntax
Tommy Ip [Thu, 4 May 2017 12:14:39 +0000 (13:14 +0100)]
Remove use of `Self: Sized` from libsyntax

The bound is not required for compiling but it prevents using `next_token()` from a trait object.

Fixes #33506.

7 years agoUpdate mod.rs
Raphaël Huchet [Thu, 4 May 2017 12:04:03 +0000 (14:04 +0200)]
Update mod.rs

7 years agoAuto merge of #41687 - rillian:no-elf-tls, r=aturon
bors [Thu, 4 May 2017 11:51:34 +0000 (11:51 +0000)]
Auto merge of #41687 - rillian:no-elf-tls, r=aturon

Remove obsolete --disable-elf-tls configure switch.

Support for disabling ELF-style thread local storage in
the standard library at configure time was removed in
pulls #30417 and #30678, in favour of a member in
the TargetOptions database. The new mentod respects
MACOSX_DEPLOYMENT_TARGET on macOS, addressing the
original use case for this configure optionl

However, those commits left the configure option itself
in place. It's no longer referenced anywhere and can
be removed.

7 years agoAdd remote device testing support
Mátyás Mustoha [Tue, 11 Apr 2017 10:10:05 +0000 (12:10 +0200)]
Add remote device testing support

7 years agocreate link to Result
Raphaël Huchet [Thu, 4 May 2017 09:33:26 +0000 (11:33 +0200)]
create link to Result

7 years agoAuto merge of #41733 - nikomatsakis:incr-comp-remove-ast-ty-to-ty-cache, r=eddyb
bors [Thu, 4 May 2017 09:15:23 +0000 (09:15 +0000)]
Auto merge of #41733 - nikomatsakis:incr-comp-remove-ast-ty-to-ty-cache, r=eddyb

Remove ast-ty-to-ty cache

As discussed on IRC, this basically just removes the cache, and rewrites rustdoc and save-analysis so call into the astconv code. It *might* make sense for this to be a more fine-grained query, but that would (at least) require us to be using `HirId` and not `NodeId`.

(Perhaps I should open a FIXME?)

I didn't measure perf impact (yet?). I did observe that the cache seems to hit *rarely* -- and only in between items (I experimented with a cache "per def-id", but that had zero hits). In other words, every single hit on the cache is a dependency bug, since it is "shuttling" information between items without dependency edges.

r? @eddyb

7 years agoJoin method returns a thread::Result
Raphaël Huchet [Thu, 4 May 2017 09:11:14 +0000 (11:11 +0200)]
Join method returns a thread::Result

7 years agoUpdate llvm to pull in various backports
Tim Neumann [Thu, 4 May 2017 06:12:17 +0000 (08:12 +0200)]
Update llvm to pull in various backports

7 years agoremove `ast_ty_to_ty_cache` entirely
Niko Matsakis [Wed, 3 May 2017 17:23:41 +0000 (13:23 -0400)]
remove `ast_ty_to_ty_cache` entirely

7 years agoconvert save-analysis to use `ItemCtxt` and not `ast_ty_to_ty_cache`
Niko Matsakis [Wed, 3 May 2017 16:18:04 +0000 (12:18 -0400)]
convert save-analysis to use `ItemCtxt` and not `ast_ty_to_ty_cache`

7 years agoremove use of `ast_ty_to_ty_cache` from librustdoc
Niko Matsakis [Wed, 3 May 2017 15:53:06 +0000 (11:53 -0400)]
remove use of `ast_ty_to_ty_cache` from librustdoc

7 years agoexpose a method for converting `hir::Ty` to `Ty<'tcx>`
Niko Matsakis [Wed, 3 May 2017 15:28:22 +0000 (11:28 -0400)]
expose a method for converting `hir::Ty` to `Ty<'tcx>`

Also, remove a lot of `pub` things from `librustc_typeck`.

7 years agoAuto merge of #41735 - frewsxcv:rollup, r=frewsxcv
bors [Wed, 3 May 2017 23:05:07 +0000 (23:05 +0000)]
Auto merge of #41735 - frewsxcv:rollup, r=frewsxcv

Rollup of 6 pull requests

- Successful merges: #41543, #41600, #41715, #41720, #41721, #41730
- Failed merges:

7 years agoRollup merge of #41730 - bholley:arc_comment, r=aturon
Corey Farwell [Wed, 3 May 2017 22:34:04 +0000 (18:34 -0400)]
Rollup merge of #41730 - bholley:arc_comment, r=aturon

Document the reasoning for the Acquire/Release handshake when dropping Arcs.

Split out from #41714. r? @aturon

7 years agoRollup merge of #41721 - mgattozzi:stdin-stdout-update, r=steveklabnik
Corey Farwell [Wed, 3 May 2017 22:34:03 +0000 (18:34 -0400)]
Rollup merge of #41721 - mgattozzi:stdin-stdout-update, r=steveklabnik

Update ChildStdin/ChildStdout docs to be clearer

This is part of https://github.com/rust-lang/rust/issues/29370 and continues the work from https://github.com/rust-lang/rust/pull/40829

7 years agoRollup merge of #41720 - frewsxcv:duration-doc-examples, r=steveklabnik
Corey Farwell [Wed, 3 May 2017 22:34:02 +0000 (18:34 -0400)]
Rollup merge of #41720 - frewsxcv:duration-doc-examples, r=steveklabnik

Improvements to `std::time::Duration` doc examples.

Opened primarily for the last commit, in response to comments in https://github.com/rust-lang/rust/issues/39949.

7 years agoRollup merge of #41715 - martinhath:master, r=aturon
Corey Farwell [Wed, 3 May 2017 22:34:01 +0000 (18:34 -0400)]
Rollup merge of #41715 - martinhath:master, r=aturon

Fix @martinhath's mailmap entry

I stumbled upon a name duplication issue in [rust-lang-nursery/thanks](https://github.com/rust-lang-nursery/thanks/), and realized that this problem is easily fixable. I've (hopefully) done the right thing here. It works locally (`git shortlog | grep "Thoresen"` only returns one entry instead of two).

I didn't bother creating an issue in the `thanks` repository, since I did the `.mailmap` editing myself.

7 years agoRollup merge of #41600 - ranma42:xz-dist, r=alexcrichton
Corey Farwell [Wed, 3 May 2017 22:34:00 +0000 (18:34 -0400)]
Rollup merge of #41600 - ranma42:xz-dist, r=alexcrichton

Generate XZ-compressed tarballs

Integrate the new `rust-installer` and extend manifests with keys for xz-compressed tarballs.

One of the steps required for https://github.com/rust-lang/rust/issues/21724

7 years agoRollup merge of #41543 - z1mvader:master, r=steveklabnik
Corey Farwell [Wed, 3 May 2017 22:33:59 +0000 (18:33 -0400)]
Rollup merge of #41543 - z1mvader:master, r=steveklabnik

Rewrote the thread struct docs

https://github.com/rust-lang/rust/issues/29378

7 years agoRetry `brew` commands upon failure
Andrea Canciani [Wed, 3 May 2017 20:38:41 +0000 (22:38 +0200)]
Retry `brew` commands upon failure

Wrap the installation on macOS with `travis_retry`.

7 years agoAuto merge of #41728 - sirideain:inference-failure-for-loops-test, r=alexcrichton
bors [Wed, 3 May 2017 19:58:35 +0000 (19:58 +0000)]
Auto merge of #41728 - sirideain:inference-failure-for-loops-test, r=alexcrichton

Add test for an inference failure.

Fixes #22066

7 years agoDocument the reasoning for the Acquire/Release handshake when dropping Arcs.
Bobby Holley [Tue, 2 May 2017 19:38:12 +0000 (12:38 -0700)]
Document the reasoning for the Acquire/Release handshake when dropping Arcs.

7 years agoAdd test for an inference failure.
Charlie Sheridan [Wed, 3 May 2017 17:07:30 +0000 (13:07 -0400)]
Add test for an inference failure.

7 years agoAuto merge of #41711 - sirideain:add-static-methods-test, r=aturon
bors [Wed, 3 May 2017 08:26:49 +0000 (08:26 +0000)]
Auto merge of #41711 - sirideain:add-static-methods-test, r=aturon

Add test for Inherent static methods

Fixes #28848

7 years agoFix MacOSX build
Andrea Canciani [Mon, 1 May 2017 23:42:30 +0000 (01:42 +0200)]
Fix MacOSX build

MacOSX does not ship `7z` nor `xz`. Let's use `xz`, just like on the
other *nix systems.

7 years agoEmit information about XZ packages in manifest
Andrea Canciani [Tue, 25 Apr 2017 14:14:28 +0000 (16:14 +0200)]
Emit information about XZ packages in manifest

7 years agoAuto merge of #41713 - cuviper:cmake-sanitizers, r=alexcrichton
bors [Wed, 3 May 2017 06:04:12 +0000 (06:04 +0000)]
Auto merge of #41713 - cuviper:cmake-sanitizers, r=alexcrichton

rustbuild: Sanity-check cmake for sanitizers too

It's possible to build the sanitizers when using an external LLVM, but
we still need cmake for this.  Extend the sanity check to look for cmake
whenever sanitizers are enabled too.

7 years agoUpdate ChildStdin/ChildStdout docs to be clearer
Michael Gattozzi [Wed, 3 May 2017 05:13:18 +0000 (01:13 -0400)]
Update ChildStdin/ChildStdout docs to be clearer

7 years agoAdd doc example for how to determine total number of secs in Duration.
Corey Farwell [Wed, 3 May 2017 04:04:59 +0000 (00:04 -0400)]
Add doc example for how to determine total number of secs in Duration.

7 years agoUpdate Duration::as_secs doc example to demonstrate truncation.
Corey Farwell [Wed, 3 May 2017 03:58:39 +0000 (23:58 -0400)]
Update Duration::as_secs doc example to demonstrate truncation.

7 years agoUpdate Duration::from_millis doc example to show underlying values.
Corey Farwell [Wed, 3 May 2017 03:56:29 +0000 (23:56 -0400)]
Update Duration::from_millis doc example to show underlying values.

7 years agoUpdate Duration::from_secs doc example to show underlying values.
Corey Farwell [Wed, 3 May 2017 03:55:40 +0000 (23:55 -0400)]
Update Duration::from_secs doc example to show underlying values.

7 years agoAuto merge of #41717 - frewsxcv:rollup, r=frewsxcv
bors [Wed, 3 May 2017 03:24:35 +0000 (03:24 +0000)]
Auto merge of #41717 - frewsxcv:rollup, r=frewsxcv

Rollup of 7 pull requests

- Successful merges: #41217, #41625, #41640, #41653, #41656, #41657, #41705
- Failed merges:

7 years agoRollup merge of #41705 - Mark-Simulacrum:remove-grammar, r=nikomatsakis
Corey Farwell [Wed, 3 May 2017 01:21:22 +0000 (21:21 -0400)]
Rollup merge of #41705 - Mark-Simulacrum:remove-grammar, r=nikomatsakis

Remove ANTLR grammar

I *think* that nothing in-tree references this, but I may be wrong. If anyone thinks of anything, please let me know and I'll work on removing.

Fixes #15677.

7 years agoRollup merge of #41657 - malbarbo:android-armv7-linker, r=alexcrichton
Corey Farwell [Wed, 3 May 2017 01:21:22 +0000 (21:21 -0400)]
Rollup merge of #41657 - malbarbo:android-armv7-linker, r=alexcrichton

Add -march=armv7-a parameter to armv7 android linker

Without this option, the linker fails to link any library that uses `std::future`. The error points some undefined references, like `std::__future_base::_Result_base`.

For example, it fails to link rustc because llvm 4.0 uses `std::future`.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64735

7 years agoRollup merge of #41656 - malbarbo:android-armeabi, r=alexcrichton
Corey Farwell [Wed, 3 May 2017 01:21:21 +0000 (21:21 -0400)]
Rollup merge of #41656 - malbarbo:android-armeabi, r=alexcrichton

Change arm-linux-androideabi to correspond to the armeabi official ABI

Fixes #40941.

7 years agoRollup merge of #41653 - achernyak:master, r=nikomatsakis
Corey Farwell [Wed, 3 May 2017 01:21:20 +0000 (21:21 -0400)]
Rollup merge of #41653 - achernyak:master, r=nikomatsakis

Queries for Crate Metadata

This resolves following parts of #41417:
* `fn stability(&self, def: DefId) -> Option<attr::Stability>;`
* `fn deprecation(&self, def: DefId) -> Option<attr::Deprecation>;`

r? @nikomatsakis

7 years agoRollup merge of #41640 - gaurikholkar:master, r=nikomatsakis
Corey Farwell [Wed, 3 May 2017 01:21:19 +0000 (21:21 -0400)]
Rollup merge of #41640 - gaurikholkar:master, r=nikomatsakis

Consider changing to & for let bindings #40402

This is a fix for #40402

For the example
```
fn main() {
    let v = vec![String::from("oh no")];

    let e = v[0];
}
```

It gives
```
error[E0507]: cannot move out of indexed content
 --> ex1.rs:4:13
  |
4 |     let e = v[0];
  |             ^^^^ cannot move out of indexed content
  |
  = help: consider changing to `&v[0]`

error: aborting due to previous error
```

Another alternative is
```
error[E0507]: cannot move out of indexed content
 --> ex1.rs:4:13
  |
4 |     let e = v[0];
  |             ^^^^ consider changing to `&v[0]`

error: aborting due to previous error
```
Also refer to #41564 for more details.

r? @nikomatsakis

7 years agoRollup merge of #41625 - nikomatsakis:incr-comp-dep-tracking-cell-mir, r=eddyb
Corey Farwell [Wed, 3 May 2017 01:21:18 +0000 (21:21 -0400)]
Rollup merge of #41625 - nikomatsakis:incr-comp-dep-tracking-cell-mir, r=eddyb

rework the queries for the MIR pipeline

This PR refashions the MIR pipeline. There are a number of changes:

* We no longer have "MIR passes" and the pass manager is completely reworked. Unless we are doing the interprocedural optimization (meaning, right now, the inline pass), we will process a single MIR from beginning to finish in a completely on-demand fashion; i.e., when you request `optimized_mir(D)`, that will trigger the MIR for `D` to actually be built and optimized, but no other functions are built or touched.
* We no longer use `&'tcx RefCell<Mir<'tcx>>` as the result of queries, since that spoils the view of queries as "pure functions". To avoid however copying the MIR, we use a `&'tcx Steal<Mir<'tcx>>` -- this is something like a ref-cell, in that you can use `borrow()` to read it, but it has no `borrow_mut()`. Instead, it has `steal()`, which will take the contents and then panic if any further read attempt occurs.
* We now support `[multi]` queries, which can optionally yield not just one result but a sequence of (K, V) pairs. This is used for the inlining pass. If inlining is enabled, then when it is invoked on **any** def-id D, it will go and read the results for **all** def-ids and transform them, and then return the results for all of them at once. This isn't ideal, and we'll probably want to rework this further, but it seems ok for now (note that MIR inlining is not enabled by default).

**Tips for the reviewer:** The commits here are meant to build individually, but the path is a *bit* meandering. In some cases, for example, I introduce a trait in one commit, and then tweak it in a later commit as I actually try to put it to use. You may want to read the README in the final commit to get a sense of where the overall design is headed.

@eddyb I did not wind up adding support for queries that produce more than one *kind* of result. Instead, I decided to just insert judicious use of the `force()` command. In other words, we had talked about e.g. having a query that produced not only the MIR but also the `const_qualif` result for the MIR in one sweep. I realized you can also have the same effect by having a kind of meta-query that forces the const-qualif pass and then reads the result. See the README for a description. (We can still do these "multi-query results" later if we want, I'm not sure though if it is necessary.)

r? @eddyb

cc @michaelwoerister @matthewhammer @arielb1, who participated in the IRC discussion.

7 years agoRollup merge of #41217 - topecongiro:docs/atomic-fence, r=steveklabnik
Corey Farwell [Wed, 3 May 2017 01:21:17 +0000 (21:21 -0400)]
Rollup merge of #41217 - topecongiro:docs/atomic-fence, r=steveklabnik

Update docs of 'fence'

This PR updates the docs for `std::sync::atomic::fence` with an example and a diagram.
Part of #29377.
r? @steveklabnik

7 years agoAuto merge of #41624 - RalfJung:mutexguard-sync, r=alexcrichton
bors [Wed, 3 May 2017 00:18:26 +0000 (00:18 +0000)]
Auto merge of #41624 - RalfJung:mutexguard-sync, r=alexcrichton

MutexGuard<T> may be Sync only if T is Sync

Fixes #41622

This is a breaking change. Does that imply any further process?

I am not sure whether I wrote that "compilation must fail"-test correctly, but at least it is passing here with the patch applied. Same for the `since = "1.18.0"`, I just picked it because I had to pick something.

7 years agoAuto merge of #41605 - tschottdorf:param-env, r=nikomatsakis
bors [Tue, 2 May 2017 20:44:03 +0000 (20:44 +0000)]
Auto merge of #41605 - tschottdorf:param-env, r=nikomatsakis

Store interned predicates in ParameterEnvironment

See #41444. As a first step towards untangling `ParameterEnvironment`, change
its `caller_bounds` field from a `Vec` into an interned slice of
`ty::Predicate`s.

This change is intentionally well-contained and doesn't pull on any of the
loose ends. In particular, you'll note that `normalize_param_env_or_error`
now interns twice.

7 years agoadd FIXME to `Steal`
Niko Matsakis [Tue, 2 May 2017 17:59:15 +0000 (13:59 -0400)]
add FIXME to `Steal`

7 years agoremove `mir_passes` from `Session` and add a FIXME
Niko Matsakis [Tue, 2 May 2017 17:58:49 +0000 (13:58 -0400)]
remove `mir_passes` from `Session` and add a FIXME

7 years agofix librustc_driver
Niko Matsakis [Tue, 2 May 2017 15:31:10 +0000 (11:31 -0400)]
fix librustc_driver

7 years agohave borrowck fetch MIR, which will perform some errors
Niko Matsakis [Tue, 2 May 2017 13:52:12 +0000 (09:52 -0400)]
have borrowck fetch MIR, which will perform some errors

7 years agoremove temporary variable
Niko Matsakis [Tue, 2 May 2017 10:34:29 +0000 (06:34 -0400)]
remove temporary variable

7 years agoupdate comment about heuristics
Niko Matsakis [Tue, 2 May 2017 10:33:11 +0000 (06:33 -0400)]
update comment about heuristics

7 years agomove queries code into transform
Niko Matsakis [Tue, 2 May 2017 10:32:03 +0000 (06:32 -0400)]
move queries code into transform

7 years agorename from `item_mir` to `optimized_mir`
Niko Matsakis [Tue, 2 May 2017 10:08:13 +0000 (06:08 -0400)]
rename from `item_mir` to `optimized_mir`

7 years agorun MIR borrowck on the validated, not optimized, MIR
Niko Matsakis [Tue, 2 May 2017 10:07:54 +0000 (06:07 -0400)]
run MIR borrowck on the validated, not optimized, MIR

7 years agodelete dead code
Niko Matsakis [Mon, 1 May 2017 22:44:25 +0000 (18:44 -0400)]
delete dead code

7 years agopacify the mercilous tidy
Niko Matsakis [Mon, 1 May 2017 22:43:46 +0000 (18:43 -0400)]
pacify the mercilous tidy

7 years agoremove irrelevant comments
Niko Matsakis [Mon, 1 May 2017 21:17:44 +0000 (17:17 -0400)]
remove irrelevant comments

7 years agosupport inlining by asking for optimizer mir for callees
Niko Matsakis [Mon, 1 May 2017 20:03:05 +0000 (16:03 -0400)]
support inlining by asking for optimizer mir for callees

I tested this with it enabled 100% of the time, and we were able to run
mir-opt tests successfully.

7 years agosimplify down to one query per pass suite
Niko Matsakis [Mon, 1 May 2017 18:39:48 +0000 (14:39 -0400)]
simplify down to one query per pass suite

7 years agorip out everything but `MirPass`, move the logic into suites
Niko Matsakis [Mon, 1 May 2017 17:46:35 +0000 (13:46 -0400)]
rip out everything but `MirPass`, move the logic into suites

7 years agoremove `Pass` and (temporarily) drop `Inline`
Niko Matsakis [Mon, 1 May 2017 16:47:00 +0000 (12:47 -0400)]
remove `Pass` and (temporarily) drop `Inline`

7 years agomove `build_mir` into `build` directory
Niko Matsakis [Tue, 2 May 2017 18:56:26 +0000 (14:56 -0400)]
move `build_mir` into `build` directory

7 years agoFix up @martinhath's mailmap entry
Martin Hafskjold Thoresen [Tue, 2 May 2017 19:12:27 +0000 (21:12 +0200)]
Fix up @martinhath's mailmap entry

7 years agoStore interned predicates in ParameterEnvironment
Tobias Schottdorf [Tue, 2 May 2017 18:37:00 +0000 (14:37 -0400)]
Store interned predicates in ParameterEnvironment

See #41444. As a first step towards untangling `ParameterEnvironment`, change
its `caller_bounds` field from a `Vec` into an interned slice of
`ty::Predicate`s.

This change is intentionally well-contained and doesn't pull on any of the
loose ends. In particular, you'll note that `normalize_param_env_or_error`
now interns twice.

7 years agoRemove obsolete --disable-elf-tls configure switch.
Ralph Giles [Mon, 1 May 2017 21:58:25 +0000 (14:58 -0700)]
Remove obsolete --disable-elf-tls configure switch.

Support for disabling ELF-style thread local storage in
the standard library at configure time was removed in
pulls #30417 and #30678, in favour of a member in
the TargetOptions database. The new method respects
MACOSX_DEPLOYMENT_TARGET on macOS, addressing the
original use case for this configure option.

However, those commits left the configure option itself
in place. It's no longer referenced anywhere and can
be removed.

7 years agoadjust privacy of various types in `build`
Niko Matsakis [Mon, 1 May 2017 15:58:05 +0000 (11:58 -0400)]
adjust privacy of various types in `build`

7 years agorename `mir_map` to `queries` and remove `build_mir_for_crate`
Niko Matsakis [Mon, 1 May 2017 15:23:53 +0000 (11:23 -0400)]
rename `mir_map` to `queries` and remove `build_mir_for_crate`

7 years agoadd a README describing the whole design
Niko Matsakis [Sat, 29 Apr 2017 09:28:35 +0000 (05:28 -0400)]
add a README describing the whole design

7 years agouse `force` to ensure const-qualif has been done, not read
Niko Matsakis [Sat, 29 Apr 2017 09:28:14 +0000 (05:28 -0400)]
use `force` to ensure const-qualif has been done, not read

7 years agoadd comments to `Steal` and use `bug!`
Niko Matsakis [Sat, 29 Apr 2017 08:36:55 +0000 (04:36 -0400)]
add comments to `Steal` and use `bug!`

7 years agoconvert the `inline` pass to use the new multi result
Niko Matsakis [Fri, 28 Apr 2017 23:29:16 +0000 (19:29 -0400)]
convert the `inline` pass to use the new multi result

This involves changing various details about that system,
though the basic shape remains the same.

7 years agoadjust the macro to allow for `multi` modifier
Niko Matsakis [Fri, 28 Apr 2017 16:09:15 +0000 (12:09 -0400)]
adjust the macro to allow for `multi` modifier

7 years agointroduce `IntoKeyValues` trait to prepare for multi-queries
Niko Matsakis [Fri, 28 Apr 2017 13:41:01 +0000 (09:41 -0400)]
introduce `IntoKeyValues` trait to prepare for multi-queries

The idea is that such queries will return `FxHashMap`

7 years agorework macro to prepare for more modifiers than just `[pub]`
Niko Matsakis [Fri, 28 Apr 2017 13:40:48 +0000 (09:40 -0400)]
rework macro to prepare for more modifiers than just `[pub]`

7 years agointroduce idea of "stealable" MIR
Niko Matsakis [Fri, 28 Apr 2017 10:00:48 +0000 (06:00 -0400)]
introduce idea of "stealable" MIR

This is a more principled version of the `RefCell` we were using
before. We now allocate a `Steal<Mir<'tcx>>` for each intermediate MIR
pass; when the next pass steals the entry, any later attempts to use it
will panic (there is no way to *test* if MIR is stolen, you're just
supposed to *know*).

7 years agorename `MirPassSet` to `MirSuite`
Niko Matsakis [Fri, 28 Apr 2017 08:49:09 +0000 (04:49 -0400)]
rename `MirPassSet` to `MirSuite`

This seems like a better noun.

7 years agoretool MIR passes completely
Niko Matsakis [Thu, 27 Apr 2017 20:48:48 +0000 (16:48 -0400)]
retool MIR passes completely

The new setup is as follows. There is a pipeline of MIR passes that each
run **per def-id** to optimize a particular function. You are intended
to request MIR at whatever stage you need it. At the moment, there is
only one stage you can request:

- `optimized_mir(def_id)`

This yields the final product. Internally, it pulls the MIR for the
given def-id through a series of steps. Right now, these are still using
an "interned ref-cell" but they are intended to "steal" from one
another:

- `mir_build` -- performs the initial construction for local MIR
- `mir_pass_set` -- performs a suite of optimizations and transformations
- `mir_pass` -- an individual optimization within a suite

So, to construct the optimized MIR, we invoke:

    mir_pass_set((MIR_OPTIMIZED, def_id))

which will build up the final MIR.

7 years agomove to only def-id passes
Niko Matsakis [Thu, 27 Apr 2017 17:16:57 +0000 (13:16 -0400)]
move to only def-id passes

this temporary disables `inline`

7 years agorewrite `Passes` to have sets of passes
Niko Matsakis [Thu, 27 Apr 2017 17:04:57 +0000 (13:04 -0400)]
rewrite `Passes` to have sets of passes

Also, store the completed set of passes in the tcx.

7 years agointroduce `DefIdPass` and remove all impls of `Pass` but `Inline`
Niko Matsakis [Thu, 27 Apr 2017 15:46:17 +0000 (11:46 -0400)]
introduce `DefIdPass` and remove all impls of `Pass` but `Inline`

7 years agosimplify the MirPass traits and passes dramatically
Niko Matsakis [Tue, 25 Apr 2017 22:23:33 +0000 (18:23 -0400)]
simplify the MirPass traits and passes dramatically

Overall goal: reduce the amount of context a mir pass needs so that it
resembles a query.

- The hooks are no longer "threaded down" to the pass, but rather run
  automatically from the top-level (we also thread down the current pass
  number, so that the files are sorted better).
  - The hook now receives a *single* callback, rather than a callback per-MIR.
- The traits are no longer lifetime parameters, which moved to the
  methods -- given that we required
  `for<'tcx>` objecs, there wasn't much point to that.
- Several passes now store a `String` instead of a `&'l str` (again, no
  point).

7 years agorework `MirPass` API to be stateless and extract helper fns
Niko Matsakis [Tue, 25 Apr 2017 22:22:59 +0000 (18:22 -0400)]
rework `MirPass` API to be stateless and extract helper fns

7 years agointroduce `mir_keys()`
Niko Matsakis [Tue, 25 Apr 2017 19:56:02 +0000 (15:56 -0400)]
introduce `mir_keys()`

Each MIR key is a DefId that has MIR associated with it

7 years agorustbuild: Sanity-check cmake for sanitizers too
Josh Stone [Tue, 2 May 2017 17:58:47 +0000 (10:58 -0700)]
rustbuild: Sanity-check cmake for sanitizers too

It's possible to build the sanitizers when using an external LLVM, but
we still need cmake for this.  Extend the sanity check to look for cmake
whenever sanitizers are enabled too.

7 years agoAuto merge of #41207 - sstewartgallus:spinpause, r=alexcrichton
bors [Tue, 2 May 2017 17:48:28 +0000 (17:48 +0000)]
Auto merge of #41207 - sstewartgallus:spinpause, r=alexcrichton

Spin loop pause function redux

GitHub's interface is screwy.

This is the same PR as https://github.com/rust-lang/rust/pull/40537

7 years agoAdd test for Inherent static methods can be called with a non-well-formed Self-type.
Charlie Sheridan [Tue, 2 May 2017 17:33:10 +0000 (13:33 -0400)]
Add test for Inherent static methods can be called with a non-well-formed Self-type.

7 years agoAuto merge of #41702 - frewsxcv:rollup, r=frewsxcv
bors [Tue, 2 May 2017 14:56:11 +0000 (14:56 +0000)]
Auto merge of #41702 - frewsxcv:rollup, r=frewsxcv

Rollup of 6 pull requests

- Successful merges: #41661, #41662, #41673, #41688, #41692, #41693
- Failed merges:

7 years agoRemove ANTLR grammar.
Mark Simulacrum [Tue, 2 May 2017 14:34:09 +0000 (08:34 -0600)]
Remove ANTLR grammar.

It is unused and not maintained.

7 years agoRollup merge of #41693 - est31:anon_params_removal, r=eddyb
Corey Farwell [Tue, 2 May 2017 13:09:59 +0000 (09:09 -0400)]
Rollup merge of #41693 - est31:anon_params_removal, r=eddyb

Removal pass for anonymous parameters

Removes occurences of anonymous parameters from the
rustc codebase, as they are to be deprecated.

See issue #41686 and RFC 1685.

r? @frewsxcv

7 years agoRollup merge of #41692 - est31:anon_params, r=eddyb
Corey Farwell [Tue, 2 May 2017 13:09:58 +0000 (09:09 -0400)]
Rollup merge of #41692 - est31:anon_params, r=eddyb

Add a lint to disallow anonymous parameters

Adds a (allow by default) lint to disallow anonymous parameters, like it was decided in RFC 1685 (rust-lang/rfcs#1685).

cc tracking issue #41686

7 years agoRollup merge of #41688 - rust-lang:hex-value-process-exit, r=sfackler
Corey Farwell [Tue, 2 May 2017 13:09:57 +0000 (09:09 -0400)]
Rollup merge of #41688 - rust-lang:hex-value-process-exit, r=sfackler

Fix incorrect hex value in doc comment example.

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

7 years agoRollup merge of #41673 - bitshifter:repr-align-codegen-test, r=arielb1
Corey Farwell [Tue, 2 May 2017 13:09:56 +0000 (09:09 -0400)]
Rollup merge of #41673 - bitshifter:repr-align-codegen-test, r=arielb1

Add simple `[repr(align)]` codegen test.

Checks alloca and memcpy are aligned correctly.

Test added to as additional check for #33626.

7 years agoRollup merge of #41662 - nikomatsakis:on-demandify-region-mapping, r=eddyb
Corey Farwell [Tue, 2 May 2017 13:09:55 +0000 (09:09 -0400)]
Rollup merge of #41662 - nikomatsakis:on-demandify-region-mapping, r=eddyb

On demandify region mapping

This is an adaptation of @cramertj's PR. I am sort of tempted to keep simplifying it, but also tempted to land it so and we can refactor more in follow-up PRs. As is, it does the following things:

- makes the region-maps an on-demand query, per function `tcx.region_maps(def_id)`
- interns code extents instead of of having them be integers
- remove the "root region extent" and (to some extent) item extents; instead we use `Option<CodeExtent<'tcx>>` in a few places (no space inefficiency since `CodeExtent<'tcx>` is now a pointer).

I'm not entirely happy with the way I have it setup though. Here are some of the changes I was considering (I'm not sure if they would work out well):

1. Removing `item_extents` entirely -- they are rarely used now, because most of the relevant places now accept an `Option<Region<'tcx>>` or an `Option<CodeExtent<'tcx>>`, but I think still used in a few places.
2. Merging `RegionMaps` into the typeck tables, instead of having it be its own query.
3. Change `CodeExtent<'tcx>` to store the parent pointer. This would mean that fewer places in the code actually *need* a `RegionMaps` anyhow, since most of them just want to be able to walk "up the tree". On the other hand, you wouldn't be able to intern a `CodeExtent<'tcx>` for some random node-id, you'd need to look it up in the table (since there'd be more information).

Most of this code is semi-temporary -- I expect it to largely go away as we move to NLL -- so I'm also not *that* concerned with making it perfect.

r? @eddyb

7 years agoRollup merge of #41661 - barik:master, r=alexcrichton
Corey Farwell [Tue, 2 May 2017 13:09:54 +0000 (09:09 -0400)]
Rollup merge of #41661 - barik:master, r=alexcrichton

Under MinGW, x.py fails to run with UnboundLocalError.

Under MinGW, `x.py` will fail with the following errors:

```bash
$ ./x.py
Traceback (most recent call last):
  File "./x.py", line 20, in <module>
    bootstrap.main()
  File "C:/src/rust/src/bootstrap/bootstrap.py", line 620, in main
    bootstrap()
  File "C:/src/rust/src/bootstrap/bootstrap.py", line 601, in bootstrap
    rb.build = rb.build_triple()
  File "C:/src/rust/src/bootstrap/bootstrap.py", line 459, in build_triple
    if os.environ.get('MSYSTEM') == 'MINGW64':
UnboundLocalError: local variable 'os' referenced before assignment
```

The reason is due to the `build_triple` function in `src/bootstrap/bootstrap.py` (Line 416):

```python
if ostype == 'Linux':
    os = subprocess.check_output(['uname', '-o']).strip().decode(default_encoding)

```

Here, the assignment to `os` is causing the `os` module to be shadowed.

Then, in (Line 459):

```python
if os.environ.get('MSYSTEM') == 'MINGW64':
    cputype = 'x86_64'
```

`os` now refers to the uninitialized local variable, not the `os` module.

Easiest fix is to simply rename the `os` variable to something like `os_from_sp`.

Also, there is a small typo fix in `x.py` referencing the wrong file name.

7 years agoUsing a span_suggestion to display use & hint
gaurikholkar [Tue, 2 May 2017 05:23:53 +0000 (22:23 -0700)]
Using a span_suggestion to display use & hint

7 years agoAdding consider changing to & suggestion for let bindings
gaurikholkar [Sat, 29 Apr 2017 12:39:45 +0000 (05:39 -0700)]
Adding consider changing to & suggestion for let bindings

7 years agoAuto merge of #41547 - alexeyzab:41425-fix-mismatched-types-error-message, r=arielb1
bors [Tue, 2 May 2017 12:11:54 +0000 (12:11 +0000)]
Auto merge of #41547 - alexeyzab:41425-fix-mismatched-types-error-message, r=arielb1

Fix error message for mismatched types

This addresses #41425 by implementing the changes mentioned in the
following comment:
https://github.com/rust-lang/rust/issues/41425#issuecomment-296754508