Commit graph

352 commits

Author SHA1 Message Date
Camille GILLOT
db9fea508a Avoid more invocations of hir_crate query. 2021-09-29 23:16:47 +02:00
bors
bf642323d6 Auto merge of #89016 - lcnr:non_blanket_impls, r=nikomatsakis,michaelwoerister
fix non_blanket_impls iteration order

We sometimes iterate over all `non_blanket_impls`, not sure if this is observable outside
of error messages (i.e. as incremental bugs). This should fix the underlying issue of #86986.

second attempt of #88718

r? `@nikomatsakis`
2021-09-23 15:44:53 +00:00
bors
ac2d9fc509 Auto merge of #89103 - Mark-Simulacrum:migrate-2021, r=estebank
Migrate in-tree crates to 2021

This replaces #89075 (cherry picking some of the commits from there), and closes #88637 and fixes #89074.

It excludes a migration of the library crates for now (see tidy diff) because we have some pending bugs around macro spans to fix there.

I instrumented bootstrap during the migration to make sure all crates moved from 2018 to 2021 had the compatibility warnings applied first.

Originally, the intent was to support cargo fix --edition within bootstrap, but this proved fairly difficult to pull off. We'd need to architect the check functionality to support running cargo check and cargo fix within the same x.py invocation, and only resetting sysroots on check. Further, it was found that cargo fix doesn't behave too well with "not quite workspaces", such as Clippy which has several crates. Bootstrap runs with --manifest-path ... for all the tools, and this makes cargo fix only attempt migration for that crate. We can't use e.g. --workspace due to needing to maintain sysroots for different phases of compilation appropriately.

It is recommended to skip the mass migration of Cargo.toml's to 2021 for review purposes; you can also use `git diff d6cd2c6c87 -I'^edition = .20...$'` to ignore the edition = 2018/21 lines in the diff.
2021-09-21 19:25:49 +00:00
bors
49c0861ed0 Auto merge of #87234 - cjgillot:lower-mono, r=petrochenkov
Lower only one HIR owner at a time

Based on https://github.com/rust-lang/rust/pull/83723
Additional diff is here: https://github.com/cjgillot/rust/compare/ownernode...lower-mono

Lowering is very tangled and has a tendency to intertwine the transformation of different items. This PR aims at simplifying the logic by:
- moving global analyses to the resolver (item_generics_num_lifetimes, proc_macros, trait_impls);
- removing a few special cases (non-exported macros and use statements);
- restricting the amount of available information at any one time;
- avoiding back-and-forth between different owners: an item must now be lowered all at once, and its parent cannot refer to its nodes.

I also removed the sorting of bodies by span.  The diagnostic ordering changes marginally, since definitions are pretty much sorted already according to the AST. This uncovered a subtlety in thir-unsafeck.

(While these items could logically be in different PRs, the dependency between commits and the amount of conflicts force a monolithic PR.)
2021-09-21 07:52:15 +00:00
lcnr
01bcddbdc4 crates is already deterministic 2021-09-21 08:24:23 +02:00
Mark Rousskov
3b89679671 Adjust documentation for compatibility with 2021
This also adjusts the lint docs generation to accept (and ignore) an allow
attribute, rather than expecting the documentation to be immediately followed by
the lint name.
2021-09-20 22:21:43 -04:00
Mark Rousskov
c746be2219 Migrate to 2021 2021-09-20 22:21:42 -04:00
Richard Cobbe
142f6c0b07 Implement #[link_ordinal] attribute in the context of #[link(kind = "raw-dylib")]. 2021-09-20 14:50:35 -07:00
Michael Woerister
543a73d678 Update odht crate to 0.3.0
This version of odht contains a potential fix for #89085.
2021-09-20 15:57:45 +02:00
Camille GILLOT
d7795d302a Do not store visibility in *ItemRef. 2021-09-20 00:29:53 +02:00
Michael Woerister
4d151d92de Update odht to 0.2.1 2021-09-17 15:57:57 +02:00
Michael Woerister
919497cc30 rustc_metadata: Remove Metadata::raw_bytes() and use Metadata::blob() directly instead. 2021-09-14 13:56:33 +02:00
Michael Woerister
5f73085f92 Rename DefPathHashMap in rustc_metadata so its name does not clash with DefPathHashMap in rustc_hir. 2021-09-14 13:56:33 +02:00
Michael Woerister
2b60338ee9 Make DefPathHash->DefId panic for if the mapping fails.
We only use this mapping for cases where we know that it must succeed.
Letting it panic otherwise makes it harder to use the API in unsupported
ways.
2021-09-14 13:56:33 +02:00
Michael Woerister
960893c50a Store DefPathHash->DefIndex map in on-disk-hash-table format in crate metadata.
This encoding allows for random access without an expensive upfront decoding
state which in turn allows simplifying the DefPathIndex lookup logic without
regressing performance.
2021-09-14 13:56:33 +02:00
Michael Woerister
d0be27c8ec Use on-disk-hash-table format for DefPathHashMap in hir::definitions. 2021-09-14 13:54:41 +02:00
Michael Woerister
0debea1377 Allow taking an OwningRef of the crate metadata blob. 2021-09-14 13:53:55 +02:00
bors
51e514c0fb Auto merge of #88759 - Amanieu:panic_in_drop, r=nagisa,eddyb
Add -Z panic-in-drop={unwind,abort} command-line option

