Commit graph

4745 commits

Author SHA1 Message Date
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
Dylan DPC
75571a5ac0
Rollup merge of #83179 - Aaron1011:actix-web-lint, r=petrochenkov
Extend `proc_macro_back_compat` lint to `actix-web`

Unlike the other cases of this lint, there's no simple way to detect if
an old version of the relevant crate (`syn`) is in use. The `actix-web`
crate only depends on `pin-project` v1.0.0, so checking the version of
`actix-web` does not guarantee that a new enough version of
`pin-project` (and therefore `syn`) is in use.

Instead, we rely on the fact that virtually all of the regressed crates
are pinned to a pre-1.0 version of `pin-project`. When this is the case,
bumping the `actix-web` dependency will pull in the *latest* version of
`pin-project`, which has an explicit dependency on a newer v dependency
on a newer version of `syn`.

The lint message tells users to update `actix-web`, since that's what
they're most likely to have control over. We could potentially tell them
to run `cargo update -p syn`, but I think it's more straightforward to
suggest an explicit change to the `Cargo.toml`

The `actori-web` fork had its last commit over a year ago, and appears
to just be a renamed fork of `actix-web`. Therefore, I've removed the
`actori-web` check entirely - any crates that actually get broken can
simply update `syn` themselves.
2021-03-19 15:03:23 +01:00
Dylan DPC
61372e1af6
Rollup merge of #82846 - GuillaumeGomez:doc-alias-list, r=jyn514
rustdoc: allow list syntax for #[doc(alias)] attributes

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

It now allows to have:

```rust
#[doc(alias = "x")]
// and:
#[doc(alias("y", "z"))]
```

cc ``@jplatte``
r? ``@jyn514``
2021-03-19 15:03:21 +01:00
Dylan DPC
29609711a5
Rollup merge of #82759 - m-ou-se:remove-unwrap-none, r=petrochenkov
Remove unwrap_none/expect_none from compiler/.

We're not going to stabilize `Option::{unwrap_none, expect_none}`. (See https://github.com/rust-lang/rust/issues/62633.) This removes the usage of those unstable methods from `compiler/`.
2021-03-19 15:03:20 +01:00
Oli Scherer
430c0d1d95 Do not ICE on ty::Error as an error must already have been reported 2021-03-19 11:46:27 +00:00
Ömer Sinan Ağacan
f9257576db 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.
2021-03-19 11:37:52 +03:00
Aman Arora
88db752e57 Hash hir_owner in typeck results 2021-03-19 00:39:39 -04:00
Jennifer Wills
52dba13e41 Replace closures_captures and upvar_capture with closure_min_captures
make changes to liveness to use closure_min_captures

use different span

borrow check uses new structures

rename to CapturedPlace

stop using upvar_capture in regionck

remove the bridge

cleanup from rebase + remove the upvar_capture reference from mutability_errors.rs

remove line from livenes test

make our unused var checking more consistent

update tests

adding more warnings to the tests

move is_ancestor_or_same_capture to rustc_middle/ty

update names to reflect the closures

add FIXME

check that all captures are immutable borrows before returning

add surrounding if statement like the original

move var out of the loop and rename

Co-authored-by: Logan Mosier <logmosier@gmail.com>
Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2021-03-18 20:45:49 -04:00
Santiago Pastorino
778e1978d5
Mark early otherwise optimization unsound 2021-03-18 20:57:44 -03:00
SparrowLii
b93590e5d8 correct macro names 2021-03-19 03:47:13 +08:00
Camille GILLOT
e5d09fbbe9 Simplify IntEncodedWithFixedSize. 2021-03-18 20:09:00 +01:00
Camille GILLOT
5003b3dc31 Move IntEncodedWithFixedSize to rustc_serialize. 2021-03-18 20:09:00 +01:00
SparrowLii
0fa158b38f Add simd_neg platform intrinsic 2021-03-19 02:16:21 +08:00
Camille GILLOT
458d044c5b Upgrade memmap to memmap2 in other crates. 2021-03-18 18:36:55 +01:00
Aaron Hill
390d1ef6d0
Extend proc_macro_back_compat lint to actix-web
Unlike the other cases of this lint, there's no simple way to detect if
an old version of the relevant crate (`syn`) is in use. The `actix-web`
crate only depends on `pin-project` v1.0.0, so checking the version of
`actix-web` does not guarantee that a new enough version of
`pin-project` (and therefore `syn`) is in use.

