]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #81356 - ehuss:libtest-filters, r=m-ou-se
Mara Bos [Mon, 8 Feb 2021 18:28:13 +0000 (19:28 +0100)]
Rollup merge of #81356 - ehuss:libtest-filters, r=m-ou-se

libtest: allow multiple filters

Libtest ignores any filters after the first. This changes it so that if multiple filters are passed, it will test against all of them.

This also affects compiletest to do the same.

Closes #30422

3 years agoRollup merge of #71531 - spastorino:move-treat-err-as-bug-tests-to-ui, r=oli-obk
Mara Bos [Mon, 8 Feb 2021 18:28:09 +0000 (19:28 +0100)]
Rollup merge of #71531 - spastorino:move-treat-err-as-bug-tests-to-ui, r=oli-obk

Move treat err as bug tests to ui

cc `@oli-obk`

3 years agoAuto merge of #81313 - LeSeulArtichaut:revert-32558, r=jyn514
bors [Mon, 8 Feb 2021 10:46:10 +0000 (10:46 +0000)]
Auto merge of #81313 - LeSeulArtichaut:revert-32558, r=jyn514

Restore linking to itself in implementors section of trait page

Reverts #32558 as proposed in [this Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Trait.20implementation.20self-links/near/223773273)
r? `@jyn514` cc `@camelid`

3 years agoAuto merge of #79245 - ssomers:btree_curb_ord_bound, r=dtolnay
bors [Mon, 8 Feb 2021 07:56:04 +0000 (07:56 +0000)]
Auto merge of #79245 - ssomers:btree_curb_ord_bound, r=dtolnay

BTree: remove Ord bound where it is absent elsewhere

Some btree methods don't really need an Ord bound and don't have one, while some methods that more obviously don't need it, do have one.

