summary refs log tree commit diff
path: root/src/librustc_metadata/decoder.rs
AgeCommit message (Collapse)AuthorLines
2018-04-20Fix path attribute in rustdocGuillaume Gomez-3/+6
2018-04-17Reduce the number of calls to `cdata`Oliver Schneider-2/+2
2018-04-17Use `LazySeq` instead of `Vec`Oliver Schneider-5/+17
2018-04-17Don't recurse into allocations, use a global table insteadOliver Schneider-31/+18
2018-03-25Rollup merge of #49273 - michaelwoerister:fix-extern-proc-macro-defkey, r=eddybkennytm-2/+19
Fix DefKey lookup for proc-macro crates. Add a special case for proc-macro crates for `def_key()` in the metadata decoder (like we already have for many other methods in there). In the long run, it would be preferable to get rid of the need for special casing proc-macro crates (see #49271). Fixes https://github.com/rust-lang/rust/issues/48739 (though I wasn't able to come up with a regression test, unfortunately) r? @eddyb
2018-03-22rustc: Add a `#[wasm_import_module]` attributeAlex Crichton-5/+5
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/+10
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-22Fix DefKey lookup for proc-macro crates.Michael Woerister-2/+19
2018-03-21work around fallout from these changes in rustcNiko Matsakis-1/+5
2018-03-19Auto merge of #49079 - oli-obk:cross_miri, r=michaelwoeristerbors-38/+30
Cleanup metadata and incremental cache processing of constants fixes #49033 fixes #49081 we really need tests for this. do we have any cross compilation tests? I couldn't find any
2018-03-16Cleanup metadata and incremental cache processing of constantsOliver Schneider-38/+30
2018-03-12Make CrateMetadata thread-safeJohn Kåre Alsaker-5/+16
2018-03-08Hide the RefCell inside InterpretInternerOliver Schneider-6/+5
It was too easy to get this wrong
2018-03-08Fully use miri in transOliver Schneider-3/+1
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-11/+4
2018-03-08Produce instead of pointersOliver Schneider-11/+27
2018-03-08Add a variant to ConstVal for storing miri resultsOliver Schneider-1/+45
2018-03-06Don't recompute SymbolExportLevel for upstream crates.Michael Woerister-4/+3
2018-03-06Rename exported_symbol_ids query to something more explicit and document ↵Michael Woerister-4/+5
what it is doing.
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-6/+6
2018-01-15Reexport -> re-export in prose and documentation commentsCarol (Nichols || Goulding)-2/+2
2018-01-13Remove `impl Foo for ..` in favor of `auto trait Foo`leonardo.yvens-10/+1
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-5/+5
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 #47243 - wesleywiser:incr_fingerprint_encoding, r=michaelwoeristerbors-0/+6
[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/+6
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-08Use different DefIndex representation that is better suited for variable ↵Michael Woerister-5/+5
length integer encodings.
2018-01-04Map invalid Spans to DUMMY_SP during crate metadata encoding.Michael Woerister-17/+11
This mirrors what we for stabilizing the incr. comp. cache and is necessary for reproducible builds.
2017-12-22Auto merge of #46842 - michaelwoerister:fingerprint-vec, r=nikomatsakisbors-1/+1
incr.comp.: Use an array instead of a hashmap for storing result hashes. Doing so should result in some of the core tracking components being faster. r? @nikomatsakis
2017-12-20incr.comp.: Replace Fingerprint::zero() with a constant.Michael Woerister-1/+1
2017-12-19incr.comp.: Precompute small hash for filenames to save some work.Michael Woerister-0/+2
2017-12-15incr.comp.: Revert hashing optimization that caused regression.Michael Woerister-2/+0
2017-12-14incr.comp.: Do less hashing per Span.Michael Woerister-0/+2
2017-12-13Auto merge of #46419 - jseyfried:all_imports_in_metadata, r=nrcbors-4/+19
Record all imports (`use`, `extern crate`) in the crate metadata This PR adds non-`pub` `use` and `extern crate` imports in the crate metadata since hygienic macros invoked in other crates may use them. We already include all other non-`pub` items in the crate metadata. This improves import suggestions in some cases. Fixes #42337. r? @nrc
2017-12-08incr.comp.: Make Span decoding more consistent so it doesn't mess up ↵Michael Woerister-13/+21
-Zincremental-verify-ich
2017-12-05Add field `is_import` to `def::Export`.Jeffrey Seyfried-4/+10
2017-12-05Include non-`pub` `use` and `extern crate` items in the crate metadata for ↵Jeffrey Seyfried-4/+13
macros 2.0.
2017-11-28incr.comp.: Make MIR encoding fit for incr.comp. caching.Michael Woerister-0/+9
2017-11-18remove the `generator_sigs` map, query, and plumbingNiko Matsakis-17/+0
2017-11-18kill the `closure_kind` queryNiko Matsakis-7/+0
2017-11-16incr.comp.: Remove default serialization implementations for things in ↵Michael Woerister-0/+21
rustc::hir::def_id so that we get an ICE instead of silently doing the wrong thing.
2017-11-16incr.comp.: Remove some code duplication around TyDecoder by factoring ↵Michael Woerister-113/+2
things into a macro.
2017-11-13incr.comp.: Properly use ty::codec::decode_cnum() in rustc_metadata::decoder.Michael Woerister-6/+1
2017-11-13incr.comp.: Add position() method to TyEncoder.Michael Woerister-0/+7
2017-11-08incr.comp.: Provide session to some more decoding contexts.Michael Woerister-2/+16
2017-11-07incr.comp.: Always require Session when decoding Spans (as to avoid silently ↵Michael Woerister-12/+16
wrong results).
2017-11-05Auto merge of #45770 - spastorino:newtype_index, r=nikomatsakisbors-0/+1
Make last structs indexes definitions use newtype_index macro This PR makes the last two index structs not using newtype_index macro to use it and also fixes this https://github.com/rust-lang/rust/issues/45763 issue.
2017-11-04Auto merge of #45711 - tirr-c:unicode-span, r=estebankbors-1/+7
Display spans correctly when there are zero-width or wide characters Hopefully... * fixes #45211 * fixes #8706 --- Before: ``` error: invalid width `7` for integer literal --> unicode_2.rs:12:25 | 12 | let _ = ("a̐éö̲", 0u7); | ^^^ | = help: valid widths are 8, 16, 32, 64 and 128 error: invalid width `42` for integer literal --> unicode_2.rs:13:20 | 13 | let _ = ("아あ", 1i42); | ^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 error: aborting due to 2 previous errors ``` After: ``` error: invalid width `7` for integer literal --> unicode_2.rs:12:25 | 12 | let _ = ("a̐éö̲", 0u7); | ^^^ | = help: valid widths are 8, 16, 32, 64 and 128 error: invalid width `42` for integer literal --> unicode_2.rs:13:20 | 13 | let _ = ("아あ", 1i42); | ^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 error: aborting due to 2 previous errors ``` Spans might display incorrectly on the browser. r? @estebank
2017-11-04Make DefIndex use newtype_index macroSantiago Pastorino-0/+1
2017-11-03[Syntax Breaking] Rename DefaultImpl to AutoImplleonardo.yvens-5/+5
DefaultImpl is a highly confusing name for what we now call auto impls, as in `impl Send for ..`. The name auto impl is not formally decided but for sanity anything is better than `DefaultImpl` which refers neither to `default impl` nor to `impl Default`.