Commit Graph

97654 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
199d585981 lowering: extract lower_expr_let 2019-08-10 20:24:43 +02:00
Mazdak Farrokhzad
ed1e943bc5 lowering: extract lower_expr_if 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
11251b9dab lowering: extract lower_expr_while_in_loop_scope 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
c8b3b2e052 lowering: move wrap_in_try_constructor -> expr.rs 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
8ddd173811 lowering: extract lower_expr_try_block 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
e450dcaf8e lowering: move lower_await -> expr.rs 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
548e3090c2 lowering: extract lower_expr_closure 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
ca19e326a6 lowering: extract lower_expr_async_closure 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
309bf2fcad lowering: extract lower_expr_range_closed 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
c789e7a5cc lowering: extract lower_expr_range 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
119499230c lowering: extract lower_expr_asm 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
45d507d39e lowering: extract lower_expr_yield 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
9d739ca12d lowering: extract lower_expr_for 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
c817596c69 lowering: extract lower_expr_try 2019-08-10 20:24:42 +02:00
Mazdak Farrokhzad
cf20d8c388 lowering: move lower_expr -> expr.rs 2019-08-10 20:24:42 +02:00
bors
9703ef6661 Auto merge of #62955 - Mark-Simulacrum:rustdoc-clean-1, r=eddyb
rustdoc: general cleanups

This is purely a refactoring, mostly just simplifying some of the code. Commits are best reviewed individually.
2019-08-10 17:19:55 +00:00
Lzu Tao
30ba4bd8e2 Use Result::unwrap_or_else instead of matching 2019-08-10 17:16:58 +00:00
Lzu Tao
93839c3fb4 Add an example to show how to insert item to a sorted vec 2019-08-10 16:31:38 +00:00
bjorn3
d809d6ee89
Derive Debug for CrateInfo 2019-08-10 16:47:27 +02:00
Ralf Jung
440a5c8100 rename RUST_CTFE_BACKTRACE to RUSTC_CTFE_BACKTRACE 2019-08-10 16:37:40 +02:00
bors
be3fb0cd2c Auto merge of #63437 - Centril:rollup-ryx881p, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #63400 (Try to break resolve into more isolated parts)
 - #63425 (Cleanup historical stability comments)
 - #63429 (.gitignore: Readd `/tmp/`)
 - #63432 (Cleanup & Simplify stuff in lowering)

Failed merges:

r? @ghost
2019-08-10 13:44:09 +00:00
Mazdak Farrokhzad
808f98378e
Rollup merge of #63432 - Centril:simplify-lowering, r=eddyb
Cleanup & Simplify stuff in lowering

Closes https://github.com/rust-lang/rust/issues/60253 as a byproduct.

It turns out that it is in fact necessary to have a `DropTemps(...)` around the `match_expr` and there is a test (https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-13304.rs) which fails without that.

r? @eddyb
2019-08-10 15:27:36 +02:00
Mazdak Farrokhzad
219336a06c
Rollup merge of #63429 - rust-lang:gitignore-readd-tmp, r=Mark-Simulacrum
.gitignore: Readd `/tmp/`

Specifically, `/tmp/partitioning-tests/` it is generated by the incremental tests, https://github.com/rust-lang/rust/search?p=2&q=partitioning-tests&unscoped_q=partitioning-tests. These are cleaned up by compiletest but not if you kill testing prematurely (which I just did to test out a rollup, and it is annoying to `rm -rf tmp/`).

r? @Mark-Simulacrum
cc @RalfJung
2019-08-10 15:27:34 +02:00
Mazdak Farrokhzad
ad8b0a0b8f
Rollup merge of #63425 - Mark-Simulacrum:clean-stability-doc, r=eddyb
Cleanup historical stability comments

These weren't removed by ccbcc720a6 most likely by accident,
let's clean them up now.
2019-08-10 15:27:33 +02:00
Mazdak Farrokhzad
9d76a938de
Rollup merge of #63400 - petrochenkov:resplit, r=eddyb
Try to break resolve into more isolated parts

Some small step towards resolve librarification.

"Late resolution" is the pass that resolves most of names in a crate beside imports and macros.
It runs when the crate is fully expanded and its module structure is fully built.
So we just walk through the crate and resolve all the expressions, types, etc.

This pass is pretty self-contained, but it was previously done by implementing `Visitor` on the whole `Resolver` (which is used for many other tasks), and fields specific to this pass were indiscernible from the global `Resolver` state.

This PR moves the late resolution pass into a separate visitor and a separate file, fields specific to this visitor are moved from `Resolver` as well.

I'm especially happy about `current_module` being removed from `Resolver`.
It was used even for operations not related to visiting and changing the `current_module` position in process.
It was also used as an implicit argument for some functions used in this style
```rust
let orig_current_module = mem::replace(&mut self.current_module, module);
self.resolve_ident_somewhere();
self.current_module = orig_current_module;
```
and having effects on e.g. privacy checking somewhere deeply inside `resolve_ident_somewhere`.
Now we explicitly pass a `ParentScope` to those functions instead, which includes the module and some other data describing our position in the crate relatively to which we resolve names.

Rustdoc was one of the users of `current_module`, it set it for resolving intra-doc links.
Now it passes it explicitly as an argument as well (I also supported resolving paths from rustdoc in unnamed blocks as a drive-by fix).

