Commit graph

6020 commits

Author SHA1 Message Date
bors 0a8629bff6 Auto merge of #85885 - bjorn3:remove_box_region, r=cjgillot
Don't use a generator for BoxedResolver

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

Based on #85810 as it touches rustc_interface too.
2021-06-11 16:11:20 +00:00
bors dddebf94bc Auto merge of #86116 - FabianWolff:issue-86100, r=varkor
Suggest a trailing comma if a 1-tuple is expected and a parenthesized expression is found

This pull request fixes #86100. The following code:
```rust
fn main() {
    let t: (i32,) = (1);
}
```
currently produces:
```
warning: unnecessary parentheses around assigned value
 --> test.rs:2:21
  |
2 |     let t: (i32,) = (1);
  |                     ^^^ help: remove these parentheses
  |
  = note: `#[warn(unused_parens)]` on by default

error[E0308]: mismatched types
 --> test.rs:2:21
  |
2 |     let t: (i32,) = (1);
  |            ------   ^^^ expected tuple, found integer
  |            |
  |            expected due to this
  |
  = note: expected tuple `(i32,)`
              found type `{integer}`

error: aborting due to previous error; 1 warning emitted
```
With my changes, I get the same warning and the following error:
```
error[E0308]: mismatched types
 --> test.rs:2:21
  |
2 |     let t: (i32,) = (1);
  |            ------   ^^^ expected tuple, found integer
  |            |
  |            expected due to this
  |
  = note: expected tuple `(i32,)`
              found type `{integer}`
help: use a trailing comma to create a tuple with one element
  |
2 |     let t: (i32,) = (1,);
  |                     ^^^^
