summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/rmeta/encoder.rs
AgeCommit message (Collapse)AuthorLines
2020-12-17Rollup merge of #80039 - LeSeulArtichaut:rm-tyencoder-tcx, r=matthewjasperYuki Okushi-4/+0
Remove unused `TyEncoder::tcx` required method Unsure if this is helpful or not... r? ``@ghost`` cc ``@matthewjasper`` ``@jackh726``
2020-12-14Convenience funcs for `some_option.unwrap_or(...)`Rich Kadel-6/+1
This ensures consistent handling of default values for options that are None if not specified on the command line.
2020-12-14Remove unused `TyEncoder::tcx` required methodLeSeulArtichaut-4/+0
2020-12-14Improve warnings on incompatible options involving -Zinstrument-coverageRich Kadel-1/+6
Adds checks for: * `no_core` attribute * explicitly-enabled `legacy` symbol mangling * mir_opt_level > 1 (which enables inlining) I removed code from the `Inline` MIR pass that forcibly disabled inlining if `-Zinstrument-coverage` was set. The default `mir_opt_level` does not enable inlining anyway. But if the level is explicitly set and is greater than 1, I issue a warning. The new warnings show up in tests, which is much better for diagnosing potential option conflicts in these cases.
2020-11-27Encode proc_macro directly.Camille GILLOT-5/+35
Encode proc_macro name directly. Do not store None values.
2020-11-26Formatting.Camille GILLOT-1/+1
2020-11-26Remove ForeignMod struct.Camille GILLOT-4/+4
2020-11-26Store ForeignItem in a side table.Camille GILLOT-1/+8
2020-11-03Auto merge of #78448 - rylev:cache-foreign_modules, r=wesleywiserbors-1/+1
foreign_modules query hash table lookups When compiling a large monolithic crate we're seeing huge times in the `foreign_modules` query due to repeated iteration over foreign modules (in order to find a module by its id). This implements hash table lookups so that which massively reduces time spent in that query in this particular case. We'll need to see if the overhead of creating the hash table has a negative impact on performance in more normal compilation scenarios. I'm working with `@wesleywiser` on this.
2020-10-29Avoid BorrowMutError with RUSTC_LOG=debugTomasz Miąsko-3/+6
$ touch empty.rs $ env RUSTC_LOG=debug rustc +stage1 --crate-type=lib empty.rs Fails with a `BorrowMutError` because source map files are already borrowed while `features_query` attempts to format a log message containing a span. Release the borrow before the query to avoid the issue.
2020-10-27Cache foreign_modules queryRyan Levick-1/+1
2020-10-19Calculate visibilities once in resolveVadim Petrochenkov-56/+13
Then use them through a query based on resolver outputs
2020-10-06Separate bounds and predicates for associated/opaque typesMatthew Jasper-1/+4
2020-10-06Split bounds from predicatesMatthew Jasper-1/+12
2020-10-05Record `expansion_that_defined` into crate metadataAaron Hill-0/+4
Fixes #77523 Now that hygiene serialization is implemented, we also need to record `expansion_that_defined` so that we properly handle a foreign `SyntaxContext`.
2020-09-30rustc_metadata: Do not forget to encode inherent impls for foreign typesVadim Petrochenkov-0/+1
2020-09-27Auto merge of #77118 - exrook:stability-generic-parameters-2, r=varkorbors-0/+4
Stability annotations on generic parameters (take 2.5) Rebase of #72314 + more tests Implements rust-lang/wg-allocators#2.
2020-09-26Encode less metadata for proc-macro cratesAaron Hill-35/+101
Currently, we serialize the same crate metadata for proc-macro crates as we do for normal crates. This is quite wasteful - almost none of this metadata is ever used, and much of it can't even be deserialized (if it contains a foreign `CrateNum`). This PR changes metadata encoding to skip encoding the majority of crate metadata for proc-macro crates. Most of the `Lazy<[T]>` fields are left completetly empty, while the non-lazy fields are left as-is. Additionally, proc-macros now have a def span that does not include their body. This was done for normal functions in #75465, but was missed for proc-macros. As a result of this PR, we should only ever encode local `CrateNum`s when encoding proc-macro crates. I've added a specialized serialization impl for `CrateNum` to assert this.
2020-09-23Rollup merge of #76939 - lcnr:const-evaluatable-cont, r=oli-obkDylan DPC-1/+1
emit errors during AbstractConst building There changes are currently still untested, so I don't expect this to pass CI :laughing: It seems to me like this is the direction we want to go in, though we didn't have too much of a discussion about this. r? @oli-obk
2020-09-22Stability annotations on generic trait parametersAvi Dessauer-0/+4
2020-09-21Record `tcx.def_span` instead of `item.span` in crate metadataAaron Hill-1/+1
This was missed in PR #75465. As a result, a few places have been using the full body span of functions, instead of just the header span.
2020-09-19wip emit errors during AbstractConst buildingBastian Kauschke-1/+1
2020-09-18support const_evaluatable_checked across crate boundariesBastian Kauschke-0/+11
2020-09-14Auto merge of #76656 - jonas-schievink:fewer-unstable-metadata-queries, r=lcnrbors-4/+16
Don't query stability data when `staged_api` is off This data only needs to be encoded when `#![feature(staged_api)]` or `-Zforce-unstable-if-unmarked` is on. Running these queries takes measurable time on large crates with many items, so skip it when the unstable flags have not been enabled.
2020-09-12Properly encode spans with a dummy location and non-root `SyntaxContext`Aaron Hill-1/+1
Previously, we would throw away the `SyntaxContext` of any span with a dummy location during metadata encoding. This commit makes metadata Span encoding consistent with incr-cache Span encoding - an 'invalid span' tag is only used when it doesn't lose any information.
2020-09-13Don't query unstable data when `staged_api` is offJonas Schievink-4/+16
2020-09-04Change ty.kind to a methodLeSeulArtichaut-2/+2
2020-08-30mv compiler to compiler/mark-0/+2012