Commit Graph

239020 Commits

Author SHA1 Message Date
Matthias Krüger
7435887d6c
Rollup merge of #117834 - RalfJung:target-feature-stability, r=b-naber
target_feature: make it more clear what that 'Option' means

Reading those tables in compiler/rustc_codegen_ssa/src/target_features.rs, it's not immediately clear that `None` means "stable". Let's use an enum with appropriately named variants to make that more obvious.
2023-11-14 21:50:38 +01:00
Matthias Krüger
d2cdf6c479
Rollup merge of #117686 - compiler-errors:gen-body, r=wesleywiser
Build pre-coroutine-transform coroutine body on error

I was accidentally building the post-transform coroutine body, rather than the pre-transform coroutine body. There's no pinning expected here yet, and the return type isn't yet transformed into `CoroutineState`.

Fixes #117670
2023-11-14 21:50:38 +01:00
Matthias Krüger
00ba7fc007
Rollup merge of #116244 - estebank:issue-73497, r=b-naber
Apply structured suggestion that allows test to work since 1.64

Close #73497.
2023-11-14 21:50:37 +01:00
bors
dd430bc8c2 Auto merge of #117907 - nikic:update-llvm-17, r=cuviper
Update to LLVM 17.0.5

Fixes https://github.com/rust-lang/rust/issues/116177.
Fixes the compile-time issue reported at https://internals.rust-lang.org/t/significant-increase-in-fat-lto-time-post-update-to-rustc-1-75-0-nightly/19765.

r? `@cuviper`
2023-11-14 20:39:19 +00:00
bors
989000b8c5 Auto merge of #15893 - Veykril:unsafe-impls-diagnostic, r=Veykril
Diagnose incorrect unsafety for trait impls
2023-11-14 20:24:21 +00:00
Lukas Wirth
e21d21a8fb Diagnose incorrect unsafety for trait impls 2023-11-14 21:05:27 +01:00
bors
49b27f4efb Auto merge of #117701 - lnicola:sync-from-ra, r=onur-ozkan,HKalbasi
Subtree update of `rust-analyzer`

r? `@HKalbasi`
2023-11-14 18:43:27 +00:00
bors
6e4538a6e9 Auto merge of #15891 - Veykril:orphan-impls, r=Veykril
feat: Diagnose some orphan trait impl cases
2023-11-14 17:55:30 +00:00
Lukas Wirth
d5faad1dae Fix inlay-hint tests being invalidated by minicore chanes 2023-11-14 18:53:48 +01:00
Lukas Wirth
6ddccc9a6e Diagnose some orphan trait impl cases 2023-11-14 18:09:34 +01:00
xFrednet
cab975c713
Changelog for Rust 1.74 🎃 2023-11-14 18:08:00 +01:00
xFrednet
9401cf21e4
Update version attribute for 1.74 lints 2023-11-14 18:08:00 +01:00
Ed Page
c8330ba354 docs(release): Remove unstable cargo change 2023-11-14 10:20:06 -06:00
Tomasz Miąsko
6873465600 Fix def-use check for call terminators 2023-11-14 17:07:34 +01:00
Laurențiu Nicola
d45ff2484f Depend on rustc_driver 2023-11-14 18:07:02 +02:00
Laurențiu Nicola
6ad73f5ee8 Depend on rustc_driver 2023-11-14 18:07:02 +02:00
bors
8d57ad1ade Auto merge of #117849 - compiler-errors:cycle, r=cjgillot
make `LayoutError::Cycle` carry `ErrorGuaranteed`

Addresses a FIXME, and also I think it's wise for error variants to carry their `ErrorGuaranteed` -- makes it easier to use that `ErrorGuaranteed` for creating, e.g. `TyKind::Error` and other error kinds. Splitting out from #117703.
2023-11-14 16:04:29 +00:00
bors
0c42e451d6 Auto merge of #11791 - Jacherr:iter_over_hash_type, r=Jarcho
Implement new lint `iter_over_hash_type`

Implements and fixes https://github.com/rust-lang/rust-clippy/issues/11788

This PR adds a new *restriction* lint `iter_over_hash_type` which prevents `Hash`-types (that is, `HashSet` and `HashMap`) from being used as the iterator in `for` loops.

The justification for this is because in `Hash`-based types, the ordering of items is not guaranteed and may vary between executions of the same program on the same hardware. In addition, it reduces readability due to the unclear iteration order.

The implementation of this lint also ensures the following:
- Calls to `HashMap::keys`, `HashMap::values`, and `HashSet::iter` are also denied when used in `for` loops,
- When this expression is used in procedural macros, it is not linted/denied.