Instead, we rely on the fact that virtually all of the regressed crates
are pinned to a pre-1.0 version of `pin-project`. When this is the case,
bumping the `actix-web` dependency will pull in the *latest* version of
`pin-project`, which has an explicit dependency on a newer v dependency
on a newer version of `syn`.

The lint message tells users to update `actix-web`, since that's what
they're most likely to have control over. We could potentially tell them
to run `cargo update -p syn`, but I think it's more straightforward to
suggest an explicit change to the `Cargo.toml`

The `actori-web` fork had its last commit over a year ago, and appears
to just be a renamed fork of `actix-web`. Therefore, I've removed the
`actori-web` check entirely - any crates that actually get broken can
simply update `syn` themselves.
2021-03-18 12:09:14 -04:00
bors
9d0446f1a7 Auto merge of #83166 - cjgillot:defkey-vge, r=oli-obk
Iterate on DefId for variances and generics.

Split from #80347
2021-03-18 14:46:38 +00:00
Mara Bos
cfb4ad4f2a Remove unwrap_none/expect_none from compiler/. 2021-03-18 14:25:54 +01:00
bors
2aafe452b8 Auto merge of #82868 - petrochenkov:bto, r=estebank
Report missing cases of `bare_trait_objects`

Fixes https://github.com/rust-lang/rust/issues/65371
2021-03-18 05:27:26 +00:00
bors
81c1d7a150 Auto merge of #76447 - pickfire:async-pub, r=estebank
Detect async visibility wrong order, `async pub`

Partially address #76437.
2021-03-18 02:32:39 +00:00
Erik Desjardins
93c1380e0b remove inhabitedness check 2021-03-17 20:56:38 -04:00
Erik Desjardins
1205e82578 remove unnecessary and ineffective caching 2021-03-17 20:24:29 -04:00
Vadim Petrochenkov
b48530bf8b Report missing cases of bare_trait_objects 2021-03-18 03:02:44 +03:00
Vadim Petrochenkov
38ed36bba4 hir: Preserve used syntax in TyKind::TraitObject 2021-03-18 03:02:32 +03:00
Dylan DPC
1839d1d57d
Rollup merge of #83231 - DieracDelta:lp64d-abi-for-riscvgc-unknown-none-elf, r=estebank
Switch riscvgc-unknown-none-elf use lp64d ABI

Corrects #83229 by directly specifying the target abi in the spec in the same way as is done for the `riscv64gc-unknown-linux-gnu` target [here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs).
2021-03-18 00:28:17 +01:00
Dylan DPC
bcb9226efb
Rollup merge of #83216 - jyn514:register-tool, r=petrochenkov
Allow registering tool lints with `register_tool`

Previously, there was no way to add a custom tool prefix, even if the tool
itself had registered a lint:

 ```rust
 #![feature(register_tool)]
 #![register_tool(xyz)]
 #![warn(xyz::my_lint)]
 ```

```
$ rustc unknown-lint.rs  --crate-type lib
error[E0710]: an unknown tool name found in scoped lint: `xyz::my_lint`
 --> unknown-lint.rs:3:9
  |
3 | #![warn(xyz::my_lint)]
  |         ^^^
```

This allows opting-in to lints from other tools using `register_tool`.

cc https://github.com/rust-lang/rust/issues/66079#issuecomment-788589193, ``@chorman0773``
r? ``@petrochenkov``
2021-03-18 00:28:14 +01:00
Dylan DPC
7cd7dee315
Rollup merge of #83168 - Aaron1011:lint-procedural-masquerade, r=petrochenkov
Extend `proc_macro_back_compat` lint to `procedural-masquerade`

We now lint on *any* use of `procedural-masquerade` crate. While this
crate still exists, its main reverse dependency (`cssparser`) no longer
depends on it. Any crates still depending off should stop doing so, as
it only exists to support very old Rust versions.

If a crate actually needs to support old versions of rustc via
`procedural-masquerade`, then they'll just need to accept the warning
until we remove it entirely (at the same time as the back-compat hack).
The latest version of `procedural-masquerade` does work with the
latest rustc, but trying to check for the version seems like more
trouble than it's worth.

While working on this, I realized that the `proc-macro-hack` check was
never actually doing anything. The corresponding enum variant in
`proc-macro-hack` is named `Value` or `Nested` - it has never been
called `Input`. Due to a strange Crater issue, the Crater run that
tested adding this did *not* end up testing it - some of the crates that
would have failed did not actually have their tests checked, making it
seem as though the `proc-macro-hack` check was working.

