Commit Graph

59066 Commits

Author SHA1 Message Date
bors
f50dbd580f Auto merge of #37918 - flodiebold:separate-bodies, r=nikomatsakis
Separate function bodies from their signatures in HIR

Also give them their own dep map node.

I'm still unhappy with the handling of inlined items (1452edc1), but maybe you have a suggestion how to improve it.

Fixes #35078.

r? @nikomatsakis
2016-11-29 08:50:38 -06:00
Florian Diebold
593b273659 librustdoc: Fix compilation after visitor change 2016-11-29 13:18:02 +01:00
Niko Matsakis
9457497bcc update comments 2016-11-29 13:04:27 +01:00
Niko Matsakis
104125d5f7 revamp Visitor with a single method for controlling nested visits 2016-11-29 13:04:27 +01:00
Florian Diebold
8575184b39 Fix rebase breakage 2016-11-29 13:04:27 +01:00
Florian Diebold
bf298aebfd Fix doc test collection 2016-11-29 13:04:27 +01:00
Florian Diebold
b10bbde335 Fix SVH tests some more 2016-11-29 13:04:27 +01:00
Florian Diebold
f0ce5bb66b Split nested_visit_mode function off from nested_visit_map
... and make the latter mandatory to implement.
2016-11-29 13:04:27 +01:00
Florian Diebold
725cffb1d5 Address remaining review comments 2016-11-29 13:04:27 +01:00
Florian Diebold
d5a501d312 Fix remaining SVH tests 2016-11-29 13:04:27 +01:00
Florian Diebold
d0ae2c8142 Refactor inlined items some more
They don't implement FnLikeNode anymore, instead are handled differently
further up in the call tree. Also, keep less information (just def ids
for the args).
2016-11-29 13:04:27 +01:00
Niko Matsakis
dd1491cfbe WIP: update tests to pass -- not complete 2016-11-29 13:04:27 +01:00
Niko Matsakis
688946d671 restructure CollectItem dep-node to separate fn sigs from bodies
Setup two tasks, one of which only processes the signatures, in order to
isolate the typeck entries for signatures from those for bodies.

Fixes #36078
Fixes #37720
2016-11-29 13:04:27 +01:00
Florian Diebold
f75c8a98dd Add make tidy fixes 2016-11-29 13:04:27 +01:00
Florian Diebold
23a8c7d4d9 Remove unused import 2016-11-29 13:04:27 +01:00
Florian Diebold
8d5ca62dcd Fix some comments 2016-11-29 13:04:27 +01:00
Florian Diebold
78b54c07e5 Make hello_world test work again
This used to work with the rustc_clean attribute, but doesn't anymore
since my rebase; but I don't know enough about the type checking to find
out what's wrong. The dep graph looks like this:

ItemSignature(xxxx) -> CollectItem(xxxx)
CollectItem(xxxx) -> ItemSignature(xxxx)
ItemSignature(xxxx) -> TypeckItemBody(yyyy)
HirBody(xxxx) -> CollectItem(xxxx)

The cycle between CollectItem and ItemSignature looks wrong, and my
guess is the CollectItem -> ItemSignature edge shouldn't be there, but
I'm not sure how to prevent it.
2016-11-29 13:04:27 +01:00
Florian Diebold
7b021298d9 Fix new tests 2016-11-29 13:04:27 +01:00
Florian Diebold
fb968d225a rustc_typeck: Make CollectItemTypesVisitor descend into bodies as well 2016-11-29 13:04:27 +01:00
Florian Diebold
c91037b964 Fix cross-crate associated constant evaluation 2016-11-29 13:04:27 +01:00
Florian Diebold
936dbbce37 Give function bodies their own dep graph node 2016-11-29 13:04:27 +01:00
Florian Diebold
16eedd2a78 Save bodies of functions for inlining into other crates
This is quite hacky and I hope to refactor it a bit, but at least it
seems to work.
2016-11-29 13:04:27 +01:00
Florian Diebold
1ac338c2a7 rustc_driver: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
0389cc6bcd rustc_passes: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
37e75411dd rustc_plugin: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
2b790f75c5 rustc_plugin: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
441e099195 rustc_metadata: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
0cdd1d4bc1 rustc_privacy: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
dd6a57ce2a rustc_trans: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
8f63b416af rustc_trans: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
2f6976ede9 rustc_incremental: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
490c23f054 rustc_incremental: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
b7a6cf8f10 rustc_typeck: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
8c8257a8c6 rustc_borrowck: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
8f6bb85b98 rustc_mir: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
8e754736dc rustc_const_eval: fix compilation 2016-11-29 13:04:27 +01:00
Florian Diebold
f55482e7c9 rustc: replace body exprs by their ids 2016-11-29 13:04:27 +01:00
Florian Diebold
069a2442b8 Add exprs map to crate, collect item blocks there 2016-11-29 13:04:27 +01:00
bors
5de15be5ec Auto merge of #38046 - rkruppe:fix-32bit-rustbuild, r=alexcrichton
Fix rustbuild on 32 bit Linux

This is cherry-picked from #37817 which seems to be stalled and currently needs to be rebased anyway.

r? @alexcrichton (who authored this change)
2016-11-28 21:44:44 -06:00
bors
1c448574bc Auto merge of #37791 - petrochenkov:where, r=nikomatsakis
Support `?Sized` in where clauses

