Commit Graph

231455 Commits

Author SHA1 Message Date
Oli Scherer
7956dbdcd1 Avoid infinite recursion for auto-fmt and auto-clippy 2023-08-03 11:37:43 +00:00
r0cky
dce7e87b16 Reduce arbitrary self type suggestions 2023-08-03 10:34:57 +00:00
bors
c115ec11d2 Auto merge of #112043 - jieyouxu:suggestion_macro_expansion_source_callsites, r=cjgillot
Fix suggestion spans for expr from macro expansions

### Issue #112007: rustc shows expanded `writeln!` macro in code suggestion

#### Before This PR

```
help: consider using a semicolon here
  |
6 |     };
  |      +
help: you might have meant to return this value
 --> C:\Users\hayle\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\macros\mod.rs:557:9
  |
55|         return $dst.write_fmt($crate::format_args_nl!($($arg)*));
  |         ++++++                                                  +
```

#### After This PR

```
help: consider using a semicolon here
   |
LL |     };
   |      +
help: you might have meant to return this value
   |
LL |         return writeln!(w, "but not here");
   |         ++++++                            +
```

### Issue #110017: `format!` `.into()` suggestion deletes the `format` macro

#### Before This PR

```
help: call `Into::into` on this expression to convert `String` into `Box<dyn std::error::Error>`
 --> /Users/eric/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/macros.rs:121:12
  |
12|         res.into()
  |            +++++++
```

#### After This PR

```
help: call `Into::into` on this expression to convert `String` into `Box<dyn std::error::Error>`
   |
LL |     Err(format!("error: {x}").into())
   |                              +++++++
```

---

Fixes #112007.
Fixes #110017.
2023-08-03 10:01:16 +00:00
Oli Scherer
4457ef2c6d Forbid old-style simd_shuffleN intrinsics 2023-08-03 09:29:00 +00:00
Guillaume Gomez
d0ed4edfc6 Migrate GUI colors test to original CSS color format 2023-08-03 11:25:33 +02:00
Urgau
ee519532f6 Also add label with original type for function pointers 2023-08-03 10:57:11 +02:00
r0cky
8c8af6cf99 Avoid too many expected symbols and reduce Nones 2023-08-03 08:56:31 +00:00
Urgau
4b3dadbe5a Also lint on cast/cast_mut and ptr::from_mut/ptr::from_ref 2023-08-03 10:52:15 +02:00
bohan
2195fa6a9b fix the span in the suggestion of remove question mark 2023-08-03 16:44:02 +08:00
bors
a922d1c0da Auto merge of #114396 - compiler-errors:hir-typeck-nits, r=oli-obk
Miscellaneous HIR typeck nits

Remove some check functions that only have one usage

Also remove `Expectation::IsLast`, which was both undocumented, and was also made redundant by my cleanup/fix in #103987 😸
2023-08-03 08:07:34 +00:00
Michael Watzko
5419abd400 Implement Option::take_if 2023-08-03 09:34:18 +02:00
bors
460e92b6a9 Auto merge of #3007 - rust-lang:rustup-2023-08-03, r=oli-obk
Automatic sync from rustc
2023-08-03 07:04:11 +00:00
bors
2e6ac7fe5b Auto merge of #114400 - matthiaskrgr:rollup-1hkd1ay, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #114363 (avoid 'miri' when refering to the shared interpreter)
 - #114371 (Add myself to mailmap)
 - #114387 (Temporarily eholk from review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-03 06:17:39 +00:00
Matthias Krüger
767a91d71f
Rollup merge of #114387 - eholk:eholk-on-vacation, r=compiler-errors
Temporarily eholk from review rotation

I'm going to be out for the rest of this week and then all of next week, and I generally haven't had the bandwidth to do much in the way of reviewing lately anyway. I'm going to remove myself for the review queue at least until I'm back from vacation and have some time to get a few other things in better shape.

r? `@wesleywiser`
2023-08-03 08:12:40 +02:00
Matthias Krüger
9f963fd577
Rollup merge of #114371 - samueltardieu:mailmap, r=compiler-errors
Add myself to mailmap

Some tool used `Samuel "Sam" Tardieu` as a full name in some of the commits imported along with clippy.
2023-08-03 08:12:40 +02:00
Matthias Krüger
01fdb9d148
Rollup merge of #114363 - RalfJung:interpret-not-miri, r=jackh726
avoid 'miri' when refering to the shared interpreter

This is basically the rustc source code version of https://github.com/rust-lang/rustc-dev-guide/pull/1471.
2023-08-03 08:12:39 +02:00
The Miri Conjob Bot
9bb8b66912 fmt 2023-08-03 05:34:22 +00:00
The Miri Conjob Bot
adb446cc07 Merge from rustc 2023-08-03 05:32:12 +00:00
The Miri Conjob Bot
072835472a Preparing for merge from rustc 2023-08-03 05:25:09 +00:00
r0cky
41e85c3d23 Apply suggestions 2023-08-03 05:18:19 +00:00
Michael Goulet
aa41c98737 Make Option<&dyn FnMut> into impl FnOnce 2023-08-03 04:33:07 +00:00
bors
fb31b3c34e Auto merge of #114353 - nnethercote:parser-ast-cleanups, r=petrochenkov
Some parser and AST cleanups