The Crater issue is being discussed at
https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Nearly.20identical.20Crater.20runs.20processed.20a.20crate.20differently/near/230406661

Despite the `proc-macro-hack` check not actually doing anything, we
haven't gotten any reports from users about their build being broken.
I went ahead and removed it entirely, since it's clear that no one is
being affected by the `proc-macro-hack` regression in practice.
2021-03-18 00:28:10 +01:00
Dylan DPC
b688b694d0
Rollup merge of #83080 - tmiasko:inline-coverage, r=wesleywiser
Make source-based code coverage compatible with MIR inlining

When codegenning code coverage use the instance that coverage data was
originally generated for, to ensure basic level of compatibility with
MIR inlining.

Fixes #83061
2021-03-18 00:28:09 +01:00
Dylan DPC
16f6583f2d
Rollup merge of #82270 - asquared31415:asm-syntax-directive-errors, r=nagisa
Emit error when trying to use assembler syntax directives in `asm!`

The `.intel_syntax` and `.att_syntax` assembler directives should not be used, in favor of not specifying a syntax for intel, and in favor of the explicit `att_syntax` option using the inline assembly options.

Closes #79869
2021-03-18 00:28:06 +01:00
Vadim Petrochenkov
dac96d45af Fix use of bare trait objects everywhere 2021-03-18 02:18:58 +03:00
bors
b4adc21c4f Auto merge of #83188 - petrochenkov:field, r=lcnr
ast/hir: Rename field-related structures

I always forget what `ast::Field` and `ast::StructField` mean despite working with AST for long time, so this PR changes the naming to less confusing and more consistent.

- `StructField` -> `FieldDef` ("field definition")
- `Field` -> `ExprField` ("expression field", not "field expression")
- `FieldPat` -> `PatField` ("pattern field", not "field pattern")

Various visiting and other methods working with the fields are renamed correspondingly too.

The second commit reduces the size of `ExprKind` by boxing fields of `ExprKind::Struct` in preparation for https://github.com/rust-lang/rust/pull/80080.
2021-03-17 16:49:46 +00:00
Camille GILLOT
fcd6f20700 Iterate for super_predicates. 2021-03-17 17:30:50 +01:00
Justin Restivo
9a3e23fed2 riscvgc-unknown-none-elf use lp64d ABI 2021-03-17 10:45:58 -04:00
Joshua Nelson
620ecc01a2 Move some test-only code to test files
This also relaxes the bounds on some structs and moves them to the impl
block instead.
2021-03-17 10:31:30 -04:00
bors
04ae50179a Auto merge of #83090 - jackh726:bound_var_replacer_option, r=varkor
Make functions passed to BoundVarReplacer be optional

This means we can reuse the bound vars when we don't care to change them
2021-03-17 14:01:48 +00:00
Joshua Nelson
bb7c04ae9c Remove unnecessary forward_inner_docs hack
and replace it with `extended_key_value_attributes` feature.
2021-03-17 09:52:45 -04:00
bors
2c7490379d Auto merge of #83225 - JohnTitor:rollup-4hnuhb8, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #82774 (Fix bad diagnostics for anon params with ref and/or qualified paths)
 - #82826 ((std::net::parser): Fix capitalization of IP version names)
 - #83092 (More precise spans for HIR paths)
 - #83124 (Do not insert impl_trait_in_bindings opaque definitions twice.)
 - #83202 (Show details in cfg version unstable book)
 - #83203 (Don't warn about old rustdoc lint names (temporarily))
 - #83206 (Update books)
 - #83219 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-17 08:27:16 +00:00
Yuki Okushi
42e6d429c6
Rollup merge of #83203 - jyn514:rustdoc-warnings, r=Manishearth
Don't warn about old rustdoc lint names (temporarily)

Since https://github.com/rust-lang/rust/pull/80527, rustdoc users have an unpleasant situation: they can either use the new tool lint names (`rustdoc::non_autolinks`) or they can use the old names (`non_autolinks`). If they use the tool lints, they get a hard error on stable compilers, because rustc rejects all tool names it doesn't recognize (https://github.com/rust-lang/rust/issues/66079#issuecomment-788589193). If they use the old name, they get a warning to rename the lint to the new name. The only way to compile without warnings is to add `#[allow(renamed_removed_lints)]`, which defeats the whole point of the change: we *want* people to switch to the new name.

