about summary refs log tree commit diff
path: root/src/librustc_metadata
AgeCommit message (Collapse)AuthorLines
2020-08-03Rollup merge of #75054 - cjgillot:rename-depkind, r=petrochenkovYuki Okushi-24/+24
Rename rustc_middle::cstore::DepKind to CrateDepKind It is ambiguous with DepGraph's own DepKind.
2020-08-02Rename rustc_middle::cstore::DepKind to DependencyKind.Camille GILLOT-24/+24
2020-07-31Move from `log` to `tracing`Oliver Scherer-1/+1
2020-07-30Rollup merge of #74915 - alexcrichton:allow-failing-canonicalize, ↵Manish Goregaokar-20/+18
r=Mark-Simulacrum rustc: Ignore fs::canonicalize errors in metadata This commit updates the metadata location logic to ignore errors when calling `fs::canonicalize`. Canonicalization was added historically so multiple `-L` paths to the same directory don't print errors about multiple candidates (since rustc can deduplicate same-named paths), but canonicalization doesn't work on all filesystems. Cargo, for example, always uses this sort of fallback where it will opportunitistically try to canonicalize but fall back to using the input path if it otherwise doesn't work. If rustc is run on a filesystem that doesn't support canonicalization then the effect of this change will be that `-L` paths which logically point to the same directory will cause errors, but that's a rare enough occurrence it shouldn't cause much issue in practice. Otherwise rustc doesn't work at all today on those sorts of filesystem where canonicalization isn't supported!
2020-07-30rustc: Ignore fs::canonicalize errors in metadataAlex Crichton-20/+18
This commit updates the metadata location logic to ignore errors when calling `fs::canonicalize`. Canonicalization was added historically so multiple `-L` paths to the same directory don't print errors about multiple candidates (since rustc can deduplicate same-named paths), but canonicalization doesn't work on all filesystems. Cargo, for example, always uses this sort of fallback where it will opportunitistically try to canonicalize but fall back to using the input path if it otherwise doesn't work. If rustc is run on a filesystem that doesn't support canonicalization then the effect of this change will be that `-L` paths which logically point to the same directory will cause errors, but that's a rare enough occurrence it shouldn't cause much issue in practice. Otherwise rustc doesn't work at all today on those sorts of filesystem where canonicalization isn't supported!
2020-07-30Auto merge of #74876 - oli-obk:lumberjack_disable, r=RalfJungbors-22/+33
Replace all uses of `log::log_enabled` with `Debug` printers cc @RalfJung this touches a bunch of logging in the miri engine. There are some visual changes, mainly that in several cases we stop prepending lines with the module path and just have a newline.
2020-07-29Address review commentsOliver Scherer-5/+3
2020-07-28Cache non-exhaustive separately from attributesMark Rousskov-4/+9
2020-07-28Replace all uses of `log::log_enabled` with `Debug` printersOliver Scherer-22/+35
2020-07-27mv std libs to library/mark-1/+33
2020-07-26Share serialization optimization between incr and metadataAaron Hill-114/+54
2020-07-26Add test for serializing hygiene *into* a proc-macro crateAaron Hill-4/+27
This is a very obscure corner case, and should never be hit in practice.
2020-07-26Hygiene serialization implementationAaron Hill-37/+250
2020-07-22build: Remove unnecessary `cargo:rerun-if-env-changed` annotationsVadim Petrochenkov-5/+0
2020-07-20index: introduce and use `FiniteBitSet`David Wood-3/+3
This commit introduces a `FiniteBitSet` type which replaces the manual bit manipulation which was being performed in polymorphization. Signed-off-by: David Wood <david@davidtw.co>
2020-07-20metadata: record `unused_generic_params`David Wood-0/+14
This commit records the results of `unused_generic_params` in crate metadata, hopefully improving performance. Signed-off-by: David Wood <david@davidtw.co>
2020-07-18rustc_metadata: Make crate loading fully speculativeVadim Petrochenkov-421/+435
2020-07-18rustc_metadata: Refactor away `CrateLocator::(dy,static)libname`Vadim Petrochenkov-27/+19
2020-07-18rustc_metadata: Remove some extra diagnostics for legacy pluginsVadim Petrochenkov-31/+2
They are deprecated so doing extra work for error recovery doesn't make sense
2020-07-18rustc_metadata: Remove a bit of ancient profilingVadim Petrochenkov-15/+1
2020-07-17Rename TypeckTables to TypeckResults.Valentin Lazureanu-2/+2
2020-07-15Auto merge of #74113 - lcnr:type-dependent-consts-2, r=eddybbors-2/+2
Support const args in type dependent paths (Take 2) once more, except it is sound this time :smiling_face_with_three_hearts: previously #71154 ----- ```rust #![feature(const_generics)] struct A; impl A { fn foo<const N: usize>(&self) -> usize { N } } struct B; impl B { fn foo<const N: usize>(&self) -> usize { 42 } } fn main() { let a = A; a.foo::<7>(); } ``` When calling `type_of` for generic const arguments, we now use the `TypeckTables` of the surrounding body to get the expected type. This alone causes cycle errors though, as we now have `typeck_tables_of(main)` -> `...` -> `type_of(main_ANON0 := 7)` -> `typeck_tables_of(main)` :zap: (see https://github.com/rust-lang/rust/issues/68400#issuecomment-611760290) To prevent this we must not call `type_of(const_arg)` during `typeck_tables_of`. This is achieved by calling `type_of(param_def_id)` instead. We have to somehow remember the `DefId` of the param through all of typeck, which is done using the struct `ty::WithOptConstParam<DefId>`, which replaces `DefId` where needed and contains an `Option<DefId>` to be able to store the const parameter in case it exists. Queries which are currently cached on disk are split into two variants: `query_name`(cached) and `query_name_(of|for)_const_arg`(not cached), with `query_name_of_const_arg` taking a pair `(did, param_did): (LocalDefId, DefId)`. For some queries a method `query_name_of_opt_const_arg` is added to `TyCtxt` which takes a `ty::WithOptConstParam` and either calls `query_name` or `query_name_of_const_arg` depending on the value of `const_param_did`. r? @eddyb @varkor
2020-07-15const generics work!Bastian Kauschke-1/+1
2020-07-15optimized_mirBastian Kauschke-1/+1
2020-07-15Change `SymbolName::name` to a `&str`.Nicholas Nethercote-3/+3
This eliminates a bunch of `Symbol::intern()` and `Symbol::as_str()` calls, which is good, because they require locking the interner. Note that the unsafety in `from_cycle_error()` is identical to the unsafety on other adjacent impls.
2020-07-15Remove lots of `Symbol::as_str()` calls.Nicholas Nethercote-5/+5
In various ways, such as changing functions to take a `Symbol` instead of a `&str`.
2020-07-15Add and use more static symbols.Nicholas Nethercote-3/+3
Note that the output of `unpretty-debug.stdout` has changed. In that test the hash values are normalized from a symbol numbers to small numbers like "0#0" and "0#1". The increase in the number of static symbols must have caused the original numbers to contain more digits, resulting in different pretty-printing prior to normalization.
2020-07-10Avoid "whitelist"Tamir Duberstein-3/+0
Other terms are more inclusive and precise.
2020-07-05Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.Eduard-Mihai Burtescu-2/+2
2020-07-05Replace early-bound normalization hack with per-query key/value type aliases.Eduard-Mihai Burtescu-6/+3
2020-07-01Rollup merge of #73449 - ehuss:duplicate-lang-item, r=matthewjasperManish Goregaokar-0/+2
Provide more information on duplicate lang item error. This gives some notes on the location of the files where the lang items were loaded from. Some duplicate lang item errors can be a little confusing, and this might help in diagnosing what has happened. Here's an example when hitting a bug with Cargo's build-std: ``` error: duplicate lang item in crate `core` (which `rustc_std_workspace_core` depends on): `try`. | = note: the lang item is first defined in crate `core` (which `z10` depends on) = note: first definition in `core` loaded from /Users/eric/Proj/rust/cargo/scratch/z10/target/target/debug/deps/libcore-a764da499c7385f4.rmeta = note: second definition in `core` loaded from /Users/eric/Proj/rust/cargo/scratch/z10/target/target/debug/deps/libcore-5b082675aea34986.rmeta ```
2020-06-30Switch crate_extern_paths to a query, and tweak wording.Eric Huss-5/+2
2020-06-30Provide more information on duplicate lang item error.Eric Huss-0/+5
2020-06-29Serialize all foreign `SourceFile`s into proc-macro crate metadataAaron Hill-37/+94
Normally, we encode a `Span` that references a foreign `SourceFile` by encoding information about the foreign crate. When we decode this `Span`, we lookup the foreign crate in order to decode the `SourceFile`. However, this approach does not work for proc-macro crates. When we load a proc-macro crate, we do not deserialzie any of its dependencies (since a proc-macro crate can only export proc-macros). This means that we cannot serialize a reference to an upstream crate, since the associated metadata will not be available when we try to deserialize it. This commit modifies foreign span handling so that we treat all foreign `SourceFile`s as local `SourceFile`s when serializing a proc-macro. All `SourceFile`s will be stored into the metadata of a proc-macro crate, allowing us to cotinue to deserialize a proc-macro crate without needing to load any of its dependencies. Since the number of foreign `SourceFile`s that we load during a compilation session may be very large, we only serialize a `SourceFile` if we have also serialized a `Span` which requires it.
2020-06-26Make `fn_arg_names` return `Ident` instead of symbolAaron Hill-15/+9
Also, implement this query for the local crate, not just foreign crates.
2020-06-23Rollup merge of #73587 - marmeladema:hir-id-ification-final, r=petrochenkovManish Goregaokar-2/+2
Move remaining `NodeId` APIs from `Definitions` to `Resolver` Implements https://github.com/rust-lang/rust/pull/73291#issuecomment-643515557 TL;DR: it moves all fields that are only needed during name resolution passes into the `Resolver` and keep the rest in `Definitions`. This effectively enforces that all references to `NodeId`s are gone once HIR lowering is completed. After this, the only remaining work for #50928 should be to adjust the dev guide. r? @petrochenkov
2020-06-23Rollup merge of #73488 - richkadel:llvm-coverage-map-gen, r=tmandryManish Goregaokar-0/+2
code coverage foundation for hash and num_counters This PR is the next iteration after PR #73011 (which is still waiting on bors to merge). @wesleywiser - PTAL r? @tmandry (FYI, I'm also working on injecting the coverage maps, in another branch, while waiting for these to merge.) Thanks!
2020-06-22Address remaining feedback itemsRich Kadel-1/+1
2020-06-22Revert "Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, ↵Aaron Hill-9/+15
r=nikomatsakis" This reverts commit 372cb9b69c76a042d0b9d4b48ff6084f64c84a2c, reversing changes made to 5c61a8dc34c3e2fc6d7f02cb288c350f0233f944.
2020-06-21Move remaining `NodeId` APIs from `Definitions` to `Resolver`marmeladema-2/+2
2020-06-21Cache decoded predicate shorthandsMatthew Jasper-18/+34
2020-06-20Rollup merge of #72600 - Aaron1011:fix/anon-const-encoding, r=varkorRalf Jung-3/+8
Properly encode AnonConst into crate metadata Fixes #68104 Previous, we were encoding AnonConst as a regular Const, causing us to treat them differently after being deserialized in another compilation session.
2020-06-19code coverage foundation for hash and num_countersRich Kadel-0/+2
Replaced dummy values for hash and num_counters with computed values, and refactored InstrumentCoverage pass to simplify injecting more counters per function in upcoming versions. Improved usage documentation and error messaging.
2020-06-19Rollup merge of #73011 - richkadel:llvm-count-from-mir-pass, r=tmandryRalf Jung-1/+3
first stage of implementing LLVM code coverage This PR replaces #70680 (WIP toward LLVM Code Coverage for Rust) since I am re-implementing the Rust LLVM code coverage feature in a different part of the compiler (in MIR pass(es) vs AST). This PR updates rustc with `-Zinstrument-coverage` option that injects the llvm intrinsic `instrprof.increment()` for code generation. This initial version only injects counters at the top of each function, and does not yet implement the required coverage map. Upcoming PRs will add the coverage map, and add more counters and/or counter expressions for each conditional code branch. Rust compiler MCP https://github.com/rust-lang/compiler-team/issues/278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation ***[I put together some development notes here, under a separate branch.](https://github.com/richkadel/rust/blob/cfa0b21d34ee64e4ebee226101bd2ef0c6757865/src/test/codegen/coverage-experiments/README-THIS-IS-TEMPORARY.md)***
2020-06-19Rollup merge of #73305 - crlf0710:disallow_loading_monsters, r=petrochenkovRalf Jung-0/+8
Disallow loading crates with non-ascii identifier name. This turns off external crate loading with non-ascii identifier names. cc #55467.
2020-06-16Ensure profiling runtime for -Zinstrument-coverageRich Kadel-1/+3
If config.toml `profiler = false`, the test/mir-opt/instrument_coverage test is ignored. Otherwise, this patch ensures the profiler_runtime is loaded when -Zinstrument-coverage is enabled. Confirmed that this works for MacOS.
2020-06-16Disallow loading crates with non-ascii identifier name.Charles Lew-0/+8
2020-06-15Auto merge of #73369 - RalfJung:rollup-hl8g9zf, r=RalfJungbors-19/+35
Rollup of 10 pull requests Successful merges: - #72707 (Use min_specialization in the remaining rustc crates) - #72740 (On recursive ADT, provide indirection structured suggestion) - #72879 (Miri: avoid tracking current location three times) - #72938 (Stabilize Option::zip) - #73086 (Rename "cyclone" to "apple-a7" per changes in upstream LLVM) - #73104 (Example about explicit mutex dropping) - #73139 (Add methods to go from a nul-terminated Vec<u8> to a CString) - #73296 (Remove vestigial CI job msvc-aux.) - #73304 (Revert heterogeneous SocketAddr PartialEq impls) - #73331 (extend network support for HermitCore) Failed merges: r? @ghost
2020-06-15Rollup merge of #72707 - matthewjasper:rustc_min_spec, r=oli-obkRalf Jung-19/+35
Use min_specialization in the remaining rustc crates This adds a lot of `transmute` calls to replace the unsound uses of specialization. It's ugly, but at least it's honest about what's going on. cc #71420, @RalfJung
2020-06-15Auto merge of #73367 - RalfJung:rollup-4ewvk9b, r=RalfJungbors-15/+9
Rollup of 10 pull requests Successful merges: - #71824 (Check for live drops in constants after drop elaboration) - #72389 (Explain move errors that occur due to method calls involving `self`) - #72556 (Fix trait alias inherent impl resolution) - #72584 (Stabilize vec::Drain::as_slice) - #72598 (Display information about captured variable in `FnMut` error) - #73336 (Group `Pattern::strip_*` method together) - #73341 (_match.rs: fix module doc comment) - #73342 (Fix iterator copied() documentation example code) - #73351 (Update E0446.md) - #73353 (structural_match: non-structural-match ty closures) Failed merges: r? @ghost