Commit graph

4745 commits

Author SHA1 Message Date
bors
7637fd588b Auto merge of #83503 - Dylan-DPC:rollup-mqvjfav, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #83055 ([rustdoc] Don't document stripped items in JSON renderer.)
 - #83437 (Refactor #82270 as lint instead of an error)
 - #83444 (Fix bootstrap tests on beta)
 - #83456 (Add docs for Vec::from functions)
 - #83463 (ExitStatusExt: Fix missing word in two docs messages)
 - #83470 (Fix patch note about #80653 not mentioning nested nor recursive)
 - #83485 (Mark asm tests as requiring LLVM 10.0.1)
 - #83486 (Don't ICE when using `#[global_alloc]` on a non-item statement)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-26 04:10:13 +00:00
Dylan DPC
b0bec95534
Rollup merge of #83486 - Aaron1011:fix/global-alloc-error, r=petrochenkov
Don't ICE when using `#[global_alloc]` on a non-item statement

Fixes #83469

We need to return an `Annotatable::Stmt` if we were passed an
`Annotatable::Stmt`
2021-03-26 02:34:45 +01:00
Dylan DPC
02b27cd79e
Rollup merge of #83437 - Amanieu:asm_syntax, r=petrochenkov
Refactor #82270 as lint instead of an error

This PR fixes several issues with #82270 which generated an error when `.intel_syntax` or `.att_syntax` was used in inline assembly:
- It is now a warn-by-default lint instead of an error.
- The lint only triggers on x86. `.intel_syntax` and `.att_syntax` are only valid on x86.
- The lint no longer provides machine-applicable suggestions for two reasons:
	- These changes should not be made automatically since changes to assembly code can be very subtle.
	- The template string is not always just a string: it can contain macro invocation (`concat!`), raw strings, escape characters, etc.

cc ``@asquared31415``
2021-03-26 02:34:39 +01:00
bors
0ced530534 Auto merge of #83465 - michaelwoerister:safe-read_raw_bytes, r=cjgillot
Allow for reading raw bytes from rustc_serialize::Decoder without unsafe code

The current `read_raw_bytes` method requires using `MaybeUninit` and `unsafe`. I don't think this is necessary. Let's see if a safe interface has any performance drawbacks.

This is a followup to #83273 and will make it easier to rebase #82183.

r? `@cjgillot`
2021-03-26 01:28:59 +00:00
Aaron Hill
7504b9bb96
Avoid double-collection for expression nonterminals 2021-03-25 18:05:49 -04:00
Aaron Hill
fe60f19f7e
Ban custom inner attributes in expressions and statements 2021-03-25 18:05:30 -04:00
Aaron Hill
8ecd931a8e
Don't ICE when using #[global_alloc] on a non-item statement
Fixes #83469

We need to return an `Annotatable::Stmt` if we were passed an
`Annotatable::Stmt`
2021-03-25 15:41:31 -04:00
bors
52e3dffa50 Auto merge of #82743 - jackh726:resolve-refactor, r=nikomatsakis
Refactor rustc_resolve::late::lifetimes to resolve per-item

There are some changes to tests that I'd like some feedback on; so this is still WIP.