This PR changes `Drop` to abort if an unwinding panic attempts to escape it, making the process abort instead. This has several benefits:
- The current behavior when unwinding out of `Drop` is very unintuitive and easy to miss: unwinding continues, but the remaining drops in scope are simply leaked.
- A lot of unsafe code doesn't expect drops to unwind, which can lead to unsoundness:
  - https://github.com/servo/rust-smallvec/issues/14
  - https://github.com/bluss/arrayvec/issues/3
- There is a code size and compilation time cost to this: LLVM needs to generate extra landing pads out of all calls in a drop implementation. This can compound when functions are inlined since unwinding will then continue on to process drops in the callee, which can itself unwind, etc.
  - Initial measurements show a 3% size reduction and up to 10% compilation time reduction on some crates (`syn`).

One thing to note about `-Z panic-in-drop=abort` is that *all* crates must be built with this option for it to be sound since it makes the compiler assume that dropping `Box<dyn Any>` will never unwind.

cc https://github.com/rust-lang/lang-team/issues/97
2021-09-12 20:48:09 +00:00
Manish Goregaokar
f5ac5cadd3
Rollup merge of #88709 - BoxyUwU:thir-abstract-const, r=lcnr
generic_const_exprs: use thir for abstract consts instead of mir

Changes `AbstractConst` building to use `thir` instead of `mir` so that there's less chance of consts unifying when they shouldn't because lowering to mir dropped information (see `abstract-consts-as-cast-5.rs` test)

r? `@lcnr`
2021-09-12 03:44:56 -07:00
Manish Goregaokar
bb5ca58d29
Rollup merge of #88677 - petrochenkov:exportid, r=davidtwco
rustc: Remove local variable IDs from `Export`s

Local variables can never be exported.
2021-09-12 03:44:53 -07:00
bors
547d9374d2 Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkov
Encode spans relative to the enclosing item

The aim of this PR is to avoid recomputing queries when code is moved without modification.

MCP at https://github.com/rust-lang/compiler-team/issues/443

This is achieved by :
1. storing the HIR owner LocalDefId information inside the span;
2. encoding and decoding spans relative to the enclosing item in the incremental on-disk cache;
3. marking a dependency to the `source_span(LocalDefId)` query when we translate a span from the short (`Span`) representation to its explicit (`SpanData`) representation.

Since all client code uses `Span`, step 3 ensures that all manipulations
of span byte positions actually create the dependency edge between
the caller and the `source_span(LocalDefId)`.
This query return the actual absolute span of the parent item.
As a consequence, any source code motion that changes the absolute byte position of a node will either:
- modify the distance to the parent's beginning, so change the relative span's hash;
- dirty `source_span`, and trigger the incremental recomputation of all code that
  depends on the span's absolute byte position.

With this scheme, I believe the dependency tracking to be accurate.

