Commit Graph

79643 Commits

Author SHA1 Message Date
Felix S. Klock II
6dfed7e813 small refactoring: replaced mutable state with return statements in control flow.
As a drive-by, removed some dead-code.
2018-06-19 19:38:37 +02:00
Felix S. Klock II
be645be660 Thread more argument info down from Hir into the mir::LocalDecls.
Namely, we thread down the `HirId` of the explicit type of the
argument.  In the case of the special `self` variable with an implicit
type, we also thread down a description of its structure (`self`/`mut
self`/`&self`/`&mut self`).
2018-06-19 19:38:37 +02:00
Felix S. Klock II
c5c4c5e938 Add fn fn_decl to Hir, for looking up the FnDecl of a body owner. 2018-06-19 19:38:37 +02:00
Felix S. Klock II
e848fe0e3a Refactor: Replace anonymous-tuple with tuple struct as prep for adding more fields in future. 2018-06-19 19:38:37 +02:00
Felix S. Klock II
cac61267a7 Thread info about form of variable bindings, including spans of arg types, down into mir::LocalDecls.
As a drive-by: the ref_for_guards created by `fn declare_binding`
should not have been tagged as user_variables in the first
place. These secret internal locals are *pointers* to user variables,
but themselves are not such (IMO. For now at least.)
2018-06-19 19:38:37 +02:00
Emerentius
000aff604e specialize StepBy<Range(Inclusive)>
the originally generated code was highly suboptimal
this brings it close to the same code or even exactly the same as a
manual while-loop by eliminating a branch and the
double stepping of n-1 + 1 steps

The intermediate trait lets us circumvent the specialization
type inference bugs
2018-06-19 19:33:54 +02:00
Adam Barth
03a40b31a7 Update zx_cprng_draw_new on Fuchsia
Fuchsia is changing the semantics for zx_cprng_draw and
zx_cprng_draw_new is a temporary name for the new semantics.
2018-06-19 09:46:51 -07:00
bors
6ec1b626ba Auto merge of #51367 - oli-obk:silence!_I_test_you, r=Mark-Simulacrum
Use quiet tests by default

r? @eddyb
2018-06-19 15:05:19 +00:00
bors
a646c912f7 Auto merge of #51081 - kornelski:examplestr, r=steveklabnik
Use String, not &str in some collection examples

Discussed in #46966

Overuse of borrowed values in data structures is a common mistake I see in Rust user forums. Users who copy&paste such examples end up fighting with the borrow checker as soon as they replace string literals with some real values.

This changes a couple of examples to use `String`, and it adds opportunity to demonstrate use of `Borrow`.
2018-06-19 13:09:04 +00:00
bors
72b0f915ba Auto merge of #51597 - Mark-Simulacrum:update-books, r=Mark-Simulacrum
Update books for next release
2018-06-19 10:53:36 +00:00
bors
1080203e97 Auto merge of #50383 - stevepentland:union-derive, r=oli-obk
Add ability to apply custom derive to union types.

The Union item type has been included in the allowed types for a custom derive.
fyi @abonander

Closes #50223
2018-06-19 08:50:41 +00:00
Wangshan Lu
f8c8701b18
Fix links in README.md 2018-06-19 16:07:14 +08:00
bors
1cfb628ead Auto merge of #51383 - Zoxc:parallel-stuff, r=nikomatsakis
Run some stuff in parallel

Requires https://github.com/rust-lang/rust/pull/50699 to actually work correctly.

r? @nikomatsakis
2018-06-19 06:51:18 +00:00
Seiichi Uchida
cafe9d0ed4 Do not consume semicolon twice while parsing local statement 2018-06-19 14:04:16 +09:00
bors
ed39523406 Auto merge of #51278 - EPashkin:fix_mod_with_multilevel_paths_on_windows, r=nikomatsakis
Fix processing mod with multi-level path on Windows