The reason behind this change will (hopefully) allow us to (as part of #76814) be able to essentially use the lifetime resolve code to resolve *all* late bound vars (including those of super traits). Currently, it only resolves those that are *syntactically* in scope. In #76814, I'm essentially finding that I would essentially have to redo the passing of bound vars through scopes (i.e. when instantiating a poly trait ref), and that's what this code does anyways. However, to be able to do this (ask super traits what bound vars are in scope), we have to be able to resolve items separately.

The first commit is actually partially orthogonal. Essentially removing one use of late bound debruijn indices.

Not exactly sure who would be best to review here.
Let r? `@nikomatsakis`
2021-03-25 19:28:16 +00:00
bors
cb473c2c5b Auto merge of #83424 - cjgillot:noparam, r=lcnr
GenericParam does not need to be a HIR owner.

The special case is not required.

Universal impl traits design to regular generic parameters, and their content is owned by the enclosing item.

Existential (and opaque) impl traits generate their own enclosing item, and are collected through it.
2021-03-25 16:35:19 +00:00
Niko Matsakis
7cb8f513c6 write-up what is happening 2021-03-25 09:24:27 -04:00
Amanieu d'Antras
5dabc80796 Refactor #82270 as lint instead of an error 2021-03-25 13:12:29 +00:00
bors
6e17a5c5fd Auto merge of #83387 - cuviper:min-llvm-10, r=nagisa
Update the minimum external LLVM to 10

r? `@nikic`
2021-03-25 13:11:18 +00:00
Michael Woerister
517d5ac230 Allow for reading raw bytes from rustc_serialize::Decoder without unsafe code. 2021-03-25 14:05:00 +01:00
bors
bba40880c0 Auto merge of #82565 - m-ou-se:ununstabilize-bits, r=kennytm
Revert reverting of stabilizing integer::BITS.

Now that `lexical-core` has an updated version that won't break with this stabilization, let's try to stabilize this again.

See https://github.com/rust-lang/rust/issues/81654#issuecomment-778564715

Tracking issue with FCP: https://github.com/rust-lang/rust/issues/76904
2021-03-25 10:29:58 +00:00
bors
372afcf93b Auto merge of #83445 - erikdesjardins:rmunion, r=RalfJung
RemoveZsts: don't touch unions

This should fix a Miri ICE

r? `@RalfJung`
2021-03-25 07:48:52 +00:00
bors
dbc37a97dc Auto merge of #83307 - richkadel:cov-unused-functions-1.1, r=tmandry
coverage bug fixes and optimization support

Adjusted LLVM codegen for code compiled with `-Zinstrument-coverage` to
address multiple, somewhat related issues.

Fixed a significant flaw in prior coverage solution: Every counter
generated a new counter variable, but there should have only been one
counter variable per function. This appears to have bloated .profraw
files significantly. (For a small program, it increased the size by
about 40%. I have not tested large programs, but there is anecdotal
evidence that profraw files were way too large. This is a good fix,
regardless, but hopefully it also addresses related issues.

Fixes: #82144

Invalid LLVM coverage data produced when compiled with -C opt-level=1

Existing tests now work up to at least `opt-level=3`. This required a
detailed analysis of the LLVM IR, comparisons with Clang C++ LLVM IR
when compiled with coverage, and a lot of trial and error with codegen
adjustments.

The biggest hurdle was figuring out how to continue to support coverage
results for unused functions and generics. Rust's coverage results have
three advantages over Clang's coverage results:

1. Rust's coverage map does not include any overlapping code regions,
   making coverage counting unambiguous.
2. Rust generates coverage results (showing zero counts) for all unused
   functions, including generics. (Clang does not generate coverage for
   uninstantiated template functions.)
3. Rust's unused functions produce minimal stubbed functions in LLVM IR,
   sufficient for including in the coverage results; while Clang must
   generate the complete LLVM IR for each unused function, even though
   it will never be called.

This PR removes the previous hack of attempting to inject coverage into
some other existing function instance, and generates dedicated instances
for each unused function. This change, and a few other adjustments
(similar to what is required for `-C link-dead-code`, but with lower
impact), makes it possible to support LLVM optimizations.

Fixes: #79651

Coverage report: "Unexecuted instantiation:..." for a generic function
from multiple crates

Fixed by removing the aforementioned hack. Some "Unexecuted
instantiation" notices are unavoidable, as explained in the
`used_crate.rs` test, but `-Zinstrument-coverage` has new options to
back off support for either unused generics, or all unused functions,
which avoids the notice, at the cost of less coverage of unused
functions.

Fixes: #82875

Invalid LLVM coverage data produced with crate brotli_decompressor

Fixed by disabling the LLVM function attribute that forces inlining, if
`-Z instrument-coverage` is enabled. This attribute is applied to
Rust functions with `#[inline(always)], and in some cases, the forced
inlining breaks coverage instrumentation and reports.

FYI: `@wesleywiser`

r? `@tmandry`
2021-03-25 05:07:34 +00:00
Yuki Okushi
67436c11c2
Rollup merge of #83442 - durin42:remove-questionable-macros, r=cuviper
LLVMWrapper: attractive nuisance macros

This came up in the review of #83425: it's hard to imagine a use of
LLVM_VERSION_LE() or LLVM_VERSION_EQ() that's not asking for trouble
when a point release gets created, so let's just discard them to prevent
the issue.
2021-03-25 09:07:32 +09:00
Yuki Okushi
5ca3f0d51f
Rollup merge of #83427 - llogiq:refactor-emitter, r=estebank
small cleanups in rustc_errors / emitter

This is either moving code around so it gets called less often or using if let instead of match in a few cases.
2021-03-25 09:07:29 +09:00
Mara Bos
81932be5e7 Revert "Revert stabilizing integer::BITS." 2021-03-24 22:34:36 +01:00
Jack Huey
cfbd0eed98 Review comments 2021-03-24 16:45:41 -04:00
Jack Huey
19ecfcd0e2 resolve late lifetimes by item
This reverts commit 22ae20733515d710c1134600bc1e29cdd76f6b9b.
2021-03-24 16:45:41 -04:00
Aaron Hill
102b5789b2
Use EvaluatedToOkModuloRegions whenever we erase regions
Fixes #80691

When we evaluate a trait predicate, we convert an
`EvaluatedToOk` result to `EvaluatedToOkModuloRegions` if we erased any
regions. We cache the result under a region-erased 'freshened'
predicate, so `EvaluatedToOk` may not be correct for other predicates
that have the same cache key.
2021-03-24 16:01:37 -04:00
Augie Fackler
04961d2405 LLVMWrapper: attractive nuisance macros
THis came up in the review of #83425: it's hard to imagine a use of
LLVM_VERSION_LE() or LLVM_VERSION_EQ() that's not asking for trouble
when a point release gets created, so let's just discard them to prevent
the issue.
2021-03-24 14:39:13 -04:00
Erik Desjardins
d5c1ad5ca1 RemoveZsts: don't touch unions 2021-03-24 13:00:36 -04:00
bors
f5fe425c92 Auto merge of #83364 - sexxi-goose:fix-83176, r=nikomatsakis
2229 migration: Don't try resolve regions before writeback

In the analysis use `resolve_vars_if_possible` instead of `fully_resolve`,
because we might not have performed regionck yet.

Fixes: #83176

r? `@nikomatsakis`
2021-03-24 14:45:16 +00:00
bors
2e012ce681 Auto merge of #83050 - osa1:issue83048, r=matthewjasper
Run analyses before thir-tree dumps

Fixes #83048
2021-03-24 12:02:13 +00:00
bors
5b33de3340 Auto merge of #75384 - JulianKnodt:cg_def, r=varkor,lcnr
implement `feature(const_generics_defaults)`

Implements const generics defaults `struct Example<const N: usize=3>`, as well as a query for getting the default of a given const-parameter's def id. There are some remaining FIXME's but they were specified as not blocking for merging this PR. This also puts the defaults behind the unstable feature gate `#![feature(const_generics_defaults)]`.

~~This currently creates a field which is always false on `GenericParamDefKind` for future use when
consts are permitted to have defaults. I'm not sure if this is exactly what is best for adding default parameters, but I mimicked the style of type defaults, so hopefully this is ok.~~

r? `@lcnr`
2021-03-24 04:13:27 +00:00
Dylan DPC
2b53ec3d1e
Rollup merge of #83392 - ehuss:w-help-edition, r=varkor
Change `-W help` to display edition level.

`-W help` was not honoring the `--edition` flag when displaying the default lint level. It was using the edition for sorting, but not for the final display.

This isn't important right now as there aren't any edition-specific lint levels. Also, the `declare_lint` macro is broken and doesn't even allow setting them right now. However, I figure it wouldn't hurt to fix this before I forget about it, in case edition-specific lints are ever used in the future.
2021-03-24 01:52:31 +01:00
Dylan DPC
30db261023
Rollup merge of #83391 - hyd-dev:uwtable, r=alexcrichton
Allow not emitting `uwtable` on Android

`uwtable` is marked as required on Android, so it can't be disabled via `-C force-unwind-tables=no`. However, I found that the reason it's marked as required was to resolve a [backtrace issue in Gecko](https://github.com/rust-lang/rust/issues/49867), and I haven't find any other reasons that make it required ([yet](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Unwind.20tables.20are.20strictly.20required.20on.20Windows.20and.20Android)). Therefore, I assume it's safe to turn it off if a (nice) backtrace is not needed, and submit this PR to allow `-C force-unwind-tables=no` when targeting Android.

Note that I haven't tested this change on Android as I don't have an Android environment for testing.
2021-03-24 01:52:30 +01:00
Dylan DPC
2f611da1d6
Rollup merge of #83313 - cjgillot:assert, r=michaelwoerister
Only enable assert_dep_graph when query-dep-graph is enabled.

This is a debugging option. The only effect should be on rustc tests.

r? ``@michaelwoerister``
2021-03-24 01:52:28 +01:00
Rich Kadel
0859cec652 Changes from review comments 2021-03-23 17:02:10 -07:00
Andre Bogus
f1807216f0 small cleanups in rustc_errors / emitter 2021-03-24 00:09:11 +01:00
Camille GILLOT
4c0b7ac7ba GenericParam does not need to be a HIR owner. 2021-03-23 22:47:22 +01:00
kadmin
33370fd982 Update to not have extra match 2021-03-23 20:01:40 +00:00
kadmin
7116bb5c33 Update with comments 2021-03-23 17:16:20 +00:00
kadmin
ea2af70466 Update with comments
A bunch of nits fixed, and a new test for pretty printing the AST.
2021-03-23 17:16:20 +00:00
kadmin
9fe793ae5d Add query for const_param_default 2021-03-23 17:16:20 +00:00
lcnr
b0feb5be2f progress, stuff compiles now 2021-03-23 17:16:20 +00:00
varkor
8ef81388e2 Some refactoring 2021-03-23 17:16:20 +00:00
kadmin
e4e5db4e42 Add has_default to GenericParamDefKind::Const
This currently creates a field which is always false on GenericParamDefKind for future use when
consts are permitted to have defaults

Update const_generics:default locations

Previously just ignored them, now actually do something about them.

Fix using type check instead of value

Add parsing

This adds all the necessary changes to lower const-generics defaults from parsing.

Change P<Expr> to AnonConst

This matches the arguments passed to instantiations of const generics, and makes it specific to
just anonymous constants.

Attempt to fix lowering bugs
2021-03-23 17:16:20 +00:00
Camille GILLOT
31447f6f08 Fix comment. 2021-03-23 18:11:04 +01:00
bors
79e5814f45 Auto merge of #83177 - erikdesjardins:zstassign, r=oli-obk
Remove assignments to ZST places instead of marking ZST return place as unused

partially reverts #83118

requested by `@tmiasko` in https://github.com/rust-lang/rust/pull/83118#issuecomment-799692574

r? `@oli-obk`
2021-03-23 12:23:27 +00:00
bors
4eb0bc7346 Auto merge of #83260 - durin42:llvm-update, r=nagisa
rustc: changes to allow an llvm update

This lets LLVM be built using 2b5f3f446f36, which is only a few weeks old. The next change in LLVM (5de2d189e6ad) breaks rustc again by removing a function that's exposed into the Rust code, but I'll file a bug about that separately.

Please scrutinize the `thinLTOResolvePrevailingInIndex` call, as I'm not at all sure an empty config is right.

I'm also suspicious that a specific alignment could be specified in the call to CreateAtomicCmpXchg, but I don't know enough to figure that out.

Thanks!
2021-03-23 09:42:22 +00:00
Rich Kadel
94a3454b03 Change def_id filter to use requires_monomorphization()
Per @wesleywiser's comment: https://github.com/rust-lang/rust/pull/83307#discussion_r599223342
2021-03-23 00:33:57 -07:00
Yuki Okushi
50d048f142
Rollup merge of #83384 - mark-i-m:rename-pat2018, r=joshtriplett
rename :pat2018 -> :pat2015

as requested by T-lang on zulip: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/or.20patterns/near/231133873

No functional changes here... just renaming.

r? `@nikomatsakis`
2021-03-23 10:15:43 +09:00
Erik Desjardins
6960bc9696 only run RemoveZsts at mir-opt-level 3 and above 2021-03-22 18:30:56 -04:00
hyd-dev
f900ee331d
Allow not emitting uwtable on Android 2021-03-23 04:39:58 +08:00
Camille GILLOT
1aad7e738e Err if the debugging options are not passed. 2021-03-22 21:31:00 +01:00
Eric Huss
45583e56c0 Change -W help to display edition level. 2021-03-22 12:57:52 -07:00
bors
5d04957a4b Auto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakis
Stabilize or_patterns (RFC 2535, 2530, 2175)

closes #54883

This PR stabilizes the or_patterns feature in Rust 1.53.

This is blocked on the following (in order):
- [x] The crater run in https://github.com/rust-lang/rust/pull/78935#issuecomment-731564021
- [x] The resolution of the unresolved questions and a second crater run (https://github.com/rust-lang/rust/pull/78935#issuecomment-735412705)
    - It looks like we will need to pursue some sort of edition-based transition for `:pat`.
- [x] Nomination and discussion by T-lang
- [x] Implement new behavior for `:pat` based on consensus (https://github.com/rust-lang/rust/pull/80100).
- [ ] An FCP on stabilization

EDIT: Stabilization report is in https://github.com/rust-lang/rust/pull/79278#issuecomment-772815177
2021-03-22 19:48:27 +00:00
Josh Stone
b97a33b1cb All supported LLVM versions have MSP430AsmPrinter 2021-03-22 12:44:48 -07:00
Augie Fackler
9431e8577d cleanup: add some comments per review feedback 2021-03-22 14:37:49 -04:00
Josh Stone
7d872f538e Update the minimum external LLVM to 10 2021-03-22 11:33:43 -07:00
Camille GILLOT
219603a958 Only enable assert_dep_graph when query-dep-graph is enabled. 2021-03-22 19:22:06 +01:00
mark
8c4b3dbb50 rename :pat2018 -> :pat215 2021-03-22 12:40:23 -05:00
bors
2287a8823d Auto merge of #83376 - Dylan-DPC:rollup-s2fsjwj, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #82374 (Add license metadata for std dependencies)
 - #82683 (Document panicking cases for integer division and remainder)
 - #83272 (Clarify non-exact length in the Iterator::take documentation)
 - #83338 (Fix test for #82270)
 - #83351 (post-drop-elab check-const: explain why we still check qualifs)
 - #83367 (Improve error message for unassigned query provider)
 - #83372 (SplitInclusive is public API)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-22 15:07:23 +00:00
Dylan DPC
014a4ee9f5
Rollup merge of #83367 - richkadel:query-err-msg, r=jyn514
Improve error message for unassigned query provider

Fixes: #83122

r? `@jyn514`

This implements the change we agreed on. Thanks!
2021-03-22 15:21:30 +01:00
Dylan DPC
1fdf7d18ad
Rollup merge of #83351 - RalfJung:precise-const-drop, r=oli-obk
post-drop-elab check-const: explain why we still check qualifs

r? `@oli-obk`
2021-03-22 15:21:29 +01:00
bors
d04c3aa865 Auto merge of #83273 - cjgillot:endecode, r=michaelwoerister
Simplify encoder and decoder

Extracted from https://github.com/rust-lang/rust/pull/83036 and https://github.com/rust-lang/rust/pull/82780.
2021-03-22 12:18:57 +00:00
Rich Kadel
688c857c56 Improve error message for unassigned query provider
Fixes: 83122
2021-03-21 23:04:07 -07:00
Aman Arora
74d7731c5b 2229 migration: Don't try resolve regions before writeback
In the analysis use `resolve_vars_if_possible` instead of `fully_resolve`,
because we might not have performed regionck yet.

Fixes: #83176
2021-03-22 00:53:25 -04:00
Dylan DPC
ea5ba76d1c
Rollup merge of #83336 - camelid:tool-mod-ice, r=petrochenkov
Fix ICE with `use clippy:🅰️:b;`

Fixes #83317.
2021-03-22 02:20:32 +01:00
Dylan DPC
85f16fb4bc
Rollup merge of #83329 - camelid:debuginfo-doc-cleanup, r=davidtwco
Cleanup LLVM debuginfo module docs

- Move debuginfo docs from `doc.rs` module to `doc.md` file
- Cleanup LLVM debuginfo module docs
2021-03-22 02:20:31 +01:00
Camelid
bfae41d7b0 Fix ICE with use clippy:🅰️:b; 2021-03-21 14:20:28 -07:00
Ralf Jung
4e7f1fa14f post-drop-elab check-const: explain why we still check qualifs 2021-03-21 21:20:59 +01:00
Nikita Popov
6ac229ca21 Don't compute optimized PointerKind for unoptimized builds
This saves us both the Freeze/Unpin queries, and avoids placing
noalias attributes, which have a compile-time impact on LLVM
even in optnone builds (due to always_inline functions).
2021-03-21 20:54:42 +01:00
Nikita Popov
39ed64399e Enable mutable noalias by default for LLVM 12
We don't have any known noalias bugs for LLVM 12 ... yet.
2021-03-21 20:10:54 +01:00
Nikita Popov
c3f9403f59 Don't consider !Unpin references as noalias
Such structures may contain self-references, in which case the
same location may be accessible through a pointer that is not
based-on the noalias pointer.

This is still grey area as far as language semantics are concerned,
but checking for !Unpin as an indicator for self-referential
sturctures seems like a good approach for the meantime.
2021-03-21 20:10:53 +01:00
Nikita Popov
08c5ffd4a3 Convert -Z mutable-noalias to Optional<bool>
The default value will dependend on the LLVM version in the future,
so don't specify one to start with.
2021-03-21 20:10:53 +01:00
Nikita Popov
dfc4cafe8e Move decision aboute noalias into codegen_llvm
The frontend shouldn't be deciding whether or not to use mutable
noalias attributes, as this is a pure LLVM concern. Only provide
the necessary information and do the actual decision in
codegen_llvm.
2021-03-21 20:10:53 +01:00
Ömer Sinan Ağacan
ae8ef70a49 Simplify and fix byte skipping in format! string parser
Fixes '\\' handling in format strings.

Fixes #83340
2021-03-21 14:42:27 +03:00
Dylan DPC
69f6a195da
Rollup merge of #83327 - tmiasko:visit-lhs, r=davidtwco
Extend comment in `UsedLocals::visit_lhs`
2021-03-21 02:01:40 +01:00
Dylan DPC
eec77d9967
Rollup merge of #83306 - Aaron1011:js-sys-lint, r=petrochenkov
Extend `proc_macro_back_compat` lint to `js-sys`

With this PR, we now lint for all cases where we perform some kind of
proc-macro back-compat hack.

The `js-sys` had an internal fix made to properly handle
`None`-delimited groups, so we need to manually check the version in the
filename. As a result, we no longer apply the back-compat hack to cases
where the version number is missing file the file path. This should not
affect any users of the `crates.io` crate.
2021-03-21 02:01:39 +01:00
Dylan DPC
118aba359b
Rollup merge of #83040 - lcnr:unused-ct-substs, r=oli-obk
extract `ConstKind::Unevaluated` into a struct

r? `@oli-obk`
2021-03-21 02:01:36 +01:00
Dylan DPC
3a113f18f8
Rollup merge of #82707 - BoxyUwU:errooaaar, r=oli-obk
const_evaluatable_checked: Stop eagerly erroring in `is_const_evaluatable`

Fixes #82279

We don't want to be emitting errors inside of is_const_evaluatable because we may call this during selection where it should be able to fail silently

There were two errors being emitted in `is_const_evaluatable`. The one causing the compile error in #82279 was inside the match arm for `FailureKind::MentionsParam` but I moved the other error being emitted too since it made things cleaner imo

The `NotConstEvaluatable` enum \*should\* have a fourth variant for when we fail to evaluate a concrete const, e.g. `0 - 1` but that cant happen until #81339

cc `@oli-obk` `@lcnr`
r? `@nikomatsakis`
2021-03-21 02:01:34 +01:00
Camelid
dc240faed5 Cleanup LLVM debuginfo module docs
* Use Markdown list syntax and unindent a bit to prevent Markdown
  interpreting the nested lists as code blocks
* A few more small typographical cleanups
2021-03-20 14:38:49 -07:00
Camelid
a2e9374048 Move debuginfo docs from doc.rs module to doc.md file
And use `#[doc = include_str!("doc.md")]` in `mod.rs` so the docs are
rendered as if they were inline in the root module.
2021-03-20 14:38:49 -07:00
lcnr
7c9b5b4ce0 update const_eval_resolve 2021-03-20 17:22:24 +01:00
lcnr
43ebac119b extract ConstKind::Unevaluated into a struct 2021-03-20 17:21:44 +01:00
bors
61edfd591c Auto merge of #83314 - Aaron1011:print-unstable-value, r=lcnr
Debug-print result when an unstable fingerprint is detected

Helps with issues like #83311

I had previously tried to do this in https://github.com/rust-lang/rust/pull/80692, but it had a significant performance impact (even though the code was never actually run). Hopefully, this will be better now that https://github.com/rust-lang/rust/pull/79100 has been merged.
2021-03-20 16:20:21 +00:00
bors
41b315a470 Auto merge of #83271 - SparrowLii:simd_neg, r=Amanieu
Add simd_neg platform intrinsic

Stdarch needs to add simd_neg to support the implementation of vneg neon instructions. Look [here](https://github.com/rust-lang/stdarch/pull/1087)
2021-03-20 09:01:35 +00:00
bors
eb9ec31168 Auto merge of #82919 - bstrie:stabchar, r=dtolnay
Stabilize `assoc_char_funcs` and `assoc_char_consts`

Stabilizes the following associated items on `char`:

* [`char::MAX`](https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX)
* [`char::REPLACEMENT_CHARACTER`](https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER)
* [`char::UNICODE_VERSION`](https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.UNICODE_VERSION)
* [`char::decode_utf16`](https://doc.rust-lang.org/std/primitive.char.html#method.decode_utf16)
* [`char::from_u32`](https://doc.rust-lang.org/std/primitive.char.html#method.from_u32)
* [`char::from_u32_unchecked`](https://doc.rust-lang.org/std/primitive.char.html#method.from_u32_unchecked)
* [`char::from_digit`](https://doc.rust-lang.org/std/primitive.char.html#method.from_digit)

Closes #71763.
2021-03-20 06:36:42 +00:00
bors
cd82e451a8 Auto merge of #83293 - osa1:82436_perf, r=varkor
Revert performance-sensitive change in #82436

This change was done in #82436, as an "optimization". Unfortunately I
missed that this code is not always executed, because of the "continue"
in the conditional above it.

This commit should solve the perf regressions introduced by #82436 as I
think there isn't anything else that could affect runtime performance in
that PR. The `Pick` type grows only one word, which I doubt can cause up
to 8.8% increase in RSS in some of the benchmarks.

---

Could someone with the rights start a perf job please?
2021-03-20 03:49:10 +00:00
Rich Kadel
5a484a1aed gave unused_fn WeakAnyLinkage; moved create_pgo_func_name_var
The sample json5format tests produce coverage results again (and work
with opt-level 3!)
2021-03-19 20:46:15 -07:00
bstrie
567f0e1a39
Stabilize assoc_char_funcs and assoc_char_consts 2021-03-19 20:35:08 -07:00
Erik Desjardins
46fd49cdc3 avoid calling for types which can't be ZSTs 2021-03-19 22:25:56 -04:00
Aaron Hill
443cef5618
Debug-print result when an unstable fingerprint is detected 2021-03-19 21:47:57 -04:00
mark
db5629adcb stabilize or_patterns 2021-03-19 19:45:32 -05:00
Rich Kadel
bcf755562a coverage bug fixes and optimization support
Adjusted LLVM codegen for code compiled with `-Zinstrument-coverage` to
address multiple, somewhat related issues.

Fixed a significant flaw in prior coverage solution: Every counter
generated a new counter variable, but there should have only been one
counter variable per function. This appears to have bloated .profraw
files significantly. (For a small program, it increased the size by
about 40%. I have not tested large programs, but there is anecdotal
evidence that profraw files were way too large. This is a good fix,
regardless, but hopefully it also addresses related issues.

Fixes: #82144

Invalid LLVM coverage data produced when compiled with -C opt-level=1

Existing tests now work up to at least `opt-level=3`. This required a
detailed analysis of the LLVM IR, comparisons with Clang C++ LLVM IR
when compiled with coverage, and a lot of trial and error with codegen
adjustments.

The biggest hurdle was figuring out how to continue to support coverage
results for unused functions and generics. Rust's coverage results have
three advantages over Clang's coverage results:

1. Rust's coverage map does not include any overlapping code regions,
   making coverage counting unambiguous.
2. Rust generates coverage results (showing zero counts) for all unused
   functions, including generics. (Clang does not generate coverage for
   uninstantiated template functions.)
3. Rust's unused functions produce minimal stubbed functions in LLVM IR,
   sufficient for including in the coverage results; while Clang must
   generate the complete LLVM IR for each unused function, even though
   it will never be called.

This PR removes the previous hack of attempting to inject coverage into
some other existing function instance, and generates dedicated instances
for each unused function. This change, and a few other adjustments
(similar to what is required for `-C link-dead-code`, but with lower
impact), makes it possible to support LLVM optimizations.

Fixes: #79651

Coverage report: "Unexecuted instantiation:..." for a generic function
from multiple crates

Fixed by removing the aforementioned hack. Some "Unexecuted
instantiation" notices are unavoidable, as explained in the
`used_crate.rs` test, but `-Zinstrument-coverage` has new options to
back off support for either unused generics, or all unused functions,
which avoids the notice, at the cost of less coverage of unused
functions.

Fixes: #82875

Invalid LLVM coverage data produced with crate brotli_decompressor

Fixed by disabling the LLVM function attribute that forces inlining, if
`-Z instrument-coverage` is enabled. This attribute is applied to
Rust functions with `#[inline(always)], and in some cases, the forced
inlining breaks coverage instrumentation and reports.
2021-03-19 17:11:50 -07:00
Tomasz Miąsko
43cadc99b7 Extend comment in UsedLocals::visit_lhs 2021-03-20 00:00:00 +00:00
Dylan DPC
51a29cbb23
Rollup merge of #83297 - oli-obk:why_bug_today_if_you_can_delay_to_tomorrow, r=petrochenkov
Do not ICE on ty::Error as an error must already have been reported

fixes #83253
2021-03-19 23:01:42 +01:00
Dylan DPC
90e52a1ad2
Rollup merge of #83277 - spastorino:early_otherwise-opt-unsound, r=oli-obk
Mark early otherwise optimization unsound

r? `@oli-obk`
cc `@tmiasko`

Related to #78496 and #82905

Should I also bump this one to level 3 or 4 or given that is unsound it doesn't matter?.
Probably need to adjust some tests.
2021-03-19 23:01:40 +01:00
Augie Fackler
babe894bab fix: I meant LLVM version 13, not 12 2021-03-19 16:46:40 -04:00
Aaron Hill
f6a35d7df2
Extend proc_macro_back_compat lint to js-sys
With this PR, we now lint for all cases where we perform some kind of
proc-macro back-compat hack.

The `js-sys` had an internal fix made to properly handle
`None`-delimited groups, so we need to manually check the version in the
filename. As a result, we no longer apply the back-compat hack to cases
where the version number is missing file the file path. This should not
affect any users of the `crates.io` crate.
2021-03-19 14:40:20 -04:00
Camille GILLOT
11b3409b5d Remove FingerprintEncoder/Decoder. 2021-03-19 19:36:05 +01:00
Camille GILLOT
09a638820e Move raw bytes handling to Encoder/Decoder. 2021-03-19 19:35:22 +01:00
bors
cebc8fef5f Auto merge of #82951 - sexxi-goose:wr-mir-replace-methods2, r=nikomatsakis
Replace closures_captures and upvar_capture with closure_min_captures

Removed all uses of closures_captures and upvar_capture and refactored code to work with closure_min_captures. This also involved removing functions that were no longer needed like the bridge.

Closes https://github.com/rust-lang/project-rfc-2229/issues/18
r? `@nikomatsakis`
2021-03-19 18:23:44 +00:00
Dylan DPC
23128c4183
Rollup merge of #83236 - cjgillot:memmap, r=joshtriplett
Upgrade memmap to memmap2

memmap is no longer maintained. memmap2 is a fork that is still maintained. https://rustsec.org/advisories/RUSTSEC-2020-0077.html

The remaining use of memmap is through measureme.
2021-03-19 15:03:28 +01:00
Dylan DPC
827ad66801
Rollup merge of #83230 - jyn514:remove-macros, r=joshtriplett
Remove unnecessary `forward_inner_docs` hack

and replace it with `extended_key_value_attributes` feature.

This is https://github.com/rust-lang/rust/pull/79150, but for compiler/.
2021-03-19 15:03:27 +01:00
Dylan DPC
37b7031078
Rollup merge of #83197 - jyn514:cfg-test-dead-code, r=joshtriplett
Move some test-only code to test files

Split out from https://github.com/rust-lang/rust/pull/83185.
2021-03-19 15:03:24 +01:00