To avoid people silencing the lint and never migrating to the tool lint, this avoids warning about the old name, while still allowing you to use the new name. Once the new `rustdoc` tool name makes it to the stable channel, we can change these lints to warn again.

This adds the new lint functions `register_alias` and `register_ignored` - I didn't see an existing way to do this.

r? `@Manishearth` cc `@rust-lang/rustdoc`
2021-03-17 15:20:58 +09:00
Yuki Okushi
9c7aca58fc
Rollup merge of #83124 - cjgillot:iiib, r=petrochenkov
Do not insert impl_trait_in_bindings opaque definitions twice.

The reference to the item already appears inside the `OpaqueDef`. It does not need to be repeated as a statement.
2021-03-17 15:20:55 +09:00
Yuki Okushi
70edab895d
Rollup merge of #83092 - petrochenkov:qspan, r=estebank
More precise spans for HIR paths

`Ty::assoc_item` is lowered to `<Ty>::assoc_item` in HIR, but `Ty` got span from the whole path.
This PR fixes that, and adjusts some diagnostic code that relied on `Ty` having the whole path span.

This is a pre-requisite for https://github.com/rust-lang/rust/pull/82868 (we cannot report suggestions like `Tr::assoc` -> `<dyn Tr>::assoc` with the current imprecise spans).
r? ````@estebank````
2021-03-17 15:20:54 +09:00
Yuki Okushi
a16db3dcda
Rollup merge of #82774 - JohnTitor:bad-diag-for-anon-params-with-ref, r=estebank
Fix bad diagnostics for anon params with ref and/or qualified paths

Fixes #82729
It's easier to review with hiding whitespace changes.
2021-03-17 15:20:48 +09:00
bors
0c341226ad Auto merge of #83084 - nagisa:nagisa/features-native, r=petrochenkov
Adjust `-Ctarget-cpu=native` handling in cg_llvm

When cg_llvm encounters the `-Ctarget-cpu=native` it computes an
explciit set of features that applies to the target in order to
correctly compile code for the host CPU (because e.g. `skylake` alone is
not sufficient to tell if some of the instructions are available or
not).

However there were a couple of issues with how we did this. Firstly, the
order in which features were overriden wasn't quite right – conceptually
you'd expect `-Ctarget-cpu=native` option to override the features that
are implicitly set by the target definition. However due to how other
`-Ctarget-cpu` values are handled we must adopt the following order
of priority:

* Features from -Ctarget-cpu=*; are overriden by
* Features implied by --target; are overriden by
* Features from -Ctarget-feature; are overriden by
* function specific features.

Another problem was in that the function level `target-features`
attribute would overwrite the entire set of the globally enabled
features, rather than just the features the
`#[target_feature(enable/disable)]` specified. With something like
`-Ctarget-cpu=native` we'd end up in a situation wherein a function
without `#[target_feature(enable)]` annotation would have a broader
set of features compared to a function with one such attribute. This
turned out to be a cause of heavy run-time regressions in some code
using these function-level attributes in conjunction with
`-Ctarget-cpu=native`, for example.

With this PR rustc is more careful about specifying the entire set of
features for functions that use `#[target_feature(enable/disable)]` or
`#[instruction_set]` attributes.

Sadly testing the original reproducer for this behaviour is quite
impossible – we cannot rely on `-Ctarget-cpu=native` to be anything in
particular on developer or CI machines.

cc https://github.com/rust-lang/rust/issues/83027 `@BurntSushi`
2021-03-17 05:46:08 +00:00
Erik Desjardins
bca761dc5d move to separate pass, cache layouts 2021-03-16 21:34:31 -04:00
Ivan Tham
21c157442c Add pub as optional check_front_matter
async-pub check created a regression for default
2021-03-17 09:04:08 +08:00
Ivan Tham
9321efd8f7 Detect pub fn attr wrong order like async pub
Redirects `const? async? unsafe? pub` to `pub const? async? unsafe?`.