Fix error in [rustfmt](https://github.com/rust-lang-nursery/rustfmt/issues/1754) because libsyntax can not handle `mod` with multilevel path on Windows.

Alternative is do almost same in https://github.com/rust-lang/rust/blob/master/src/libstd/sys/windows/fs.rs#L717 to allow work on paths with different separators, Ex. "\\\\?\\c:\\windows/temp"
2018-06-19 02:17:52 +00:00
Steve Pentland
14abb550bf
Add ability to apply custom derive to union types.
The Union item type has been included in the allowed types for a custom
derive. Closes #50223
2018-06-18 21:34:11 -04:00
John Kåre Alsaker
fe1cb88c08 Use MTRef and MTLock to avoid a RefCell 2018-06-19 03:19:50 +02:00
John Kåre Alsaker
8368f364e3 Add MTRef and a lock_mut function to MTLock 2018-06-19 03:19:50 +02:00
John Kåre Alsaker
d86eb784d6 Parallelize trans item collection 2018-06-19 03:19:50 +02:00
John Kåre Alsaker
71c26b3171 Save query results and the dep graph in parallel 2018-06-19 03:19:49 +02:00
John Kåre Alsaker
b5650f9282 Parallel code 2018-06-19 03:19:48 +02:00
John Kåre Alsaker
6ee8e0fc11 Add par_body_owners 2018-06-19 03:19:26 +02:00
Nicholas Nethercote
ba0bb02f6f Return a SmallVec from place_elements.
These vectors are always small, so this avoids lots of allocations.
2018-06-19 09:37:31 +10:00
Nicholas Nethercote
8c7433a3cc Avoid allocations in has_any_child_of.
`has_any_child_of` is hot. It allocates a `Vec` that almost always
doesn't exceed a length of 1.

This patch peels off the first iteration of the loop, avoiding the need
for the `Vec` creation in ~99% of cases.
2018-06-19 09:37:26 +10:00
bors
fc19590297 Auto merge of #51248 - fabric-and-ink:newtype_index_debrujin, r=nikomatsakis
Declare DebruijnIndex via newtype_index macro

Part of #49887

Declare `DebruijnIndex` via the `newtype_index` macro.
2018-06-18 23:14:50 +00:00
Simon Sapin
2b789bd057 Rename OOM to allocation error
The acronym is not descriptive unless one has seen it before.

* Rename the `oom` function to `handle_alloc_error`. It was **stabilized in 1.28**, so if we do this at all we need to land it this cycle.
* Rename `set_oom_hook` to `set_alloc_error_hook`
* Rename `take_oom_hook` to `take_alloc_error_hook`

Bikeshed: `alloc` v.s. `allocator`, `error` v.s. `failure`
2018-06-18 21:41:24 +02:00
bors
5230979794 Auto merge of #50894 - teiesti:stabilize_path_ancestors, r=dtolnay
Stabilize std::path::Path::ancestors

Closes #48581

r? @BurntSushi
2018-06-18 18:56:13 +00:00
Tobias Stolzmann
65d119cbf6
Stabilize std::path::Path:ancestors 2018-06-18 19:49:45 +02:00
bors
b36917b331 Auto merge of #51460 - nikomatsakis:nll-perf-examination-refactor-1, r=pnkfelix
Improve memoization and refactor NLL type check

I have a big branch that is refactoring NLL type check with the goal of introducing canonicalization-based memoization for all of the operations it does. This PR contains an initial prefix of that branch which, I believe, stands alone. It does introduce a few smaller optimizations of its own:

- Skip operations that are trivially a no-op
- Cache the results of the dropck-outlives computations done by liveness
- Skip resetting unifications if nothing changed

r? @pnkfelix
2018-06-18 16:37:10 +00:00
Mark Simulacrum
deaba27861 Update books for next release 2018-06-18 10:34:48 -06:00
bors
862703e05e Auto merge of #51414 - oli-obk:impl_trait_type_def, r=pnkfelix
Add existential type definitions

Note: this does not allow creating named existential types, it just desugars `impl Trait` to a less (but still very) hacky version of actual `existential type` items.

r? @nikomatsakis
2018-06-18 14:34:52 +00:00
Kornel
01e82f111e Prefer use of owned values in examples 2018-06-18 12:38:46 +01:00
bors
c45ae9ea3a Auto merge of #51605 - ericfindlay:master, r=kennytm
Fixed minor error in Compiler Error Index, E0603.
2018-06-18 00:27:58 +00:00
Nicholas Nethercote
70d22fa051 Improve Node::{parent,dependents} interplay.
This patch:

- Reorders things a bit so that `parent` is always handled before
  `dependents`.

- Uses iterator chaining to avoid some code duplication.
2018-06-18 10:04:23 +10:00
Nicholas Nethercote
6151bab8e1 Improve pushing to Node::dependents.
This patch makes it impossible for a node to end up in both
`node.parent` and `node.dependents`.
2018-06-18 10:04:23 +10:00
bors
4f2936393e Auto merge of #51404 - clarcharr:never_hash, r=KodrAus
impl Hash for !

This was missing in some generic code I was writing and I figured that it would be worthwhile to add this. Blanket-requiring these traits to allow usage of errors in `HashSet`s and `HashMap`s isn't too unreasonable of a use case, and a prerequisite for allowing `!` as an error in such situations is this impl.
2018-06-17 22:25:34 +00:00
bors
86a8f1a637 Auto merge of #51529 - nodakai:improve-sys_common-mutex, r=oli-obk
libstd: add an RAII utility for sys_common::mutex::Mutex

It is indeed debatable whether or not we should introduce more sophistication like this to the lowest layer of a system library. In fact, `Drop::drop()` cannot be `unsafe` (IIRC there was a discussion on introducing an unsafe variant of `Drop` whose entire scope must be within `unsafe`)
2018-06-17 20:11:35 +00:00
bors
2b973e6532 Auto merge of #51555 - ccesare:remove_unused_variables_redox_os, r=kennytm
Removed two unused variables in os.rs

Issue #51419 suggested removing two unused variables in `libstd/sys/redox/os.rs`. This PR implements that change.

It compiles for me locally, but I haven't run any other tests.
2018-06-17 18:06:31 +00:00
bors
85a6cd9ab5 Auto merge of #51552 - ccesare:patch-1, r=kennytm
Minor language change to CONTRIBUTING.md

In the `#building` section, the doc read that a default configuration "shall use around 3.5 GB of disk space." Changed "shall use" to "requires," as I don't think it's meant to sound so prescriptive.
2018-06-17 16:07:29 +00:00
bors
9181741ede Auto merge of #51549 - PSeitz:patch-1, r=kennytm
Follow up to #51508, make parse_block public instead parse_block_expr

This is an follow up to #51508

I mistakenly made parse_block_expr public instead of parse_block.
This fixes this.
2018-06-17 14:05:43 +00:00
bors
499583aa92 Auto merge of #51392 - glaubitz:powerpc-tests, r=petrochenkov
test: Ignore some problematic tests on powerpc and powerpc64*

This updates the list of tests which can be safely ignored on powerpc and powerpc64*.
2018-06-17 11:53:56 +00:00
John Paul Adrian Glaubitz
d63aabcb36 test: Ignore some problematic tests on powerpc and powerpc64* 2018-06-17 12:00:47 +02:00
bors
594b05dd97 Auto merge of #51425 - QuietMisdreavus:thats-def-a-namespace-there, r=petrochenkov
refactor: create multiple HIR items for imports

When lowering `use` statements into HIR, they get a `Def` of the thing they're pointing at. This is great for things that need to know what was just pulled into scope. However, this is a bit misleading, because a `use` statement can pull things from multiple namespaces if their names collide. This is a problem for rustdoc, because if there are a module and a function with the same name (for example) then it will only document the module import, because that's that the lowered `use` statement points to.

The current version of this PR does the following:

* Whenever the resolver comes across a `use` statement, it loads the definitions into a new `import_map` instead of the existing `def_map`. This keeps the resolutions per-namespace so that all the target definitions are available.
* When lowering `use` statements, it looks up the resolutions in the `import_map` and creates multiple `Item`s if there is more than one resolution.
* To ensure the `NodeId`s are properly tracked in the lowered module, they need to be created in the AST, and pulled out as needed if multiple resolutions are available.

Fixes https://github.com/rust-lang/rust/issues/34843
2018-06-17 09:48:10 +00:00
bors
aec00f97e1 Auto merge of #51466 - joshlf:ref-split, r=dtolnay
Add Ref/RefMut map_split method

As proposed [here](https://internals.rust-lang.org/t/make-refcell-support-slice-splitting/7707).

TLDR: Add a `map_split` method that allows multiple `RefMut`s to exist simultaneously so long as they refer to non-overlapping regions of the original `RefCell`. This is useful for things like the slice `split_at_mut` method.
2018-06-17 07:49:25 +00:00
NODA, Kai
b81da27862 libstd: add an RAII utility for sys_common::mutex::Mutex
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2018-06-17 15:18:32 +08:00
bors
0f8f4903f7 Auto merge of #51382 - GuillaumeGomez:intra-link-lint, r=QuietMisdreavus
Add lint for intra link resolution failure

This PR is almost done, just remains this note:

```
note: requested on the command line with `-W intra-link-resolution-failure`
```

I have no idea why my lint is considered as being passed through command line and wasn't able to find where it was set. If anyone has an idea, it'd be very helpful!

cc @QuietMisdreavus
2018-06-17 02:57:40 +00:00
Eric Findlay
1eff1d414f Fixed minor error in Compiler Error Index, E0603. 2018-06-17 11:35:53 +09:00
bors
68da15eae9 Auto merge of #51596 - Mark-Simulacrum:bootstrap-racy-tests, r=petrochenkov
Prevent Windows filesystem races in bootstrap tests

Fixes #51595.

This also makes bootstrap tests run near last in `./x.py test` invocations
since they are unlikely to fail.

r? @petrochenkov
2018-06-16 23:48:16 +00:00
bors
ae46aefd5b Auto merge of #51594 - eddyb:issue-51582, r=nagisa
rustc_codegen_llvm: don't treat i1 as signed, even for #[repr(i8)] enums.

Fixes #51582. r? @nagisa cc @nox @oli-obk
2018-06-16 21:48:31 +00:00
bors
b7e94a148d Auto merge of #51558 - Manishearth:manish-is-stupid, r=oli-obk
Fix my comment on editions

me = idiot

r? @oli-obk
2018-06-16 19:49:33 +00:00