Commit graph

6486 commits

Author SHA1 Message Date
Mara Bos
60535441c8 Check FromIterator trait impl in prelude collision check. 2021-07-07 13:26:38 +00:00
bors
c5e344f774 Auto merge of #86920 - JohnTitor:rollup-buvzpkr, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #80918 (Add Integer::log variants)
 - #86717 (Rename some Rust 2021 lints to better names )
 - #86819 (Clean up rustdoc IDs)
 - #86880 (Test ManuallyDrop::clone_from.)
 - #86906 (Replace deprecated compare_and_swap and fix typo in core::sync::atomic::{fence, compiler_fence} docs)
 - #86907 (Migrate `cpu-usage-over-time.py` to Python 3)
 - #86916 (rewrote documentation for thread::yield_now())
 - #86919 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-07 03:31:23 +00:00
Yuki Okushi
7e95290caa
Rollup merge of #86717 - rylev:rename, r=nikomatsakis
Rename some Rust 2021 lints to better names

Based on conversation in https://github.com/rust-lang/rust/issues/85894.

Rename a bunch of Rust 2021 related lints:

Lints that are officially renamed because they are already in beta or stable:
* `disjoint_capture_migration` => `rust_2021_incompatible_closure_captures`
* `or_patterns_back_compat` => `rust_2021_incompatible_or_patterns`
* `non_fmt_panic` => `non_fmt_panics`

Lints that are renamed but don't require any back -compat work since they aren't yet in stable:
* `future_prelude_collision` => `rust_2021_prelude_collisions`
* `reserved_prefix` => `rust_2021_token_prefixes`

Lints that have been discussed but that I did not rename:
* ~`non_fmt_panic` and `bare_trait_object`: is making this plural worth the headache we might cause users?~
* `array_into_iter`: I'm unsure of a good name and whether bothering users with a name change is worth it.

r? `@nikomatsakis`
2021-07-07 12:17:39 +09:00
bors
c0bd5a584d Auto merge of #86901 - sexxi-goose:query_remove, r=nikomatsakis
Make type_implements_trait not a query

r? `@nikomatsakis`
2021-07-07 01:03:41 +00:00
bors
b20e3ff2af Auto merge of #86911 - bjorn3:crate_info_refactor, r=petrochenkov
Refactor linker code

This merges `LinkerInfo` into `CrateInfo` as there is no reason to keep them separate. `LinkerInfo::to_linker` is merged into `get_linker` as both have different logic for each linker type and `to_linker` is directly called after `get_linker`. Also contains a couple of small cleanups.

See the individual commits for all changes.
2021-07-06 22:20:43 +00:00
Aman Arora
1bcbc18e3d Fix depnode size 2021-07-06 15:55:13 -04:00
bors
885399992c Auto merge of #86636 - wesleywiser:misc_enum_improvements, r=michaelwoerister
[msvc] Consistently show active variant and fix visualization for single variant enums

Prior to this change, there were a few cases where inspecting an enum in either WinDbg or Visual Studio would not show the active variant name. After these changes, we now consistently show the active variant name as `[variant]` in the debugger.

We also didn't handle single variant enums very well. That is now also resolved.