An example of the former is `iter`, even though it explicitly exposes the work of the Ord implementation (["sorted by key"](https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.iter) - but I'm not suggesting it should have the Ord bound). An example of the latter is `new`, which doesn't involve any keys whatsoever.

3 years agoAuto merge of #80962 - jhpratt:const_int_fn-stabilization, r=dtolnay
bors [Mon, 8 Feb 2021 05:05:55 +0000 (05:05 +0000)]
Auto merge of #80962 - jhpratt:const_int_fn-stabilization, r=dtolnay

Stabilize remaining integer methods as `const fn`

This pull request stabilizes the following methods as `const fn`:

- `i*::checked_div`
- `i*::checked_div_euclid`
- `i*::checked_rem`
- `i*::checked_rem_euclid`
- `i*::div_euclid`
- `i*::overflowing_div`
- `i*::overflowing_div_euclid`
- `i*::overflowing_rem`
- `i*::overflowing_rem_euclid`
- `i*::rem_euclid`
- `i*::wrapping_div`
- `i*::wrapping_div_euclid`
- `i*::wrapping_rem`
- `i*::wrapping_rem_euclid`
- `u*::checked_div`
- `u*::checked_div_euclid`
- `u*::checked_rem`
- `u*::checked_rem_euclid`
- `u*::div_euclid`
- `u*::overflowing_div`
- `u*::overflowing_div_euclid`
- `u*::overflowing_rem`
- `u*::overflowing_rem_euclid`
- `u*::rem_euclid`
- `u*::wrapping_div`
- `u*::wrapping_div_euclid`
- `u*::wrapping_rem`
- `u*::wrapping_rem_euclid`

These can all be implemented on the current stable (1.49). There are two unstable details: const likely/unlikely and unchecked division/remainder. Both of these are for optimizations, and are in no way required to make the methods function; there is no exposure of these details publicly. Per comments below, it seems best practice is to stabilize the intrinsics. As such, `intrinsics::unchecked_div` and `intrinsics::unchecked_rem` have been stabilized as `const` as part of this pull request as well. The methods themselves remain unstable.

I believe part of the reason these were not stabilized previously was the behavior around division by 0 and modulo 0. After testing on nightly, the diagnostic for something like `const _: i8 = 5i8 % 0i8;` is similar to that of `const _: i8 = 5i8.rem_euclid(0i8);` (assuming the appropriate feature flag is enabled). As such, I believe these methods are ready to be stabilized as `const fn`.

This pull request represents the final methods mentioned in #53718. As such, this PR closes #53718.

`@rustbot` modify labels to +A-const-fn, +T-libs

3 years agoAuto merge of #72603 - jsgf:extern-loc, r=nikomatsakis
bors [Mon, 8 Feb 2021 02:23:17 +0000 (02:23 +0000)]
Auto merge of #72603 - jsgf:extern-loc, r=nikomatsakis

Implement `--extern-location`

This PR implements `--extern-location` as a followup to #72342 as part of the implementation of #57274. The goal of this PR is to allow rustc, in coordination with the build system, to present a useful diagnostic about how to remove an unnecessary dependency from a dependency specification file (eg Cargo.toml).

EDIT: Updated to current PR state.

The location is specified for each named crate - that is, for a given `--extern foo[=path]` there can also be `--extern-location foo=<location>`. It supports ~~three~~ two styles of location:
~~1. `--extern-location foo=file:<path>:<line>` - a file path and line specification
1. `--extern-location foo=span:<path>:<start>:<end>` - a span specified as a file and start and end byte offsets~~
1. `--extern-location foo=raw:<anything>` - a raw string which is included in the output
1. `--extern-location foo=json:<anything>` - an arbitrary Json structure which is emitted via Json diagnostics in a `tool_metadata` field.

~~1 & 2 are turned into an internal `Span`, so long as the path exists and is readable, and the location is meaningful (within the file, etc). This is used as the `Span` for a fix suggestion which is reported like other fix suggestions.~~

`raw` and `json` are for the case where the location isn't best expressed as a file and location within that file. For example, it could be a rule name and the name of a dependency within that rule. `rustc` makes no attempt to parse the raw string, and simply includes it in the output diagnostic text. `json` is only included in json diagnostics. `raw` is emitted as text and also as a json string in `tool_metadata`.

If no `--extern-location` option is specified then it will emit a default json structure consisting of `{"name": name, "path": path}` corresponding to the name and path in `--extern name=path`.

This is a prototype/RFC to make some of the earlier conversations more concrete. It doesn't stand on its own - it's only useful if implemented by Cargo and other build systems. There's also a ton of implementation details which I'd appreciate a second eye on as well.

~~**NOTE** The first commit in this PR is #72342 and should be ignored for the purposes of review. The first commit is a very simplistic implementation which is basically raw-only, presented as a MVP. The second implements the full thing, and subsequent commits are incremental fixes.~~

cc `@ehuss` `@est31` `@petrochenkov` `@estebank`

3 years agoMake sure all fields are accounted for in `encode_fields!`
Jeremy Fitzhardinge [Sun, 7 Feb 2021 04:29:04 +0000 (20:29 -0800)]
Make sure all fields are accounted for in `encode_fields!`

This will make sure the encoder will get updated if any new fields are
added to Diagnostic.

3 years agoImplement Encoder for Diagnostic manually
Jeremy Fitzhardinge [Mon, 18 Jan 2021 22:10:31 +0000 (14:10 -0800)]
Implement Encoder for Diagnostic manually

...so we can skip serializing `tool_metadata` if it hasn't been set.
This makes the output a bit cleaner, and avoiding having to update a
bunch of unrelated tests.

3 years agoAdd `--extern-loc` to augment unused crate dependency diagnostics
Jeremy Fitzhardinge [Mon, 25 May 2020 23:21:25 +0000 (16:21 -0700)]
Add `--extern-loc` to augment unused crate dependency diagnostics

This allows a build system to indicate a location in its own dependency
specification files (eg Cargo's `Cargo.toml`) which can be reported
along side any unused crate dependency.

This supports several types of location:
 - 'json' - provide some json-structured data, which is included in the json diagnostics
     in a `tool_metadata` field
 - 'raw' - emit the provided string into the output. This also appears as a json string in
     `tool_metadata`.

If no `--extern-location` is explicitly provided then a default json entry of the form
`"tool_metadata":{"name":<cratename>,"path":<cratepath>}` is emitted.

3 years agoAuto merge of #80652 - calebzulawski:simd-lanes, r=nagisa
bors [Sun, 7 Feb 2021 22:25:14 +0000 (22:25 +0000)]
Auto merge of #80652 - calebzulawski:simd-lanes, r=nagisa

Improve SIMD type element count validation

Resolves rust-lang/stdsimd#53.

These changes are motivated by `stdsimd` moving in the direction of const generic vectors, e.g.:
```rust
#[repr(simd)]
struct SimdF32<const N: usize>([f32; N]);
```

This makes a few changes:
* Establishes a maximum SIMD lane count of 2^16 (65536).  This value is arbitrary, but attempts to validate lane count before hitting potential errors in the backend.  It's not clear what LLVM's maximum lane count is, but cranelift's appears to be much less than `usize::MAX`, at least.
* Expands some SIMD intrinsics to support arbitrary lane counts.  This resolves the ICE in the linked issue.
* Attempts to catch invalid-sized vectors during typeck when possible.

Unresolved questions:
* Generic-length vectors can't be validated in typeck and are only validated after monomorphization while computing layout.  This "works", but the errors simply bail out with no context beyond the name of the type.  Should these errors instead return `LayoutError` or otherwise provide context in some way?  As it stands, users of `stdsimd` could trivially produce monomorphization errors by making zero-length vectors.

cc `@bjorn3`

3 years agoAuto merge of #79078 - petrochenkov:derattr, r=Aaron1011
bors [Sun, 7 Feb 2021 19:36:10 +0000 (19:36 +0000)]
Auto merge of #79078 - petrochenkov:derattr, r=Aaron1011

expand/resolve: Turn `#[derive]` into a regular macro attribute

This PR turns `#[derive]` into a regular attribute macro declared in libcore and defined in `rustc_builtin_macros`, like it was previously done with other "active" attributes in https://github.com/rust-lang/rust/pull/62086, https://github.com/rust-lang/rust/pull/62735 and other PRs.
This PR is also a continuation of #65252, #69870 and other PRs linked from them, which layed the ground for converting `#[derive]` specifically.

`#[derive]` still asks `rustc_resolve` to resolve paths inside `derive(...)`, and `rustc_expand` gets those resolution results through some backdoor (which I'll try to address later), but otherwise `#[derive]` is treated as any other macro attributes, which simplifies the resolution-expansion infra pretty significantly.

The change has several observable effects on language and library.
Some of the language changes are **feature-gated** by [`feature(macro_attributes_in_derive_output)`](https://github.com/rust-lang/rust/issues/81119).

#### Library

- `derive` is now available through standard library as `{core,std}::prelude::v1::derive`.

#### Language

- `derive` now goes through name resolution, so it can now be renamed - `use derive as my_derive; #[my_derive(Debug)] struct S;`.
- `derive` now goes through name resolution, so this resolution can fail in corner cases. Crater found one such regression, where import `use foo as derive` goes into a cycle with `#[derive(Something)]`.
- **[feature-gated]** `#[derive]` is now expanded as any other attributes in left-to-right order. This allows to remove the restriction on other macro attributes following `#[derive]` (https://github.com/rust-lang/reference/issues/566). The following macro attributes become a part of the derive's input (this is not a change, non-macro attributes following `#[derive]` were treated in the same way previously).
- `#[derive]` is now expanded as any other attributes in left-to-right order. This means two derive attributes `#[derive(Foo)] #[derive(Bar)]` are now expanded separately rather than together. It doesn't generally make difference, except for esoteric cases. For example `#[derive(Foo)]` can now produce an import bringing `Bar` into scope, but previously both `Foo` and `Bar` were required to be resolved before expanding any of them.
- **[feature-gated]** `#[derive()]` (with empty list in parentheses) actually becomes useful. For historical reasons `#[derive]` *fully configures* its input, eagerly evaluating `cfg` everywhere in its target, for example on fields.
Expansion infra doesn't do that for other attributes, but now when macro attributes attributes are allowed to be written after `#[derive]`, it means that derive can *fully configure* items for them.
    ```rust
#[derive()]
#[my_attr]
struct S {
#[cfg(FALSE)] // this field in removed by `#[derive()]` and not observed by `#[my_attr]`
field: u8
}
    ```
- `#[derive]` on some non-item targets is now prohibited. This was accidentally allowed as noop in the past, but was warned about since early 2018 (#50092), despite that crater found a few such cases in unmaintained crates.
- Derive helper attributes used before their introduction are now reported with a deprecation lint. This change is long overdue (since macro modularization, https://github.com/rust-lang/rust/issues/52226#issuecomment-422605033), but it was hard to do without fixing expansion order for derives. The deprecation is tracked by #79202.
```rust
    #[trait_helper] // warning: derive helper attribute is used before it is introduced
    #[derive(Trait)]
    struct S {}
```

Crater analysis: https://github.com/rust-lang/rust/pull/79078#issuecomment-731436821

3 years agoRemove treat-err-as-bug delay_span_bug test from run-make-fulldeps
Santiago Pastorino [Sun, 7 Feb 2021 04:50:17 +0000 (01:50 -0300)]
Remove treat-err-as-bug delay_span_bug test from run-make-fulldeps

3 years agoCreate ui test for -Ztreat-err-as-bug delay_span_bug
Santiago Pastorino [Sun, 7 Feb 2021 04:44:29 +0000 (01:44 -0300)]
Create ui test for -Ztreat-err-as-bug delay_span_bug

3 years agoAddress review comments
Vadim Petrochenkov [Sun, 7 Feb 2021 16:26:33 +0000 (19:26 +0300)]
Address review comments

3 years agoFeature gate macro attributes in `#[derive]` output
Vadim Petrochenkov [Sun, 17 Jan 2021 13:05:02 +0000 (16:05 +0300)]
Feature gate macro attributes in `#[derive]` output

3 years agoexpand/resolve: Turn `#[derive]` into a regular macro attribute
Vadim Petrochenkov [Sat, 14 Nov 2020 11:47:14 +0000 (14:47 +0300)]
expand/resolve: Turn `#[derive]` into a regular macro attribute

3 years agoAuto merge of #80632 - Nadrieril:fix-80501, r=varkor
bors [Sun, 7 Feb 2021 16:48:57 +0000 (16:48 +0000)]
Auto merge of #80632 - Nadrieril:fix-80501, r=varkor

Identify unreachable subpatterns more reliably

In https://github.com/rust-lang/rust/pull/80104 I used `Span`s to identify unreachable sub-patterns in the presence of or-patterns during exhaustiveness checking. In https://github.com/rust-lang/rust/issues/80501 it was revealed that `Span`s are complicated and that this was not a good idea.
Instead, this PR identifies subpatterns logically: as a path in the tree of subpatterns of a given pattern. I made a struct that captures a set of such subpatterns. This is a bit complex, but thankfully self-contained; the rest of the code does not need to know anything about it.
Fixes https://github.com/rust-lang/rust/issues/80501. I think I managed to keep the perf neutral.

r? `@varkor`

3 years agoAuto merge of #81853 - GuillaumeGomez:rollup-xzh1z4v, r=GuillaumeGomez
bors [Sun, 7 Feb 2021 13:57:24 +0000 (13:57 +0000)]
Auto merge of #81853 - GuillaumeGomez:rollup-xzh1z4v, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #81526 (btree: use Option's unwrap_unchecked())
 - #81742 (Add a note about the correctness and the effect on unsafe code to the `ExactSizeIterator` docs)
 - #81830 (Add long error explanation for E0542)
 - #81835 (Improve long explanation for E0546)
 - #81843 (Add regression test for #29821)

Failed merges:

 - #81836 (Add long explanation for E0547)

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #81843 - bstrie:issue-29821, r=lcnr
Guillaume Gomez [Sun, 7 Feb 2021 13:45:56 +0000 (14:45 +0100)]
Rollup merge of #81843 - bstrie:issue-29821, r=lcnr

Add regression test for #29821

Closes #29821

3 years agoRollup merge of #81835 - jesusprubio:improve-long-eplanation-e0546, r=GuillaumeGomez
Guillaume Gomez [Sun, 7 Feb 2021 13:45:54 +0000 (14:45 +0100)]
Rollup merge of #81835 - jesusprubio:improve-long-eplanation-e0546, r=GuillaumeGomez

Improve long explanation for E0546

Helps with #61137

3 years agoRollup merge of #81830 - jesusprubio:add-log-explanation-e0542, r=GuillaumeGomez
Guillaume Gomez [Sun, 7 Feb 2021 13:45:53 +0000 (14:45 +0100)]
Rollup merge of #81830 - jesusprubio:add-log-explanation-e0542, r=GuillaumeGomez

Add long error explanation for E0542

Helps with #61137

3 years agoRollup merge of #81742 - sdroege:exact-size-iterator-correctness, r=kennytm
Guillaume Gomez [Sun, 7 Feb 2021 13:45:51 +0000 (14:45 +0100)]
Rollup merge of #81742 - sdroege:exact-size-iterator-correctness, r=kennytm

Add a note about the correctness and the effect on unsafe code to the `ExactSizeIterator` docs

As it is a safe trait it does not provide any guarantee that the
returned length is correct and as such unsafe code must not rely on it.

That's why `TrustedLen` exists.

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

3 years agoRollup merge of #81526 - ojeda:btree-use-unwrap_unchecked, r=scottmcm
Guillaume Gomez [Sun, 7 Feb 2021 13:45:46 +0000 (14:45 +0100)]
Rollup merge of #81526 - ojeda:btree-use-unwrap_unchecked, r=scottmcm

btree: use Option's unwrap_unchecked()

Now that https://github.com/rust-lang/rust/issues/81383 is available, start using it.

3 years agoAuto merge of #81502 - CraftSpider:method-abi, r=jyn514
bors [Sun, 7 Feb 2021 10:59:41 +0000 (10:59 +0000)]
Auto merge of #81502 - CraftSpider:method-abi, r=jyn514

Add abi field to `Method`

Also bumps version and adds a test (Will conflict with #81500, whichever is merged first)

Rationale: It's possible for methods to have an ABI. This should be exposed in the JSON.

3 years agoAuto merge of #81498 - thomaseizinger:ice-workaround-56935-rustc-index, r=matthewjasper
bors [Sun, 7 Feb 2021 08:09:58 +0000 (08:09 +0000)]
Auto merge of #81498 - thomaseizinger:ice-workaround-56935-rustc-index, r=matthewjasper

Apply workaround from #72003 for #56935 to allow for cross-compilation of `rustc_index` crate

This patch applies the same workaround as #72003 to the `rustc_index` crate. This allows recent versions of rustfmt to compile to wasm again.

Related: #72017.

3 years agoAuto merge of #81462 - osa1:issue75158, r=Mark-Simulacrum
bors [Sun, 7 Feb 2021 05:22:14 +0000 (05:22 +0000)]
Auto merge of #81462 - osa1:issue75158, r=Mark-Simulacrum

Add test for #75158

This also shifts some type-size related tests into a new directory, so that we keep the number of files at the root down.

Closes #75158

3 years agoRemove treat-err-as-bug err test from run-make-fulldeps
Santiago Pastorino [Sun, 7 Feb 2021 04:49:35 +0000 (01:49 -0300)]
Remove treat-err-as-bug err test from run-make-fulldeps

3 years agoCreate ui test for -Ztreat-err-as-bug err
Santiago Pastorino [Fri, 24 Apr 2020 20:22:55 +0000 (17:22 -0300)]
Create ui test for -Ztreat-err-as-bug err

3 years agoAuto merge of #81821 - nikic:update-wasm32, r=sanxiyn
bors [Sun, 7 Feb 2021 02:36:08 +0000 (02:36 +0000)]
Auto merge of #81821 - nikic:update-wasm32, r=sanxiyn

Upgrade wasm32 image to Ubuntu 20.04

This switches the wasm32 image, which is used to test
wasm32-unknown-emscripten, to Ubuntu 20.04. While at it, enable
most of the excluded tests, as they seem to work fine with some
minor fixes.

3 years agoAuto merge of #78052 - da-x:path-trimming-type-aliases, r=davidtwco
bors [Sat, 6 Feb 2021 23:44:42 +0000 (23:44 +0000)]
Auto merge of #78052 - da-x:path-trimming-type-aliases, r=davidtwco

path trimming: ignore type aliases

Continuation of #73996.

3 years agoRemove accidentally left-behind git mark
Rune Tynan [Sat, 6 Feb 2021 22:37:36 +0000 (17:37 -0500)]
Remove accidentally left-behind git mark

3 years agoAdd regression test for #29821
bstrie [Sat, 6 Feb 2021 21:58:52 +0000 (16:58 -0500)]
Add regression test for #29821

Closes #29821

3 years agoAuto merge of #80883 - GuillaumeGomez:remove-some-function-fields, r=ollie27
bors [Sat, 6 Feb 2021 20:55:36 +0000 (20:55 +0000)]
Auto merge of #80883 - GuillaumeGomez:remove-some-function-fields, r=ollie27

Remove some function fields

Same kind as #80845.

This PR removes the `all_types` and `ret_types` from the `clean::Function` type.

Another change that I had to do was implementing the `From` trait to be able to convert `hir::def::DefKind` into `clean::TypeKind` without requiring `DocContext` (and so I updated the `clean` method so that it's taken into account).

The last two commits improve a bit the `get_real_types` function and the `Type::generics` method.

r? `@jyn514`

3 years agoRestore linking to itself in implementors section of trait page
LeSeulArtichaut [Sat, 23 Jan 2021 22:51:06 +0000 (23:51 +0100)]
Restore linking to itself in implementors section of trait page

3 years agoTypo fix
Jesus Rubio [Sat, 6 Feb 2021 18:45:43 +0000 (19:45 +0100)]
Typo fix

3 years agoReferences added
Jesus Rubio [Sat, 6 Feb 2021 18:44:09 +0000 (19:44 +0100)]
References added

3 years agoComments updated to keep the consistency
Jesus Rubio [Sat, 6 Feb 2021 18:41:03 +0000 (19:41 +0100)]
Comments updated to keep the consistency

3 years agoAuto merge of #81832 - jonas-schievink:rollup-3nw53p0, r=jonas-schievink
bors [Sat, 6 Feb 2021 18:03:37 +0000 (18:03 +0000)]
Auto merge of #81832 - jonas-schievink:rollup-3nw53p0, r=jonas-schievink

Rollup of 7 pull requests

Successful merges:

 - #81402 (tidy: Run tidy style against markdown files.)
 - #81434 (BTree: fix documentation of unstable public members)
 - #81680 (Refactor `PrimitiveTypeTable` for Clippy)
 - #81737 (typeck: Emit structured suggestions for tuple struct syntax)
 - #81738 (Miscellaneous small diagnostics cleanup)
 - #81766 (Enable 'task list' markdown extension)
 - #81812 (Add a test for escaping LLVMisms in inline asm)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoImprove long explanation for E0546
Jesus Rubio [Sat, 6 Feb 2021 17:27:19 +0000 (18:27 +0100)]
Improve long explanation for E0546

3 years agoFormat fixes
Jesus Rubio [Sat, 6 Feb 2021 17:05:21 +0000 (18:05 +0100)]
Format fixes

3 years agoUpdate compiler/rustc_error_codes/src/error_codes/E0542.md
Jesús Rubio [Sat, 6 Feb 2021 16:39:11 +0000 (17:39 +0100)]
Update compiler/rustc_error_codes/src/error_codes/E0542.md

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
3 years agoRollup merge of #81812 - nagisa:nagisa/escape-the-escape-hatch, r=Amanieu
Jonas Schievink [Sat, 6 Feb 2021 16:01:52 +0000 (17:01 +0100)]
Rollup merge of #81812 - nagisa:nagisa/escape-the-escape-hatch, r=Amanieu

Add a test for escaping LLVMisms in inline asm

We escape certain LLVM-specific features when passing the inline
assembly string to the LLVM. Until now, however, there was no test
making sure this behaviour stays intact. This commit adds such a test!

r? `@Amanieu`
cc `@joshtriplett`

3 years agoRollup merge of #81766 - jyn514:task-lists, r=GuillaumeGomez
Jonas Schievink [Sat, 6 Feb 2021 16:01:50 +0000 (17:01 +0100)]
Rollup merge of #81766 - jyn514:task-lists, r=GuillaumeGomez

Enable 'task list' markdown extension

Closes https://github.com/rust-lang/rust/issues/71183.

3 years agoRollup merge of #81738 - camelid:misc-small-diag-cleanup, r=lcnr
Jonas Schievink [Sat, 6 Feb 2021 16:01:49 +0000 (17:01 +0100)]
Rollup merge of #81738 - camelid:misc-small-diag-cleanup, r=lcnr

Miscellaneous small diagnostics cleanup

3 years agoRollup merge of #81737 - camelid:typeck-structure-sugg, r=lcnr
Jonas Schievink [Sat, 6 Feb 2021 16:01:47 +0000 (17:01 +0100)]
Rollup merge of #81737 - camelid:typeck-structure-sugg, r=lcnr

typeck: Emit structured suggestions for tuple struct syntax

And tuple variant syntax, but that didn't fit in the subject :)

Now the fact that these are suggestions is exposed both to the layout
engine and to IDEs and rustfix for automatic application.

3 years agoRollup merge of #81680 - camsteffen:primty, r=oli-obk
Jonas Schievink [Sat, 6 Feb 2021 16:01:45 +0000 (17:01 +0100)]
Rollup merge of #81680 - camsteffen:primty, r=oli-obk

Refactor `PrimitiveTypeTable` for Clippy

I removed `PrimitiveTypeTable` and added `PrimTy::ALL` and `PrimTy::from_name` in its place. This allows Clippy to use `PrimTy::from_name` for the `builtin_type_shadow` lint, and a `const` list of primitive types is deleted from Clippy code (the goal). All changes should be a little faster, if anything.

3 years agoRollup merge of #81434 - ssomers:btree_drain_filter_doc_update, r=dtolnay
Jonas Schievink [Sat, 6 Feb 2021 16:01:43 +0000 (17:01 +0100)]
Rollup merge of #81434 - ssomers:btree_drain_filter_doc_update, r=dtolnay

BTree: fix documentation of unstable public members

As rightfully requested in #62924 & #70530.
r? `@Mark-Simulacrum`

3 years agoRollup merge of #81402 - ehuss:md-tidy, r=jyn514
Jonas Schievink [Sat, 6 Feb 2021 16:01:42 +0000 (17:01 +0100)]
Rollup merge of #81402 - ehuss:md-tidy, r=jyn514

tidy: Run tidy style against markdown files.

This adds tidy checks for markdown files.  I think it is useful to have some style enforcement (for the same reasons the style is enforced on other files).  I think it is worthwhile to avoid `ignore` on rust examples since having broken code in documentation is frustrating.  Avoiding trailing whitespace is good because it has semantic meaning in markdown, which I think should be avoided.

3 years agoAdd long error explanation for E0542
Jesus Rubio [Sat, 6 Feb 2021 15:42:34 +0000 (16:42 +0100)]
Add long error explanation for E0542

3 years agoAuto merge of #81824 - RalfJung:miri, r=RalfJung
bors [Sat, 6 Feb 2021 15:14:44 +0000 (15:14 +0000)]
Auto merge of #81824 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/81770
Cc `@rust-lang/miri` r? `@ghost`

3 years agoAdd a test for escaping LLVMisms in inline asm
Simonas Kazlauskas [Sat, 6 Feb 2021 00:26:35 +0000 (02:26 +0200)]
Add a test for escaping LLVMisms in inline asm

We escape certain LLVM-specific features when passing the inline
assembly string to the LLVM. Until now, however, there was no test
making sure this behaviour stays intact. This commit adds such a test!

3 years agoupdate Miri
Ralf Jung [Sat, 6 Feb 2021 12:18:51 +0000 (13:18 +0100)]
update Miri

3 years agoUpgrade wasm32 image to Ubuntu 20.04
Nikita Popov [Fri, 5 Feb 2021 14:52:49 +0000 (15:52 +0100)]
Upgrade wasm32 image to Ubuntu 20.04

This switches the wasm32 image, which is used to test
wasm32-unknown-emscripten to Ubuntu 20.04. While at it, enable
most of the excluded tests, as they seem to work fine with some
minor fixes.

3 years agopath trimming: disable on src/test/run-make-fulldeps/coverage-spanview
Dan Aloni [Thu, 28 Jan 2021 06:47:53 +0000 (08:47 +0200)]
path trimming: disable on src/test/run-make-fulldeps/coverage-spanview

3 years agopath trimming: ignore type aliases
Dan Aloni [Thu, 28 Jan 2021 16:01:36 +0000 (18:01 +0200)]
path trimming: ignore type aliases

3 years agoBTreeMap: remove Ord bound where it is absent elsewhere
Stein Somers [Fri, 20 Nov 2020 20:29:00 +0000 (21:29 +0100)]
BTreeMap: remove Ord bound where it is absent elsewhere

3 years agoAuto merge of #81792 - pietroalbini:bump-nightly, r=Mark-Simulacrum
bors [Sat, 6 Feb 2021 07:55:28 +0000 (07:55 +0000)]
Auto merge of #81792 - pietroalbini:bump-nightly, r=Mark-Simulacrum

Bump nightly version to 1.52.0

cc `@rust-lang/release`

3 years agoEnable 'task list' markdown extension
Joshua Nelson [Thu, 4 Feb 2021 23:10:33 +0000 (18:10 -0500)]
Enable 'task list' markdown extension

- Add documentation about task lists

3 years agoAuto merge of #81810 - m-ou-se:rollup-q3nborp, r=m-ou-se
bors [Sat, 6 Feb 2021 04:55:09 +0000 (04:55 +0000)]
Auto merge of #81810 - m-ou-se:rollup-q3nborp, r=m-ou-se

Rollup of 7 pull requests

Successful merges:

 - #80011 (Stabilize `peekable_next_if`)
 - #81580 (Document how `MaybeUninit<Struct>` can be initialized.)
 - #81610 (BTreeMap: make Ord bound explicit, compile-test its absence)
 - #81664 (Avoid a hir access inside get_static)
 - #81675 (Make rustdoc respect `--error-format short` in doctests)
 - #81753 (Never MIR inline functions with a different instruction set)
 - #81795 (Small refactor with Iterator::reduce)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoAdd abi field to `Method`
Rune Tynan [Fri, 29 Jan 2021 06:07:50 +0000 (01:07 -0500)]
Add abi field to `Method`

3 years agoBTreeMap: fix documentation of unstable public members
Stein Somers [Wed, 27 Jan 2021 12:21:02 +0000 (13:21 +0100)]
BTreeMap: fix documentation of unstable public members

3 years agoBump clippy version
Mark Rousskov [Fri, 5 Feb 2021 23:29:05 +0000 (18:29 -0500)]
Bump clippy version

3 years agoRollup merge of #81795 - camsteffen:diagnostics-reduce, r=oli-obk
Mara Bos [Fri, 5 Feb 2021 23:14:17 +0000 (00:14 +0100)]
Rollup merge of #81795 - camsteffen:diagnostics-reduce, r=oli-obk

Small refactor with Iterator::reduce

3 years agoRollup merge of #81753 - tmiasko:inline-instruction-set, r=oli-obk
Mara Bos [Fri, 5 Feb 2021 23:14:16 +0000 (00:14 +0100)]
Rollup merge of #81753 - tmiasko:inline-instruction-set, r=oli-obk

Never MIR inline functions with a different instruction set

3 years agoRollup merge of #81675 - poliorcetics:respect-shortness, r=jyn514
Mara Bos [Fri, 5 Feb 2021 23:14:14 +0000 (00:14 +0100)]
Rollup merge of #81675 - poliorcetics:respect-shortness, r=jyn514

Make rustdoc respect `--error-format short` in doctests

Note that this will not work with `cargo test`, only with `rustdoc --test`, I'll have to modify `cargo` as well.

Fix #81662.

`@rustbot` label +T-rustdoc +A-doctests

3 years agoRollup merge of #81664 - bjorn3:no_codegen_hir, r=lcnr
Mara Bos [Fri, 5 Feb 2021 23:14:13 +0000 (00:14 +0100)]
Rollup merge of #81664 - bjorn3:no_codegen_hir, r=lcnr

Avoid a hir access inside get_static

Together with #81056 this ensures that the codegen unit DepNode doesn't have a direct dependency on any part of the hir.

3 years agoRollup merge of #81610 - ssomers:btree_emphasize_ord_bound, r=dtolnay
Mara Bos [Fri, 5 Feb 2021 23:14:11 +0000 (00:14 +0100)]
Rollup merge of #81610 - ssomers:btree_emphasize_ord_bound, r=dtolnay

BTreeMap: make Ord bound explicit, compile-test its absence

Most `BTreeMap` and `BTreeSet` members are subject to an `Ord` bound but a fair number of methods are not. To better convey and perhaps later tune the `Ord` bound, make it stand out in individual `where` clauses, instead of once far away at the beginning of an `impl` block. This PR does not introduce or remove any bounds.

Also adds compilation test cases checking that the bound doesn't creep in unintended on the historically unbounded methods.

3 years agoRollup merge of #81580 - rodrimati1992:patch-2, r=dtolnay
Mara Bos [Fri, 5 Feb 2021 23:14:09 +0000 (00:14 +0100)]
Rollup merge of #81580 - rodrimati1992:patch-2, r=dtolnay

Document how `MaybeUninit<Struct>` can be initialized.

3 years agoRollup merge of #80011 - Stupremee:stabilize-peekable-next-if, r=dtolnay
Mara Bos [Fri, 5 Feb 2021 23:14:06 +0000 (00:14 +0100)]
Rollup merge of #80011 - Stupremee:stabilize-peekable-next-if, r=dtolnay

Stabilize `peekable_next_if`

This PR stabilizes the `peekable_next_if` feature

Resolves #72480

3 years agoAuto merge of #79253 - rcvalle:fix-rustc-sysroot-cas, r=nagisa
bors [Fri, 5 Feb 2021 22:58:13 +0000 (22:58 +0000)]
Auto merge of #79253 - rcvalle:fix-rustc-sysroot-cas, r=nagisa

Fix rustc sysroot in systems using CAS

Change filesearch::get_or_default_sysroot() to check if sysroot is found using env::args().next() if rustc in argv[0] is a symlink; otherwise, or if it is not found, use env::current_exe() to imply sysroot. This makes the rustc binary able to locate Rust libraries in systems using content-addressable storage (CAS).

3 years agoBump peekable_next_if to rust 1.51.0
David Tolnay [Fri, 5 Feb 2021 22:25:21 +0000 (14:25 -0800)]
Bump peekable_next_if to rust 1.51.0

3 years agoAuto merge of #81215 - cjgillot:defkey-mir, r=oli-obk
bors [Fri, 5 Feb 2021 18:21:47 +0000 (18:21 +0000)]
Auto merge of #81215 - cjgillot:defkey-mir, r=oli-obk

Encode MIR metadata by iterating on DefId instead of traversing the HIR tree

Split out of https://github.com/rust-lang/rust/pull/80347.

This part only traverses `mir_keys` and encodes MIR according to the def kind.

r? `@oli-obk`

3 years agoRemove unneeded From trait impl for DefKind
Guillaume Gomez [Tue, 2 Feb 2021 23:46:48 +0000 (00:46 +0100)]
Remove unneeded From trait impl for DefKind

3 years agoRemove unused cache argument
Guillaume Gomez [Tue, 2 Feb 2021 23:42:39 +0000 (00:42 +0100)]
Remove unused cache argument

3 years agoImprove code
Guillaume Gomez [Fri, 29 Jan 2021 13:45:03 +0000 (14:45 +0100)]
Improve code

3 years agoImprove html::render::cache::get_real_types code
Guillaume Gomez [Thu, 28 Jan 2021 15:23:41 +0000 (16:23 +0100)]
Improve html::render::cache::get_real_types code

3 years agoRemove Function all_types and ret_types fields
Guillaume Gomez [Thu, 28 Jan 2021 15:07:24 +0000 (16:07 +0100)]
Remove Function all_types and ret_types fields

3 years agoExplicitly match all DefKind item in conversion to TypeKind
Guillaume Gomez [Tue, 12 Jan 2021 12:58:16 +0000 (13:58 +0100)]
Explicitly match all DefKind item in conversion to TypeKind

3 years agoSmall refactor with Iterator::reduce
Cameron Steffen [Thu, 4 Feb 2021 21:44:24 +0000 (15:44 -0600)]
Small refactor with Iterator::reduce

3 years agobump nightly version to 1.52.0
Pietro Albini [Fri, 5 Feb 2021 15:24:49 +0000 (16:24 +0100)]
bump nightly version to 1.52.0

3 years agoAuto merge of #81257 - pnkfelix:issue-80949-short-term-resolution-via-revert-of-pr...
bors [Fri, 5 Feb 2021 14:52:57 +0000 (14:52 +0000)]
Auto merge of #81257 - pnkfelix:issue-80949-short-term-resolution-via-revert-of-pr-78373, r=matthewjasper

Revert 78373 ("dont leak return value after panic in drop")

Short term resolution for issue #80949.

Reopen #47949 after this lands.

(We plan to fine-tune PR #78373 to not run into this problem.)

3 years agoAuto merge of #81784 - m-ou-se:rollup-s23fow7, r=m-ou-se
bors [Fri, 5 Feb 2021 12:11:05 +0000 (12:11 +0000)]
Auto merge of #81784 - m-ou-se:rollup-s23fow7, r=m-ou-se

Rollup of 15 pull requests

Successful merges:

 - #79554 (Generic associated types in trait paths)
 - #80726 (relax adt unsizing requirements)
 - #81307 (Handle `Span`s for byte and raw strings and add more detail )
 - #81318 (rustdoc-json: Fix has_body)
 - #81456 (Make remote-test-server easier to use with new targets)
 - #81497 (rustdoc: Move `display_fn` struct inside `display_fn`)
 - #81500 (Remove struct_type from union output)
 - #81542 (Expose correct symlink API on WASI)
 - #81676 (Add more information to the error code for 'crate not found')
 - #81682 (Add additional bitset benchmarks)
 - #81730 (Make `Allocator` object-safe)
 - #81763 (Cleanup rustdoc pass descriptions a bit)
 - #81767 (Update LayoutError/LayoutErr stability attributes)
 - #81771 (Indicate change in RSS from start to end of pass in time-passes output)
 - #81781 (Fix `install-awscli.sh` error in CI)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRun x.py fmt to fix tidy issues
Wesley Wiser [Fri, 5 Feb 2021 11:35:32 +0000 (06:35 -0500)]
Run x.py fmt to fix tidy issues

3 years agoRollup merge of #81781 - m-ou-se:fix-ci, r=pietroalbini
Mara Bos [Fri, 5 Feb 2021 11:26:10 +0000 (12:26 +0100)]
Rollup merge of #81781 - m-ou-se:fix-ci, r=pietroalbini

Fix `install-awscli.sh` error in CI

This fixes the `install-awscli.sh` error about missing `'bdist_wheel'`.

3 years agoRollup merge of #81771 - tgnottingham:time-passes-rss-delta, r=oli-obk
Mara Bos [Fri, 5 Feb 2021 11:26:08 +0000 (12:26 +0100)]
Rollup merge of #81771 - tgnottingham:time-passes-rss-delta, r=oli-obk

Indicate change in RSS from start to end of pass in time-passes output

Previously, this was omitted because it could be misleading, but the
functionality seems too useful not to include.

r? ``@oli-obk``

3 years agoRollup merge of #81767 - exrook:layout-error-stability, r=Mark-Simulacrum
Mara Bos [Fri, 5 Feb 2021 11:26:07 +0000 (12:26 +0100)]
Rollup merge of #81767 - exrook:layout-error-stability, r=Mark-Simulacrum

Update LayoutError/LayoutErr stability attributes

`LayoutError` ended up not making it into 1.49.0, updating the stability attributes to reflect that.

I also pushed `LayoutErr` deprecation back a release to allow 2 releases before the deprecation comes into effect.

This change should be backported to beta.

3 years agoRollup merge of #81763 - camelid:rustdoc-passes-desc-up, r=GuillaumeGomez
Mara Bos [Fri, 5 Feb 2021 11:26:06 +0000 (12:26 +0100)]
Rollup merge of #81763 - camelid:rustdoc-passes-desc-up, r=GuillaumeGomez

Cleanup rustdoc pass descriptions a bit

Also changed a couple of comments from "intra-doc-links" to
"intra-doc links" (my understanding is that "intra-doc links" is the
standard way to refer to them).

3 years agoRollup merge of #81730 - RustyYato:object-safe-allocator, r=Amanieu
Mara Bos [Fri, 5 Feb 2021 11:26:05 +0000 (12:26 +0100)]
Rollup merge of #81730 - RustyYato:object-safe-allocator, r=Amanieu

Make `Allocator` object-safe

This allows rust-lang/wg-allocators#83: polymorphic allocators

3 years agoRollup merge of #81682 - JulianKnodt:bit_set_iter_benchmarks, r=oli-obk
Mara Bos [Fri, 5 Feb 2021 11:26:03 +0000 (12:26 +0100)]
Rollup merge of #81682 - JulianKnodt:bit_set_iter_benchmarks, r=oli-obk

Add additional bitset benchmarks

Add additional benchmarks for operations in bitset, I realize that it was a bit lacking when I intended to optimize it earlier, so I was hoping to put some in so I can verify my work later.

3 years agoRollup merge of #81676 - jyn514:crate-not-found, r=oli-obk
Mara Bos [Fri, 5 Feb 2021 11:26:02 +0000 (12:26 +0100)]
Rollup merge of #81676 - jyn514:crate-not-found, r=oli-obk

Add more information to the error code for 'crate not found'

This comes up a lot when bootstrapping.

3 years agoRollup merge of #81542 - RReverser:wasi-symlink, r=alexcrichton
Mara Bos [Fri, 5 Feb 2021 11:26:00 +0000 (12:26 +0100)]
Rollup merge of #81542 - RReverser:wasi-symlink, r=alexcrichton

Expose correct symlink API on WASI

As described in https://github.com/rust-lang/rust/issues/68574, the currently exposed API for symlinks is, in fact, a thin wrapper around the corresponding syscall, and not suitable for public usage.

The reason is that the 2nd param in the call is expected to be a handle of a "preopened directory" (a WASI concept for exposing dirs), and the only way to retrieve such handle right now is by tinkering with a private `__wasilibc_find_relpath` API, which is an implementation detail and definitely not something we want users to call directly.

Making matters worse, the semantics of this param aren't obvious from its name (`fd`), and easy to misinterpret, resulting in people trying to pass a handle of the target file itself (as in https://github.com/vitiral/path_abs/pull/50), which doesn't work as expected.

I did a [codesearch among open-source repos](https://sourcegraph.com/search?q=std%3A%3Aos%3A%3Awasi%3A%3Afs%3A%3Asymlink&patternType=literal), and the usage above is so far the only usage of this API at all, but we should fix it before more people start using it incorrectly.

While this is technically a breaking API change, I believe it's a justified one, as 1) it's OS-specific and 2) there was strictly no way to correctly use the previous form of the API, and if someone does use it, they're likely doing it wrong like in the example above.

The new API does not lead to the same confusion, as it mirrors `std::os::unix::fs::symlink` and `std::os::windows::fs::symlink_{file,dir}` variants by accepting source/target paths.

Fixes #68574.

r? ``@alexcrichton``

3 years agoRollup merge of #81500 - CraftSpider:union-kind, r=jyn514
Mara Bos [Fri, 5 Feb 2021 11:25:59 +0000 (12:25 +0100)]
Rollup merge of #81500 - CraftSpider:union-kind, r=jyn514

Remove struct_type from union output

Also bumps the format number and adds a test

Rationale: It's illegal to have unions of the form `union Union(i32, f32);`, or `union Union;`. The struct_type field was recently removed from the rustdoc Union AST, at which time this field was changed to always just read "union". It makes sense to completely remove it, as it provides no information.

3 years agoRollup merge of #81497 - camelid:rustdoc-display_fn-remove-cell, r=jyn514
Mara Bos [Fri, 5 Feb 2021 11:25:58 +0000 (12:25 +0100)]
Rollup merge of #81497 - camelid:rustdoc-display_fn-remove-cell, r=jyn514

rustdoc: Move `display_fn` struct inside `display_fn`

This makes it clear that it's an implementation detail of `display_fn`
and shouldn't be used elsewhere, and it enforces in the compiler that no
one else can use it.

r? ````@GuillaumeGomez````

3 years agoRollup merge of #81456 - Amanieu:remote-test-server, r=Amanieu
Mara Bos [Fri, 5 Feb 2021 11:25:56 +0000 (12:25 +0100)]
Rollup merge of #81456 - Amanieu:remote-test-server, r=Amanieu

Make remote-test-server easier to use with new targets

While testing #81455 I encountered 2 issues with `remote-test-server`:
- It is built with the stage 0 toolchain, which does not support a newly added target.
- It overwrites `LD_LIBRARY_PATH` instead of appending to it, which prevents the use of a custom sysroot for target libraries.

3 years agoRollup merge of #81318 - CraftSpider:json-trait-fix, r=jyn514
Mara Bos [Fri, 5 Feb 2021 11:25:54 +0000 (12:25 +0100)]
Rollup merge of #81318 - CraftSpider:json-trait-fix, r=jyn514

rustdoc-json: Fix has_body

Previously, `has_body` was always true. Now propagate the type of the method to set it correctly. Relies on #81287, that will need to be merged first.

3 years agoRollup merge of #81307 - estebank:invalid-byte-str-span, r=petrochenkov
Mara Bos [Fri, 5 Feb 2021 11:25:53 +0000 (12:25 +0100)]
Rollup merge of #81307 - estebank:invalid-byte-str-span, r=petrochenkov

Handle `Span`s for byte and raw strings and add more detail

CC #81208.

3 years agoRollup merge of #80726 - lcnr:unsize-query, r=oli-obk
Mara Bos [Fri, 5 Feb 2021 11:25:52 +0000 (12:25 +0100)]
Rollup merge of #80726 - lcnr:unsize-query, r=oli-obk

relax adt unsizing requirements

Changes unsizing of structs in case the last struct field shares generic params with other adt fields which do not change.
This change is currently insta stable and changes the language, so it at least requires a lang fcp. I feel like the current state is fairly unintuitive.

An example for what's now allowed would be https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6dd331d23f5c9ffc8c978175aae2e967
```rust
struct A<T, U: ?Sized>(T, B<T, U>); // previously ERR
// struct A<T, U: ?Sized>(T, B<[u32; 1], U>); // ok
struct B<T, U: ?Sized>(T, U);

fn main() {
    let x = A([0; 1], B([0; 1], [0; 1]));
    let y: &A<[u32; 1], [u32]> = &x;
    assert_eq!(y.1.1.len(), 1);
}
```

3 years agoRollup merge of #79554 - b-naber:generic-associated-types-in-trait-paths, r=jackh726
Mara Bos [Fri, 5 Feb 2021 11:25:50 +0000 (12:25 +0100)]
Rollup merge of #79554 - b-naber:generic-associated-types-in-trait-paths, r=jackh726

Generic associated types in trait paths

This is the second part of https://github.com/rust-lang/rust/pull/78978

This should fix:

Fixes #67510
Fixes #68648
Fixes #68649
Fixes #68650
Fixes #68652
Fixes #74684
Fixes #76535
Fixes #79422
Fixes #80433

and implement the remaining functionality needed for https://github.com/rust-lang/rust/issues/44265

r? ``@matthewjasper``

3 years agoFix `install-awscli.sh` error in CI.
Mara Bos [Fri, 5 Feb 2021 10:48:43 +0000 (11:48 +0100)]
Fix `install-awscli.sh` error in CI.

3 years agoAuto merge of #81736 - tgnottingham:tune-cgu-scheduling-for-memory, r=nagisa
bors [Fri, 5 Feb 2021 09:20:51 +0000 (09:20 +0000)]
Auto merge of #81736 - tgnottingham:tune-cgu-scheduling-for-memory, r=nagisa

rustc_codegen_ssa: tune codegen scheduling to reduce memory usage

For better throughput during parallel processing by LLVM, we used to sort
CGUs largest to smallest. This would lead to better thread utilization
by, for example, preventing a large CGU from being processed last and
having only one LLVM thread working while the rest remained idle.

However, this strategy would lead to high memory usage, as it meant the
LLVM-IR for all of the largest CGUs would be resident in memory at once.

Instead, we can compromise by ordering CGUs such that the largest and
smallest are first, second largest and smallest are next, etc. If there
are large size variations, this can reduce memory usage significantly.