summary refs log tree commit diff
path: root/src/librustc_metadata/encoder.rs
AgeCommit message (Collapse)AuthorLines
2018-04-17Difference between master and betaOliver Schneider-1/+1
2018-04-17Get rid of redundant `HashSet`Oliver Schneider-13/+12
2018-04-17Encode items before encoding the list of AllocIdsOliver Schneider-10/+13
2018-04-17Use `LazySeq` instead of `Vec`Oliver Schneider-17/+22
2018-04-17Don't recurse into allocations, use a global table insteadOliver Schneider-22/+46
2018-03-22rustc: Add a `#[wasm_import_module]` attributeAlex Crichton-1/+11
This commit adds a new attribute to the Rust compiler specific to the wasm target (and no other targets). The `#[wasm_import_module]` attribute is used to specify the module that a name is imported from, and is used like so: #[wasm_import_module = "./foo.js"] extern { fn some_js_function(); } Here the import of the symbol `some_js_function` is tagged with the `./foo.js` module in the wasm output file. Wasm-the-format includes two fields on all imports, a module and a field. The field is the symbol name (`some_js_function` above) and the module has historically unconditionally been `"env"`. I'm not sure if this `"env"` convention has asm.js or LLVM roots, but regardless we'd like the ability to configure it! The proposed ES module integration with wasm (aka a wasm module is "just another ES module") requires that the import module of wasm imports is interpreted as an ES module import, meaning that you'll need to encode paths, NPM packages, etc. As a result, we'll need this to be something other than `"env"`! Unfortunately neither our version of LLVM nor LLD supports custom import modules (aka anything not `"env"`). My hope is that by the time LLVM 7 is released both will have support, but in the meantime this commit adds some primitive encoding/decoding of wasm files to the compiler. This way rustc postprocesses the wasm module that LLVM emits to ensure it's got all the imports we'd like to have in it. Eventually I'd ideally like to unconditionally require this attribute to be placed on all `extern { ... }` blocks. For now though it seemed prudent to add it as an unstable attribute, so for now it's not required (as that'd force usage of a feature gate). Hopefully it doesn't take too long to "stabilize" this! cc rust-lang-nursery/rust-wasm#29
2018-03-22rustc: Add a `#[wasm_custom_section]` attributeAlex Crichton-0/+12
This commit is an implementation of adding custom sections to wasm artifacts in rustc. The intention here is to expose the ability of the wasm binary format to contain custom sections with arbitrary user-defined data. Currently neither our version of LLVM nor LLD supports this so the implementation is currently custom to rustc itself. The implementation here is to attach a `#[wasm_custom_section = "foo"]` attribute to any `const` which has a type like `[u8; N]`. Other types of constants aren't supported yet but may be added one day! This should hopefully be enough to get off the ground with *some* custom section support. The current semantics are that any constant tagged with `#[wasm_custom_section]` section will be *appended* to the corresponding section in the final output wasm artifact (and this affects dependencies linked in as well, not just the final crate). This means that whatever is interpreting the contents must be able to interpret binary-concatenated sections (or each constant needs to be in its own custom section). To test this change the existing `run-make` test suite was moved to a `run-make-fulldeps` folder and a new `run-make` test suite was added which applies to all targets by default. This test suite currently only has one test which only runs for the wasm target (using a node.js script to use `WebAssembly` in JS to parse the wasm output).
2018-03-20Encode/decode extern statics in metadata and incremental cacheOliver Schneider-2/+2
2018-03-16Cleanup metadata and incremental cache processing of constantsOliver Schneider-24/+20
2018-03-08Hide the RefCell inside InterpretInternerOliver Schneider-3/+3
It was too easy to get this wrong
2018-03-08Don't borrow the interpret_interner for anything but a direct function callOliver Schneider-5/+4
2018-03-08Fully use miri in transOliver Schneider-5/+3
2018-03-08Initial changes to librustc to support const trait fns.Alexander Regueiro-1/+8
2018-03-08Nuke the entire ctfe from orbit, it's the only way to be sureOliver Schneider-9/+4
2018-03-08Produce instead of pointersOliver Schneider-6/+8
2018-03-08Add a variant to ConstVal for storing miri resultsOliver Schneider-1/+38
2018-03-06Add `inline` to `TransFnAttrs`Wesley Wiser-2/+2
Part of #47320
2018-03-06Don't show crate metadata symbol as exported symbol to downstream crates.Michael Woerister-3/+19
2018-03-06Don't recompute SymbolExportLevel for upstream crates.Michael Woerister-15/+13
2018-03-06Clean up handling of symbol export information.Michael Woerister-10/+9
2018-03-06Rename exported_symbol_ids query to something more explicit and document ↵Michael Woerister-11/+14
what it is doing.
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-3/+3
2018-02-22Implement --remap-path-prefixJeremy Fitzhardinge-1/+1
Remove experimental -Zremap-path-prefix-from/to, and replace it with the stabilized --remap-path-prefix=from=to variant. This is an implementation for issue of #41555.
2018-01-13Remove `impl Foo for ..` in favor of `auto trait Foo`leonardo.yvens-12/+0
No longer parse it. Remove AutoTrait variant from AST and HIR. Remove backwards compatibility lint. Remove coherence checks, they make no sense for the new syntax. Remove from rustdoc.
2018-01-13Auto merge of #47181 - michaelwoerister:var-len-def-index, r=eddybbors-1/+1
Use DefIndex encoding that works better with on-disk variable length integer representations. Use the least instead of the most significant bit for representing the address space. r? @eddyb
2018-01-11Auto merge of #47087 - Zoxc:incr_no_in_ignore, r=michaelwoeristerbors-8/+9
Replace uses of DepGraph.in_ignore with DepGraph.with_ignore I currently plan to track tasks in thread local storage. Ignoring things in a closure ensures that the ignore tasks do not overlap the beginning or end of any other task. The TLS API will also use a closure to change a TLS value, so having the ignore task be a closure also helps there. It also adds `assert_ignored` which is used before a `TyCtxt` is created. Instead of adding a new ignore task this simply ensures that we are in a context where reads are ignored. r? @michaelwoerister
2018-01-11Auto merge of #47243 - wesleywiser:incr_fingerprint_encoding, r=michaelwoeristerbors-0/+7
[incremental] Specialize encoding and decoding of Fingerprints This saves the storage space used by about 32 bits per `Fingerprint`. On average, this reduces the size of the `/target/{mode}/incremental` folder by roughly 5% [Full details here](https://gist.github.com/wesleywiser/264076314794fbd6a4c110d7c1adc43e). Fixes #45875 r? @michaelwoerister
2018-01-09[incremental] Specialize encoding and decoding of FingerprintsWesley Wiser-0/+7
This saves the storage space used by about 32 bits per `Fingerprint`. On average, this reduces the size of the `/target/{mode}/incremental` folder by roughly 5%. Fixes #45875
2018-01-09Replace uses of DepGraph.in_ignore with DepGraph.with_ignoreJohn Kåre Alsaker-8/+9
2018-01-09Rollup merge of #47258 - rkruppe:struct-assert, r=eddybkennytm-4/+4
rustc::ty: Rename struct_variant to non_enum_variant r? @eddyb
2018-01-08Use different DefIndex representation that is better suited for variable ↵Michael Woerister-1/+1
length integer encodings.
2018-01-08rustc::ty: Rename `struct_variant` to `non_enum_variant`Robin Kruppe-4/+4
It is also intended for use with unions.
2018-01-04Span Encoding: Replace if with debug_assertion() and add some comments.Michael Woerister-3/+4
2018-01-04Map invalid Spans to DUMMY_SP during crate metadata encoding.Michael Woerister-1/+39
This mirrors what we for stabilizing the incr. comp. cache and is necessary for reproducible builds.
2017-12-21Auto merge of #46922 - kennytm:rollup, r=kennytmbors-0/+7
Rollup of 14 pull requests - Successful merges: #46636, #46780, #46784, #46809, #46814, #46820, #46839, #46847, #46858, #46878, #46884, #46890, #46898, #46918 - Failed merges:
2017-12-21Add GenericParam, refactor Generics in ast, hir, rustdocJonas Platte-3/+3
The Generics now contain one Vec of an enum for the generic parameters, rather than two separate Vec's for lifetime and type parameters. Additionally, places that previously used Vec<LifetimeDef> now use Vec<GenericParam> instead.
2017-12-19incr.comp.: Precompute small hash for filenames to save some work.Michael Woerister-0/+7
2017-12-14add trait aliases to HIRAlex Burka-1/+3
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-15/+17
2017-12-05Include non-`pub` `use` and `extern crate` items in the crate metadata for ↵Jeffrey Seyfried-3/+1
macros 2.0.
2017-12-01Auto merge of #46370 - michaelwoerister:rm-metadata-hashing, r=eddybbors-58/+10
incr.comp.: Remove ability to produce incr. comp. hashes during metadata export. This functionality has been superseded by on-import hashing, which can be less conservative and does not require extra infrastructure. r? @nikomatsakis
2017-11-29incr.comp.: Remove on-export crate metadata hashing.Michael Woerister-58/+10
2017-11-28incr.comp.: Make MIR encoding fit for incr.comp. caching.Michael Woerister-0/+9
2017-11-21Auto merge of #45879 - nikomatsakis:nll-kill-cyclic-closures, r=arielb1bors-13/+19
move closure kind, signature into `ClosureSubsts` Instead of using side-tables, store the closure-kind and signature in the substitutions themselves. This has two key effects: - It means that the closure's type changes as inference finds out more things, which is very nice. - As a result, it avoids the need for the `freshen_closure_like` code (though we still use it for generators). - It avoids cyclic closures calls. - These were never meant to be supported, precisely because they make a lot of the fancy inference that we do much more complicated. However, due to an oversight, it was previously possible -- if challenging -- to create a setup where a closure *directly* called itself (see e.g. #21410). We have to see what the effect of this change is, though. Needs a crater run. Marking as [WIP] until that has been assessed. r? @arielb1
2017-11-21Auto merge of #45701 - cramertj:impl-trait-this-time, r=eddybbors-1/+1
impl Trait Lifetime Handling This PR implements the updated strategy for handling `impl Trait` lifetimes, as described in [RFC 1951](https://github.com/rust-lang/rfcs/blob/master/text/1951-expand-impl-trait.md) (cc #42183). With this PR, the `impl Trait` desugaring works as follows: ```rust fn foo<T, 'a, 'b, 'c>(...) -> impl Foo<'a, 'b> { ... } // desugars to exists type MyFoo<ParentT, 'parent_a, 'parent_b, 'parent_c, 'a, 'b>: Foo<'a, 'b>; fn foo<T, 'a, 'b, 'c>(...) -> MyFoo<T, 'static, 'static, 'static, 'a, 'b> { ... } ``` All of the in-scope (parent) generics are listed as parent generics of the anonymous type, with parent regions being replaced by `'static`. Parent regions referenced in the `impl Trait` return type are duplicated into the anonymous type's generics and mapped appropriately. One case came up that wasn't specified in the RFC: it's possible to write a return type that contains multiple regions, neither of which outlives the other. In that case, it's not clear what the required lifetime of the output type should be, so we generate an error. There's one remaining FIXME in one of the tests: `-> impl Foo<'a, 'b> + 'c` should be able to outlive both `'a` and `'b`, but not `'c`. Currently, it can't outlive any of them. @nikomatsakis and I have discussed this, and there are some complex interactions here if we ever allow `impl<'a, 'b> SomeTrait for AnonType<'a, 'b> { ... }`, so the plan is to hold off on this until we've got a better idea of what the interactions are here. cc #34511. Fixes #44727.
2017-11-18remove the `generator_sigs` map, query, and plumbingNiko Matsakis-12/+19
2017-11-18kill the `closure_kind` queryNiko Matsakis-1/+0
2017-11-17Fix impl Trait Lifetime HandlingTaylor Cramer-1/+1
After this change, impl Trait existentials are desugared to a new `abstract type` definition paired with a set of lifetimes to apply. In-scope generics are included as parents of the `abstract type` generics. Parent regions are replaced with static, and parent regions referenced in the `impl Trait` type are duplicated at the end of the `abstract type`'s generics.
2017-11-17Auto merge of #46004 - michaelwoerister:cached-mir-wip-3, r=nikomatsakisbors-2/+29
incr.comp.: Implement query result cache and use it to cache type checking tables. This is a spike implementation of caching more than LLVM IR and object files when doing incremental compilation. At the moment, only the `typeck_tables_of` query is cached but MIR and borrow-check will follow shortly. The feature is activated by running with `-Zincremental-queries` in addition to `-Zincremental`, it is not yet active by default. r? @nikomatsakis
2017-11-16incr.comp.: Remove default serialization implementations for things in ↵Michael Woerister-2/+29
rustc::hir::def_id so that we get an ICE instead of silently doing the wrong thing.