For the moment, the spans are marked during lowering.
I'd rather do this during def-collection,
but the AST MutVisitor is not practical enough just yet.
The only difference is that we attach macro-expanded spans
to their expansion point instead of the macro itself.
2021-09-11 23:35:28 +00:00
Amanieu d'Antras
a149bed3bd Ensure that crates are linked with compatible panic-in-drop settings 2021-09-11 16:13:30 +01:00
Vadim Petrochenkov
294510e1bb rustc: Remove local variable IDs from Exports
Local variables can never be exported.
2021-09-10 23:41:48 +03:00
Guillaume Gomez
c9a56cdc58 Add help for E0463 2021-09-10 21:36:09 +02:00
Camille GILLOT
00485e0c0e Keep a parent LocalDefId in SpanData. 2021-09-10 20:17:33 +02:00
Ellen
8295e4a6cf add test for builtin types N + N unifying with fn call 2021-09-09 15:44:04 +01:00
Ellen
406d2ab95d rename mir -> thir around abstract consts 2021-09-09 01:32:03 +01:00
bors
d295e36c38 Auto merge of #88538 - bjorn3:no_session_in_crate_loader, r=petrochenkov
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-04 07:17:12 +00:00
bjorn3
ff98cb6408 Remove unused argument from resolve_crate 2021-09-02 12:25:27 +02:00
bjorn3
f59198ab96 Introduce CrateRejections struct 2021-09-02 12:25:27 +02:00
bjorn3
b3f850a50c Remove root field from CrateLocator 2021-09-02 12:25:26 +02:00
bjorn3
3a8c457916 Remove host_hash from CrateLocator 2021-09-02 12:25:26 +02:00
bjorn3
a3ada4e68a Refactor CrateLocator.is_proc_macro
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-02 12:25:26 +02:00
bjorn3
4f35f66796 Don't store Session in CrateLocator 2021-09-02 12:25:26 +02:00
Camille GILLOT
f8efe5d822 Compute proc_macros in resolutions. 2021-09-01 20:13:16 +02:00
inquisitivecrystal
8c62fa0575 Treat macros as HIR items 2021-08-28 00:16:34 -07:00
bors
958d788a0b Auto merge of #85344 - cbeuw:remap-across-cwd, r=michaelwoerister
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-25 10:58:43 +00:00
bors
f66e825f73 Auto merge of #87739 - Aaron1011:remove-used-attrs, r=wesleywiser
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-24 03:58:22 +00:00
Frank Steffahn
2f9ddf3bc7 Fix typos “an”→“a” and a few different ones that appeared in the same search 2021-08-22 18:15:49 +02:00
Frank Steffahn
b08b92eb42 Revert a change of “an --extern” (can be read with “dash dash”) 2021-08-22 16:37:47 +02:00
Frank Steffahn
bf88b113ea Fix typos “a”→“an” 2021-08-22 15:35:11 +02:00
Aaron Hill
af46699f81
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-21 13:27:27 -05:00
Aaron Hill
a895069c50
Include (potentially remapped) working dir in crate hash
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-15 15:17:37 -05:00
bors
eb2226b1f1 Auto merge of #85296 - bjorn3:plugin_cleanup, r=petrochenkov
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-12 04:30:41 +00:00
bjorn3
a501308ec1 Replace #[plugin_registrar] with exporting __rustc_plugin_registrar 2021-08-10 14:20:48 +02:00
bors
7b52ad00cb Auto merge of #87619 - 12101111:fix-native_link_modifiers_bundle, r=petrochenkov
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-09 03:59:30 +00:00
12101111
d935a14f4c
Fix feature gate checking of static-nobundle and native_link_modifiers 2021-08-08 21:46:40 +08:00
Ellen
2c004a2287 encode generics_of of fields and ty params 2021-08-06 14:20:59 +01:00
Amanieu d'Antras
1247f9b829 Add back -Zno-profiler-runtime
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-08-04 10:47:59 +01:00
Jade
3cf820e17d rfc3052: Remove authors field from Cargo manifests
Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.
2021-07-29 14:56:05 -07:00
bors
6489ee1041 Auto merge of #83723 - cjgillot:ownernode, r=petrochenkov
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-25 11:11:02 +00:00
Camille GILLOT
fee421685d Introduce OwnerNode::Crate. 2021-07-25 12:22:47 +02:00
Camille GILLOT
36a28060f1 Merge the BTreeMap in hir::Crate. 2021-07-25 12:18:56 +02:00
Joshua Nelson
17f7536fb2 Remove detection of rustup and cargo in 'missing extern crate' diagnostics
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-24 01:29:42 +00:00
bors
18073052d8 Auto merge of #86698 - cjgillot:modc, r=estebank
Move OnDiskCache to rustc_query_impl.

