Commit Graph

5265 Commits

Author SHA1 Message Date
bors
2d11e25794 Auto merge of #84794 - ChrisDenton:dedup-native-libs, r=petrochenkov
Deduplicate native libs before they are passed to the linker

Stop spamming the linker with the same native library over and over again, if they directly follow from each other. This would help prevent [this situation](https://github.com/MSxDOS/ntapi/issues/2).

Issue #38460 has been open since 2016 so I think it's worth making an incomplete fix that at least addresses the most common symptom and without otherwise changing how Rust handles native libs. This PR is intended to be easy to revert (if necessary) when a more permanent fix is implemented.
2021-05-05 03:56:26 +00:00
bors
45ccf91070 Auto merge of #84915 - Mark-Simulacrum:bitset-xor-eq, r=jackh726
Retain data in vectorized registers for longer

This seems to be a mild performance improvement on the keccak crate at least, though not sure it'll show up more broadly.
2021-05-05 01:23:01 +00:00
Justus K
b6120bfb35
Add type to differentiate between fake and real DefId's 2021-05-04 19:34:12 +02:00
Mark Rousskov
9d4c0944cb Change bitwise operator to more easily keep data in vector registers 2021-05-04 11:55:18 -04:00
bors
7a0f1781d0 Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakis
Update BARE_TRAIT_OBJECT and ELLIPSIS_INCLUSIVE_RANGE_PATTERNS to errors in Rust 2021

This addresses https://github.com/rust-lang/rust/pull/81244 by updating two lints to errors in the Rust 2021 edition.

r? `@estebank`
2021-05-04 08:09:23 +00:00
bors
0309953232 Auto merge of #84833 - Mark-Simulacrum:thread-local-consts, r=varkor
"const" initialized thread locals in rustc

This appears to give a slight speedup on many of our benchmarks.
2021-05-04 03:14:32 +00:00
bors
14f863c443 Auto merge of #84472 - Aaron1011:conservative-paramenv-and, r=lcnr
Be more conservative about discarding caller_bound in `ParamEnv::and`
2021-05-04 00:48:42 +00:00
bors
716394d658 Auto merge of #84862 - GuillaumeGomez:rollup-cbc93h4, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #84835 (Add link to Issue #34202 in udp docs)
 - #84852 (Change librustdoc write!(.. \n) to writeln!(..); fix comment grammar)
 - #84854 (use double quotes and full path for E0761)
 - #84856 (Correct stability of ErrorKind::OutOfMemory)
 - #84858 (Fix stability attributes of byte-to-string specialization)
 - #84860 (Link to MCP from target tier policy)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-03 14:35:12 +00:00
Guillaume Gomez
377722103e
Rollup merge of #84854 - hi-rustin:rustin-patch-E0761, r=varkor
use double quotes and full path for E0761

close https://github.com/rust-lang/rust/issues/84828
2021-05-03 15:08:09 +02:00
hi-rustin
461f52071d use full path for E0761 2021-05-03 18:57:48 +08:00
Vadim Petrochenkov
1443c7646d parser: Remove support for inner attributes on non-block expressions 2021-05-03 13:33:53 +03:00
hi-rustin
f758eb664e use double quotes for E0761 2021-05-03 16:02:54 +08:00
bors
2428cc4816 Auto merge of #84842 - blkerby:null_lowercase, r=joshtriplett
Replace 'NULL' with 'null'

This replaces occurrences of "NULL" with "null" in docs, comments, and compiler error/lint messages. This is for the sake of consistency, as the lowercase "null" is already the dominant form in Rust. The all-caps NULL looks like the C macro (or SQL keyword), which seems out of place in a Rust context, given that NULL does not exist in the Rust language or standard library (instead having [`ptr::null()`](https://doc.rust-lang.org/stable/std/ptr/fn.null.html)).
2021-05-03 05:41:23 +00:00
Brent Kerby
6679f5ceb1 Change 'NULL' to 'null' 2021-05-02 17:46:00 -06:00
Dylan DPC
b0c7e64de0
Rollup merge of #84818 - ABouttefeux:enum-suggest, r=jackh726
suggestion for unit enum variant when matched with a patern

resolve #84700

add suggestion for code like
```rust
enum FarmAnimal {
    Worm,
    Cow,
    Bull,
    Chicken { num_eggs: usize },
    Dog (String),
}

fn what_does_the_animal_say(animal: &FarmAnimal) {

    let noise = match animal {
        FarmAnimal::Cow(_) => "moo".to_string(),
        _ => todo!()
    };

    println!("{:?} says: {:?}", animal, noise);
}
```

```
error[E0532]: expected tuple struct or tuple variant, found unit variant `FarmAnimal::Cow`
  --> $DIR/issue-84700.rs:15:9
   |
LL |     Cow,
   |     --- `FarmAnimal::Cow` defined here
...
LL |         FarmAnimal::Cow(_) => "moo".to_string(),
   |         ^^^^^^^^^^^^^^^^^^ help: use this syntax instead: `FarmAnimal::Cow`
   ```
2021-05-03 00:32:44 +02:00
Dylan DPC
0133af504b
Rollup merge of #84784 - JulianKnodt:suggest_const, r=lcnr
Add help message to suggest const for unused type param

r? `@lcnr`
2021-05-03 00:32:42 +02:00
Dylan DPC
966e9e2471
Rollup merge of #84072 - nagisa:target-family-two-the-movie, r=petrochenkov
Allow setting `target_family` to multiple values, and implement `target_family="wasm"`

As per the conclusion in [this thread](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg.28wasm.29.3F/near/233158441), this implements an ability to specify any number of `target_family` values, allowing for more flexible generic groups, or "families", to be created than just the OS-based unix/windows dichotomy.

cc https://github.com/rust-lang/reference/pull/1006
2021-05-03 00:32:40 +02:00
Simonas Kazlauskas
1a491e2304 Set target_family="wasm" for wasm targets 2021-05-03 00:32:44 +03:00
Mark Rousskov
5065144d6d Use new thread-local const-init
Let's see if this gives us any speedup - some of the TLS state modified in this
commit *is* pretty heavily accessed, so we can hope!
2021-05-02 14:06:07 -04:00
Dylan DPC
0bc9727e29
Rollup merge of #84821 - jyn514:fix-nit, r=Mark-Simulacrum
Fix nit in rustc_session::options

Addresses https://github.com/rust-lang/rust/pull/84802#discussion_r624578203 - I never actually pushed the commit before that PR got merged.

r? `@Mark-Simulacrum`
2021-05-02 17:00:25 +02:00
Dylan DPC
2553053828
Rollup merge of #84752 - lrh2000:generator-debuginfo, r=tmandry
Fix debuginfo for generators

First, all fields except the discriminant (including `outer_fields`) should be put into structures inside the variant part, which gives an equivalent layout but offers us much better integration with debuggers.

Second, artificial flags in generator variants should be removed.
 - Literally, variants are not artificial. We have `yield` statements, upvars and inner variables in the source code.
 - Functionally, we don't want debuggers to suppress the variants. It contains the state of the generator, which is useful when debugging. So they shouldn't be marked artificial.
 - Debuggers may use artificial flags to find the active variant. In this case, marking variants artificial will make debuggers not work properly.

Fixes #62572.
Fixes #79009.

And refer https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Debuginfo.20for.20generators.
2021-05-02 17:00:23 +02:00
Dylan DPC
4198d0a87c
Rollup merge of #84392 - dario23:fmt-assert-args-pub, r=varkor,RalfJung
Make AssertKind::fmt_assert_args public
2021-05-02 17:00:22 +02:00
Dylan DPC
a00edce017
Rollup merge of #84358 - sexxi-goose:print_captures_borrowck_rebased, r=nikomatsakis
Update closure capture error logging for disjoint captures for disjoint captures

Improved error logging when `#![feature(capture_disjoint_fields)]` is used.

Closes https://github.com/rust-lang/project-rfc-2229/issues/8
Closes https://github.com/rust-lang/project-rfc-2229/issues/36
Closes https://github.com/rust-lang/project-rfc-2229/issues/39
Closes #76005
2021-05-02 17:00:21 +02:00
Joshua Nelson
d5bda3c4fe Fix nit in rustc_session::options 2021-05-02 10:08:08 -04:00
Aliénore Bouttefeux
5cc21d9051 add suggestion for unit enum variant when matched with a patern 2021-05-02 13:58:38 +02:00
bors
89ebad52a8 Auto merge of #84802 - jyn514:option-dead-code, r=Mark-Simulacrum
Remove dead code in `rustc_session::Options`

- Don't recompile the same functions for each debugging option
  This reduces the amount of items in the crate by quite a lot.
- Remove unused `parse_opt_list` and `parse_pathbuf_push` functions
- Remove unused macro parameters
- Remove `allow(dead_code)`.
2021-05-02 11:43:39 +00:00
bors
3a1cd0ed36 Auto merge of #84805 - Mark-Simulacrum:no-dup-extend, r=cjgillot
Avoid generating QueryMap::extend for each key type

Should be a small win on compile times for rustc_query_impl, where this ends up getting codegen'd.
2021-05-02 09:22:13 +00:00
Mark Rousskov
61fd56fdb9 Avoid generating QueryMap::extend for each key type 2021-05-01 20:13:18 -04:00
Joshua Nelson
b19c02cce0 Remove unused macro parameters 2021-05-01 19:01:49 -04:00
Joshua Nelson
5cf4499181 Remove unused parse_pathbuf_push function
This also remove the `allow(dead_code)`.
2021-05-01 19:01:45 -04:00
Joshua Nelson
a88a94e8aa Don't recompile the same functions for each debugging option
This reduces the amount of items in the crate by quite a lot.
2021-05-01 19:01:10 -04:00
Chris Pardy
d19c46870f add docstrings and add issue to FIXMEs 2021-05-01 19:01:06 -04:00
ChrisPardy
e612f7abfc Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-05-01 19:01:06 -04:00
ChrisPardy
20a1315cbb Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-05-01 19:01:06 -04:00
ChrisPardy
25beade8df Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-05-01 19:01:05 -04:00
Chris Pardy
08c4fbcea7 Closure capture borrow diagnostics for disjoint captures 2021-05-01 19:01:05 -04:00
Joshua Nelson
85ee3d0f23 Remove unused parse_opt_list function 2021-05-01 18:58:05 -04:00
kadmin
50c86db4fa Add help message for unused type param 2021-05-01 21:58:06 +00:00
bors
4de7572097 Auto merge of #84410 - BoxyUwU:blue, r=varkor
Fix generic arg mismatch errors being ignored with explicit late bound lifetimes

Fixes #83466

r? `@varkor`
2021-05-01 21:07:10 +00:00
Aaron Hill
91daf705b4
Make TypeFoldable::is_global() false when fresh tys/consts are present
This ensures that `ParamEnv::and` preserves the original `caller_bounds`
when we have a value containing fresh tys/consts. This ensures that when
we cache a `SelectionCandidate`, the cache key (a `ParamEnvAnd`)
contains all of the information that influenced the computation of our
result (e.g. we may end up choosing a `ParamCandidate`)
2021-05-01 16:58:33 -04:00
Chris Denton
e40faeffa2
Deduplicate native libs before they are passed to the linker 2021-05-01 21:30:26 +01:00
bors
6e2a34474b Auto merge of #83114 - cjgillot:hop, r=eddyb
Move HIR parenting information out of hir_owner

Split out of #82681.

The parent of a HIR node and its content are currently bundled together, but are rarely used together.
This PR separates both information in two distinct queries for HIR owners.
This reduces incremental invalidation for HIR items that appear within a function body when this body (and the local ids) changes.
2021-05-01 18:03:25 +00:00
Ellen
39054339c1 test: *sneezes* 2021-05-01 18:36:05 +01:00
bors
603a42ec54 Auto merge of #84658 - Amanieu:reserved_regs, r=petrochenkov
Be stricter about rejecting LLVM reserved registers in asm!

LLVM will silently produce incorrect code if these registers are used as operands.

cc `@rust-lang/wg-inline-asm`
2021-05-01 13:01:24 +00:00
Amanieu d'Antras
ea310d9253 Reserve x18 on AArch64 and un-reserve x16 2021-05-01 13:25:56 +01:00
bors
fed59d669c Auto merge of #84786 - JohnTitor:rollup-j5omx6f, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #84601 (rustdoc: Only store locations in Cache::extern_locations and calculate the other info on-demand)
 - #84704 (platform-support.md: Update for consistency with Target Tier Policy)
 - #84724 (Replace llvm::sys::fs::F_None with llvm::sys::fs::OF_None)
 - #84740 (Reset the docs' copy path button after 1 second)
 - #84749 (Sync `rustc_codegen_cranelift`)
 - #84756 (Add a ToC to the Target Tier Policy documentation)
 - #84765 (Update cargo)
 - #84774 (Fix misspelling)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-01 09:59:54 +00:00
Yuki Okushi
fc850b6c60
Rollup merge of #84749 - XAMPPRocky:cranelift-rebase, r=bjorn3
Sync `rustc_codegen_cranelift`

Retrying #84746

r? ``@bjorn3``

---

Edit(bjorn3): Since the last sync there have been some refactorings around the driver code in preparation for a planned new feature. In addition ``@mominul`` implemented `-Ctarget-cpu` support and ``@XAMPPRocky`` fixed compilation of cg_clif itself for Windows with the MSVC toolchain.
2021-05-01 18:32:35 +09:00
Yuki Okushi
4d6d26ec6d
Rollup merge of #84724 - MaskRay:sys-fs, r=petrochenkov
Replace llvm::sys::fs::F_None with llvm::sys::fs::OF_None

The former is deprecated.
OF_None has been available in LLVM since 2018-06.

-----

OF_None (https://reviews.llvm.org/rG1f67a3cba9b09636c56e2109d8a35ae96dc15782) exists in LLVM 9.
https://reviews.llvm.org/D101506 may drop `F_None` support.
2021-05-01 18:32:34 +09:00
bors
1c2c6b6700 Auto merge of #84582 - richkadel:issue-84561, r=tmandry
Vastly improves coverage spans for macros

Fixes: #84561

This resolves problems where macros like `trace!(...)` would show zero coverage if tracing was disabled, and `assert_eq!(...)` would show zero coverage if the assertion did not fail, because only one coverage span was generated, for the branch.

This PR started with an idea that I could just drop branching blocks with same span as expanded macro. (See the fixed issue for more details.)

That did help, but it didn't resolve everything.

I also needed to add a span specifically for the macro name (plus `!`) to ensure the macro gets coverage even if it's internal expansion adds conditional branching blocks that are retained, and would otherwise drop the outer span. Now that outer span is _only_ the `(argument, list)`, which can safely be dropped now), because the macro name has its own span.

While testing, I also noticed the spanview debug output can cause an ICE on a function with no body. The
workaround for this is included in this PR (separate commit).

r? `@tmandry`
cc? `@wesleywiser`
2021-05-01 07:48:24 +00:00
bors
8a9fa3682d Auto merge of #84719 - Mark-Simulacrum:reduce-query-impl, r=davidtwco
Move iter_results to dyn FnMut rather than a generic

This means that we're no longer generating the iteration/locking code for each invocation site of iter_results, rather just once per query (roughly), which seems much better: this is a 15% win in instruction counts when compiling the rustc_query_impl crate. The code where this is used also is pretty cold, I suspect; the old solution didn't fully monomorphize either.
2021-04-30 22:21:07 +00:00