summary refs log tree commit diff
path: root/compiler/rustc_metadata/src
AgeCommit message (Collapse)AuthorLines
2022-06-20Fix panic by checking if `CStore` has the crate data we want before actually ↵Guillaume Gomez-0/+4
querying it
2022-06-19Rollup merge of #98136 - fee1-dead-contrib:rename_impl_constness, r=oli-obkDylan DPC-11/+11
Rename `impl_constness` to `constness` The current code is a basis for `is_const_fn_raw`, and `impl_constness` is no longer a valid name, which is previously used for determining the constness of impls, and not items in general. r? `@oli-obk`
2022-06-17Auto merge of #98106 - cjgillot:split-definitions, r=michaelwoeristerbors-2/+2
Split up `Definitions` and `ResolverAstLowering`. Split off https://github.com/rust-lang/rust/pull/95573 r? `@michaelwoerister`
2022-06-16Move `finish` out of the `Encoder` trait.Nicholas Nethercote-8/+1
This simplifies things, but requires making `CacheEncoder` non-generic. (This was previously merged as commit 4 in #94732 and then was reverted in #97905 because it caused a perf regression.)
2022-06-15Rename `impl_constness` to `constness`Deadbeef-11/+11
The current code is a basis for `is_const_fn_raw`, and `impl_constness` is no longer a valid name, which is previously used for determining the constness of impls, and not items in general.
2022-06-15Rollup merge of #98110 - cjgillot:closure-brace, r=Aaron1011Yuki Okushi-1/+1
Make `ExprKind::Closure` a struct variant. Simple refactor since we both need it to introduce additional fields in `ExprKind::Closure`. r? ``@Aaron1011``
2022-06-14Separate Definitions and CrateStore from ResolverOutputs.Camille GILLOT-2/+2
2022-06-14Rename rustc_serialize::opaque::Encoder as MemEncoder.Nicholas Nethercote-14/+16
This avoids the name clash with `rustc_serialize::Encoder` (a trait), and allows lots qualifiers to be removed and imports to be simplified (e.g. fewer `as` imports). (This was previously merged as commit 5 in #94732 and then was reverted in #97905 because of a perf regression caused by commit 4 in #94732.)
2022-06-12Make `ExprKind::Closure` a struct variant.Camille GILLOT-1/+1
2022-06-11Auto merge of #95880 - cjgillot:def-ident-span, r=petrochenkovbors-23/+6
Handle `def_ident_span` like `def_span`. `def_ident_span` had an ad-hoc status in the compiler. This PR refactors it to be a first-class citizen like `def_span`: - it gets encoded in the main metadata loop, instead of the visitor; - its implementation is updated to mirror the one of `def_span`. We do not remove the `Option` in the return type, since some items do not have an ident, AnonConsts for instance.
2022-06-11Rollup merge of #97789 - ferrocene:pa-fix-issue-71363-test, r=cjgillotDylan DPC-0/+2
Fix #71363's test by adding `-Z translate-remapped-path-to-local-path=no` The test relies on `library/std/src/error.rs` not corresponding to a local path, but remapping might still find the related local file of a remapped path. To fix the test, this PR adds a new `-Z` flag to disable finding the corresponding local path of a remapped path.
2022-06-11Auto merge of #97905 - nnethercote:revert-infallible-encoder, r=bjorn3bors-15/+20
Revert part of #94372 to improve performance #94732 was supposed to give small but widespread performance improvements, as judged from three per-merge performance runs. But the performance run that occurred after merging included a roughly equal number of improvements and regressions, for unclear reasons. This PR is for a test run reverting those changes, to see what happens. r? `@ghost`
2022-06-10Assert def_ident_span presence.Camille GILLOT-1/+2
2022-06-10Encode def_ident_span using the query.Camille GILLOT-23/+5
2022-06-10Revert dc08bc51f2c58a0f5f815a07f9bb3d671153b5a1.Nicholas Nethercote-1/+8
2022-06-10Revert b983e42936feab29f6333e9835913afc6b4a394e.Nicholas Nethercote-14/+12
2022-06-09Stabilize the `bundle` native library modifierVadim Petrochenkov-19/+0
2022-06-08Rename `rustc_serialize::opaque::Encoder` as `MemEncoder`.Nicholas Nethercote-12/+14
This avoids the name clash with `rustc_serialize::Encoder` (a trait), and allows lots qualifiers to be removed and imports to be simplified (e.g. fewer `as` imports).
2022-06-08Move `finish` out of the `Encoder` trait.Nicholas Nethercote-8/+1
This simplifies things, but requires making `CacheEncoder` non-generic.
2022-06-08Use delayed error handling for `Encodable` and `Encoder` infallible.Nicholas Nethercote-57/+51
There are two impls of the `Encoder` trait: `opaque::Encoder` and `opaque::FileEncoder`. The former encodes into memory and is infallible, the latter writes to file and is fallible. Currently, standard `Result`/`?`/`unwrap` error handling is used, but this is a bit verbose and has non-trivial cost, which is annoying given how rare failures are (especially in the infallible `opaque::Encoder` case). This commit changes how `Encoder` fallibility is handled. All the `emit_*` methods are now infallible. `opaque::Encoder` requires no great changes for this. `opaque::FileEncoder` now implements a delayed error handling strategy. If a failure occurs, it records this via the `res` field, and all subsequent encoding operations are skipped if `res` indicates an error has occurred. Once encoding is complete, the new `finish` method is called, which returns a `Result`. In other words, there is now a single `Result`-producing method instead of many of them. This has very little effect on how any file errors are reported if `opaque::FileEncoder` has any failures. Much of this commit is boring mechanical changes, removing `Result` return values and `?` or `unwrap` from expressions. The more interesting parts are as follows. - serialize.rs: The `Encoder` trait gains an `Ok` associated type. The `into_inner` method is changed into `finish`, which returns `Result<Vec<u8>, !>`. - opaque.rs: The `FileEncoder` adopts the delayed error handling strategy. Its `Ok` type is a `usize`, returning the number of bytes written, replacing previous uses of `FileEncoder::position`. - Various methods that take an encoder now consume it, rather than being passed a mutable reference, e.g. `serialize_query_result_cache`.
2022-06-08Don't pass in a vector to `Encoder::new`.Nicholas Nethercote-1/+1
It's not necessary.
2022-06-06fix #71363 test by adding `-Z translate-remapped-path-to-local-path=no`Pietro Albini-0/+2
The test relies on library/std/src/error.rs not corresponding to a local path, but remapping might still find the related local file of a remapped path. To fix the test, this adds a new -Z flag to disable finding the corresponding local path of a remapped path.
2022-06-03Fully stabilize NLLJack Huey-1/+0
2022-06-03Remove emit_unitbjorn3-5/+0
It doesn't do anything for all encoders
2022-05-30Auto merge of #96964 - oli-obk:const_trait_mvp, r=compiler-errorsbors-2/+2
Replace `#[default_method_body_is_const]` with `#[const_trait]` pulled out of #96077 related issues: #67792 and #92158 cc `@fee1-dead` This is groundwork to only allowing `impl const Trait` for traits that are marked with `#[const_trait]`. This is necessary to prevent adding a new default method from becoming a breaking change (as it could be a non-const fn).
2022-05-30Add a helper function for checking whether a default function in a trait can ↵Oli Scherer-4/+2
be treated as `const`
2022-05-30Remove `#[default..]` and add `#[const_trait]`Deadbeef-3/+5
2022-05-28Make TyCtxt implement Interner, make HashStable generic and move to ↵Michael Goulet-5/+5
rustc_type_ir
2022-05-28Remove some comments, inline interner fnMichael Goulet-0/+1
2022-05-28Initial fixes on top of type interner commitMichael Goulet-7/+10
2022-05-27Auto merge of #97004 - nnethercote:proc-macro-tweaks, r=eddybbors-2/+2
Proc macro tweaks Various improvements I spotted while looking through the proc macro code. r? `@eddyb`
2022-05-27Rename `ProcMacroDerive` as `DeriveProcMacro`.Nicholas Nethercote-2/+2
So it matches the existing `AttrProcMacro` and `BangProcMacro` types.
2022-05-27Auto merge of #96298 - petrochenkov:fromgen, r=estebankbors-2/+3
libcore: Add `iter::from_generator` which is like `iter::from_fn`, but for coroutines instead of functions An equally useful little helper. I didn't follow any of the async-wg work, so I don't know why something like this wasn't added before.
2022-05-27libcore: Add `iter::from_generator` which is like `iter::from_fn`, but for ↵Vadim Petrochenkov-2/+3
coroutines instead of functions
2022-05-26Auto merge of #97386 - nnethercote:optimize-pos-adjustments, r=bjorn3bors-22/+4
Optimize position adjustments A small improvement. r? `@bjorn3`
2022-05-26Avoid adjusting file positions twice.Nicholas Nethercote-22/+4
`imported_source_files` adjusts lots of file positions, and then calls `new_imported_source_file`, which then adjust them all again. This commit combines the two adjustments into one, for a small perf win.
2022-05-25Rollup merge of #97328 - petrochenkov:nativice, r=michaelwoeristerDylan DPC-4/+5
rustc: Fix ICE in native library error reporting Fixes https://github.com/rust-lang/rust/issues/97299
2022-05-25Rollup merge of #97384 - nnethercote:fix-metadata-stats, r=bjorn3Dylan DPC-23/+69
Fix metadata stats. This commit: - Counts some things that weren't being counted previously, and adds an assertion that ensure everything is counted. - Reorders things so the `eprintln`s order matches the code order. - Adds percentages, and makes clear that the zero bytes count is orthogonal to the other measurements. Example of the new output: ``` 55463779 metadata bytes, of which 18054531 bytes (32.6%) are zero preamble: 30 bytes ( 0.0%) dep: 0 bytes ( 0.0%) lib feature: 17458 bytes ( 0.0%) lang item: 337 bytes ( 0.0%) diagnostic item: 1788 bytes ( 0.0%) native lib: 0 bytes ( 0.0%) foreign modules: 5113 bytes ( 0.0%) def-path table: 720180 bytes ( 1.3%) traits: 359 bytes ( 0.0%) impls: 64624 bytes ( 0.1%) incoherent_impls: 130 bytes ( 0.0%) mir: 16137354 bytes (29.1%) item: 23773099 bytes (42.9%) interpret_alloc_index: 599 bytes ( 0.0%) proc-macro-data: 0 bytes ( 0.0%) tables: 10081135 bytes (18.2%) debugger visualizers: 0 bytes ( 0.0%) exported symbols: 5666 bytes ( 0.0%) hygiene: 1539390 bytes ( 2.8%) def-path hashes: 2752564 bytes ( 5.0%) source_map: 363540 bytes ( 0.7%) final: 413 bytes ( 0.0%) ``` r? `@bjorn3`
2022-05-25Fix metadata stats.Nicholas Nethercote-23/+69
This commit: - Counts some things that weren't being counted previously, and adds an assertion that ensure everything is counted. - Reorders things so the `eprintln`s order matches the code order. - Adds percentages, and makes clear that the zero bytes count is orthogonal to the other measurements. Example of the new output: ``` 55463779 metadata bytes, of which 18054531 bytes (32.6%) are zero preamble: 30 bytes ( 0.0%) dep: 0 bytes ( 0.0%) lib feature: 17458 bytes ( 0.0%) lang item: 337 bytes ( 0.0%) diagnostic item: 1788 bytes ( 0.0%) native lib: 0 bytes ( 0.0%) foreign modules: 5113 bytes ( 0.0%) def-path table: 720180 bytes ( 1.3%) traits: 359 bytes ( 0.0%) impls: 64624 bytes ( 0.1%) incoherent_impls: 130 bytes ( 0.0%) mir: 16137354 bytes (29.1%) item: 23773099 bytes (42.9%) interpret_alloc_index: 599 bytes ( 0.0%) proc-macro-data: 0 bytes ( 0.0%) tables: 10081135 bytes (18.2%) debugger visualizers: 0 bytes ( 0.0%) exported symbols: 5666 bytes ( 0.0%) hygiene: 1539390 bytes ( 2.8%) def-path hashes: 2752564 bytes ( 5.0%) source_map: 363540 bytes ( 0.7%) final: 413 bytes ( 0.0%) ```
2022-05-24Make Lazy not care about lifetimes until decodeMichael Goulet-54/+95
2022-05-23Fix iterator implementation, add some inlinesMichael Goulet-3/+20
2022-05-23refine comments, disambiguate len for array and tablesMichael Goulet-36/+41
2022-05-23split out the various responsibilities of LazyMichael Goulet-420/+370
2022-05-23rustc: Fix ICE in native library error reportingVadim Petrochenkov-4/+5
2022-05-21Auto merge of #97239 - jhpratt:remove-crate-vis, r=joshtriplettbors-66/+65
Remove `crate` visibility modifier FCP to remove this syntax is just about complete in #53120. Once it completes, this should be merged ASAP to avoid merge conflicts. The first two commits remove usage of the feature in this repository, while the last removes the feature itself.
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-66/+65
2022-05-20Auto merge of #95418 - cjgillot:more-disk, r=davidtwcobors-13/+0
Cache more queries on disk One of the principles of incremental compilation is to allow saving results on disk to avoid recomputing them. This PR investigates persisting a lot of queries whose result are to be saved into metadata. Some of the queries are cheap reads from HIR, but we may also want to get rid of these reads for incremental lowering.
2022-05-19Auto merge of #97024 - lcnr:simplify_type-sus, r=<try>bors-1/+1
`simplify_type` improvements and cursed docs the existing `TreatParams` enum pretty much mixes everything up. Not sure why this looked right to me in #94057 This also includes two changes which impact perf: - `ty::Projection` with inference vars shouldn't be treated as a rigid type, even if fully normalized - `ty::Placeholder` only unifies with itself, so actually return `Some` for them r? `@nikomatsakis`
2022-05-18Properly apply path prefix remapping paths emitted into debuginfo.Michael Woerister-0/+7
2022-05-18Move logic for making potentially remapped paths absolute into helper method.Michael Woerister-64/+29