Commit Graph

4598 Commits

Author SHA1 Message Date
Denis Drakhnia c992fced6b e2k impl 2021-05-09 12:35:30 +03:00
Deadbeef ab7b1cca2d Fix ICE of for-loop mut borrowck where no suggestions are available 2021-05-03 14:35:18 -04:00
Felix S. Klock II 381f1318ad Revert PR 81473 to resolve (on beta) issues 81626 and 81658.
Revert "Add missing brace"

This reverts commit 85ad773049.

Revert "Simplify base_expr"

This reverts commit 899aae465e.

Revert "Warn write-only fields"

This reverts commit d3c69a4c0d.
2021-05-03 11:43:15 -04:00
Mara Bos cadf901b1d Remove assert_matches feature attributes. 2021-05-03 09:30:11 -04:00
Mark Rousskov aa3e8d3e78 Remove assert_matches users 2021-05-03 09:30:11 -04:00
Felix S. Klock II 1905c98e92 Effective beta backport of 8d1083e319841624f64400e1524805a40d725439
(I recreated it by hand because the result of the cherry-pick wasn't worth
trying to salvage.)
2021-05-03 09:29:50 -04:00
katelyn a. martin 8341f4274d move new c abi abort behavior behind feature gate
### Background

    In #76570, new ABI strings including `C-unwind` were introduced.
    Their behavior is specified in RFC 2945 [1].

    However, it was reported in the #ffi-unwind stream of the Rust
    community Zulip that this had altered the way that `extern "C"`
    functions behaved even when the `c_unwind` feature gate was not
    active. [2]

 ### Overview

    This makes a small patch to
    `rustc_mir_build::build::should_abort_on_panic`, so that the same
    behavior from before is in place when the `c_unwind` gate is not
    active.

    `rustc_middle::ty::layout::fn_can_unwind` is not touched, as the
    visible behavior should not differ before/after #76570. [3]

 ### Footnotes

 [1]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md
 [2]: https://rust-lang.zulipchat.com/#narrow/stream/210922-project-ffi-unwind/topic/Is.20unwinding.20through.20extern.20C.20UB.3F/near/230112325
 [3]: https://github.com/rust-lang/rust/pull/76570/files#diff-b0320c2b8868f325d83c027fc5d71732636e9763551e35895488f30fe057c6e9L2599-R2617
2021-04-29 17:07:56 -04: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
bstrie 567f0e1a39
Stabilize `assoc_char_funcs` and `assoc_char_consts` 2021-03-19 20:35:08 -07:00
Aaron Hill 443cef5618
Debug-print result when an unstable fingerprint is detected 2021-03-19 21:47:57 -04: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
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
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
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