Visibility resolution is also changed to use early resolution (which is correct because it's used during the work of `BuildReducedGraphVisitor`, i.e. integration of a new AST fragment into the existing partially built module structures.) instead of untimely late resolution (which worked only due to restrictions on paths in visibilities like inability to refer to anything except ancestor modules).
This slightly regresses its diagnostics because late resolution has a more systematic error detection and recovery currently.
Due to changes in `current_module` and visibilities `BuildReducedGraphVisitor` ended up almost as heavily affected by this refactoring as late resolution.

Fixes https://github.com/rust-lang/rust/issues/63223 (due to visibility resolution changes).
2019-08-10 15:27:31 +02:00
Tatsuyuki Ishi
2358e3eff6 Revert "Rollup merge of #62150 - alex:mem-uninit-refactor, r=RalfJung"
This reverts commit 1d45156866, reversing
changes made to 0f92eb8a4a.
2019-08-10 22:16:35 +09:00
Ralf Jung
62f1e8a7f1 fix test 2019-08-10 14:49:11 +02:00
Mark Rousskov
32f144a527 Implement Clean<Crate> on hir::Crate directly 2019-08-10 07:52:07 -04:00
Mark Rousskov
78d9088e77 Replace is_doc_reachable with is_public 2019-08-10 07:52:07 -04:00
Mark Rousskov
c36e0c0424 Remove NodeId from doctree::Module 2019-08-10 07:52:07 -04:00
Mark Rousskov
4beb751575 Gather deprecation information during cleaning 2019-08-10 07:52:07 -04:00
Mark Rousskov
11735b6235 Gather stability information during cleaning 2019-08-10 07:52:07 -04:00
Mark Rousskov
6c5d212f5f Make exact_paths a non-optional field on RustdocVisitor
Also privatizes needlessly public methods to enforce which methods
callers are intended to call, i.e., only `new` and `visit`.
2019-08-10 07:52:07 -04:00
Mark Rousskov
2fadc4524d Represent ownership transfer in RustdocVisitor::visit
Previously visit could be called multiple times, but this is inaccurate,
as it deconstructs Visitor state.
2019-08-10 07:52:07 -04:00
Mark Rousskov
2d18504c27 Remove Option from resolver 2019-08-10 07:52:07 -04:00
Ralf Jung
03e95ae412 Miri shouldn't look at types 2019-08-10 13:09:35 +02:00
Mark Rousskov
37100024de Make fields of RustdocVisitor private 2019-08-10 06:48:59 -04:00
Vadim Petrochenkov
319f0debd4 resolve: Address FIXME from the previous commit
Make the `is_import` flag in `ScopeSet` independent from namespace
Fix rebase
2019-08-10 13:48:17 +03:00
Mazdak Farrokhzad
8758d7f69d Cleanup & Simplify stuff in lowering. 2019-08-10 12:38:54 +02:00
Vadim Petrochenkov
8cc8133973 Fix calls to resolver from rustdoc and HIR lowering
Cleanup some surrounding code.
Support resolution of intra doc links in unnamed block scopes.
(Paths from rustdoc now use early resolution and no longer need results of late resolution like all the built ribs.)

Fix one test hitting file path limits on Windows.
2019-08-10 13:16:06 +03:00
Vadim Petrochenkov
f360d795f1 resolve: Move some more code around
Move methods logically belonging to build-reduced-graph into `impl BuildReducedGraphVisitor` and `build_reduced_graph.rs`
Move types mostly specific to late resolution closer to the late resolution visitor
2019-08-10 13:16:06 +03:00
Vadim Petrochenkov
9c86ce76e5 resolve: Turn resolve_error into a method on Resolver
Rename it to `report_error` and move into `diagnostics.rs`

Also turn `check_unused` into a method on `Resolver`
2019-08-10 13:16:06 +03:00
Vadim Petrochenkov
6a347f3701 resolve: Remove Deref<Target=Resolver> implementations
It's now immediately clear what fields belong to the global resolver state and what are specific to passes/visitors.
2019-08-10 13:16:06 +03:00
Vadim Petrochenkov
df03e420e0 resolve: Track whole parent scope in the visitors
Instead of tracking current module and other components separately.
(`ParentScope` includes the module as a component.)
2019-08-10 13:16:06 +03:00
Vadim Petrochenkov
ff85d1c2d2 resolve: Move late resolution visitor into a separate file 2019-08-10 13:16:06 +03:00
Vadim Petrochenkov
e2e8746acc resolve: Move late resolution into a separate visitor
Move `Resolver` fields specific to late resolution to the new visitor.
The `current_module` field from `Resolver` is replaced with two `current_module`s in `LateResolutionVisitor` and `BuildReducedGraphVisitor`.
Outside of those visitors `current_module` is replaced by passing `parent_scope` to more functions and using the parent module from it.

Visibility resolution no longer have access to later resolution methods and has to use early resolution, so its diagnostics in case of errors regress slightly.
2019-08-10 13:15:15 +03:00
bors
6f70adcb18 Auto merge of #63352 - jgalenson:reproducible-lto, r=alexcrichton
Sort the fat LTO modules to produce deterministic output.

Some projects that use LTO for their release builds are not reproducible.  We can fix this by sorting the fat LTO modules before using them.

It might also be useful to do this for thin LTO, but I couldn't get that to work to test it so I didn't do it.
2019-08-10 10:02:28 +00:00
Andreas Jonson
676953fde9 Revert "Simplify MIR generation for logical ops"
This reverts commit e38e954a0d.

llvm were not able to optimize the code that well with the simplified mir.

Closes: #62993
2019-08-10 10:52:04 +02:00
Mazdak Farrokhzad
83b837a7f9
.gitignore: Explain why /obj/ is ignored 2019-08-10 10:39:40 +02:00
Mazdak Farrokhzad
87a8c5706d
Explain why /tmp/ is ignored 2019-08-10 10:01:03 +02:00