Commit graph

142890 commits

Author SHA1 Message Date
Ralf Jung 0b94338a26 CTFE engine: rename copy → copy_intrinsic, move to intrinsics.rs 2021-05-04 13:56:31 +02: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 c20c9219da Auto merge of #84874 - joshtriplett:ci-extract-llvm-win64-installer, r=Mark-Simulacrum
CI: Extract LLVM win64 installer directly, using 7z

Currently, we have LLVM tarballs for win64, generated by someone running
the installer via wine and tarring up the result.

7z knows how to extract NSIS installers directly, and the result is
identical to our tarball, except that it doesn't include `Uninstall.exe`
(which we don't care about) and it includes the NSIS plugin directory
(which we also don't care about).

This simplifies the process of upgrading CI, and allows us to just
mirror the upstream release .exe directly. This also improves our
supply chain.
2021-05-04 05:40:24 +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
Josh Triplett 22d187a3f6 CI: Extract LLVM win64 installer directly, using 7z
Currently, we have LLVM tarballs for win64, generated by someone running
the installer via wine and tarring up the result.

7z knows how to extract NSIS installers directly, and the result is
identical to our tarball, except that it doesn't include `Uninstall.exe`
(which we don't care about) and it includes the NSIS plugin directory
(which we also don't care about).

This simplifies the process of upgrading CI, and allows us to just
mirror the upstream release .exe directly. This also improves our
supply chain.
2021-05-03 11:23:00 -07: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 2d789b6373
Rollup merge of #84860 - badboy:link-to-mcp, r=GuillaumeGomez
Link to MCP from target tier policy

Promoting new targets requires filing a MCP. Probably good to link to the documentation what that even is.
2021-05-03 15:08:12 +02:00
Guillaume Gomez 55e21e8cca
Rollup merge of #84858 - LingMan:patch-1, r=JohnTitor
Fix stability attributes of byte-to-string specialization
2021-05-03 15:08:11 +02:00
Guillaume Gomez 2604440d8a
Rollup merge of #84856 - kornelski:enomem, r=JohnTitor
Correct stability of ErrorKind::OutOfMemory

Fix for #84744
2021-05-03 15:08:10 +02: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
Guillaume Gomez ed1646a785
Rollup merge of #84852 - mautamu:master, r=GuillaumeGomez
Change librustdoc write!(.. \n) to writeln!(..); fix comment grammar

Howdy,

This PR does the following:
1. Updates the grammar of a comment in librustdoc.
2. Replaces a few write!(..\n) macros with writeln!(..\n) for clarity. (Please let me know if there is a reason why this might be wrong!)

Best,
Mautamu
2021-05-03 15:08:07 +02:00
Guillaume Gomez dd5fc8edb8
Rollup merge of #84835 - wcampbell0x2a:add-issue-34202-link, r=m-ou-se
Add link to Issue #34202 in udp docs
2021-05-03 15:08:02 +02:00
Jan-Erik Rediger 9ed197b93c Link to MCP from target tier policy 2021-05-03 13:48:56 +02:00
LingMan eb9f168e1e
Fix stability attributes of byte-to-string specialization 2021-05-03 13:00:34 +02:00
hi-rustin 461f52071d use full path for E0761 2021-05-03 18:57:48 +08:00
bors c825bc431e Auto merge of #83312 - petrochenkov:noinner, r=Aaron1011
parser: Remove support for inner attributes on non-block expressions

Remove support for attributes like
```rust
fn attrs() {
    (#![print_target_and_args(fifth)] 1, 2);

    [#![print_target_and_args(sixth)] 1 , 2];
    [#![print_target_and_args(seventh)] true ; 5];

    match 0 {
        #![print_target_and_args(eighth)]
        _ => {}
    }

    MyStruct { #![print_target_and_args(ninth)] field: true };
}
```
They are
- useless
- unstable (modulo holes like https://github.com/rust-lang/rust/issues/65860)
- pessimize compiler performance, namely token collection for macros (cc https://github.com/rust-lang/rust/pull/82608)

I still want to run crater on this to check whether the stability holes are exploited in practice, and whether such attributes are used at all.
2021-05-03 10:56:15 +00:00
Vadim Petrochenkov 1443c7646d parser: Remove support for inner attributes on non-block expressions 2021-05-03 13:33:53 +03:00
Kornel 2247d46b11 Correct stability of ErrorKind::OutOfMemory 2021-05-03 10:28:19 +01:00
bors e327a823d8 Auto merge of #84845 - wcampbell0x2a:clippy-redundant-field-names, r=joshtriplett
[clippy] remove redundant field names
2021-05-03 08:05:12 +00:00
hi-rustin f758eb664e use double quotes for E0761 2021-05-03 16:02:54 +08:00
mautamu 8db7973f19
Change librustdoc write(.. \n) to writeln(..); fix comment in grammar
More grammar
2021-05-03 02:19:57 -05: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
wcampbell 962c3416ca
[clippy] remove redundant field names
Signed-off-by: wcampbell <wcampbell1995@gmail.com>
2021-05-02 20:24:17 -04:00
bors 59f551a2dc Auto merge of #84840 - Dylan-DPC:rollup-uzk7w0h, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #84072 (Allow setting `target_family` to multiple values, and implement `target_family="wasm"`)
 - #84744 (Add ErrorKind::OutOfMemory)
 - #84784 (Add help message to suggest const for unused type param)
 - #84811 (RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo)
 - #84818 (suggestion for unit enum variant when matched with a patern)
 - #84832 (Do not print visibility in external traits)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-03 00:17:16 +00:00
Brent Kerby 6679f5ceb1 Change 'NULL' to 'null' 2021-05-02 17:46:00 -06:00
wcampbell e4250a014e
Add link to Issue #34202 in udp docs
Signed-off-by: wcampbell <wcampbell1995@gmail.com>
2021-05-02 19:13:41 -04:00
Dylan DPC 83c49d09b7
Rollup merge of #84832 - Stupremee:dont-print-vis-in-external-traits, r=jyn514
Do not print visibility in external traits

This PR fixes the bug that caused traits, which were re-exported, having visibility modifiers in front of methods, which is invalid.

It would be nice to add a test for this, but I don't even know if tests with multiple crates are possible.

Resolves #81274
2021-05-03 00:32:45 +02: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 37ce3321eb
Rollup merge of #84811 - scottmcm:rustdoc-trait-alias-fix, r=jyn514
RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo

Fixes #84782

The code was assuming `Trait` when adding bounds to the cache, so add a check on the DefId to see what its kind really is.

r? `@jyn514`

Before:
![image](https://user-images.githubusercontent.com/18526288/116775611-6a751e80-aa53-11eb-84d0-ed6b7782be3c.png)

After:
![image](https://user-images.githubusercontent.com/18526288/116802227-d19cdc80-ab00-11eb-8133-7b34dd750da2.png)
2021-05-03 00:32:43 +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 77abe7a5f4
Rollup merge of #84744 - kornelski:enomem, r=joshtriplett
Add ErrorKind::OutOfMemory

Ability to express `ENOMEM` as an `io::Error`.

I've used `OutOfMemory` as opposed to `NotEnoughMem` or `AllocationFailed`, because "OOM" is used in Rust already.

See also #84612
2021-05-03 00:32:41 +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
bors 8a8ed07883 Auto merge of #82576 - gilescope:to_string, r=Amanieu
i8 and u8::to_string() specialisation (far less asm).

Take 2. Around 1/6th of the assembly to without specialisation.

https://godbolt.org/z/bzz8Mq

(partially fixes #73533 )
2021-05-02 22:01:57 +00:00
Simonas Kazlauskas 1a491e2304 Set target_family="wasm" for wasm targets 2021-05-03 00:32:44 +03:00
bors 6b5de7aaec Auto merge of #84754 - GuillaumeGomez:toggle-migration, r=jsha
Migrate trait and impl blocks' toggles into

Part of #83332

After this, I think only the "global" doc comment will be used as JS toggle. Once this PR is merged, I check what remains and remove them.

There is one change that this PR brings:

![Screenshot from 2021-04-30 15-39-04](https://user-images.githubusercontent.com/3050060/116713412-0f9ce200-a9d5-11eb-979c-2e7a73d16706.png)
![Screenshot from 2021-04-30 15-39-07](https://user-images.githubusercontent.com/3050060/116713415-10357880-a9d5-11eb-9868-1ba9e5ebf65e.png)

As you can see, I had to move the "undocumented" items below, they're not mixed with the others anymore. Unfortunately, I don't see a way to keep the current appearance without JS. As a a reminder, currently it looks like this:

![Screenshot from 2021-04-30 15-39-12](https://user-images.githubusercontent.com/3050060/116713547-31966480-a9d5-11eb-90bb-686042eefeec.png)
![Screenshot from 2021-04-30 15-39-15](https://user-images.githubusercontent.com/3050060/116713549-322efb00-a9d5-11eb-94a9-cfea073120db.png)

r? `@jsha`
2021-05-02 19:46:10 +00:00
Scott McMurray 40ffa94244 PR feedback 2021-05-02 12:29:23 -07:00
Justus K 9ca6d5863b
Do not print visibility in external traits 2021-05-02 21:16:50 +02: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
Guillaume Gomez 0d52eb9de8 Improve code readability 2021-05-02 19:12:20 +02:00
bors e10cbc33c1 Auto merge of #84822 - Dylan-DPC:rollup-wego8d6, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #84358 (Update closure capture error logging for disjoint captures for disjoint captures)
 - #84392 (Make AssertKind::fmt_assert_args public)
 - #84752 (Fix debuginfo for generators)
 - #84763 (shrink doctree::Module)
 - #84821 (Fix nit in rustc_session::options)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-02 15:01:52 +00: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 e643e2ebdf
Rollup merge of #84763 - tdelabro:shrink-doctree-module, r=jyn514
shrink doctree::Module

helps https://github.com/rust-lang/rust/issues/76382
2021-05-02 17:00:24 +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
Guillaume Gomez 29777fc6cd Update tests 2021-05-02 14:17:07 +02:00
Guillaume Gomez 5bd9146858 Add missing CSS rules for associated types 2021-05-02 14:17:07 +02:00
Guillaume Gomez dfde867fcd Migrate trait and impl blocks' toggles into 2021-05-02 14:17:07 +02:00