Commit Graph

153053 Commits

Author SHA1 Message Date
Mara Bos 00ca4d0dd3 Update non_fmt_panics test. 2021-08-16 17:26:08 +02:00
Mara Bos 0a313250a4 Improve non_fmt_panics suggestion based on trait impls. 2021-08-16 17:25:35 +02:00
bors 23461b210f Auto merge of #87696 - ssomers:btree_lazy_iterator_cleanup, r=Mark-Simulacrum
BTree: merge the complication introduced by #81486 and #86031

Also:
- Deallocate the last few tree nodes as soon as an `into_iter` iterator steps beyond the end, instead of waiting around for the drop of the iterator (just to share more code).
- Symmetric code for backward iteration.
- Mark unsafe the methods on dying handles, modelling dying handles after raw pointers: it's the caller's responsibility to use them safely.

r? `@Mark-Simulacrum`
2021-08-16 03:45:26 +00:00
bors 2a6fb9a4c0 Auto merge of #80357 - c410-f3r:new-hir-let, r=matthewjasper
Introduce `hir::ExprKind::Let` - Take 2

Builds on #68577 and depends on #79328.

cc #53667
2021-08-16 00:31:42 +00:00
bors 2bd17c1d43 Auto merge of #87590 - Amanieu:deprecate_llvm_asm, r=nagisa
Deprecate llvm_asm!

We would like to remove `llvm_asm!` from the compiler once `asm!` is stabilized. This PR deprecates `llvm_asm!` to encourage any remaining users to migrate to `asm!` (or if `asm!` is not supported for their target, to add this support to rustc).

The only remaining user of `llvm_asm!` in the standard library was `black_box`, which has been rewritten to use volatile operations when `asm!` is not available on the current target.

cc `@rust-lang/wg-inline-asm`

cc `@RalfJung` for the changes to `black_box` which might affect Miri.

r? `@nagisa`
2021-08-15 21:22:02 +00:00
Caio 6aa9937a76 Introduce hir::ExprKind::Let - Take 2 2021-08-15 16:18:26 -03:00
Matthew Jasper 2d9f2eae84 Use correct drop scopes for if expressions 2021-08-15 16:05:25 -03:00
bors 2d2bc94c8c Auto merge of #87982 - m-ou-se:non-fmt-panic-assert-str, r=cjgillot
Add automatic migration for assert!(.., string).

Fixes part of #87313.
2021-08-15 17:57:39 +00:00
bors c0490a2dbb Auto merge of #87792 - GuillaumeGomez:ci-fetch, r=pietroalbini
Remove git fetch from CI

https://github.com/rust-lang/rust/pull/86623 added a call to `git fetch`, which is problematic for releases.

r? `@pietroalbini`
2021-08-15 14:02:40 +00:00
Amanieu d'Antras 632a400a36 Fix ui tests for llvm_asm! deprecation 2021-08-15 13:27:13 +01:00
Amanieu d'Antras 6fd4f3463f Allow the use of the deprecated llvm_asm! in black_box 2021-08-15 13:14:32 +01:00
Amanieu d'Antras 4dd933cdc2 Deprecate llvm_asm! 2021-08-15 13:14:32 +01:00
bors 58d685ecb3 Auto merge of #86692 - dns2utf8:parallelize_rustdoc-gui_tests, r=GuillaumeGomez
Run rustdoc-gui tests in parallel