Before:
![image](https://user-images.githubusercontent.com/831192/123480097-dc8b5f00-d5cf-11eb-93a8-9fc05a97029b.png)

After:
![image](https://user-images.githubusercontent.com/831192/123479966-aa79fd00-d5cf-11eb-955e-9798616a8829.png)

r? `@michaelwoerister`
2021-07-06 19:31:24 +00:00
Aman Arora
8ef5212eff Make type_implements_trait not a query 2021-07-06 14:38:10 -04:00
Ryan Levick
d4e384bc1d rename rust_2021_token_prefixes to rust_2021_prefixes_incompatible_syntax 2021-07-06 20:13:36 +02:00
Ryan Levick
941eb2adbd Rename future_prelude_collisions to rust_2021_prelude_collisions 2021-07-06 20:13:17 +02:00
Ryan Levick
81c11a212e rust_2021_token_prefixes 2021-07-06 20:13:16 +02:00
Ryan Levick
a902e25f58 Add s to non_fmt_panic 2021-07-06 20:12:56 +02:00
Ryan Levick
3a45bb919c Fix mis-styled code 2021-07-06 20:12:55 +02:00
Ryan Levick
6c87772e3c Rename reserved_prefix lint to reserved_prefixes 2021-07-06 20:12:55 +02:00
Ryan Levick
ecca9a8b1a Add s to FUTURE_PRELUDE_COLLISION 2021-07-06 20:11:45 +02:00
Ryan Levick
1d49658f5c Change or_patterns_back_compat lint to rust_2021_incompatible_or_patterns 2021-07-06 20:11:45 +02:00
Ryan Levick
df71a99a0e Rename lint 2021-07-06 20:11:45 +02:00
Ryan Levick
bbfb8579ff Rename disjoint_capture_migration lint to rust_2021_incompatible_closure_captures 2021-07-06 20:11:45 +02:00
bors
238fd72880 Auto merge of #86572 - rylev:force-warnings-always, r=nikomatsakis
Force warnings even when can_emit_warnings == false

Fixes an issue mentioned in #85512 with --cap-lints overriding --force-warnings.

Fixes https://github.com/rust-lang/rust/issues/86751

r? `@ehuss`
2021-07-06 16:50:33 +00:00
bjorn3
b21cbfd77d Fold LinkerInfo into CrateInfo 2021-07-06 18:28:07 +02:00
bjorn3
b4a12f95c1 Don't store the full LinkerInfo inside Linker impls 2021-07-06 18:09:49 +02:00
bjorn3
cfff3a35a2 Merge LinkerInfo::to_linker into get_linker 2021-07-06 18:01:44 +02:00
bjorn3
0b061cbeac Move get_linker to linker.rs 2021-07-06 17:54:13 +02:00
bjorn3
56ee9864c1 Don't pass local_crate_name to link_binary separately
It is already part of CodegenResults
2021-07-06 17:49:23 +02:00
bjorn3
5aaa953dcc Remove unused panic_runtime field from CrateInfo 2021-07-06 17:38:27 +02:00
bors
b09dad3edd Auto merge of #86231 - nagisa:nagisa/abi-allowlist, r=petrochenkov
Replace per-target ABI denylist with an allowlist

It makes very little sense to maintain denylists of ABIs when, as far as
non-generic ABIs are concerned, targets usually only support a small
subset of the available ABIs.

This has historically been a cause of bugs such as us allowing use of
the platform-specific ABIs on x86 targets – these in turn would cause
LLVM errors or assertions to fire.

In this PR we got rid of the per-target ABI denylists, and instead compute
which ABIs are supported with a simple match based on, mostly, the
`Target::arch` field. Among other things, this makes it impossible to
forget to consider this problem (in either direction) and forces one to
consider what the ABI support looks like when adding an ABI (rarely)
rather than target (often), which should hopefully also reduce the
cognitive load on both contributors as well as reviewers.

Fixes #57182

Sponsored by: standard.ai

---

## Summary for teams

One significant user-facing change after this PR is that there's now a future compat warning when building…

* `stdcall`, `fastcall`, `thiscall` using code with targets other than 32-bit x86 (i386...i686) or *-windows-*;
* `vectorcall` using code when building for targets other than x86 (either 32 or 64 bit) or *-windows-*.

Previously these ABIs have been accepted much more broadly, even for architectures and targets where this made no sense (e.g. on wasm32) and would fall back to the C ABI. In practice this doesn't seem to be used too widely and the [breakages in crater](https://github.com/rust-lang/rust/pull/86231#issuecomment-866300943) that we see are mostly about Windows-specific code that was missing relevant `cfg`s and just happened to successfully `check` on Linux for one reason or another.

The intention is that this warning becomes a hard error after some time.
2021-07-06 14:02:19 +00:00
bjorn3
323a74779f Move LinkerInfo into CrateInfo 2021-07-06 15:31:38 +02:00
Ryan Levick
5af5a6d49d Add missing docs and remove dead code 2021-07-06 13:47:03 +02:00
bors
d04ec47358 Auto merge of #86143 - bjorn3:revert_revert_merge_crate_disambiguator, r=michaelwoerister
Reland "Merge CrateDisambiguator into StableCrateId"

Reverts https://github.com/rust-lang/rust/pull/85891 as this revert of #85804 made perf even worse.

r? `@Mark-Simulacrum`
2021-07-06 11:31:59 +00:00
Simonas Kazlauskas
8240e7aa10 Replace per-target ABI denylist with an allowlist
It makes very little sense to maintain denylists of ABIs when, as far as
non-generic ABIs are concerned, targets usually only support a small
subset of the available ABIs.

This has historically been a cause of bugs such as us allowing use of
the platform-specific ABIs on x86 targets – these in turn would cause
LLVM errors or assertions to fire.

Fixes #57182

Sponsored by: standard.ai
2021-07-06 13:12:15 +03:00
bjorn3
56c6a48d2e Truncate hex stable crate id to 8 characters (32 bits) 2021-07-06 11:36:23 +02:00
bjorn3
ca935ddbf1 Make tcx.stable_crate_id() faster 2021-07-06 11:28:06 +02:00
bjorn3
96d3bd467d Revert "Revert "Fix test""
This reverts commit 6c5b6985fd.
2021-07-06 11:28:06 +02:00
bjorn3
489ad8b8b5 Revert "Revert "Merge CrateDisambiguator into StableCrateId""
This reverts commit 8176ab8bc1.
2021-07-06 11:28:04 +02:00
bors
d7901f37bb Auto merge of #86694 - cjgillot:pmmd, r=petrochenkov
Store macro parent module in ExpnData.

As a consequence, its value is hashed as part of the ExpnId's stable hash.

Closes #85999
2021-07-06 08:50:24 +00:00
Camille GILLOT
3162c37b59 Store macro parent module in ExpnData. 2021-07-06 08:07:06 +02:00
bors
d5a406bb66 Auto merge of #82985 - cjgillot:lint, r=jackh726
Cleanup the computation of lint levels

This now uses an `IndexVec` and a special root `LintStackIndex = 0` to encode command-line levels.
2021-07-06 00:33:21 +00:00
bors
72b0c7dfe9 Auto merge of #86877 - bjorn3:remove_lib_source, r=petrochenkov
Remove LibSource

The information is stored in used_crate_source too anyway.

Split out of #86105

r? `@petrochenkov`
2021-07-05 21:52:34 +00:00
bors
952fdf2a11 Auto merge of #86891 - JohnTitor:rollup-gy2gan9, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #83581 (Add std::os::unix::fs::DirEntryExt2::file_name_ref(&self) -> &OsStr)
 - #85377 (aborts: Clarify documentation and comments)
 - #86685 (double-check mutability inside Allocation)
 - #86794 (Stabilize `Seek::rewind()`)
 - #86852 (Remove some doc aliases)
 - #86878 (⬆️ rust-analyzer)
 - #86886 (Remove `impl Clean for {Ident, Symbol}`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-05 19:11:43 +00:00
Yuki Okushi
1ca32050b1
Rollup merge of #86685 - RalfJung:alloc-mut, r=oli-obk
double-check mutability inside Allocation

r? `@oli-obk`
2021-07-06 02:33:14 +09:00
bors
969a6c2481 Auto merge of #86674 - Aaron1011:new-querify-limits, r=michaelwoerister
Query-ify global limit attribute handling

Currently, we read various 'global limits' from inner attributes the crate root (`recursion_limit`, `move_size_limit`, `type_length_limit`, `const_eval_limit`). These limits are then stored in `Sessions`, allowing them to be access from a `TyCtxt` without registering a dependency on the crate root attributes.

This PR moves the calculation of these global limits behind queries, so that we properly track dependencies on crate root attributes. During the setup of macro expansion (before we've created a `TyCtxt`), we need to access the recursion limit, which is now done by directly calling into the code shared by the normal query implementations.
2021-07-05 16:30:53 +00:00
bjorn3
5added38c9 Deduplicate info.used_crate_source indexing 2021-07-05 17:44:15 +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
09d9b608d6 Auto merge of #86282 - camelid:macro_rules-matchers, r=jyn514
Pretty-print macro matchers instead of using source code

Fixes #86208.
2021-07-05 05:09:35 +00:00
bors
44860d13fa Auto merge of #86867 - JohnTitor:convert-to-actual-assert, r=jackh726
Convert `debug_assert!` to `assert!` in `Binder::dummy`

This is needed for #85350 not to be passed.
r? `@jackh726`
2021-07-05 02:05:04 +00:00
Yuki Okushi
8bb5f37492
Rollup merge of #86862 - tmiasko:re-export-SwitchIntEdgeEffects, r=jonas-schievink
re-export SwitchIntEdgeEffects

This makes it possible to use `switch_int_edge_effects` outside
`rustc_mir::dataflow::impls`.
2021-07-05 07:13:27 +09:00
Yuki Okushi
5d555bf239
Rollup merge of #86477 - tlyu:e0716-clarification, r=JohnTitor
E0716: clarify that equivalent code example is erroneous

In E0716, there is a code block that is equivalent to the erroneous
code example. Especially when viewed with `rustc --explain`, it's
not obvious that it is also erroneous, and some users have been
confused when they try to change their code to match the erroneous
equivalent.

`@rustbot` label +A-diagnostics +D-newcomer-roadblock +T-compiler
2021-07-05 07:13:22 +09:00
Aaron Hill
7e5a88a56c
Combine individual limit queries into single limits query 2021-07-04 13:02:51 -05:00
bors
23c652dfe3 Auto merge of #86866 - nikomatsakis:issue-84841, r=oli-obk
Hack: Ignore inference variables in certain queries

Fixes #84841
Fixes #86753

Some queries are not built to accept types with inference variables, which can lead to ICEs. These queries probably ought to be converted to canonical form, but as a quick workaround, we can return conservative results in the case that inference variables are found.

We should file a follow-up issue (and update the FIXMEs...) to do the proper refactoring.

cc `@arora-aman`

r? `@oli-obk`
2021-07-04 17:39:37 +00:00
Aaron Hill
ff15b5e2c7
Query-ify global limit attribute handling 2021-07-04 12:33:14 -05:00