Fix #76437
2021-03-17 09:02:19 +08:00
Yuki Okushi
2d99e68940 Emit more pretty diagnostics for qualified paths 2021-03-17 09:57:58 +09:00
Yuki Okushi
8240f1a3d3 Fix bad diagnostics for anon params with qualified paths 2021-03-17 07:45:19 +09:00
Yuki Okushi
ea355bc6be Fix bad diagnostics for anon params with ref 2021-03-17 07:45:19 +09:00
bors
e655fb6221 Auto merge of #82936 - oli-obk:valtree, r=RalfJung,lcnr,matthewjasper
Implement (but don't use) valtree and refactor in preparation of use

This PR does not cause any functional change. It refactors various things that are needed to make valtrees possible. This refactoring got big enough that I decided I'd want it reviewed as a PR instead of trying to make one huge PR with all the changes.

cc `@rust-lang/wg-const-eval` on the following commits:

* 2027184 implement valtree
* eeecea9 fallible Scalar -> ScalarInt
* 042f663 ScalarInt convenience methods

cc `@eddyb` on ef04a6d

cc `@rust-lang/wg-mir-opt` for cf1700c (`mir::Constant` can now represent either a `ConstValue` or a `ty::Const`, and it is totally possible to have two different representations for the same value)
2021-03-16 22:42:56 +00:00
Joshua Nelson
e3031fe22a Allow registering tool lints with register_tool
Previously, there was no way to add a custom tool prefix, even if the tool
itself had registered a lint:

 ```
 #![feature(register_tool)]
 #![register_tool(xyz)]
 #![warn(xyz::my_lint)]
 ```

```
$ rustc unknown-lint.rs  --crate-type lib
error[E0710]: an unknown tool name found in scoped lint: `xyz::my_lint`
 --> unknown-lint.rs:3:9
  |
3 | #![warn(xyz::my_lint)]
  |         ^^^
```

This allows opting-in to lints from other tools using `register_tool`.
2021-03-16 17:33:03 -04:00
Augie Fackler
dcdb9ad3d2 llvm-wrapper: pass std::string instead of StringRef
LLVM change 5fbd1a333aa1a0b70903d036b98ea56c51ae5224 modified this
function to want std::string instead of StringRef, which is easily done.
2021-03-16 17:13:20 -04:00
Augie Fackler
0ed1c33ad9 llvm-wrapper: add alignment argument to CreateAtomicCmpXchg
As far as I can tell what we've been getting is llvm::MaybeAlign(), so
just use that for now. This is required sometime after
24539f1ef2471d07bd87f833cb0288fc0f251f4b.
2021-03-16 17:13:13 -04:00
Augie Fackler
af95484778 llvm-wrapper: adapt to function signature change of thinLTOResolvePrevailingInIndex
This changed in 54fb3ca96e261f7107cb1b5778c34cb0e0808be6 - I'm not
entirely sure it's correct that we're leaving config empty, but the one
case in LLVM that looked similar did that.
2021-03-16 16:45:21 -04:00
Simonas Kazlauskas
72fb4379d5 Adjust -Ctarget-cpu=native handling in cg_llvm
When cg_llvm encounters the `-Ctarget-cpu=native` it computes an
explciit set of features that applies to the target in order to
correctly compile code for the host CPU (because e.g. `skylake` alone is
not sufficient to tell if some of the instructions are available or
not).

However there were a couple of issues with how we did this. Firstly, the
order in which features were overriden wasn't quite right – conceptually
you'd expect `-Ctarget-cpu=native` option to override the features that
are implicitly set by the target definition. However due to how other
`-Ctarget-cpu` values are handled we must adopt the following order
of priority:

* Features from -Ctarget-cpu=*; are overriden by
* Features implied by --target; are overriden by
* Features from -Ctarget-feature; are overriden by
* function specific features.

Another problem was in that the function level `target-features`
attribute would overwrite the entire set of the globally enabled
features, rather than just the features the
`#[target_feature(enable/disable)]` specified. With something like
`-Ctarget-cpu=native` we'd end up in a situation wherein a function
without `#[target_feature(enable)]` annotation would have a broader
set of features compared to a function with one such attribute. This
turned out to be a cause of heavy run-time regressions in some code
using these function-level attributes in conjunction with
`-Ctarget-cpu=native`, for example.

With this PR rustc is more careful about specifying the entire set of
features for functions that use `#[target_feature(enable/disable)]` or
`#[instruction_set]` attributes.

Sadly testing the original reproducer for this behaviour is quite
impossible – we cannot rely on `-Ctarget-cpu=native` to be anything in
particular on developer or CI machines.
2021-03-16 21:32:55 +02:00
bors
f5d8117c33 Auto merge of #82536 - sexxi-goose:handle-patterns-take-2, r=nikomatsakis
2229: Handle patterns within closures correctly when `capture_disjoint_fields` is enabled

This PR fixes several issues related to handling patterns within closures when `capture_disjoint_fields` is enabled.
1. Matching is always considered a use of the place, even with `_` patterns
2. Compiler ICE when capturing fields in closures through `let` assignments

To do so, we

- Introduced new Fake Reads
- Delayed use of `Place` in favor of `PlaceBuilder`
- Ensured that `PlaceBuilder` can be resolved before attempting to extract `Place` in any of the pattern matching code

Closes rust-lang/project-rfc-2229/issues/27
Closes rust-lang/project-rfc-2229/issues/24
r? `@nikomatsakis`
2021-03-16 19:19:06 +00:00
Camille GILLOT
c74a3553ae Filter generics. 2021-03-16 20:07:26 +01:00
Camille GILLOT
4223db76b9 Iterate on inferred_outlives. 2021-03-16 20:07:26 +01:00
Camille GILLOT
58bca6f658 Iterate on explicit_predicates. 2021-03-16 20:07:26 +01:00
Camille GILLOT
dda31b97c8 Iterate on generics_of. 2021-03-16 20:07:25 +01:00
Camille GILLOT
6337594e3c Iterate on variances_of. 2021-03-16 20:07:25 +01:00
Oli Scherer
c4d564c780
Update compiler/rustc_middle/src/ty/consts/valtree.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-03-16 18:31:33 +01:00
Oli Scherer
5b9bd903c0
Update compiler/rustc_middle/src/ty/consts/valtree.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-03-16 18:31:25 +01:00
Oli Scherer
f0997fa1e8
Update compiler/rustc_mir/src/const_eval/mod.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-03-16 18:26:09 +01:00
Joshua Nelson
c1b99f0b90 Don't warn about old rustdoc lint names (temporarily)
Right now, rustdoc users have an unpleasant situation: they can either
use the new tool lint names (`rustdoc::non_autolinks`) or they can use
the old names (`non_autolinks`). If they use the tool lints, they get a
hard error on stable compilers, because rustc rejects all tool names it
doesn't recognize. If they use the old name, they get a warning to
rename the lint to the new name. The only way to compile without
warnings is to add `#[allow(renamed_removed_lints)]`, which defeats the
whole point of the change: we *want* people to switch to the new name.

To avoid people silencing the lint and never migrating to the tool lint,
this avoids warning about the old name, while still allowing you to use
the new name. Once the new `rustdoc` tool name makes it to the stable
channel, we can change these lints to warn again.

This adds the new lint functions `register_alias` and `register_ignored`
- I didn't see an existing way to do this.
2021-03-16 13:13:59 -04:00
Yuki Okushi
ec074276ab
Rollup merge of #83196 - tmiasko:valid-range-delay-span-bug, r=oli-obk
Use delay_span_bug instead of panic in layout_scalar_valid_range

#83054 introduced validation of scalar range attributes, but panicking
code that uses the attribute remained reachable. Use `delay_span_bug`
instead to avoid the ICE.

Fixes #83180.
2021-03-16 23:54:03 +09:00
bors
f24ce9b014 Auto merge of #82838 - Amanieu:rustdoc_asm, r=nagisa
Allow rustdoc to handle asm! of foreign architectures

This allows rustdoc to process code containing `asm!` for architectures other than the current one. Since this never reaches codegen, we just replace target-specific registers and register classes with a dummy one.

Fixes #82869
2021-03-16 10:05:46 +00:00
Vadim Petrochenkov
d1522b39dd ast: Reduce size of ExprKind by boxing fields of ExprKind::Struct 2021-03-16 11:41:24 +03:00
Vadim Petrochenkov
b25d3ba781 ast/hir: Rename field-related structures
StructField -> FieldDef ("field definition")
Field -> ExprField ("expression field", not "field expression")
FieldPat -> PatField ("pattern field", not "field pattern")

Also rename visiting and other methods working on them.
2021-03-16 11:41:24 +03:00
bors
195ad4830e Auto merge of #82898 - oli-obk:tait_🧊, r=nikomatsakis
Add a `min_type_alias_impl_trait` feature gate

This new feature gate only permits type alias impl trait to be constrained by function and trait method return types. All other possible constraining sites like const/static types, closure return types and binding types are now forbidden and gated under the `type_alias_impl_trait` and `impl_trait_in_bindings` feature gates (which are both marked as incomplete, as they have various ways to ICE the compiler or cause query cycles where they shouldn't).

r? `@nikomatsakis`

This is best reviewed commit-by-commit
2021-03-16 04:24:48 +00:00
Erik Desjardins
899836306f remove assignments to ZST places 2021-03-15 21:57:52 -04:00
bors
4c10c84c63 Auto merge of #83153 - Aaron1011:eval-always-extern_mod_stmt_cnum, r=michaelwoerister
Mark `extern_mod_stmt_cnum` as `eval_always`

This query reads from global untracked state, so it always needs to be
evaluated.
2021-03-16 01:33:06 +00:00
Erik Desjardins
affb081fa0 revert changes from #83118 to mark zst return place as unused 2021-03-15 20:18:03 -04:00
Tomasz Miąsko
335427a3db Use delay_span_bug instead of panic in layout_scalar_valid_range
83054 introduced validation of scalar range attributes, but panicking
code that uses the attribute remained reachable. Use `delay_span_bug`
instead to avoid the ICE.
2021-03-16 00:00:00 +00:00
Jack Huey
ba27cae728 Make functions passed to BoundVarReplacer be optional 2021-03-15 19:00:37 -04:00
Tomasz Miąsko
5a9538acb5 Functions inlined into reachable functions are reachable
Consider functions to be reachable for code coverage purposes, either
when they reach the code generation directly, or indirectly as inlined
part of another function.
2021-03-15 23:26:03 +01:00
Tomasz Miąsko
1796cc0e6c Make source-based code coverage compatible with MIR inlining
When codegenning code coverage use the instance that coverage data was
originally generated for, to ensure basic level of compatibility with
MIR inlining.
2021-03-15 23:26:03 +01:00
Aaron Hill
d6a7c1d47f
Extend proc_macro_back_compat lint to procedural-masquerade
We now lint on *any* use of `procedural-masquerade` crate. While this
crate still exists, its main reverse dependency (`cssparser`) no longer
depends on it. Any crates still depending off should stop doing so, as
it only exists to support very old Rust versions.

If a crate actually needs to support old versions of rustc via
`procedural-masquerade`, then they'll just need to accept the warning
until we remove it entirely (at the same time as the back-compat hack).
The latest version of `procedural-masquerade` does not work with the
latest rustc, but trying to check for the version seems like more
trouble than it's worth.

While working on this, I realized that the `proc-macro-hack` check was
never actually doing anything. The corresponding enum variant in
`proc-macro-hack` is named `Value` or `Nested` - it has never been
called `Input`. Due to a strange Crater issue, the Crater run that
tested adding this did *not* end up testing it - some of the crates that
would have failed did not actually have their tests checked, making it
seem as though the `proc-macro-hack` check was working.

The Crater issue is being discussed at
https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Nearly.20identical.20Crater.20runs.20processed.20a.20crate.20differently/near/230406661

Despite the `proc-macro-hack` check not actually doing anything, we
haven't gotten any reports from users about their build being broken.
I went ahead and removed it entirely, since it's clear that no one is
being affected by the `proc-macro-hack` regression in practice.
2021-03-15 16:00:49 -04:00
Vadim Petrochenkov
7e66e9d6b0 More precise spans for HIR paths 2021-03-15 22:13:45 +03:00
Oli Scherer
c2683aa569 Explain each variant of TAIT usage with examples 2021-03-15 17:39:18 +00:00
Oli Scherer
4a6dc8e203 Only allow tait defining uses in function and method return position 2021-03-15 17:36:57 +00:00
Oli Scherer
cdbb0ff8ca Special case type aliases from impl trait in const/static types 2021-03-15 17:33:28 +00:00
Oli Scherer
1f7df1956a Replace type_alias_impl_trait by min_type_alias_impl_trait with no actual changes in behaviour
This makes `type_alias_impl_trait` not actually do anything anymore
2021-03-15 17:32:43 +00:00
Roxane
189d206522 Fix error after rebase 2021-03-15 13:16:18 -04:00
Roxane
22eaffe71a Add comments with examples and tests 2021-03-15 13:16:04 -04:00
Oli Scherer
f261a82a8d Use tracing instrumentation for better bug diagnosing 2021-03-15 16:53:05 +00:00
Aaron Hill
e70d47b3b5
Mark extern_mod_stmt_cnum as eval_always
This query reads from global untracked state, so it always needs to be
evaluated.
2021-03-15 12:26:49 -04:00
Dylan DPC
2816c110e0
Rollup merge of #83144 - hyd-dev:parse-sess-created, r=oli-obk
Introduce `rustc_interface::interface::Config::parse_sess_created` callback

Resolves #82900.

cc `@oli-obk`
2021-03-15 16:23:00 +01:00
Dylan DPC
9b16c7a712
Rollup merge of #83132 - Aaron1011:fix/incr-cache-dummy, r=estebank
Don't encode file information for span with a dummy location

Fixes #83112

The location information for a dummy span isn't real, so don't encode
it. This brings the incr comp cache code into line with the Span
`StableHash` impl, which doesn't hash the location information for dummy
spans.

Previously, we would attempt to load the 'original' file from a dummy
span - if the file id changed (e.g. due to being moved on disk), we would get an
ICE, since the Span was still valid due to its hash being unchanged.
2021-03-15 16:22:58 +01:00
Dylan DPC
d1f5f1d156
Rollup merge of #83127 - Aaron1011:time-macros-impl-warn, r=petrochenkov
Introduce `proc_macro_back_compat` lint, and emit for `time-macros-impl`

Now that future-incompat-report support has landed in nightly Cargo, we
can start to make progress towards removing the various proc-macro
back-compat hacks that have accumulated in the compiler.

This PR introduces a new lint `proc_macro_back_compat`, which results in
a future-incompat-report entry being generated. All proc-macro
back-compat warnings will be grouped under this lint. Note that this
lint will never actually become a hard error - instead, we will remove
the special cases for various macros, which will cause older versions of
those crates to emit some other error.

I've added code to fire this lint for the `time-macros-impl` case. This
is the easiest case out of all of our current back-compat hacks - the
crate was renamed to `time-macros`, so seeing a filename with
`time-macros-impl` guarantees that an older version of the parent `time`
crate is in use.

When Cargo's future-incompat-report feature gets stabilized, affected
users will start to see future-incompat warnings when they build their
crates.
2021-03-15 16:22:57 +01:00
Dylan DPC
8ec9b2a0ac
Rollup merge of #83113 - osa1:refactor_try_index_step, r=jonas-schievink
Minor refactoring in try_index_step

Merges `if-let` and `if x.is_some() { ... }` blocks
2021-03-15 16:22:56 +01:00
Dylan DPC
f1061d1dff
Rollup merge of #83108 - jyn514:remove-unused, r=estebank
Remove unused `opt_local_def_id_to_hir_id` function

Found while investigating #82933 - all LocalDefIds are expected to have
HirIds, there's no point in pretending otherwise.
2021-03-15 16:22:53 +01:00
Dylan DPC
75a15bf275
Rollup merge of #83098 - camelid:more-doc-attr-check, r=davidtwco
Find more invalid doc attributes

- Lint on `#[doc(123)]`, `#[doc("hello")]`, etc.
- Lint every attribute; e.g., will now report two warnings for `#[doc(foo, bar)]`
- Add hyphen to "crate level"
- Display paths like `#[doc(foo::bar)]` correctly instead of as an empty string
2021-03-15 16:22:52 +01:00
Dylan DPC
b8622f2b3b
Rollup merge of #83054 - tmiasko:rustc_layout_scalar_valid_range, r=davidtwco
Validate rustc_layout_scalar_valid_range_{start,end} attributes

Fixes #82251, fixes #82981.
2021-03-15 16:22:51 +01:00
Dylan DPC
4eca4929ec
Rollup merge of #82989 - Smittyvb:other-lang-literal-errors, r=varkor
Custom error on literal names from other languages

This detects all Java literal types and all single word C data types, and suggests the corresponding Rust literal type.
2021-03-15 16:22:50 +01:00
hyd-dev
4709dcd476
Change the .unwrap to .expect with a helpful message 2021-03-15 20:45:45 +08:00
Oli Scherer
1ffd21a15c Pacify tidy 2021-03-15 12:19:29 +00:00
Smitty
5eae9af193 Custom error on literal names from other languages
This detects all Java literal types and all single word C data types,
and suggests the corresponding Rust literal type.
2021-03-15 08:11:02 -04:00
Oli Scherer
9f407ae5ee Do not expose fallible to_int operation on Scalar.
Any use of it has been shown to be a bug in the past.
2021-03-15 12:06:52 +00:00
Oli Scherer
0dd5a1b622 Explain pointer and dyn Trait handling in const_to_valtree 2021-03-15 12:06:52 +00:00
Oli Scherer
c01c49430c Explain how we encode enums at the encoding site 2021-03-15 12:06:52 +00:00
Oli Scherer
f646c1e434 Explain why we do not allow const_to_valtree to read from statics 2021-03-15 12:06:52 +00:00
Oli Scherer
bc8641a487 Document valtree 2021-03-15 12:06:52 +00:00