```
i.e. I have added a suggestion to add a trailing comma to create a 1-tuple. This suggestion is only issued if a 1-tuple is expected and the expression (`(1)` in the example above) is surrounded by parentheses and does not already have a tuple type. In this situation, I'd say that it is pretty likely that the user meant to create a tuple.
2021-06-11 10:25:53 +00:00
bors 66ba81059e Auto merge of #85994 - tmiasko:monomorphic-needs-drop, r=RalfJung
Disallow non-monomorphic calls to `needs_drop` in interpreter

otherwise evaluation could change after further substitutions.
2021-06-11 07:44:58 +00:00
bors 68aa6b2d83 Auto merge of #86204 - alexcrichton:wasm-simd-stable, r=Amanieu
std: Stabilize wasm simd intrinsics

This commit performs two changes to stabilize Rust support for
WebAssembly simd intrinsics:

* The stdarch submodule is updated to pull in rust-lang/stdarch#1179.
* The `wasm_target_feature` feature gate requirement for the `simd128`
  feature has been removed, stabilizing the name `simd128`.

This should conclude the FCP started on #74372 and...

Closes #74372
2021-06-11 05:02:41 +00:00
Alex Crichton e05bb26d9f std: Stabilize wasm simd intrinsics
This commit performs two changes to stabilize Rust support for
WebAssembly simd intrinsics:

* The stdarch submodule is updated to pull in rust-lang/stdarch#1179.
* The `wasm_target_feature` feature gate requirement for the `simd128`
  feature has been removed, stabilizing the name `simd128`.

This should conclude the FCP started on #74372 and...

Closes #74372
2021-06-10 19:42:05 -07:00
bors 72868e017b Auto merge of #85961 - 1000teslas:issue-71519-fix, r=petrochenkov
MVP for using rust-lld as part of cc

Will fix #71519. I need to figure out how to write a test showing that lld is used instead of whatever linker cc normally uses. When I manually run rustc using `echo 'fn main() {}' | RUSTC_LOG=rustc_codegen_ssa:🔙:link=debug ./rustc -Clinker-flavor=gcc-lld --crate-type bin -Clink-arg=-Wl,-v` (thanks to bjorn3 on Zulip), I can see that lld is used, but I'm not sure how to inspect that output in a test.
2021-06-11 02:21:52 +00:00
bors 16e18395ce Auto merge of #80080 - rylev:qpath-on-struct, r=petrochenkov
Allow qualified paths in struct construction (both expressions and patterns)

Fixes #79658
2021-06-10 20:32:43 +00:00
bjorn3 4301d1ee7d Remove unnecessary transmute 2021-06-10 19:36:27 +02:00
bors 1f949e94e8 Auto merge of #86020 - nagisa:nagisa/outliner, r=pnkfelix
Disable the machine outliner by default

This addresses a codegen-issue that needs to be fixed upstream in LLVM.
While we wait for the fix, we can disable it.

Verified manually that the outliner is no longer run when
`-Copt-level=z` is specified, and also that you can override this with
`-Cllvm-args=-enable-machine-outliner` if you need it anyway.

A regression test is not really feasible in this instance, given that we
do not have any minimal reproducers.

Fixes #85351

cc `@pnkfelix`
2021-06-10 15:11:01 +00:00
Ryan Levick 6936349233 Add support for using qualified paths with structs in expression and pattern
position.
2021-06-10 13:18:41 +02:00
bors 0279cb11ed Auto merge of #85741 - tmiasko:ssa, r=nagisa
Use preorder traversal when checking for SSA locals

Traverse blocks in topological sort of dominance partial order, to ensure that
local analyzer correctly identifies locals that are already in static single
assignment form, while avoiding dependency on implicit numeric order of blocks.

When rebuilding the standard library, this change reduces the number of locals
that require an alloca from 62452 to 62348.
2021-06-10 10:06:58 +00:00
1000teslas 2a76762695 gcc-lld mvp
ignore test if rust-lld not found

create ld -> rust-lld symlink at build time instead of run time

for testing in ci

copy instead of symlinking

remove linux check

test for linker, suggestions from bjorn3

fix overly restrictive lld matcher

use -Zgcc-ld flag instead of -Clinker-flavor

refactor code adding lld to gcc path

revert ci changes

suggestions from petrochenkov

rename gcc_ld to gcc-ld in dirs
2021-06-10 17:10:40 +10:00
bors c5fbcd35a8 Auto merge of #86186 - JohnTitor:rollup-upaw6wx, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #82037 (Make symbols stripping work on MacOS X)
 - #84687 (Multiple improvements to RwLocks)
 - #85997 (rustdoc: Print a warning if the diff when comparing to old nightlies is empty)
 - #86051 (Updated code examples and wording in move keyword documentation )
 - #86111 (fix off by one in `std::iter::Iterator` documentation)
 - #86113 (build doctests with lld if use-lld = true)
 - #86175 (update Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-10 03:11:24 +00:00
Yuki Okushi 27e84b89da
Rollup merge of #82037 - calavera:strip_debuginfo_osx, r=petrochenkov
Make symbols stripping work on MacOS X

As reported in the [stabilization issue](https://github.com/rust-lang/rust/issues/72110), MacOS' linker doesn't support the `-s` and `-S` flags to strip symbols anymore. However, the os ships a separated tool to perform these operations.

This change allows the compiler to use that tool after a target has been compiled to strip symbols.

For rationale, see: https://github.com/rust-lang/rust/issues/72110#issuecomment-641169818
For option selection, see: https://www.unix.com/man-page/osx/1/strip/

Signed-off-by: David Calavera <david.calavera@gmail.com>
2021-06-10 11:02:01 +09:00
bors 1639a16ebf Auto merge of #85910 - cjgillot:no-meta-version, r=Aaron1011
Drop metadata_encoding_version.

Part of #85153

r? `@Aaron1011`
2021-06-10 00:39:25 +00:00
David Calavera df0fc6daee Make symbols stripping work on MacOS X
As reported in the stabilization issue, MacOS' linker doesn't support the `-s` and `-S` flags to strip symbols anymore. However, the os ships a separated tool to perform these operations.

This change allows the compiler to use that tool after a target has been compiled to strip symbols.

For rationale, see: https://github.com/rust-lang/rust/issues/72110#issuecomment-641169818
For option selection, see: https://www.unix.com/man-page/osx/1/strip/

Signed-off-by: David Calavera <david.calavera@gmail.com>
2021-06-09 09:27:11 -07:00
bors 47d38752c6 Auto merge of #86150 - cjgillot:notable, r=michaelwoerister
Do not require the DefPathTable to construct the on-disk cache.

r? `@michaelwoerister`
2021-06-09 14:06:10 +00:00
bjorn3 2754d4e514 Add safety comments 2021-06-09 14:51:42 +02:00
bjorn3 e1aa45b64d Use explicit drop impl 2021-06-09 14:47:01 +02:00
bors c4b5406981 Auto merge of #86118 - spastorino:tait-soundness-bug, r=nikomatsakis
Create different inference variables for different defining uses of TAITs

Fixes #73481

r? `@nikomatsakis`
cc `@oli-obk`
2021-06-09 09:00:16 +00:00
bors d45d205d59 Auto merge of #86107 - Smittyvb:peephole-optim-eq-bool, r=wesleywiser
Peephole optimize `x == false` and `x != true`

This adds peephole optimizations to make `x == false`, `false == x`, `x != true`, and `true != x` get optimized to `!x` in the `instcombine` MIR pass. That pass currently handles `x == true` -> `x` already.
2021-06-09 06:06:06 +00:00
Yuki Okushi d7186a8efe
Rollup merge of #86124 - Aaron1011:ambig-macro-name, r=varkor
Include macro name in 'local ambiguity' error

Currently, we only point at the span of the macro argument. When the
macro call is itself generated by another macro, this can make it
difficult or impossible to determine which macro is responsible for
producing the error.
2021-06-09 12:04:06 +09:00
Yuki Okushi da1a4498ca
Rollup merge of #85982 - alexcrichton:doc-safe-wasm, r=jyn514
Enable rustdoc to document safe wasm intrinsics

This commit fixes an issue not found during #84988 where rustdoc is used
to document cross-platform intrinsics but it was requiring that
functions which use `#[target_feature]` are `unsafe` erroneously, even
if they're WebAssembly specific. Rustdoc today, for example, already has
a special case where it enables annotations like
`#[target_feature(enable = "simd128")]` on platforms other than
WebAssembly. The purpose of this commit is to relax the "require all
`#[target_feature]` functions are `unsafe`" requirement for all targets
whenever rustdoc is running, enabling all targets to fully document
other targets, such as WebAssembly, where intrinsics functions aren't
always `unsafe`.
2021-06-09 12:04:04 +09:00
Camille GILLOT aeb050da9f Do not require the DefPathTable to construct the on-disk cache. 2021-06-08 22:23:03 +02:00
Santiago Pastorino 7b1e1c7333
add VecMap docs 2021-06-08 17:17:48 -03:00
Santiago Pastorino cad762b1e2
Use impl FnMut directly as predicate type 2021-06-08 17:17:48 -03:00
Santiago Pastorino ed94da14ed
Explicitly pass find arguments down the predicate so coercions can apply 2021-06-08 17:17:47 -03:00
Santiago Pastorino 0ad09f9386
Do not deconstruct OpaqueTypeKey to make the code more clear 2021-06-08 17:17:45 -03:00
Santiago Pastorino ecd78e985e
defin_ty_def_id -> definition_ty_def_id 2021-06-08 16:45:44 -03:00
bjorn3 2bf839e870 Don't require LintStore to live for 'a in configure_and_expand_inner 2021-06-08 19:24:17 +02:00
bjorn3 cf1f92a2ca Revert "Let several methods take &Resolver instead of a BoxedResolver wrapper"
This reverts commit 5343ec338f72a61e2f51f9d90117092c8e8a725a.
2021-06-08 19:24:17 +02:00
bjorn3 5e148200d4 Use a submodule as safety boundary for BoxedResolver 2021-06-08 19:24:17 +02:00
bjorn3 86c2d1a2a7 Don't use a generator for BoxedResolver
The generator is non-trivial and requires unsafe code anyway. Using
regular unsafe code without a generator is much easier to follow.
2021-06-08 19:24:17 +02:00
bjorn3 36bdfdc411 Don't return a BoxedResolver on errors 2021-06-08 19:24:17 +02:00
bjorn3 9d9ccec3fc Inline two more methods 2021-06-08 19:24:17 +02:00
bjorn3 d376f032e6 Let several methods take &Resolver instead of a BoxedResolver wrapper 2021-06-08 19:24:16 +02:00
bjorn3 db4d8e2cab Store boxed metadata loader in CrateLoader 2021-06-08 19:24:16 +02:00
bjorn3 ecc68e7879 Replace Pin::new with .as_mut() 2021-06-08 19:24:16 +02:00
bjorn3 bddf151dea Use more accurate lifetimes 2021-06-08 19:24:16 +02:00
bjorn3 1b7ec34878 Inline PinnedGenerator 2021-06-08 19:24:16 +02:00
bjorn3 99e112d282 Inline the rest of box_region 2021-06-08 19:24:16 +02:00
bjorn3 86b3ebe2da Inline box_region macro calls 2021-06-08 19:24:15 +02:00
bjorn3 8f397bc8a0 Simplify box_region macros 2021-06-08 19:24:15 +02:00
Santiago Pastorino f07412db41
Destructure OpaqueTypeKey in certain cases to simplify code 2021-06-08 10:13:54 -03:00
Santiago Pastorino 1278f3f295
Simplify code by using VecMap::get_by 2021-06-08 09:41:26 -03:00
Santiago Pastorino dd56ec653c
Add VecMap::get_by(FnMut -> bool) 2021-06-08 09:40:58 -03:00
Yuki Okushi b7fadfddcb
Rollup merge of #86103 - camsteffen:lifetime-hack, r=jackh726
Remove lifetime hack