This should be the last remnant of the query implementation that was still in rustc_middle.
2021-07-18 10:42:23 +00:00
Camille GILLOT
81241cbf3a Move OnDiskCache to rustc_query_impl. 2021-07-18 11:14:07 +02:00
Yuki Okushi
81d0b70402
Rollup merge of #87092 - ricobbe:fix-raw-dylib-multiple-definitions, 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-18 14:21:56 +09:00
Camille GILLOT
41c1f39fa8 Drop ExpnData::krate. 2021-07-17 19:41:10 +02:00
Camille GILLOT
dbd2d77641 Drop orig_id. 2021-07-17 19:41:09 +02:00
Camille GILLOT
37a13def48 Encode ExpnId using ExpnHash for incr. comp. 2021-07-17 19:41:08 +02:00
Camille GILLOT
2fe37c5bd1 Choose encoding format in caller code. 2021-07-17 19:41:07 +02:00
Camille GILLOT
6e78d6c9d6 Make the CrateNum part of the ExpnId. 2021-07-17 19:35:33 +02:00
Richard Cobbe
ce59f1aac5 Consider all fields when comparing DllImports, to remove nondetermininsm in multiple-definitions test 2021-07-16 11:10:31 -07:00
Camille GILLOT
c2d43e1329 Simplify metadata decoding. 2021-07-15 19:31:47 +02:00
Camille GILLOT
47ea2ae933 Separate encoding paths.
The two paths will be modified independently in the next few commits.
2021-07-15 19:31:46 +02:00
bors
b9197978a9 Auto merge of #86876 - jyn514:56935-target-crate-num, r=petrochenkov
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-15 02:39:38 +00:00
Joshua Nelson
68b959827b 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.
2021-07-14 20:36:35 -04:00
Camille GILLOT
3fba5a4844 Shrink the CrateStore dynamic interface. 2021-07-14 16:37:56 +02:00
bors
c7d6bcc788 Auto merge of #87044 - cjgillot:expnhash, r=petrochenkov
Cache expansion hash globally

... instead of computing it multiple times.

Split from #86676
r? `@petrochenkov`
2021-07-13 22:32:58 +00:00
Camille GILLOT
616ce3c5c0 Cache expansion hash. 2021-07-13 23:10:56 +02:00
bors
394804bb23 Auto merge of #86857 - fee1-dead:add-attr, r=oli-obk
Add #[default_method_body_is_const]

`@rustbot` label F-const_trait_impl
2021-07-13 06:59:34 +00:00
bors
72568552fd Auto merge of #85941 - cjgillot:qresolve, r=Aaron1011
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-11 16:09:17 +00:00
Vadim Petrochenkov
de897f5205 rustc_expand: Remove redundant field from proc macro expander structures
This information is already available from `ExpnData`
2021-07-10 23:22:27 +03:00
Deadbeef
89d190f090
Add impl_constness query 2021-07-10 20:54:49 +08:00
Richard Cobbe
a867dd4c7e Add support for raw-dylib with stdcall, fastcall functions on i686-pc-windows-msvc. 2021-07-09 12:04:54 -07:00
Camille GILLOT
9f6d7e7dad Correct comments about untracked accesses. 2021-07-06 19:26:02 +02:00
Camille GILLOT
071a047dc7 Make resolutions a query. 2021-07-06 19:22:27 +02:00
bjorn3
489ad8b8b5 Revert "Revert "Merge CrateDisambiguator into StableCrateId""
This reverts commit 8176ab8bc1.
2021-07-06 11:28:04 +02:00
bjorn3
8748e37d35 Remove LibSource
The information is stored in used_crate_source too anyway
2021-07-05 10:49:07 +02:00
bors
7100b311df Auto merge of #86749 - bjorn3:link_info_refactor_part1, r=petrochenkov
Rename all_crate_nums query to crates and remove useless wrapper

Split out of https://github.com/rust-lang/rust/pull/86105

r? `@petrochenkov`
2021-07-01 19:00:08 +00:00
bjorn3
c7d2099de0 Rename all_crate_nums query to crates and remove useless wrapper 2021-07-01 16:51:11 +02:00
bors
1034282bca Auto merge of #86617 - joshtriplett:prune-dependencies, r=Mark-Simulacrum
Remove unused dependencies from compiler crates

Various compiler crates have dependencies that they don't appear to use. I used some scripting to detect such dependencies, filtered them based on some manual review, and removed those that do indeed appear to be entirely unused.
2021-07-01 03:49:47 +00:00
Deadbeef
3b9453bfe2
use is_const_fn_raw when encoding constness
this properly encodes cross-crate constness data.
2021-06-30 23:56:43 +08:00
bors
345530412f Auto merge of #85909 - cjgillot:alloc-kind-query, r=Aaron1011
Make allocator_kind a query.