changelog: add new `iter_over_hash_type` lint to prevent unordered iterations through hashed data structures
2023-11-14 15:55:00 +00:00
cui fliter
a44a4edc0e Fix some typos
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-11-14 23:06:50 +08:00
lcnr
8fcbd1991f review + fix CI 2023-11-14 13:41:28 +00:00
bors
ca8f33e19b Auto merge of #11778 - granddaifuku:fix/reduce-indexing-manual_memcpy-when-array-length-is-equal-to-range, r=blyxyas
fix: [manual_memcpy] reduce indexing suggestions when array length is equal to loop range

fixes: #11689

This PR improves `manual_memcpy` suggestions by reducing unnecessary indexing.

For example,
```rust
let src = [0, 1, 2, 3, 4];
let mut dest = [0; 4];
for i in 0..4 {
    dest[i] = src[i];
{
```
Clippy suggests `dest[..4].copy_from_slice(&src[..4]);`.
I reduced this suggestion as `dest.copy_from_slice(&src[..4]);`. (Removed needless indexing.)

changelog: [`manual_memcpy`]: Reduce indexing suggestions when array length is equal to loop range
2023-11-14 13:27:36 +00:00
lcnr
9aa2330e41 finish RegionKind rename
- `ReFree` -> `ReLateParam`
- `ReEarlyBound` -> `ReEarlyParam`
2023-11-14 13:13:27 +00:00
lcnr
15f21562e6 finish RegionKind rename
- `ReFree` -> `ReLateParam`
- `ReEarlyBound` -> `ReEarlyParam`
2023-11-14 13:13:27 +00:00
bors
d97bb195bf Auto merge of #117787 - ouz-a:smir_coroutinewitness, r=celinval
Add CoroutineWitness to covered types in smir

Previously we accepted `CouroutineWitness` as `unreachable!` but https://github.com/rust-lang/project-stable-mir/issues/50 shows it is indeed reachable, this pr fixes that and covers `CouroutineWitness`
2023-11-14 13:10:25 +00:00
Yudai Fukushima
a9d42e6d6d fix: reduce [manual_memcpy] indexing when array length is same to loop range
Format

refactor: extract function to shrink function length

fix: remove cmp to calculate range

fix: replace if_chain with let chains
2023-11-14 22:05:44 +09:00
Gavin Gray
caae1e08ec Add guard checking for associated types before computing intercrate ambiguity of projections. Bless test with more specific notes on the ambiguity cause. 2023-11-14 13:55:59 +01:00
y21
3f6b29ad32 [impl_trait_in_params]: fix span calculation 2023-11-14 13:52:44 +01:00
Lukas Wirth
b74015512d Remove UserError from LayoutError 2023-11-14 13:32:04 +01:00
Lukas Wirth
e844784d8d Simplify 2023-11-14 12:53:14 +01:00
Nikita Popov
8e2fcc4ca2 Update to LLVM 17.0.5 2023-11-14 12:06:30 +01:00
bors
fa14810f21 Auto merge of #117731 - nnethercote:rustc_macros, r=Nilstrieb
`rustc_macros` cleanups

Just some improvements I found while reading over this code.

r? `@Nilstrieb`
2023-11-14 10:55:42 +00:00
bors
5526682702 Auto merge of #117330 - tmiasko:custom-mir-cleanup-blocks, r=cjgillot
Custom MIR: Support cleanup blocks

Cleanup blocks are declared with `bb (cleanup) = { ... }`.

`Call` and `Drop` terminators take an additional argument describing the unwind action, which is one of the following:

* `UnwindContinue()`
* `UnwindUnreachable()`
* `UnwindTerminate(reason)`, where reason is `ReasonAbi` or `ReasonInCleanup`
* `UnwindCleanup(block)`

Also support unwind resume and unwind terminate terminators:

* `UnwindResume()`
* `UnwindTerminate(reason)`
2023-11-14 08:53:25 +00:00
dswij
48f38eb131 needless_return_with_question_mark ignore let-else 2023-11-14 16:30:52 +08:00
Tomasz Miąsko
78da577650 Custom MIR: Support cleanup blocks
Cleanup blocks are declared with `bb (cleanup) = { ... }`.

`Call` and `Drop` terminators take an additional argument describing the
unwind action, which is one of the following:

* `UnwindContinue()`
* `UnwindUnreachable()`
* `UnwindTerminate(reason)`, where reason is `ReasonAbi` or `ReasonInCleanup`
* `UnwindCleanup(block)`

Also support unwind resume and unwind terminate terminators:

* `UnwindResume()`
* `UnwindTerminate(reason)`
2023-11-14 08:23:58 +01:00
bors
173b6e686b Auto merge of #117856 - estebank:issue-66023, r=compiler-errors
Always point at index span on index obligation failure

