Commit Graph

59041 Commits

Author SHA1 Message Date
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
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
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
Eduard Burtescu
f97c132cac rustc: use Span's allow_internal_unstable instead of hir::BlockCheckMode. 2016-11-28 04:18:10 +02:00
Eduard Burtescu
da47c2e2ac rustc_typeck: save the type cache for rustdoc and save-analysis. 2016-11-28 04:18:10 +02:00
Eduard-Mihai Burtescu
962633cdbb rustc: embed path resolutions into the HIR instead of keeping DefMap. 2016-11-28 04:18:10 +02:00
Eduard-Mihai Burtescu
bc096549e8 rustc: desugar use a::{b,c}; into use a::b; use a::c; in HIR. 2016-11-28 04:18:10 +02:00
Eduard Burtescu
6ebc6d8154 rustc: track hir::{TraitRef, Visibility} in the HIR map. 2016-11-28 04:18:10 +02:00
Eduard Burtescu
16b5c2cfef rustc: desugar UFCS as much as possible during HIR lowering. 2016-11-28 04:18:10 +02:00
Eduard Burtescu
34d1352f0e rustc: encode the optionality of type parameters in HIR paths. 2016-11-28 04:18:10 +02:00
bors
03bdaade2a Auto merge of #38022 - arthurprs:micro-opt-hm, r=bluss
Use displacement instead of initial bucket in HashMap code

Use displacement instead of initial bucket in HashMap code. It makes the code a bit cleaner and also saves a few instructions (handy since it'll be using some to do some sort of adaptive behavior soon).
2016-11-27 17:06:58 -06:00
arthurprs
178e29df7d Use displacement instead of initial bucket in HashMap code 2016-11-27 21:38:46 +01:00
bors
9ca50bd4d5 Auto merge of #38027 - rkruppe:llvm-printpasses-fwdcompat, r=alexcrichton
[LLVM 4.0] LLVMRustPrintPasses

Adapt `LLVMRustPrintPasses` to LLVM 4.0 preferring `StringRef` over `char *`

cc #37609
2016-11-27 13:51:40 -06:00
bors
2008732975 Auto merge of #37983 - GuillaumeGomez:tcp_listener_doc, r=frewsxcv
Add examples for TcpListener struct

r? @frewsxcv
2016-11-27 10:39:41 -06:00
Robin Kruppe
cb0e24eafa Adapt LLVMRustPrintPasses to LLVM 4.0 preferring StringRef over char * 2016-11-27 14:48:47 +01:00
bors
0e17ba5ffc Auto merge of #38007 - alygin:err-expl-fix, r=eddyb
Fix error explanation formatting

Errors E0101, E0458, E0535 and E0537 have incorrectly formatted bulleted lists in their explanations. As the result, they are not rendered as lists in the documentation.

The fix applies the correct formatting to those lists.
2016-11-27 06:04:18 -06:00
Guillaume Gomez
f216f1fc53 Add examples for TcpListener struct 2016-11-27 13:00:31 +01:00
bors
f3930aab46 Auto merge of #38023 - arielb1:constant-evil-x2, r=eddyb
don't double-apply variant padding to const enums

`build_const_struct` already returns the struct with padding - don't double-apply it in the `General` case.

This should hopefully be the last time we have this sort of bug.

Fixes #38002.

Beta-nominating because regression.

r? @eddyb
2016-11-26 21:49:41 -06:00
Ariel Ben-Yehuda
fcebf3beab don't double-apply variant padding to const enums
Fixes #38002.
2016-11-27 02:57:55 +02:00
bors
f8614c3973 Auto merge of #36340 - sfackler:slice-get-slice, r=alexcrichton
Implement RFC 1679

cc #35729

r? @alexcrichton
2016-11-26 18:47:06 -06:00
bors
9a8657925b Auto merge of #38004 - GuillaumeGomez:tcp_stream_doc, r=frewsxcv
Add missing urls and examples to TcpStream

r? @frewsxcv
2016-11-26 15:37:34 -06:00
bors
9003e1ab6a Auto merge of #38008 - bluss:rustbuild-benches, r=alexcrichton
Add rustbuild command `bench`

Add command bench to rustbuild, so that `./x.py bench <path>` can compile and run benchmarks.

`./x.py bench --stage 1 src/libcollections` and `./x.py bench --stage 1 src/libstd` should both compile well. Just `./x.py bench` runs all benchmarks for the libstd crates.

Fixes #37897
2016-11-26 12:32:19 -06:00
Andrew Lygin
984c039e4e Fix error explanation formatting 2016-11-26 21:20:20 +03:00
Andrew Lygin
9fb81b92f9 Fix error explanation formatting 2016-11-26 21:20:20 +03:00
Steven Fackler
5377b5e9c4 Overload get{,_mut}{,_unchecked} 2016-11-26 10:07:39 -08:00
Martin Pool
591c134456 Clearer description of std::path::MAIN_SEPARATOR. 2016-11-26 09:24:48 -08:00
bors
7e39c0ede5 Auto merge of #38015 - sanxiyn:rollup, r=sanxiyn
Rollup of 7 pull requests

- Successful merges: #37962, #37963, #37967, #37978, #37985, #38001, #38010
- Failed merges:
2016-11-26 07:40:43 -06:00
Seo Sanghyeon
44b926a6bb Rollup merge of #38010 - frewsxcv:lock-creations, r=GuillaumeGomez
Document how lock 'guard' structures are created.
2016-11-26 22:02:15 +09:00