Things I found while looking closely at this code.

r? `@petrochenkov`
2023-08-03 04:26:42 +00:00
Michael Goulet
a63bb24593 Inline one usage of check_expr_eq_type 2023-08-03 04:23:22 +00:00
Michael Goulet
f3589a723d Inline check_expr_meets_expectation_or_error 2023-08-03 04:23:22 +00:00
Michael Goulet
6868b93cf5 No need for Expectation::IsLast 2023-08-03 04:23:22 +00:00
Taras Tsugrii
6ae2677d72 [rustc_span][perf] Hoist lookup sorted by words out of the loop.
@lqd commented on https://github.com/rust-lang/rust/pull/114351 asking
if `sort_by_words(lookup)` is computed repeatedly. I was assuming that
rustc should have no difficulties to hoist it automatically outside of
the loop to avoid repeated pure computation, but according to
 https://godbolt.org/z/frs8Kj1rq it seems like I was wrong:
original version seems to have 2 calls per loop iteration
```
.LBB16_3:
        mov     rbx, qword ptr [r13]
        mov     r14, qword ptr [r13 + 8]
        lea     rdi, [rsp + 40]
        mov     rsi, rbx
        mov     rdx, r14
        call    example::sort_by_words
        lea     rdi, [rsp + 64]
        mov     rsi, qword ptr [rsp + 8]
        mov     rdx, qword ptr [rsp + 16]
        call    example::sort_by_words
        mov     rdi, qword ptr [rsp + 40]
        mov     rdx, qword ptr [rsp + 56]
        mov     rsi, qword ptr [rsp + 64]
        cmp     rdx, qword ptr [rsp + 80]
        mov     qword ptr [rsp + 32], rdi
        mov     qword ptr [rsp + 24], rsi
        jne     .LBB16_5
        call    qword ptr [rip + bcmp@GOTPCREL]
        test    eax, eax
        sete    al
        mov     dword ptr [rsp + 4], eax
        mov     rsi, qword ptr [rsp + 72]
        test    rsi, rsi
        jne     .LBB16_8
        jmp     .LBB16_9
```
but the manually hoisted version just 1:
```
.LBB16_3:
        mov     r13, qword ptr [r15]
        mov     r14, qword ptr [r15 + 8]
        lea     rdi, [rsp + 64]
        mov     rsi, r13
        mov     rdx, r14
        call    example::sort_by_words
        mov     rdi, qword ptr [rsp + 64]
        mov     rdx, qword ptr [rsp + 16]
        cmp     qword ptr [rsp + 80], rdx
        mov     qword ptr [rsp + 32], rdi
        jne     .LBB16_5
        mov     rsi, qword ptr [rsp + 8]
        call    qword ptr [rip + bcmp@GOTPCREL]
        test    eax, eax
        sete    bpl
        mov     rsi, qword ptr [rsp + 72]
        test    rsi, rsi
        jne     .LBB16_8
        jmp     .LBB16_9
```
This code is probably not very hot, but there is no reason to leave
such a low hanging fruit.
2023-08-02 20:51:16 -07:00
bors
d8bbef50bb Auto merge of #113220 - tgross35:cstr-bytes-docs, r=workingjubilee
Clarify documentation for `CStr`

* Better differentiate summaries for `from_bytes_until_nul` and `from_bytes_with_nul`
* Add some links where they may be helpful
2023-08-03 02:40:19 +00:00
bors
aa70e5fb6e Auto merge of #113292 - MU001999:fix/issue-113222, r=Nilstrieb
Suggest `x build library` for a custom toolchain that fails to load `core`

Fixes #113222

The nicer suggestion for dev-channel won't be emitted if `-Z ui-testing` enabled. IMO, this is acceptable for now.
2023-08-03 00:53:01 +00:00
León Orell Valerian Liehr
6f5d8556ca
Handle inherent associated types fallout 2023-08-03 02:18:52 +02:00
Catherine Flores
bbd69e4a4c Add test for enum with fields 2023-08-02 23:59:30 +00:00
León Orell Valerian Liehr
263a0dec60
Compute variances for lazy type aliases 2023-08-03 01:38:23 +02:00
León Orell Valerian Liehr
2b8a3b44bf
Make lint missing-copy-implementations honor negative Copy impls 2023-08-03 01:37:42 +02:00
bors
736ef39a84 Auto merge of #107254 - chenyukang:yukang/fix-107113-wrong-sugg-in-macro, r=estebank
Avoid wrong code suggesting for attribute macro

Fixes #107113
r? `@estebank`
2023-08-02 23:04:27 +00:00
Nicholas Nethercote
d75ee2a6bc Remove MacDelimiter.
It's the same as `Delimiter`, minus the `Invisible` variant. I'm
generally in favour of using types to make impossible states
unrepresentable, but this one feels very low-value, and the conversions
between the two types are annoying and confusing.