It compiles without the hack. But I don't know why. I can't get the example in the referenced issue to compile...
2021-06-08 13:26:38 +09:00
Yuki Okushi 2e8ffed861
Rollup merge of #86096 - FabianWolff:ec-E0316, r=GuillaumeGomez
Comment out unused error codes and add description for E0316

I have added an extended description of `E0316` and commented out a bunch of unused error codes to make clear the fact that they are no longer in use. You can check for yourself with
```shell
for ec in                                                \
    E0314 E0315   E0473 E0474 E0475   E0479 E0480 E0481  \
    E0483 E0484 E0485 E0486 E0487 E0488 E0489
do
    if [ ! -z "`grep -r $ec compiler/* --exclude-dir=rustc_error_codes`" ]
    then
        echo $ec
        false
    fi
done
```
i.e. these error codes appear nowhere in the compiler code and thus cannot be emitted.

r? ```@GuillaumeGomez```
2021-06-08 13:26:36 +09:00
Yuki Okushi 472dbec026
Rollup merge of #85906 - LingMan:iter_find, r=matthewjasper
Use `Iterator::find` instead of open-coding it

```@rustbot``` modify labels +C-cleanup +T-compiler
2021-06-08 13:26:28 +09:00
Aaron Hill 822f800ad7
Include macro name in 'local ambiguity' error
Currently, we only point at the span of the macro argument. When the
macro call is itself generated by another macro, this can make it
difficult or impossible to determine which macro is responsible for
producing the error.
2021-06-07 20:17:48 -05:00