about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src
AgeCommit message (Collapse)AuthorLines
2021-09-10Keep a parent LocalDefId in SpanData.Camille GILLOT-1/+2
2021-09-09add test for builtin types N + N unifying with fn callEllen-1/+1
2021-09-09rename mir -> thir around abstract constsEllen-9/+13
2021-09-04Auto merge of #88538 - bjorn3:no_session_in_crate_loader, r=petrochenkovbors-94/+77
CrateLocator refactorings This makes the `CrateLocator` a lot cleaner IMHO and much more self-contained. The last commit removes `extra_filename` from the crate metadata. This is an **insta-stable** change as it allows a crate like `libfoo-abc.rlib` to be used as dependency and then be renamed as `libfoo-bcd.rlib` while still being found as indirect dependency. This may reduce performance when there are a lot of versions of the same crate available as the extra filename won't be used to do an early rejection of crates before trying to load metadata, but it makes the logic to find the right filename a lot cleaner.
2021-09-02Remove unused argument from resolve_cratebjorn3-9/+6
2021-09-02Introduce CrateRejections structbjorn3-40/+36
2021-09-02Remove root field from CrateLocatorbjorn3-9/+4
2021-09-02Remove host_hash from CrateLocatorbjorn3-7/+3
2021-09-02Refactor CrateLocator.is_proc_macrobjorn3-18/+13
This also fixes a (theoretical) bug where a proc-macro may be loaded as plugin if it exports a symbol with the right name.
2021-09-02Don't store Session in CrateLocatorbjorn3-11/+15
2021-09-01Compute proc_macros in resolutions.Camille GILLOT-9/+11
2021-08-28Treat macros as HIR itemsinquisitivecrystal-14/+11
2021-08-25Auto merge of #85344 - cbeuw:remap-across-cwd, r=michaelwoeristerbors-5/+14
Correctly handle remapping from path containing the current directory with trailing paths If we have a `auxiliary/lib.rs`, and we generate the metadata with `--remap-path-prefix $PWD/auxiliary=xyz`, the path to `$PWD/auxiliary/lib.rs` won't be correctly remapped in the metadata. This is because internally, path to the working directory itself and relative paths to files under the working directory are remapped separately (hence neither are affected since neither has `$PWD/auxiliary` as prefix), but the concatenation between the working directory and the relative path is not remapped. This PR fixes that.
2021-08-24Auto merge of #87739 - Aaron1011:remove-used-attrs, r=wesleywiserbors-2/+1
Remove `Session.used_attrs` and move logic to `CheckAttrVisitor` Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-22Fix typos “an”→“a” and a few different ones that appeared in the ↵Frank Steffahn-1/+1
same search
2021-08-22Revert a change of “an --extern” (can be read with “dash dash”)Frank Steffahn-1/+1
2021-08-22Fix typos “a”→“an”Frank Steffahn-1/+1
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-2/+1
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-15Include (potentially remapped) working dir in crate hashAaron Hill-1/+4
Fixes #85019 A `SourceFile` created during compilation may have a relative path (e.g. if rustc itself is invoked with a relative path). When we write out crate metadata, we convert all relative paths to absolute paths using the current working direction. However, the working directory is not included in the crate hash. This means that the crate metadata can change while the crate hash remains the same. Among other problems, this can cause a fingerprint mismatch ICE, since incremental compilation uses the crate metadata hash to determine if a foreign query is green. This commit moves the field holding the working directory from `Session` to `Options`, including it as part of the crate hash.
2021-08-12Auto merge of #85296 - bjorn3:plugin_cleanup, r=petrochenkovbors-4/+4
Plugin interface cleanup The first commit performs two uncontroversial cleanups. The second commit removes `#[plugin_registrar]` and instead requires you to export a `__rustc_plugin_registrar` function, this will require a change to servo's script_plugins (cc `@jdm)`
2021-08-10Replace #[plugin_registrar] with exporting __rustc_plugin_registrarbjorn3-4/+4
2021-08-09Auto merge of #87619 - 12101111:fix-native_link_modifiers_bundle, r=petrochenkovbors-11/+9
Fix feature gate checking of static-nobundle and native_link_modifiers Feature native_link_modifiers_bundle don't need feature static-nobundle to work. Also check the feature gates when using native_link_modifiers from command line options. Current nighly compiler don't check those feature gate. ``` > touch lib.rs > rustc +nightly lib.rs -L /usr/lib -l static:+bundle=dl --crate-type=rlib > rustc +nightly lib.rs -L /usr/lib -l dylib:+as-needed=dl --crate-type=dylib -Ctarget-feature=-crt-static > rustc +nightly lib.rs -L /usr/lib -l static:-bundle=dl --crate-type=rlib error[E0658]: kind="static-nobundle" is unstable | = note: see issue #37403 <https://github.com/rust-lang/rust/issues/37403> for more information = help: add `#![feature(static_nobundle)]` to the crate attributes to enable error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. ``` First found this in https://github.com/rust-lang/rust/pull/85600#discussion_r676612655
2021-08-08 Fix feature gate checking of static-nobundle and native_link_modifiers12101111-11/+9
2021-08-06encode `generics_of` of fields and ty paramsEllen-2/+2
2021-08-04Add back -Zno-profiler-runtimeAmanieu d'Antras-8/+6
This was removed by #85284 in favor of -Zprofiler-runtime=<name>. However the suggested -Zprofiler-runtime=None doesn't work because "None" is treated as a crate name.
2021-07-25Auto merge of #83723 - cjgillot:ownernode, r=petrochenkovbors-2/+2
Store all HIR owners in the same container This replaces the previous storage in a BTreeMap for each of Item/ImplItem/TraitItem/ForeignItem. This should allow for a more compact storage. Based on https://github.com/rust-lang/rust/pull/83114
2021-07-25Introduce OwnerNode::Crate.Camille GILLOT-1/+1
2021-07-25Merge the BTreeMap in hir::Crate.Camille GILLOT-1/+1
2021-07-24Remove detection of rustup and cargo in 'missing extern crate' diagnosticsJoshua Nelson-2/+5
Previously, this would change the test output when RUSTUP_HOME was set: ``` ---- [ui] ui/issues/issue-49851/compiler-builtins-error.rs stdout ---- diff of stderr: 1 error[E0463]: can't find crate for `core` 2 | 3 = note: the `thumbv7em-none-eabihf` target may not be installed + = help: consider downloading the target with `rustup target add thumbv7em-none-eabihf` 4 5 error: aborting due to previous error 6 ``` Originally, I fixed it by explicitly unsetting RUSTUP_HOME in compiletest. Then I realized that almost no one has RUSTUP_HOME set, since rustup doesn't set it itself; although it does set RUST_RECURSION_COUNT whenever it launches a proxy. Then it was pointed out that this runtime check doesn't really make sense and it's fine to make it unconditional.
2021-07-18Auto merge of #86698 - cjgillot:modc, r=estebankbors-1/+4
Move OnDiskCache to rustc_query_impl. This should be the last remnant of the query implementation that was still in rustc_middle.
2021-07-18Move OnDiskCache to rustc_query_impl.Camille GILLOT-1/+4
2021-07-18Rollup merge of #87092 - ricobbe:fix-raw-dylib-multiple-definitions, ↵Yuki Okushi-1/+1
r=petrochenkov Remove nondeterminism in multiple-definitions test Compare all fields in `DllImport` when sorting to avoid nondeterminism in the error for multiple inconsistent definitions of an extern function. Restore the multiple-definitions test. Resolves #87084.
2021-07-17Drop ExpnData::krate.Camille GILLOT-1/+1
2021-07-17Drop orig_id.Camille GILLOT-1/+1
2021-07-17Encode ExpnId using ExpnHash for incr. comp.Camille GILLOT-18/+43
2021-07-17Choose encoding format in caller code.Camille GILLOT-3/+16
2021-07-17Make the CrateNum part of the ExpnId.Camille GILLOT-8/+40
2021-07-16Consider all fields when comparing DllImports, to remove nondetermininsm in ↵Richard Cobbe-1/+1
multiple-definitions test
2021-07-15Simplify metadata decoding.Camille GILLOT-14/+4
2021-07-15Separate encoding paths.Camille GILLOT-35/+25
The two paths will be modified independently in the next few commits.
2021-07-15Auto merge of #86876 - jyn514:56935-target-crate-num, r=petrochenkovbors-1/+5
Reuse CrateNum for proc-macro crates even when cross-compiling Proc-macros are always compiled for the host, so this should be the same in every way as recompiling the crate. I am not sure why the previous code special-cased the target, since the compiler properly gives an error when trying to load a crate for a different host: ``` error[E0461]: couldn't find crate `dependency` with expected target triple x86_64-unknown-linux-gnu --> /home/joshua/rustc4/src/test/ui/cfg-dependent.rs:8:2 | LL | dependency::is_64(); | ^^^^^^^^^^ | = note: the following crate versions were found: crate `dependency`, target triple i686-unknown-linux-gnu: /home/joshua/rustc4/build/x86_64-unknown-linux-gnu/test/ui/cfg-dependent/auxiliary/libdependency.so ``` I think another possible fix is to remove the check altogether. But I'm not sure, and this fix works, so I'm not making the larger change here. Fixes https://github.com/rust-lang/rust/issues/56935. r? `@petrochenkov` cc `@alexcrichton`
2021-07-14Reuse CrateNum for proc-macro crates even when cross-compilingJoshua Nelson-1/+5
Proc-macros are always compiled for the host, so this should be the same in every way as recompiling the crate. I am not sure why the previous code special-cased the target, since the compiler properly gives an error when trying to load a crate for a different host: ``` error[E0461]: couldn't find crate `dependency` with expected target triple x86_64-unknown-linux-gnu --> /home/joshua/rustc4/src/test/ui/cfg-dependent.rs:8:2 | LL | dependency::is_64(); | ^^^^^^^^^^ | = note: the following crate versions were found: crate `dependency`, target triple i686-unknown-linux-gnu: /home/joshua/rustc4/build/x86_64-unknown-linux-gnu/test/ui/cfg-dependent/auxiliary/libdependency.so ``` I think another possible fix is to remove the check altogether. But I'm not sure, and this fix works, so I'm not making the larger change here.
2021-07-14Shrink the CrateStore dynamic interface.Camille GILLOT-22/+15
2021-07-13Auto merge of #87044 - cjgillot:expnhash, r=petrochenkovbors-9/+25
Cache expansion hash globally ... instead of computing it multiple times. Split from #86676 r? `@petrochenkov`
2021-07-13Cache expansion hash.Camille GILLOT-9/+25
2021-07-13Auto merge of #86857 - fee1-dead:add-attr, r=oli-obkbors-3/+14
Add #[default_method_body_is_const] `@rustbot` label F-const_trait_impl
2021-07-11Auto merge of #85941 - cjgillot:qresolve, r=Aaron1011bors-3/+9
Reduce the amount of untracked state in TyCtxt -- Take 2 Main part of #85153 The offending line (https://github.com/rust-lang/rust/pull/85153#discussion_r642866298) is replaced by a FIXME until the possible bug and the perf concern are both resolved. r? `@Aaron1011`
2021-07-10rustc_expand: Remove redundant field from proc macro expander structuresVadim Petrochenkov-19/+12
This information is already available from `ExpnData`
2021-07-10Add impl_constness queryDeadbeef-3/+14
2021-07-09Add support for raw-dylib with stdcall, fastcall functions on ↵Richard Cobbe-15/+57
i686-pc-windows-msvc.