I hid the passing tests and only show the failed ones in alphabetical order:
![image](https://user-images.githubusercontent.com/739070/123663020-84e63100-d825-11eb-9b35-0a8c30cd219c.png)

Also this PR cuts down the execution time from ~40 to ~9 seconds
2021-08-15 10:56:35 +00:00
bors dfe5fd0902 Auto merge of #87975 - m-ou-se:unused-import-attributes, r=nagisa
Include attributes in removal span for unused imports.

Fixes https://github.com/rust-lang/rust/issues/87973
2021-08-15 07:40:53 +00:00
bors 40db258731 Auto merge of #87974 - steffahn:slice_split_size_hints, r=dtolnay
Test and fix `size_hint` for slice’s [r]split* iterators

Adds extensive test (of `size_hint`) for all the _[r]split*_ iterators.
Fixes `size_hint` upper bound for _split_inclusive*_ iterators which was one higher than necessary for non-empty slices.
Fixes `size_hint` lower bound for _[r]splitn*_ iterators when _n == 0_, which was one too high.

**Lower bound being one too high was a logic error, violating the correctness condition of `size_hint`.**

_Edit:_ I’ve opened an issue for that bug, so this PR fixes #87978
2021-08-15 04:48:42 +00:00
bors 85109e257a Auto merge of #87581 - Amanieu:asm_clobber_abi, r=nagisa
Add support for clobber_abi to asm!

This PR adds the `clobber_abi` feature that was proposed in #81092.

Fixes #81092

cc `@rust-lang/wg-inline-asm`

r? `@nagisa`
2021-08-14 22:29:27 +00:00
Stefan Schindler 7f2b52b1d6 More spacing between the different blocks of results 2021-08-14 23:36:17 +02:00
Stefan Schindler 86fa21cda5 Implement a finish method for the status_bar and some cleanup 2021-08-14 23:19:28 +02:00
bors 8007b506ac Auto merge of #83417 - erikdesjardins:enableremovezsts, r=oli-obk
Run RemoveZsts pass at mir-opt-level=1

per https://github.com/rust-lang/rust/pull/83177#issuecomment-803942217

This pass removes assignments to ZST places.

Perf (from https://github.com/rust-lang/rust/pull/83177#issuecomment-803442557): https://perf.rust-lang.org/compare.html?start=41b315a470d583f6446599984ff9ad3bd61012b2&end=bd5d1b96f0c64c9938feea831789e1b5bb2cd4a2

r? `@oli-obk`
2021-08-14 19:59:08 +00:00
bors e55c13e109 Auto merge of #87324 - asquared31415:named-asm-labels, r=Amanieu
Lint against named asm labels

This adds a deny-by-default lint to prevent the use of named labels in inline `asm!`.  Without a solution to #81088 about whether the compiler should rewrite named labels or a special syntax for labels, a lint against them should prevent users from writing assembly that could break for internal compiler reasons, such as inlining or anything else that could change the number of actual inline assembly blocks emitted.

This does **not** resolve the issue with rewriting labels, that still needs a decision if the compiler should do any more work to try to make them work.
2021-08-14 17:33:38 +00:00
bors a59e885314 Auto merge of #87913 - a1phyr:vec_spec_clone_from, r=dtolnay
Specialize `Vec::clone_from` for `Copy` types

This should improve performance and reduce code size.

This also improves `clone_from` for `String`, `OsString` and `PathBuf`.
2021-08-14 14:52:33 +00:00
bors 136eaa1b25 Auto merge of #87375 - fee1-dead:move-constness-to-traitpred, r=oli-obk
Try filtering out non-const impls when we expect const impls

**TL;DR**: Associated types on const impls are now bounded; we now disallow calling a const function with bounds when the specified type param only has a non-const impl.

r? `@oli-obk`
2021-08-14 12:06:34 +00:00
bors fa2692990c Auto merge of #87600 - JohnTitor:classify-ui-tests, r=petrochenkov
Move some UI tests to more suitable subdirs

The classifui result: https://gist.github.com/JohnTitor/c9e00840990b5e4a8fc562ec3571e427/e06c42226c6038da91e403c33b9947843420cf44

Some notes:
- backtrace-debuginfo.rs: previously I skipped this, I'm still not sure what the best dir is. Any ideas?
- estr-subtyping.rs: Seems a quite old test so removed, shouldn't?
- deref-suggestion.rs: moved to inference as `suggestions` is not an ideal dir.
- issue-43023.rs: a bit misclassified, moved to `derives`

cc #73494
r? `@petrochenkov`
2021-08-14 09:25:33 +00:00
bors 99efc51dae Auto merge of #85020 - lrh2000:named-upvars, r=tmandry
Name the captured upvars for closures/generators in debuginfo

Previously, debuggers print closures as something like
```
y::main::closure-0 (0x7fffffffdd34)
```
The pointer actually references to an upvar. It is not very obvious, especially for beginners.

It's because upvars don't have names before, as they are packed into a tuple. This PR names the upvars, so we can expect to see something like
```
y::main::closure-0 {_captured_ref__b: 0x[...]}
```

r? `@tmandry`
Discussed at https://github.com/rust-lang/rust/pull/84752#issuecomment-831639489 .
2021-08-14 07:01:36 +00:00
bors c6094fc7b9 Auto merge of #88006 - GuillaumeGomez:update-browser-ui-test-dep, r=notriddle
Update browser-ui-test package version

r? `@notriddle`
2021-08-14 04:09:22 +00:00
bors 32c3f2d6ca Auto merge of #87997 - sl4m:update-favicon-order, r=GuillaumeGomez
Updates favicon order of precedence as it matters to Chrome

Hi, this updates #75438 to fix an order of precedence issue for Chrome. Unfortunately, the last favicon defined wins when it comes to Chrome, hence the primary icon being placed last. I [brought it up](https://bugs.chromium.org/p/chromium/issues/detail?id=1104663) with the Chromium team last year, but so far it's a non-issue.

I've created an example website that mimics the behaviour in Chrome. https://sl4m.github.io/chrome-favicon/

This is what I'm seeing at the moment when viewing https://doc.rust-lang.org/core/index.html in Chrome. It's falling back to the PNG.

<img width="80" alt="Screenshot 2021-08-12 at 21 11 58" src="https://user-images.githubusercontent.com/47347/129304041-b598213e-fcd3-4df1-addb-e6feac6c35b1.png">
2021-08-14 01:12:22 +00:00
bors d0a10b2056 Auto merge of #87478 - jackh726:issue-84931, r=estebank
Point to where clause for GATs to add bound

Fixes #84931

r? `@estebank`
2021-08-13 22:28:01 +00:00
jackh726 22fc7d6e5a Point to where clause for GATs 2021-08-13 17:07:56 -04:00
bors 5a19ffe1c2 Auto merge of #86492 - hyd-dev:no-mangle-method, r=petrochenkov
Associated functions that contain extern indicator or have `#[rustc_std_internal_symbol]` are reachable

Previously these fails to link with ``undefined reference to `foo'``:

<details>
<summary>Example 1</summary>

```rs
struct AssocFn;

impl AssocFn {
    #[no_mangle]
    fn foo() {}
}

fn main() {
    extern "Rust" {
        fn foo();
    }
    unsafe { foo() }
}
```
([Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=f1244afcdd26e2a28445f6e82ca46b50))
</details>

<details>
<summary>Example 2</summary>

```rs
#![crate_name = "lib"]
#![crate_type = "lib"]

struct AssocFn;

impl AssocFn {
    #[no_mangle]
    fn foo() {}
}
```
```rs
extern crate lib;

fn main() {
    extern "Rust" {
        fn foo();
    }
    unsafe { foo() }
}
```
</details>

But I believe they should link successfully, because this works:
<details>

```rs
#[no_mangle]
fn foo() {}

fn main() {
    extern "Rust" {
        fn foo();
    }
    unsafe { foo() }
}
```
([Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=789b3f283ee6126f53939429103ed98d))
</details>

This PR fixes the problem, by adding associated functions that have "custom linkage" to `reachable_set`, just like normal functions.

I haven't tested whether #76211 and [Miri](https://github.com/rust-lang/miri/issues/1837) are fixed by this PR yet, but I'm submitting this anyway since this fixes the examples above.

I added a `run-pass` test that combines my two examples above, but I'm not sure if that's the right way to test this. Maybe I should add / modify an existing codegen test (`src/test/codegen/export-no-mangle.rs`?) instead?
2021-08-13 19:47:03 +00:00
bors 881aeab7b1 Auto merge of #87984 - m-ou-se:closure-lint-wording, r=Aaron1011
Closure lint wording

Some small changes to the wording of the closure migration lint.

r? `@Aaron1011`
2021-08-13 16:57:34 +00:00
Mara Bos 2db4533f66 Update tests for new closure migration lint wording. 2021-08-13 16:26:40 +02:00
Mara Bos fa7bf885f8 Update closure migration diagnostic wording. 2021-08-13 16:21:59 +02:00
bors 5de331ba40 Auto merge of #88009 - GuillaumeGomez:rollup-f194yyk, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #87795 (Avoid ICE caused by suggestion)
 - #87966 (Fix `command-create-pidfd` test inside unprivileged Docker containers)
 - #87969 (Revert "Rollup merge of #87779 - Aaron1011:stmt-ast-id, r=petrochenkov")
 - #88005 (Add rustdoc GUI test for headers)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-08-13 14:16:12 +00:00
Guillaume Gomez f382d23f7a
Rollup merge of #88005 - GuillaumeGomez:headers-gui-tests, r=notriddle
Add rustdoc GUI test for headers

Add test for #87861.

r? ``@notriddle``
2021-08-13 15:29:12 +02:00
Guillaume Gomez 96c9dabd17
Rollup merge of #87969 - Aaron1011:revert-stmt-id, r=petrochenkov
Revert "Rollup merge of #87779 - Aaron1011:stmt-ast-id, r=petrochenkov"

Fixes #87877

This change interacts badly with `noop_flat_map_stmt`,
which synthesizes multiple statements with the same `NodeId`.

I'm working on a better fix that will still allow us to
remove this special case. For now, let's revert the change
to fix the ICE.

This reverts commit a4262cc984, reversing
changes made to 8ee962f88e.
2021-08-13 15:29:12 +02:00
Guillaume Gomez fc3a90dc74
Rollup merge of #87966 - pietroalbini:fix-pidfd-test, r=m-ou-se
Fix `command-create-pidfd` test inside unprivileged Docker containers

In `src/test/ui/command/command-create-pidfd.rs` (added #81825), the detection code to skip the test on unsupported platforms doesn't account for unprivileged Docker containers (CI uses privileged containers), which leads to a test failure as you can't call the `clone3` syscall in that environment. This PR enhances the detection code to also consider unprivileged containers.
2021-08-13 15:29:11 +02:00
Guillaume Gomez 717f9e3769
Rollup merge of #87795 - estebank:erase-lifetimes-in-suggestion, r=oli-obk
Avoid ICE caused by suggestion

When suggesting dereferencing something that can be iterable in a `for`
loop, erase lifetimes and use a fresh `ty::ParamEnv` to avoid 'region
constraints already solved' panic.

Fix #87657, fix #87709, fix #87651.
2021-08-13 15:29:10 +02:00
Frank Steffahn 3f0d04e97b Improve wording, correct -> tight. 2021-08-13 15:27:30 +02:00
Guillaume Gomez 11716db285 Update browser-ui-test package version 2021-08-13 14:52:28 +02:00
Guillaume Gomez a3d3df4ba6 Add rustdoc GUI test for headers 2021-08-13 14:23:13 +02:00
Deadbeef 74627c17c5
Fix Cargo.lock and ui test 2021-08-13 11:30:33 +00:00
Mara Bos 8fedb31649 Use is_diagnostic_item instead of get_diagnostic_item. 2021-08-13 12:21:31 +02:00
Mara Bos 5ad41069e6 Update non-fmt-panic tests. 2021-08-13 12:20:14 +02:00
Frank Steffahn 4304686049 Consistent use of `impl Trait` arguments in the test's helper function. 2021-08-13 12:02:35 +02:00
Mara Bos b4f448a7ea non_fmt_panic: machine app. suggestion for assert with string msg. 2021-08-13 11:50:32 +02:00
Deadbeef 2931a9df2f
make check less conservative and add explanation 2021-08-13 09:28:52 +00:00
Deadbeef 54d4fc245a
Bless test 2021-08-13 09:28:52 +00:00
Deadbeef 1fa712d0ba
Make assoc types work with `?const `opt=out 2021-08-13 09:28:52 +00:00
Deadbeef 8c2a1e8e43
allow incomplete features for now 2021-08-13 09:28:52 +00:00
Deadbeef 7ea0280aa9
Moved ui test 2021-08-13 09:28:51 +00:00