about summary refs log tree commit diff
path: root/src/librustc_metadata
AgeCommit message (Collapse)AuthorLines
2016-11-29rustc: replace body exprs by their idsFlorian Diebold-1/+1
2016-11-28Refactor TyTrait to contain a interned ExistentialPredicate slice.Mark-Simulacrum-0/+9
Renames TyTrait to TyDynamic.
2016-11-28Auto merge of #38024 - jseyfried:avoid_needless_proc_macro_deps, r=nrcbors-21/+22
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-28Avoid loading needless proc-macro dependencies.Jeffrey Seyfried-21/+22
2016-11-28rustc: embed path resolutions into the HIR instead of keeping DefMap.Eduard-Mihai Burtescu-6/+7
2016-11-28rustc: desugar `use a::{b,c};` into `use a::b; use a::c;` in HIR.Eduard-Mihai Burtescu-2/+2
2016-11-26Fix error explanation formattingAndrew Lygin-3/+4
2016-11-26Fix error explanation formattingAndrew Lygin-3/+4
2016-11-24Delay error reporting of filename mismatch.Paul Lietar-7/+22
When cross compiling with procedural macros, the crate loader starts by looking for a target crate, before trying with a host crate. Rather than emitting an error immediately if the host and target extension differ, the compiler should delay it until both attempts have failed. Fixes #37899 r? @jseyfried
2016-11-23Auto merge of #37931 - eddyb:meta-version, r=jseyfriedbors-18/+31
rustc_metadata: don't break the version check when CrateRoot changes. In #36551 I made `rustc_version` a field of `CrateRoot`, but despite it being the first field, one could still break the version check by changing `CrateRoot` so older compilers couldn't fully decode it (e.g. #37463). This PR fixes #37803 by moving the version string back at the beginning of metadata, right after the 32-bit big-endian absolute position of `CrateRoot`, and by incrementing `METADATA_VERSION`.
2016-11-22Auto merge of #37681 - nrc:crate-metadata, r=@alexcrichtonbors-42/+84
add --crate-type metadata r? @alexcrichton
2016-11-23Rebasing and review changesNick Cameron-26/+38
2016-11-22rustc_metadata: don't break the version check when CrateRoot changes.Eduard-Mihai Burtescu-18/+31
2016-11-21Auto merge of #37824 - jseyfried:symbols, r=eddybbors-65/+66
Clean up `ast::Attribute`, `ast::CrateConfig`, and string interning This PR - removes `ast::Attribute_` (changing `Attribute` from `Spanned<Attribute_>` to a struct), - moves a `MetaItem`'s name from the `MetaItemKind` variants to a field of `MetaItem`, - avoids needlessly wrapping `ast::MetaItem` with `P`, - moves string interning into `syntax::symbol` (`ast::Name` is a reexport of `symbol::Symbol` for now), - replaces `InternedString` with `Symbol` in the AST, HIR, and various other places, and - refactors `ast::CrateConfig` from a `Vec` to a `HashSet`. r? @eddyb
2016-11-21Use `Symbol` instead of `InternedString` in the AST, HIR, and various other ↵Jeffrey Seyfried-60/+60
places.
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-13/+14
2016-11-21Read in rmeta cratesNick Cameron-26/+55
2016-11-21Add --crate-type metadataNick Cameron-1/+2
With the same semantics as -Zno-trans
2016-11-20Fix bug in proc-macro dependencies.Jeffrey Seyfried-0/+3
2016-11-20Refactor `MetaItemKind` to use `Name`s instead of `InternedString`s.Jeffrey Seyfried-3/+3
2016-11-20Refactor away `ast::Attribute_`.Jeffrey Seyfried-1/+1
2016-11-17Auto merge of #37846 - jseyfried:fix_proc_macro_dep, r=alexcrichtonbors-4/+4
Fix bug in proc_macro dependency loading Fixes #37839. r? @alexcrichton
2016-11-17Auto merge of #37660 - nikomatsakis:incremental-36349, r=eddybbors-24/+26
Separate impl items from the parent impl This change separates impl item bodies out of the impl itself. This gives incremental more resolution. In so doing, it refactors how the visitors work, and cleans up a bit of the collect/check logic (mostly by moving things out of collect that didn't really belong there, because they were just checking conditions). However, this is not as effective as I expected, for a kind of frustrating reason. In particular, when invoking `foo.bar()` you still wind up with dependencies on private items. The problem is that the method resolution code scans that list for methods with the name `bar` -- and this winds up touching *all* the methods, even private ones. I can imagine two obvious ways to fix this: - separating fn bodies from fn sigs (#35078, currently being pursued by @flodiebold) - a more aggressive model of incremental that @michaelwoerister has been advocating, in which we hash the intermediate results (e.g., the outputs of collect) so that we can see that the intermediate result hasn't changed, even if a particular impl item has changed. So all in all I'm not quite sure whether to land this or not. =) It still seems like it has to be a win in some cases, but not with the test cases we have just now. I can try to gin up some test cases, but I'm not sure if they will be totally realistic. On the other hand, some of the early refactorings to the visitor trait seem worthwhile to me regardless. cc #36349 -- well, this is basically a fix for that issue, I guess r? @michaelwoerister NB: Based atop of @eddyb's PR https://github.com/rust-lang/rust/pull/37402; don't land until that lands.
2016-11-18Fix bug in loading proc macro dependencies.Jeffrey Seyfried-4/+4
2016-11-17Auto merge of #37424 - shiver:issue-37131, r=alexcrichtonbors-1/+6
Improved error reporting when target sysroot is missing. Attempts to resolve #37131. This is my first pull request on rust, so I would greatly appreciate any feedback you have on this. Thanks!
2016-11-17hash the contents of impl-item-ref by adding them to visitorNiko Matsakis-21/+18
Also simplify some of the `ty::AssociatedItem` representation, in particular by folding `has_value` into `hir::Defaultness`
2016-11-17Auto merge of #37793 - jseyfried:fix_proc_macro_def_ids, r=nrcbors-11/+30
Fix proc macro def ids Update some `CStore` methods to also work correctly with proc macro def ids. Fixes #37788. r? @nrc
2016-11-17Improved error reporting when target sysroot is missing.Robert Vally-1/+6
2016-11-16fallout from separating impl-items from implsNiko Matsakis-0/+4
Basically adding `visit_impl_item` in various places and so forth.
2016-11-16refactor Visitor into ItemLikeVisitor and intravisit::VisitorNiko Matsakis-3/+4
There are now three patterns (shallow, deep, and nested visit). These are described in detail on the docs in `itemlikevisit::ItemLikeVisitor`.
2016-11-16rustc: Implement #[link(cfg(..))] and crt-staticAlex Crichton-35/+51
This commit is an implementation of [RFC 1721] which adds a new target feature to the compiler, `crt-static`, which can be used to select how the C runtime for a target is linked. Most targets dynamically linke the C runtime by default with the notable exception of some of the musl targets. [RFC 1721]: https://github.com/rust-lang/rfcs/blob/master/text/1721-crt-static.md This commit first adds the new target-feature, `crt-static`. If enabled, then the `cfg(target_feature = "crt-static")` will be available. Targets like musl will have this enabled by default. This feature can be controlled through the standard target-feature interface, `-C target-feature=+crt-static` or `-C target-feature=-crt-static`. Next this adds an gated and unstable `#[link(cfg(..))]` feature to enable the `crt-static` semantics we want with libc. The exact behavior of this attribute is a little squishy, but it's intended to be a forever-unstable implementation detail of the liblibc crate. Specifically the `#[link(cfg(..))]` annotation means that the `#[link]` directive is only active in a compilation unit if that `cfg` value is satisfied. For example when compiling an rlib, these directives are just encoded and ignored for dylibs, and all staticlibs are continued to be put into the rlib as usual. When placing that rlib into a staticlib, executable, or dylib, however, the `cfg` is evaluated *as if it were defined in the final artifact* and the library is decided to be linked or not. Essentially, what'll happen is: * On MSVC with `-C target-feature=-crt-static`, the `msvcrt.lib` library will be linked to. * On MSVC with `-C target-feature=+crt-static`, the `libcmt.lib` library will be linked to. * On musl with `-C target-feature=-crt-static`, the object files in liblibc.rlib are removed and `-lc` is passed instead. * On musl with `-C target-feature=+crt-static`, the object files in liblibc.rlib are used and `-lc` is not passed. This commit does **not** include an update to the liblibc module to implement these changes. I plan to do that just after the 1.14.0 beta release is cut to ensure we get ample time to test this feature. cc #37406
2016-11-16Improve proc macro def ids.Jeffrey Seyfried-11/+30
2016-11-12rustc_typeck: register item types for closuresAriel Ben-Yehuda-1/+1
This makes them closer to actual items and allows for more transparent treatment.
2016-11-12rustc: move closure upvar types to the closure substsAriel Ben-Yehuda-1/+1
This moves closures to the (DefId, Substs) scheme like all other items, and saves a word from the size of TyS now that Substs is 2 words.
2016-11-12Rollup merge of #37688 - eddyb:lazy-8, r=petrochenkovEduard-Mihai Burtescu-8/+11
[8/n] rustc: clean up lookup_item_type and remove TypeScheme. _This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37676) | [next]()) 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> * `tcx.tcache` -> `tcx.item_types` * `TypeScheme` (grouping `Ty` and `ty::Generics`) is removed * `tcx.item_types` entries no longer duplicated in `tcx.tables.node_types` * `tcx.lookup_item_type(def_id).ty` -> `tcx.item_type(def_id)` * `tcx.lookup_item_type(def_id).generics` -> `tcx.item_generics(def_id)` * `tcx.lookup_generics(def_id)` -> `tcx.item_generics(def_id)` * `tcx.lookup_{super_,}predicates(def_id)` -> `tcx.item_{super_,}predicates(def_id)`
2016-11-10rustc: clean up lookup_item_type and remove TypeScheme.Eduard Burtescu-8/+11
2016-11-10Support `#[macro_reexport]`ing custom derives.Jeffrey Seyfried-85/+87
2016-11-10Improve macro reexports.Jeffrey Seyfried-104/+121
2016-11-10Add variants `Def::Macro` and `Namespace::MacroNS`.Jeffrey Seyfried-3/+16
2016-11-10Register and stability check `#[no_link]` crates.Jeffrey Seyfried-34/+37
2016-11-10Refactor `explicitly_linked: bool` -> `dep_kind: DepKind`.Jeffrey Seyfried-32/+28
2016-11-10Clean up `CrateSource`.Jeffrey Seyfried-67/+27
2016-11-10rustc: unify and simplify managing associated items.Eduard Burtescu-84/+67
2016-11-09Rollup merge of #37614 - keeperofdakeys:proc_macro, r=jseyfriedEduard-Mihai Burtescu-2/+6
macros 1.1: Allow proc_macro functions to declare attributes to be mark as used This PR allows proc macro functions to declare attribute names that should be marked as used when attached to the deriving item. There are a few questions for this PR. - Currently this uses a separate attribute named `#[proc_macro_attributes(..)]`, is this the best choice? - In order to make this work, the `check_attribute` function had to be modified to not error on attributes marked as used. This is a pretty large change in semantics, is there a better way to do this? - I've got a few clones where I don't know if I need them (like turning `item` into a `TokenStream`), can these be avoided? - Is switching to `MultiItemDecorator` the right thing here? Also fixes https://github.com/rust-lang/rust/issues/37563.
2016-11-09Rollup merge of #37229 - nnethercote:FxHasher, r=nikomatsakisEduard-Mihai Burtescu-29/+29
Replace FNV with a faster hash function. Hash table lookups are very hot in rustc profiles and the time taken within `FnvHash` itself is a big part of that. Although FNV is a simple hash, it processes its input one byte at a time. In contrast, Firefox has a homespun hash function that is also simple but works on multiple bytes at a time. So I tried it out and the results are compelling: ``` futures-rs-test 4.326s vs 4.212s --> 1.027x faster (variance: 1.001x, 1.007x) helloworld 0.233s vs 0.232s --> 1.004x faster (variance: 1.037x, 1.016x) html5ever-2016- 5.397s vs 5.210s --> 1.036x faster (variance: 1.009x, 1.006x) hyper.0.5.0 5.018s vs 4.905s --> 1.023x faster (variance: 1.007x, 1.006x) inflate-0.1.0 4.889s vs 4.872s --> 1.004x faster (variance: 1.012x, 1.007x) issue-32062-equ 0.347s vs 0.335s --> 1.035x faster (variance: 1.033x, 1.019x) issue-32278-big 1.717s vs 1.622s --> 1.059x faster (variance: 1.027x, 1.028x) jld-day15-parse 1.537s vs 1.459s --> 1.054x faster (variance: 1.005x, 1.003x) piston-image-0. 11.863s vs 11.482s --> 1.033x faster (variance: 1.060x, 1.002x) regex.0.1.30 2.517s vs 2.453s --> 1.026x faster (variance: 1.011x, 1.013x) rust-encoding-0 2.080s vs 2.047s --> 1.016x faster (variance: 1.005x, 1.005x) syntex-0.42.2 32.268s vs 31.275s --> 1.032x faster (variance: 1.014x, 1.022x) syntex-0.42.2-i 17.629s vs 16.559s --> 1.065x faster (variance: 1.013x, 1.021x) ``` (That's a stage1 compiler doing debug builds. Results for a stage2 compiler are similar.) The attached commit is not in a state suitable for landing because I changed the implementation of FnvHasher without changing its name (because that would have required touching many lines in the compiler). Nonetheless, it is a good place to start discussions. Profiles show very clearly that this new hash function is a lot faster to compute than FNV. The quality of the new hash function is less clear -- it seems to do better in some cases and worse in others (judging by the number of instructions executed in `Hash{Map,Set}::get`). CC @brson, @arthurprs
2016-11-08Allow proc_macro functions to whitelist specific attributesJosh Driver-2/+6
By using a second attribute `attributes(Bar)` on proc_macro_derive, whitelist any attributes with the name `Bar` in the deriving item. This allows a proc_macro function to use custom attribtues without a custom attribute error or unused attribute lint.
2016-11-08Auto merge of #36843 - petrochenkov:dotstab, r=nikomatsakisbors-1/+1
Stabilize `..` in tuple (struct) patterns I'd like to nominate `..` in tuple and tuple struct patterns for stabilization. This feature is a relatively small extension to existing stable functionality and doesn't have known blockers. The feature first appeared in Rust 1.10 6 months ago. An example of use: https://github.com/rust-lang/rust/pull/36203 Closes https://github.com/rust-lang/rust/issues/33627 r? @nikomatsakis
2016-11-08Replace FnvHasher use with FxHasher.Nicholas Nethercote-29/+29
This speeds up compilation by 3--6% across most of rustc-benchmarks.
2016-11-03Stabilize `..` in tuple (struct) patternsVadim Petrochenkov-1/+1
2016-11-02rustc: record the target type of every adjustment.Eduard Burtescu-1/+1