Implemented as described in https://github.com/rust-lang/rust/issues/20503#issuecomment-258677026 - `?Trait` bounds are moved on type parameter definitions when possible, reported as errors otherwise.
(It'd be nice to unify bounds and where clauses in HIR, but this is mostly blocked by rustdoc now - it needs to render bounds in pleasant way and the best way to do it so far is to mirror what was written in source code.)

Fixes https://github.com/rust-lang/rust/issues/20503
r? @nikomatsakis
2016-11-28 15:15:17 -06:00
bors
39c267a8d5 Auto merge of #38024 - jseyfried:avoid_needless_proc_macro_deps, r=nrc
Avoid loading needless proc-macro dependencies

Fixes #37958 when no proc-macros are exported; in particular, without `pub extern crate proc_macros;`, `#![feature(macro_reexport)]`, or `#![feature(use_extern_macros)]`.

I opened https://github.com/rust-lang/cargo/issues/3334 for exported proc macros.

r? @alexcrichton
2016-11-28 07:03:43 -06:00
Robin Kruppe
02249e813e Define VISIBILITY_HIDDEN when compiling compiler-rt
This is cherry-picked from #37817 which seems to be stalled and currently needs to be rebased anyway.

r? @alexcrichton (who authored this change)
2016-11-28 12:23:57 +01:00
bors
0b399e5e99 Auto merge of #37676 - eddyb:lazy-7, r=nikomatsakis
[7/n] rustc: desugar UFCS in HIR and don't use DefMap for associated resolutions.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37412) | [next](https://github.com/rust-lang/rust/pull/37688)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments._

<hr>

Previously, a path like `T::Assoc::method`, while equivalent to `<<T>::Assoc>::method`, wasn't desugared in any way at the HIR level and everything inspecting it had to either deal with knowing only `T` (before typeck) or knowing only the definition of `method` (after typeck).
Such a path also had only one `NodeId` and associated resolution during typeck modified `DefMap`, in a way that would be hard for incremental recompilation to track, and inconvenient for partial type conversions from HIR to `Ty`, which are required to break faux-cycles in on-demand type collection.

The desugarings performed by this PR are as follows:
* `use a::{b,c};` is flattened to `use a as _; use a::b; use a::c;`
  * as resolution is complete, `use a as _;` doesn't do anything, except get checked for stability
* `Vec::new` (an expression) becomes `Vec<..>::new<..>`, to distinguish it from `<Vec>::new<..>`
  * the "infer all parameters" `<..>` form is internal and not even pretty-printed
  * used when there are no type parameters at all, in an expression or pattern path segment
* `T::A::B` becomes `<<T>::A>::B` in a type, and `<<T<..>>::A<..>>::B<..>` in an expression/pattern
  * one additional `hir::Ty` node is created for each prefix, starting with the fully-resolved type (`T`) and extending it with each segment (e.g. `<T>::A`)
* fully-resolved paths contain their `Def` in HIR, getting rid of the `DefMap` and absolving incremental recompilation of needing to manually look up nodes to handle that side information

Not keeping the `DefMap` around meant that associated resolutions had to be stored somewhere else:
* expressions and patterns use a new `NodeId -> Def` map in `ty::Tables`
  * compatible with the future per-body (constant / `fn` / closure) `Tables`
* types are accessible via `Ty` and the usual per-item generics / predicates / type
  * `rustdoc` and `save-analysis` are the only situations which insist on mapping syntactical types to semantical ones, or at least understand the resolution of associated types, therefore the type conversion cache, i.e. a `NodeId -> Ty` map, is exposed by typeck for this purpose
  * stability had to be split into a pass that runs on HIR and checks the results of name resolution, and impromptu checks triggered by `typeck` for associated paths, methods, fields, etc.
  * privacy using semantic types results in accurate reachability for `impl Trait`, which fixes #35870, and thorough introspection of associated types, which may allow relaxing private-in-public checking on bounds, while keeping the intended ban on projections with private type parameters

cc @petrochenkov
2016-11-27 23:32:57 -06:00
Jeffrey Seyfried
1fd9041b82 Avoid loading needless proc-macro dependencies. 2016-11-28 03:37:02 +00:00
Eduard-Mihai Burtescu
372c6df564 rustc_typeck: don't record associated type resolutions. 2016-11-28 05:12:41 +02:00
Eduard Burtescu
548e681f2f rustc_privacy: switch private-in-public checking to Ty. 2016-11-28 05:12:41 +02:00
Eduard Burtescu
fcdb4def83 rustc: track fields in the HIR map. 2016-11-28 05:12:41 +02:00
Eduard-Mihai Burtescu
36d33d6b71 rustc_privacy: visit Ty instead of HIR types in EmbargoVisitor. 2016-11-28 05:09:28 +02:00
bors
c7ddb8946b Auto merge of #38019 - sourcefrog:doc-separator, r=frewsxcv
Clearer description of std::path::MAIN_SEPARATOR.
2016-11-27 20:22:44 -06:00
Eduard Burtescu
9aaf26e7aa rustc: rework stability to be on-demand for type-directed lookup. 2016-11-28 04:18:11 +02:00