Part of #85153

r? `@Aaron1011`
2021-06-28 01:20:01 +00:00
Josh Triplett
70e2683397 rustc_metadata: Remove unused dependency stable_deref_trait
Unused since commit 8331dbe6d0
("Add an Mmap wrapper to rustc_data_structures").
2021-06-25 01:12:59 -07:00
Jacob Pratt
3f14f4b3ce
Use #[non_exhaustive] where appropriate
Due to the std/alloc split, it is not possible to make
`alloc::collections::TryReserveError::AllocError` non-exhaustive without
having an unstable, doc-hidden method to construct (which negates the
benefits from `#[non_exhaustive]`.
2021-06-24 04:16:11 -04:00
Jeremy Fitzhardinge
cef3ab75b1 Print more crate details in -Zls
Useful for debugging crate hash and resolution issues.
2021-06-21 17:22:35 -07:00
Camille GILLOT
cbdfbdd40b Implement the query in cstore_impl. 2021-06-20 11:58:46 +02:00
bors
ed33787335 Auto merge of #85284 - eggyal:custom-profiler-runtime, r=jackh726
Provide option for specifying the profiler runtime

Currently, if `-Zinstrument-coverage` is enabled, the target is linked
against the `library/profiler_builtins` crate (which pulls in LLVM's
compiler-rt runtime).

This option enables backends to specify an alternative runtime crate for
handling injected instrumentation calls.
2021-06-18 04:39:01 +00:00
Alan Egerton
872839eb49
Early return from inject_profiler_runtime 2021-06-17 12:11:40 +01:00
bors
b17d9c1332 Auto merge of #85834 - cjgillot:save-sbi, r=michaelwoerister
Encode CrateNum using the StableCrateId for incr. comp.
2021-06-17 09:03:58 +00:00
bors
0a8629bff6 Auto merge of #85885 - bjorn3:remove_box_region, r=cjgillot
Don't use a generator for BoxedResolver

The generator is non-trivial and requires unsafe code anyway. Using regular unsafe code without a generator is much easier to follow.

Based on #85810 as it touches rustc_interface too.
2021-06-11 16:11:20 +00:00
bors
1639a16ebf Auto merge of #85910 - cjgillot:no-meta-version, r=Aaron1011
Drop metadata_encoding_version.

Part of #85153

r? `@Aaron1011`
2021-06-10 00:39:25 +00:00
Camille GILLOT
5be514992f Encode CrateNum using the StableCrateId for incr. comp. 2021-06-09 20:20:49 +02:00
bjorn3
db4d8e2cab Store boxed metadata loader in CrateLoader 2021-06-08 19:24:16 +02:00
bjorn3
8176ab8bc1 Revert "Merge CrateDisambiguator into StableCrateId"
This reverts commit d0ec85d3fb.
2021-06-07 10:37:45 +02:00
bors
9a576175cc Auto merge of #84171 - ricobbe:raw-dylib-via-llvm, r=petrochenkov
Partial support for raw-dylib linkage

First cut of functionality for issue #58713: add support for `#[link(kind = "raw-dylib")]` on `extern` blocks in lib crates compiled to .rlib files.  Does not yet support `#[link_name]` attributes on functions, or the `#[link_ordinal]` attribute, or `#[link(kind = "raw-dylib")]` on `extern` blocks in bin crates; I intend to publish subsequent PRs to fill those gaps.  It's also not yet clear whether this works for functions in `extern "stdcall"` blocks; I also intend to investigate that shortly and make any necessary changes as a follow-on PR.

This implementation calls out to an LLVM function to construct the actual `.idata` sections as temporary `.lib` files on disk and then links those into the generated .rlib.
2021-06-06 03:59:17 +00:00
bors
6c2dd251bb Auto merge of #86002 - cjgillot:expn_that_defined, r=petrochenkov
Always go through the expn_that_defined query.
2021-06-05 21:10:01 +00:00
Richard Cobbe
6aa45b71b1 Add first cut of functionality for #58713: support for #[link(kind = "raw-dylib")].
This does not yet support #[link_name] attributes on functions, the #[link_ordinal]
attribute, #[link(kind = "raw-dylib")] on extern blocks in bin crates, or
stdcall functions on 32-bit x86.
2021-06-04 18:01:35 -07:00
Camille GILLOT
507a1fdf13 Always go through the expn_that_defined query. 2021-06-04 21:37:34 +02:00