Look at the change in `src/tools/rustfmt/src/expr.rs` for an example:
the old code converted from `MacDelimiter` to `Delimiter` and back
again, for no good reason. This suggests the author was confused about
the types.
2023-08-03 09:03:30 +10:00
Bryan Garza
673ab17c7f Add separate feature gate for async fn track caller
This patch adds a feature gate `async_fn_track_caller` that is separate from `closure_track_caller`. This is to allow enabling `async_fn_track_caller` separately.

Fixes #110009
2023-08-02 14:18:21 -07:00
bors
8131b9774e Auto merge of #114364 - weihanglo:update-cargo, r=weihanglo
Update cargo

10 commits in c91a693e7977e33a1064b63a5daf5fb689f01651..020651c52257052d28f6fd83fbecf5cfa1ed516c
2023-07-31 00:26:46 +0000 to 2023-08-02 16:00:37 +0000
- Update rustix to 0.38.6 (rust-lang/cargo#12436)
- replace `master` branch by default branch in documentation (rust-lang/cargo#12435)
- `#[allow(internal_features)]` in RUSTC_BOOTSTRAP test (rust-lang/cargo#12429)
- ci: rewrite bump check and respect semver (rust-lang/cargo#12395)
- fix(update): Tweak CLI behavior (rust-lang/cargo#12428)
- chore(deps): update compatible (rust-lang/cargo#12426)
- Display crate version on timings graph (rust-lang/cargo#12420)
- chore(deps): update alpine docker tag to v3.18 (rust-lang/cargo#12427)
- Use thiserror for credential provider errors (rust-lang/cargo#12424)
- Clarify in `--help` that `cargo test --all-targets` excludes doctests (rust-lang/cargo#12422)

r? `@ghost`
2023-08-02 21:13:43 +00:00
Eric Holk
50b174b850
Temporarily eholk from review rotation 2023-08-02 13:15:35 -07:00
bors
6e6d39a4f5 Auto merge of #114345 - lqd:revert-113588, r=RalfJung
Revert #113588 to fix bootstrap timings

This reverts #113588 which seems to have broken perf's bootstrap timings via some git issue

https://github.com/rust-lang/rust/pull/114318#issuecomment-1660807886 show a newly broken benchmark, the error at the time was

```
fatal: Path 'src/ci/channel' exists on disk, but not in 'e62323df22ecf9c163023132d17b7114f68b72e8'.
       thread 'main' panicked at 'command did not execute successfully: cd "/home/collector/rustc-perf/rust" && "git" "show" "e62323df22ecf9c163023132d17b7114f68b72e8:src/ci/channel"
       expected success, got: exit status: 128', config.rs:1786:27
```

If this lands, it will reopen #101907 and annoy miri, but it could actually be an issue that would appear during the next bootstrap bump, not just rustc-perf today.

r? `@ghost`
2023-08-02 19:22:20 +00:00
bors
042cfd871f Auto merge of #3006 - RalfJung:miri-script-shell, r=RalfJung
miri-script and cargo-miri cleanups

At least in an initial test, `cmd!(Shell::new()?, "env")` does show the full environment. Let's see what CI says.

`@osiewicz` why did you add this code to forward the host environment?
2023-08-02 18:51:05 +00:00
Ralf Jung
6e9479f4e0 cargo-miri: avoid set_env 2023-08-02 20:47:22 +02:00
Ralf Jung
7fc0cbb02a Command debug printing prints the environment these days, we can kill some custom debugging code 2023-08-02 20:47:22 +02:00
Ralf Jung
27377cbd8b fix miri-script being silent when running './miri test' 2023-08-02 20:47:22 +02:00
Ralf Jung
751cfa83f8 no need to forward all env vars 2023-08-02 20:18:16 +02:00
Weihang Lo
1f960bc969
Update cargo 2023-08-02 18:48:00 +01:00
bors
20747af894 Auto merge of #114202 - fee1-dead-contrib:rm-constness-2, r=oli-obk
Remove `constness` from `TraitPredicate`

Any ICEs or compiler errors created by this PR are expected and intended to be fixed in the future.

r? `@oli-obk`
cc #110395
2023-08-02 17:22:17 +00:00
bors
0640ae9430 Auto merge of #3004 - RalfJung:borrow-tests, r=RalfJung
add some SB and TB tests

Also I realized the `direct_mut_to_const_raw` test can be enabled in TB, so let's do that.
2023-08-02 17:10:58 +00:00
Ralf Jung
7767cbb3b0 const validation: point at where we found a pointer but expected an integer 2023-08-02 18:51:50 +02:00
bors
0ea879f9ce Auto merge of #3005 - RalfJung:miriscript, r=RalfJung
miri-script: simplify flag computation a bit
2023-08-02 16:33:31 +00:00
Ralf Jung
df3b25f386 add local_addr_of_mut test 2023-08-02 18:33:01 +02:00
Ralf Jung
42269c35af miri-script: simplify flag computation a bit 2023-08-02 18:28:15 +02:00