Use more targetted span for index obligation failures by rewriting the obligation cause span.

CC #66023
2023-11-14 06:20:25 +00:00
bors
5777f2c6bd Auto merge of #117801 - tmiasko:remove-zsts-fuel, r=cjgillot
Remove incorrect transformation from RemoveZsts

Partial removal of storage statements for a local is incorrect, so a decision to optimize cannot be make independently for each statement.

Avoid the issue by performing the transformation completely or not at all.
2023-11-14 04:22:56 +00:00
bors
d5375d0587 Auto merge of #117773 - nnethercote:rm-Zperf-stats, r=wesleywiser
Remove `-Zperf-stats`.

The included measurements have varied over the years. At one point there were quite a few more, but #49558 deleted a lot that were no longer used. Today there's just four, and it's a motley collection that doesn't seem particularly valuable.

I think it has been well and truly subsumed by self-profiling, which collects way more data.

r? `@wesleywiser`
2023-11-14 02:24:05 +00:00
DropDemBits
787ca888e3
Add IdentPat::set_pat
Needed so that the `tuple_pat` node gets added to the syntax tree,
which is required as we're using structured snippets.
2023-11-13 20:41:06 -05:00
Esteban Küber
f830fe313b Detect more => typos
Handle and recover `match expr { pat >= { arm } }`.
2023-11-14 00:46:37 +00:00
sjwang05
614ddc9695
Suggest lhs deref for binops 2023-11-13 16:25:16 -08:00
bors
b9175240ea Auto merge of #116301 - mj10021:issue-115737-fix, r=cuviper
fix rounding issue with exponents in fmt

fixes issue #115737 , where the decimal places are rounded incorrectly when formatting scientific notation
2023-11-14 00:04:05 +00:00
DropDemBits
6f68cd3394
Remove unwraps from destructure_tuple_binding 2023-11-13 18:42:58 -05:00
bors
ba7c7a3019 Auto merge of #117887 - matthiaskrgr:rollup-rgur03f, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #114224 (rustc_llvm: Link to libkstat on Solaris/SPARC)
 - #117695 (Reorder checks to make sure potential missing expect on Option/Result…)
 - #117870 (`fn args_ref_X` to `fn args_X`)
 - #117879 (tests: update check for inferred nneg on zext)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-13 21:47:18 +00:00
Matthias Krüger
6d5d509755
Rollup merge of #117879 - durin42:nneg-zext, r=nikic
tests: update check for inferred nneg on zext

This was broken by upstream
llvm/llvm-project@dc6d077396. It's easy enough to use a regex match to support both, so we do that.

r? `@nikic`
`@rustbot` label: +llvm-main
2023-11-13 21:28:56 +01:00
Matthias Krüger
a87ad4e2a7
Rollup merge of #117870 - lcnr:rename-args_ref, r=compiler-errors
`fn args_ref_X` to `fn args_X`
2023-11-13 21:28:55 +01:00
Matthias Krüger
918c17acc3
Rollup merge of #117695 - 3tilley:prioritise-unwrap-expect-over-last-method-call, r=compiler-errors
Reorder checks to make sure potential missing expect on Option/Result…

… runs before removing last method call

Fixes #117669
2023-11-13 21:28:55 +01:00
Matthias Krüger
03d6e7ade0
Rollup merge of #114224 - inferiorhumanorgans:solaris-llvm-wrapper, r=cuviper
rustc_llvm: Link to libkstat on Solaris/SPARC

getHostCPUName calls into libkstat but as of
LLVM 16.0.6 libLLVMTargetParser is not explicitly
linked against libkstat causing builds to fail
due to undefined symbols.

See also: llvm/llvm-project#64186
2023-11-13 21:28:54 +01:00
Esteban Küber
5061c09c58 review comments: more targeted span setting approach 2023-11-13 19:57:15 +00:00
bors
85b8450466 Auto merge of #116866 - slanterns:inspect-stabilize, r=BurntSushi
Stabilize `result_option_inspect`

This PR stabilizes `result_option_inspect`:

```rust
// core::option

impl Option<T> {
    pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self;
}

// core::result

impl Result<T, E> {
    pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self;
    pub fn inspect_err<F: FnOnce(&E)>(self, f: F) -> Self;
}
```

<br>

Tracking issue: https://github.com/rust-lang/rust/issues/91345.
Implementation PR: https://github.com/rust-lang/rust/pull/91346.

Closes https://github.com/rust-lang/rust/issues/91345.
2023-11-13 19:46:18 +00:00
bors
177d8f2ee5 Auto merge of #3163 - RalfJung:borrow-privacy, r=RalfJung
don't expose all the borrow tracker stuff to the entire crate
2023-11-13 19:42:58 +00:00