Commit Graph

29983 Commits

Author SHA1 Message Date
sjwang05
614ddc9695
Suggest lhs deref for binops 2023-11-13 16:25:16 -08:00
Michael Goulet
a8a2ee4e8f Recover dyn and impl after for<...> 2023-11-14 00:15:10 +00: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
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
Josh Stone
855388e9a2
Mention LLVM 64186 in a comment 2023-11-13 11:04:53 -08:00
bors
531cb83fcf Auto merge of #117881 - TaKO8Ki:rollup-n7jtmgj, r=TaKO8Ki
Rollup of 5 pull requests

Successful merges:

 - #117737 (Remove `-Zkeep-hygiene-data`.)
 - #117830 (Small improvements in object lifetime default code)
 - #117858 (Compute layout with spans for better cycle errors in coroutines)
 - #117863 (Remove some unused stuff from `rustc_index`)
 - #117872 (Cranelift isn't available on non-nightly channels)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-13 17:29:00 +00:00
Takayuki Maeda
19bffe1ea6
Rollup merge of #117863 - nnethercote:rustc_index, r=Mark-Simulacrum
Remove some unused stuff from `rustc_index`

r? `@Mark-Simulacrum`
2023-11-14 00:54:17 +09:00
Takayuki Maeda
cf21b6ef28
Rollup merge of #117858 - compiler-errors:span, r=lcnr
Compute layout with spans for better cycle errors in coroutines

Split out from #117703, this PR at least gives us a nicer span to point at when we hit a cycle error in coroutine layout cycles.
2023-11-14 00:54:16 +09:00
Takayuki Maeda
826b181cef
Rollup merge of #117830 - Nilstrieb:object-lifetime-default-nits, r=cjgillot
Small improvements in object lifetime default code

I found those while trying to understand how the code works.
2023-11-14 00:54:16 +09:00
Takayuki Maeda
bf8cf456b6
Rollup merge of #117737 - nnethercote:rm-Zkeep-hygiene-data, r=petrochenkov
Remove `-Zkeep-hygiene-data`.

It was added way back in #28585 under the name `-Zkeep-mtwt-tables`. The justification was:

> This is so that the resolution results can be used after analysis,
> potentially for tool support.

There are no uses of significance in the code base, and various Google searches for both option names (and variants) found nothing of interest. I think this can safely be removed.

r? `@davidtwco`
2023-11-14 00:54:15 +09:00
Gavin Gray
60d99ab883 Fix overflow and cycle bound for ProofTreeVisitor. 2023-11-13 16:36:01 +01:00
bors
4bd2fd5c83 Auto merge of #117876 - lcnr:region-kind-rename, r=BoxyUwU
`ReLateBound` -> `ReBound`

first step of https://github.com/rust-lang/types-team/issues/95

already fairly large xx

there's some future work here I intentionally did not contribute as part of this PR, from my notes:
- `DescriptionCtx` to `DescriptionCtxt`
- what is `CheckRegions::Bound`?
- `collect_late_bound_regions` et al
- `erase_late_bound_regions` -> `instantiate_bound_regions_with_erased`?
- `EraseEarlyRegions` should be removed, feels duplicate

r? `@BoxyUwU`
2023-11-13 15:33:01 +00:00
lcnr
8935a1be01 update type flags
- `HAS_RE_LATE_BOUND` -> `HAS_RE_BOUND`
- `HAS_TY_LATE_BOUND` -> `HAS_TY_BOUND`
- `HAS_CT_LATE_BOUND` -> `HAS_CT_BOUND`
- `HAS_LATE_BOUND` -> `HAS_BOUND_VARS`
- `fn has_late_bound_regions` -> `fn has_bound_regions`
- `fnhas_non_region_late_bound` -> `fn has_non_region_bound_vars`
- `fn has_late_bound_vars` -> `fn has_bound_vars`
2023-11-13 14:13:54 +00:00
lcnr
dd0739aabe continue renaming
- `RegionVariableOrigin::~~Late~~BoundRegion`
- `~~Late~~BoundRegionConversionTime`
2023-11-13 14:13:54 +00:00
lcnr
86fa1317a3 rename ReLateBound to ReBound
other changes:
- `Region::new_late_bound` -> `Region::new_bound`
- `Region::is_late_bound` -> `Region::is_bound`
2023-11-13 14:13:54 +00:00
lcnr
28328c8389 remove unnecessary _ in variable name 2023-11-13 14:13:54 +00:00
lcnr
85883503c3 add fixme to RegionCtxt 2023-11-13 14:13:54 +00:00
bors
1ab2bcda43 Auto merge of #117811 - MU001999:master, r=lcnr
Turn assert_eq into a delay_span_bug

Fixes #117789
2023-11-13 12:17:22 +00:00
lcnr
42945fc1e2 args~~_ref~~_may_unify 2023-11-13 11:27:15 +00:00
Ralf Jung
6dd2ea0f35 features must be additive 2023-11-13 09:41:45 +01:00
bors
c225c45bce Auto merge of #117862 - SpeedReach:patch-1, r=nnethercote
Fix comment in compiler/rustc_ast/src/token.rs.

Gt -> Greater than -> `>`
Ge -> Greater equal -> `>=`
2023-11-13 08:14:01 +00:00
bors
b5cdb9631f Auto merge of #117827 - Zalathar:bogus-macro-name-span, r=davidtwco
coverage: Avoid creating malformed macro name spans

This is a workaround for #117788. It detects a particular scenario where we would create malformed coverage spans that might cause `llvm-cov` to immediately exit with an error, preventing the user from processing coverage reports.

The patch has been kept as simple as possible so that it's trivial to backport to beta (or stable) if desired.

---

The `maybe_push_macro_name_span` method is trying to detect macro invocations, so that it can split a span into two parts just after the `!` of the invocation.

Under some circumstances (probably involving nested macros), it gets confused and produces a span that is larger than the original span, and possibly extends outside its enclosing function and even into an adjacent file.

In extreme cases, that can result in malformed coverage mappings that cause `llvm-cov` to fail. For now, we at least want to detect these egregious cases and avoid them, so that coverage reports can still be produced.
2023-11-13 06:16:27 +00:00
Nicholas Nethercote
82e396a4ba Remove unnecessary annotation. 2023-11-13 17:09:26 +11:00
Nicholas Nethercote
2433542b41 Remove IndexSlice::convert_index_type. 2023-11-13 17:00:48 +11:00
Nicholas Nethercote
8b18c16ecb Remove impl FiniteBitSetTy for {u64,u128}.
Only the impl for `u32` is used. These can be reinstated easily if
needed in the future.
2023-11-13 16:44:20 +11:00
Nicholas Nethercote
b7cf697a6d Remove BitSet::to_hybrid. 2023-11-13 16:26:26 +11:00
Nicholas Nethercote
06faf589ac Remove BitSet::words. 2023-11-13 16:24:16 +11:00
Sleep_AllDay
8c0ae83723
Fix comment
Gt => Greater than => `>`
Ge => Greater equal => `>=`
2023-11-13 13:15:55 +08:00
Michael Goulet
7994b5849c Compute layout with spans for better cycle errors in coroutines 2023-11-13 02:22:25 +00:00
bors
ea1e5cc91f Auto merge of #117770 - sjwang05:issue-117766, r=estebank,TaKO8Ki
Catch stray `{` in let-chains

Fixes #117766
2023-11-13 01:57:59 +00:00
Esteban Küber
69634f2077 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-13 00:52:10 +00:00
Mu001999
62b6529e03 Turn assert_eq into a delay_span_bug 2023-11-13 08:36:12 +08:00
sjwang05
274824b917
Fix is_keyword_ahead visibility
Co-authored-by: Takayuki Maeda <takoyaki0316@gmail.com>
2023-11-12 14:46:01 -08:00
Nicholas Nethercote
aefbb616af 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.
2023-11-13 09:45:20 +11:00
Michael Goulet
99664b0bbf Don't expect a rcvr in print_disambiguation_help 2023-11-12 19:59:13 +00:00
Michael Goulet
121d9f5b16 make LayoutError::Cycle carry ErrorGuaranteed 2023-11-12 18:59:18 +00:00
Nilstrieb
e5c330ac48 Note about object lifetime defaults in does not live long enough error
This is a aspect of Rust that frequently trips up people who are not
aware of it yet. This diagnostic attempts to explain what's happening
and why the lifetime constraint, that was never mentioned in the source,
arose.
2023-11-12 13:51:16 +01:00
Ralf Jung
31493c70fa interpret: simplify handling of shifts by no longer trying to handle signed and unsigned shift amounts in the same branch 2023-11-12 12:49:46 +01:00
Ralf Jung
5b5006916b target_feature: make it more clear what that 'Option' means 2023-11-12 12:46:05 +01:00
Nilstrieb
8bcd221b4c Small improvements in object lifetime default code
I found those while trying to understand how the code works.
2023-11-12 11:59:01 +01:00
Ralf Jung
f6a49ba416 patterns: don't ice when encountering a raw str slice 2023-11-12 09:43:08 +01:00
Zalathar
ed8298b825 coverage: Avoid creating malformed macro name spans
This method is trying to detect macro invocations, so that it can split a span
into two parts just after the `!` of the invocation.

Under some circumstances (probably involving nested macros), it gets confused
and produces a span that is larger than the original span, and possibly extends
outside its enclosing function and even into an adjacent file.

In extreme cases, that can result in malformed coverage mappings that cause
`llvm-cov` to fail. For now, we at least want to detect these egregious cases
and avoid them, so that coverage reports can still be produced.
2023-11-12 18:33:11 +11:00
bors
a04d56b36d Auto merge of #117817 - fmease:deny-more-tilde-const, r=fee1-dead
Deny more `~const` trait bounds

thereby fixing a family of ICEs (delayed bugs) for `feature(const_trait_impl, effects)` code.

As discussed
r? `@fee1-dead`
2023-11-12 04:40:44 +00:00
Paul Menage
2e6b57541d Add -Z llvm_module_flag
Allow adding values to the `!llvm.module.flags` metadata for a generated
module.  The syntax is

`-Z llvm_module_flag=<name>:<type>:<value>:<behavior>`

Currently only u32 values are supported but the type is required to be
specified for forward compatibility.  The `behavior` element must match
one of the named LLVM metadata behaviors.viors.

This flag is expected to be perma-unstable.
2023-11-11 19:48:47 -08:00
León Orell Valerian Liehr
8ce5d784a6
Deny more ~const trait bounds 2023-11-12 00:00:12 +01:00
sjwang05
f88cf0206f
Move unclosed delim errors to separate function 2023-11-11 13:39:08 -08:00
BlackHoleFox
b27c3b7f21 Remove legacy bitcode from all Apple specs 2023-11-11 15:12:21 -06:00
bors
2c1b65ee14 Auto merge of #115694 - clarfonthey:std-hash-private, r=dtolnay
Add `std:#️⃣:{DefaultHasher, RandomState}` exports (needs FCP)

This implements rust-lang/libs-team#267 to move the libstd hasher types to `std::hash` where they belong, instead of `std::collections::hash_map`.

<details><summary>The below no longer applies, but is kept for clarity.</summary>
This is a small refactor for #27242, which moves the definitions of `RandomState` and `DefaultHasher` into `std::hash`, but in a way that won't be noticed in the public API.

I've opened rust-lang/libs-team#267 as a formal ACP to move these directly into the root of `std::hash`, but for now, they're at least separated out from the collections code in a way that will make moving that around easier.

I decided to simply copy the rustdoc for `std::hash` from `core::hash` since I think it would be ideal for the two to diverge longer-term, especially if the ACP is accepted. However, I would be willing to factor them out into a common markdown document if that's preferred.
</details>
2023-11-11 21:12:20 +00:00
León Orell Valerian Liehr
732b4bb664
Make rustc_parse_format compile on stable again 2023-11-11 15:48:13 +01:00
Ralf Jung
581a317bbb rustc_log: provide a way to init logging based on the values, not names, of the env vars 2023-11-11 15:24:33 +01:00
Tomasz Miąsko
d7d2e761e0 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-11 01:51:09 +01:00
Kirby Linvill
ae1726bfce
Ignore FieldIdx and VariantIdx examples in docs 2023-11-10 17:18:59 -07:00
bors
edf0b1db0a Auto merge of #115229 - iSwapna:issue-115222-fix, r=estebank
On method chain expression failure, look for missing method in earlier segments of the chain

This PR tries to fix the issue: https://github.com/rust-lang/rust/issues/115222

As suggested by `@estebank` , I did the following:
1. Add new test `tests/ui/structs/method-chain-expression-failure.rs`
2. In `compiler/rusct_hir_tycheck/src/method/suggest.rs`
   walking up the method chain and calling `probe_for_name` with the method name. But the call fails to return `Ok`.
2023-11-10 21:10:30 +00:00
Swapna Iyer
56a109d15b Recurse over the method chain and maintain a stack to peek at previous receiver to align spans 2023-11-10 13:00:27 -08:00
sjwang05
a49368f00b
Correctly handle while-let-chains 2023-11-10 12:13:53 -08:00
Kirby Linvill
d517a1cbda
Add SMIR visitor for Places and projections 2023-11-10 11:25:58 -07:00
Oğuz Ağcayazı
6812f64c35 add CoroutineWitness to covered types 2023-11-10 17:02:08 +03:00
bjorn3
d186b49460 Merge commit 'c84d1871dc4456539b7b578830268ab3539915d0' into sync_cg_clif-2023-11-10 2023-11-10 11:30:51 +00:00
sjwang05
9455259450
Catch an edge case 2023-11-09 20:07:17 -08:00
Kirby Linvill
998aa383ba
Defer Place ty implementation in Stable Mir to later PR 2023-11-09 20:56:40 -07:00
Kirby Linvill
2e70d95cdb
Remove rich UserTypeProjection projections in SMIR
It's not clear to me (klinvill) that UserTypeProjections are produced
anymore with the removal of type ascriptions as per
https://github.com/rust-lang/rfcs/pull/3307. Furthermore, it's not clear
to me which variants of ProjectionElem could appear in such projections.
For these reasons, I'm reverting projections in UserTypeProjections to
simple strings until I can get more clarity on UserTypeProjections.
2023-11-09 20:56:40 -07:00
Kirby Linvill
b1585983cc
Add stable MIR Projections support based on MIR structure
This commit includes richer projections for both Places and
UserTypeProjections. However, the tests only touch on Places. There are
also outstanding TODOs regarding how projections should be resolved to
produce Place types, and regarding if UserTypeProjections should just
contain ProjectionElem<(),()> objects as in MIR.
2023-11-09 20:56:35 -07:00
Nicholas Nethercote
2e40d11f8c Remove -Zkeep-hygiene-data.
It was added way back in #28585 under the name `-Zkeep-mtwt-tables`. The
justification was:

> This is so that the resolution results can be used after analysis,
> potentially for tool support.

There are no uses of significance in the code base, and various Google
searches for both option names (and variants) found nothing of interest.

@petrochenkov says removing this part (and it's only part) of the
hygiene data is dubious. It doesn't seem that big, so let's just keep it
around.
2023-11-10 14:00:08 +11:00
sjwang05
0094238157
Catch stray { in let-chains 2023-11-09 18:47:49 -08:00
Matthias Krüger
7607597d3a
Rollup merge of #117743 - sjwang05:issue-117720, r=estebank
Suggest removing `;` for `;` within let-chains

Fixes #117720
2023-11-10 01:50:25 +01:00
Matthias Krüger
7fd7719ca1
Rollup merge of #117741 - eltociear:patch-23, r=compiler-errors
Fix typo in internal.rs

covert -> convert
2023-11-10 01:50:25 +01:00
Nicholas Nethercote
dd6bab9eff Factor out some duplicated code. 2023-11-10 10:54:26 +11:00
Nicholas Nethercote
316ffba3c8 Update instructions in a comment.
And avoid duplication.
2023-11-10 10:54:26 +11:00
Nicholas Nethercote
b35e576657 Minor cleanups.
- Reduce some function exposure.
- Fix some comment formatting.
2023-11-10 10:54:26 +11:00
Nicholas Nethercote
49908b4d90 Simplify the current_rustc_version macro.
It currently has the syntax
`current_rustc_version!(env!("CFG_RELEASE"))` where the
`env!("CFG_RELEASE")` part looks like a normal expression but it is
actually parsed and processed by the `current_rustc_version` macro.

The documented rationale for this is that you'll find it if you grep for
`env!("CFG_RELEASE")`. But I think that's of very little use -- I would
personally grep for just "CFG_RELEASE" -- and it complicates the macro,
requiring the use of `syn`.

This commit simplifies the macro.
2023-11-10 10:54:21 +11:00
bors
0f44eb32f1 Auto merge of #117727 - saethlin:inline-derived-fmt, r=nnethercote
Emit #[inline] on derive(Debug)

While working on https://github.com/rust-lang/rust/pull/116583 I noticed that the `cross_crate_inlinable` query identifies a lot of derived `Debug` impls as a MIR body that's little more than a call, which suggests they may be a good candidate for `#[inline]`. So here I've implemented that change specifically.

It seems to provide a nice improvement to build times.
2023-11-09 21:34:14 +00:00
Ben Kimock
d32d9238cf Emit #[inline] on derive(Debug) 2023-11-09 10:40:55 -05:00
bors
b7583d38b7 Auto merge of #117712 - lcnr:expand-coroutine, r=jackh726
generator layout: ignore fake borrows

fixes #117059

We emit fake shallow borrows in case the scrutinee place uses a `Deref` and there is a match guard. This is necessary to prevent the match guard from mutating the scrutinee: fab1054e17/compiler/rustc_mir_build/src/build/matches/mod.rs (L1250-L1265)

These fake borrows end up impacting the generator witness computation in `mir_generator_witnesses`, which causes the issue in #117059. This PR now completely ignores fake borrows during this computation. This is sound as thse are always removed after analysis and the actual computation of the generator layout happens afterwards.

Only the second commit impacts behavior, and could be backported by itself.

r? types
2023-11-09 14:23:45 +00:00
bors
e7998aa21f Auto merge of #117734 - nnethercote:rm-Zstrip, r=davidtwco
Remove `-Z strip`.

It was stabilized as `-C strip` in November 2021. The unstable option was kept around as a temporary measure to ease the transition. Two years is more than enough!

r? `@tmandry`
2023-11-09 12:26:28 +00:00
lcnr
fce71adf31 remove stability assert in evaluate_goal 2023-11-09 11:32:51 +01:00
lcnr
442e112d17 update overflow handling for norm, add test 2023-11-09 11:32:51 +01:00
lcnr
e3850f404d rework alias-relate to norm(lhs) == norm(rhs) 2023-11-09 11:32:50 +01:00
lcnr
1c54494888 only instantiate opaques with rigid types 2023-11-09 11:32:12 +01:00
lcnr
1f12f1cc83 try_normalize_ty end with rigid alias on failure 2023-11-09 11:31:22 +01:00
bors
287ae4db75 Auto merge of #117632 - Nilstrieb:icup, r=davidtwco
Update ICU4X

This updates all ICU4X crates and regenerates rustc_baked_icu_data.

Since the new unicode license under which they are licensed does not have an SPDX identifier yet, we define some exceptions. The license has to be reviewed to make sure it is still fine to use here, but I assume that is the case.

I also added an exception for rustc_icu_data to the unexplained ignore doctest tidy lint. This is a bit hacky but the whole style.rs in tidy is a mess so I didn't want to touch it more than this small hack.

part of #112865

r? `@davidtwco` `@wesleywiser` `@Manishearth`
2023-11-09 09:00:57 +00:00
sjwang05
5693a34db2
Suggest fix for ; within let-chains 2023-11-09 00:31:42 -08:00
Ikko Eltociear Ashimine
b8648216a5
Fix typo in internal.rs
covert -> convert
2023-11-09 16:10:37 +09:00
Takayuki Maeda
b4fa5b7004
Rollup merge of #117694 - jmillikin:core-io-borrowed-buf, r=m-ou-se
Move `BorrowedBuf` and `BorrowedCursor` from `std:io` to `core::io`

Tracking issue: https://github.com/rust-lang/rust/issues/117693

ACP: https://github.com/rust-lang/libs-team/issues/290
2023-11-09 11:36:52 +09:00
Takayuki Maeda
4cc549811f
Rollup merge of #117645 - compiler-errors:auto-trait-subst, r=petrochenkov
Extend builtin/auto trait args with error when they have >1 argument

Reuse `extend_with_error` to add error args to any auto trait (or built-in trait like `Copy` that is defined incorrectly) that has additional non-`Self` args.

Fixes #117628
2023-11-09 11:36:52 +09:00
bors
d8dbf7ca0e Auto merge of #117557 - Zoxc:panic-prio, r=petrochenkov
Make `FatalErrorMarker` lower priority than other panics

This makes `FatalErrorMarker` lower priority than other panics in a parallel sections. If any other panics occur, they will be unwound instead of `FatalErrorMarker`. This ensures `rustc` will exit with the correct error code on ICEs.

This fixes https://github.com/rust-lang/rust/issues/116659.
2023-11-09 00:39:02 +00:00
Nicholas Nethercote
ecc936b155 Remove -Z strip.
It was stabilized as `-C strip` in November 2021. The unstable option
was kept around as a temporary measure to ease the transition. Two years
is more than enough!
2023-11-09 11:36:02 +11:00
John Millikin
341c85648c Move BorrowedBuf and BorrowedCursor from std:io to core::io
Assigned new feature name `core_io_borrowed_buf` to distinguish from the
`Read::read_buf` functionality in `std::io`.
2023-11-09 07:10:11 +09:00
lcnr
992d93f687 rename BorrowKind::Shallow to Fake
also adds some comments
2023-11-08 22:55:28 +01:00
lcnr
a42eca42df generator layout: ignore fake borrows 2023-11-08 22:55:28 +01:00
bors
fdaaaf9f92 Auto merge of #116930 - RalfJung:raw-ptr-match, r=davidtwco
patterns: reject raw pointers that are not just integers

Matching against `0 as *const i32` is fine, matching against `&42 as *const i32` is not.

This extends the existing check against function pointers and wide pointers: we now uniformly reject all these pointer types during valtree construction, and then later lint because of that. See [here](https://github.com/rust-lang/rust/pull/116930#issuecomment-1784654073) for some more explanation and context.

Also fixes https://github.com/rust-lang/rust/issues/116929.

Cc `@oli-obk` `@lcnr`
2023-11-08 20:42:32 +00:00
Ralf Jung
30588657b7 avoid unnecessary nested conditionals 2023-11-08 20:37:08 +01:00
bors
90fdc1fc27 Auto merge of #117716 - GuillaumeGomez:rollup-83gnhll, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #117263 (handle the case when the change-id isn't found)
 - #117282 (Recover from incorrectly ordered/duplicated function keywords)
 - #117679 (tests/rustdoc-json: Avoid needless use of `no_core` and `lang_items`)
 - #117702 (target: move base and target specifications)
 - #117713 (Add test for reexported hidden item with `--document-hidden-items`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-08 18:33:23 +00:00
Guillaume Gomez
d8c52b378d
Rollup merge of #117702 - davidtwco:target-tier-refactors, r=petrochenkov
target: move base and target specifications

Follow-up to #116004.

In anticipation of later PRs where we'll want to add tidy checks to ensure that, for each target, we have a test or a platform support document or something like that, this PR moves target specifications into a directory on their own so that we can just list the files in this directory to get a list of all targets.

- Base specifications are moved to `rustc_target::spec::base`.
- Target specifications are moved to `rustc_target::spec::targets`.
- All the other source files containing types used in the target specs remain in `rustc_target::spec`.
  - `rustc_target/src/spec/abi.rs` is moved to `rustc_target/src/spec/abi/mod.rs` (where there was already a `tests.rs`) for uniformity.

r? ``@petrochenkov``
2023-11-08 17:14:37 +01:00
Guillaume Gomez
c828371179
Rollup merge of #117282 - clubby789:recover-wrong-function-header, r=TaKO8Ki
Recover from incorrectly ordered/duplicated function keywords

Fixes #115714
2023-11-08 17:14:36 +01:00
bors
341efb1017 Auto merge of #117560 - lqd:issue-117146, r=matthewjasper
Compute polonius loan scopes over the region graph

In issue #117146 a loan flows into an SCC containing a placeholder, and whose representative is an existential region. Since we currently compute loan scopes by looking at SCCs and their representatives only, polonius would compute kill points for this loan here whereas NLLs would not of course.

There are a few ways to fix this:
- don't try to be efficient by doing the computation over SCCs, and simply look for free regions and placeholders in the successors of the issuing region.
- change how the SCC representatives are picked, biasing towards placeholders over existential regions. They *shouldn't* matter much, but some downstream code may subtly depend on the current scheme (though no tests fail if we do such a change). This is for unrelated reasons also the way #116891 changes the representative computation. So that PR would also fix issue #117146.
- try to remove placeholders from the main path, and contain them to a pre-pass + a post-pass kind of polonius leak check. If possible, it would fix this issue by turning an outlives constraints to a placeholder into a constraint to 'static. This should also fix the issue, as the representative would be the free region in the SCC. We want to prototype this change to see if it's possible to try to simplify the borrowck main path from having to deal with placeholders and higher-ranked subtyping 🤞.

I'd like to take advantage of fuzzing and a crater run sooner rather than later, so that we grow more confidence that the 2 models are indeed equivalent empirically. Therefore this PR implements option 1 to fix the issue now.

We can take care of efficiency later after validation, and once we implement option 3 (which could also impact option 2 and that associated PR, maybe the lack of placeholders could remove the need to change the representative computation) to traverse SCCs and their representative again.

(Or we maybe will have some kind of naive position-dependent outlives propagation by then and this code would have been changed)

Fixes #117146.

r? `@matthewjasper`
2023-11-08 16:13:37 +00:00
Max Tilley
1854776fa9 Reorder type mismatch suggestions
Suggestions are reordered to to make sure potential missing expect on Option/Result runs
before the suggestion to remove the last method call
2023-11-08 14:15:25 +00:00
bors
755629fe59 Auto merge of #117706 - matthiaskrgr:rollup-lscx7dg, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #114316 (Add AIX platform support document)
 - #117531 (rustdoc: properly elide cross-crate host effect args)
 - #117650 (Add -Zcross-crate-inline-threshold=yes)
 - #117663 (bump some deps)
 - #117667 (Document clippy_config in nightly-rustc docs)
 - #117698 (Clarify `space_between`)
 - #117700 (coverage: Rename the `run-coverage` test mode to `coverage-run`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-08 12:06:04 +00:00
lcnr
bf360d407e instrument constituent types computation 2023-11-08 12:24:42 +01:00
Matthias Krüger
55306535dd
Rollup merge of #117698 - nnethercote:space_between-2, r=petrochenkov
Clarify `space_between`

r? ``@petrochenkov``
2023-11-08 11:25:56 +01:00
Matthias Krüger
8198864377
Rollup merge of #117650 - saethlin:inline-me-please, r=davidtwco
Add -Zcross-crate-inline-threshold=yes

``@thomcc`` says this would be useful for

>  seeing if it makes a difference in some code if i do it when building the sysroot, since -Zbuild-std + lto helps more than it seems like it should

And I've changed the possible values as a reference to ``@Manishearth`` saying

> LLVM's inlining heuristic is "yes".
2023-11-08 11:25:54 +01:00
bors
fab1054e17 Auto merge of #117542 - compiler-errors:only-normalize-predicate, r=lcnr
Only use `normalize_param_env` when normalizing predicate in `check_item_bounds`

Only use the `normalize_param_env` when normalizing the item bound predicate in `check_item_bounds`, instead of using it when processing this obligation as well. This causes <BUG> to reoccur, but hopefully with better caching in the future, we can fix this would having such bad effects on perf.

This PR also fixes #117598. It turns out that the GAT predicate that we install is actually wrong -- given code like:

```
impl<'r> HasValueRef<'r> for Any {
    type Database = Any;
}
```

We currently generate a predicate that looks like `<Any as HasValueRef<'r>>::Database = Any`, where `'r` is an early-bound variable. Really this GAT assumption should be universally quantified over the impl's args, i.e. `for<'r> <Any as HasValueRef<'r>>::Database = Any`, but then we'd need the binder to also include all the WC of the impl as well, which we don't support yet, lol.
2023-11-08 10:08:44 +00:00
David Wood
ef7ebaa788
rustc_target: move file for uniformity
Signed-off-by: David Wood <david@davidtw.co>
2023-11-08 14:37:54 +08:00
David Wood
1af256fe8a
targets: move target specs to spec/targets
Signed-off-by: David Wood <david@davidtw.co>
2023-11-08 14:25:45 +08:00
David Wood
76aa83e3e1
target: move base specs to spec/base
Signed-off-by: David Wood <david@davidtw.co>
2023-11-08 14:15:26 +08:00
Nicholas Nethercote
783d4b8b26 Clarify space_between.
To avoid `!matches!(...)`, which is hard to think about. Instead every
case now uses direct pattern matching and returns true or false.

Also add a couple of cases to the `stringify.rs` test that currently
print badly.
2023-11-08 14:39:59 +11:00
Michael Goulet
97c9d8f405 Only use normalize_param_env when normalizing predicate in check_item_bounds 2023-11-08 02:35:25 +00:00
Matthias Krüger
f72e974e3f
Rollup merge of #117655 - compiler-errors:method-tweaks, r=estebank
Method suggestion code tweaks

I was rummaging around the method suggestion code after https://github.com/rust-lang/rust/pull/117006#discussion_r1384153722 and saw a few things to simplify.

This is two unrelated commits, both in the same file. Review them separately, if you'd like.

r? estebank
2023-11-08 00:47:52 +01:00
Matthias Krüger
7552dd19ad
Rollup merge of #117625 - nnethercote:clippy-perf, r=cuviper
Fix some clippy perf lints

`@matthiaskrgr` gave me the output of a clippy run with perf lints enabled. This PR fixes ones that I thought were worth fixing.

r? `@cuviper`
2023-11-08 00:47:51 +01:00
Matthias Krüger
3c6307240c
Rollup merge of #116399 - WaffleLapkin:erase_small_things, r=cjgillot
Small changes w/ `query::Erase<_>`

r? `@cjgillot`
cc `@Zoxc`
2023-11-08 00:47:51 +01:00
Matthias Krüger
b724d9c90e
Rollup merge of #113925 - clubby789:const-ctor-repeat, r=estebank
Improve diagnostic for const ctors in array repeat expressions

Fixes #113912
2023-11-08 00:47:50 +01:00
Ben Kimock
fcdd99edca Add -Zcross-crate-inline-threshold=yes 2023-11-07 18:45:11 -05:00
Nicholas Nethercote
1b3733e5a4 rustc: minor changes suggested by clippy perf lints. 2023-11-08 08:57:57 +11:00
Michael Goulet
0ba7d19769 Build pre-coroutine-transform coroutine body 2023-11-07 21:14:43 +00:00
Maybe Waffle
eca9a1533f Add an explanation for transmute_unchecked 2023-11-07 20:31:55 +00:00
Matthias Krüger
518fe492f1
Rollup merge of #117675 - zmodem:vectorize_h, r=durin42
llvm-wrapper: Remove include of non-existant Vectorize.h

LLVM recently removed the header: 2400c54c37

It only contained a declaration of `createLoadStoreVectorizerPass()`, which Rust doesn't reference.
2023-11-07 19:29:57 +01:00
Matthias Krüger
f8c67704f2
Rollup merge of #117616 - RalfJung:unstable-target-features, r=compiler-errors
warn when using an unstable feature with -Ctarget-feature

Setting or unsetting the wrong target features can cause ABI incompatibility (https://github.com/rust-lang/rust/issues/116344, https://github.com/rust-lang/rust/issues/116558). We need to carefully audit features for their ABI impact before stabilization. I just learned that we currently accept arbitrary unstable features on stable and if they are in the list of Rust target features, even unstable, then we don't even warn about that!1 That doesn't seem great, so I propose we introduce a warning here.

This has an obvious loophole via `-Ctarget-cpu`. I'm not sure how to best deal with that, but it seems better to fix what we can and think about the other cases later, maybe once we have a better idea for how to resolve the general mess that are ABI-affecting target features.
2023-11-07 19:29:56 +01:00
Matthias Krüger
cd5b5e08fe
Rollup merge of #115485 - DaniPopes:rustdoc-macro-consts, r=jackh726,fmease
Format macro const literals with pretty printer

Fixes #115295
2023-11-07 19:29:56 +01:00
Ralf Jung
0865a2ec78 test and fix some more targets 2023-11-07 17:21:02 +01:00
Hans Wennborg
752a6132e5 llvm-wrapper: Remove include of non-existant Vectorize.h 2023-11-07 16:40:35 +01:00
bors
187d1afa9d Auto merge of #117297 - clubby789:fn-trait-missing-paren, r=TaKO8Ki
Give a better diagnostic for missing parens in Fn* bounds

Fixes #108109

It would be nice to try and recover here, but I'm not sure it's worth the effort, especially as the bounds on the recovered function would be incorrect.
2023-11-07 13:04:56 +00:00
bors
61a3eea804 Auto merge of #117229 - matthewjasper:thir-unsafeck-fixes, r=cjgillot
Thir unsafeck fixes

- Recognise thread local statics in THIR unsafeck
- Add suggestion for unsafe_op_in_unsafe_fn
- Fix unsafe checking of let expressions
2023-11-07 10:41:10 +00:00
bors
114f1f6838 Auto merge of #117610 - compiler-errors:object-hmm, r=aliemjay
Only instantiate binder during dyn's built-in trait candidate probe once

See UI test for demonstration of the issue.

This was "caused" by #117131, but only because we're using the `normalize_param_env` (which has been augmented with a projection clause used to normalize GATs) which features non-lifetime bound vars in it.

Fixes #117602 technically, though that's also fixed by #117542.

r? types
2023-11-07 08:43:08 +00:00
bors
504f63efb0 Auto merge of #117418 - compiler-errors:better_error_body, r=oli-obk
Build a better MIR body when errors are encountered

Doesn't really have much of an effect on its own, but it does lead to a less confusing phony MIR body being generated when an error is detected during THIR/MIR/match building. This was quite confusing when I hacked `-Zunpretty=mir` to emit `mir_built` rather than `instance_mir`.

This coincidentually also fixes #117413, but not as generally as #117416.

cc `@Nadrieril`
2023-11-07 06:42:20 +00:00
Michael Goulet
0add056dee Rework print_disambiguation_help 2023-11-07 05:23:09 +00:00
Michael Goulet
88a37acb26 Yeet MethodCallComponents 2023-11-07 05:13:22 +00:00
bors
4e0fb98a5c Auto merge of #117006 - estebank:issue-69512, r=compiler-errors
When not finding assoc fn on type, look for builder fn

When we have a resolution error when looking at a fully qualified path on a type, look for all associated functions on inherent impls that return `Self` and mention them to the user.

```
error[E0599]: no function or associated item named `new` found for struct `TcpStream` in the current scope
   --> tests/ui/resolve/fn-new-doesnt-exist.rs:4:28
    |
4   |    let stream = TcpStream::new();
    |                            ^^^ function or associated item not found in `TcpStream`
    |
note: if you're trying to build a new `TcpStream` consider using one of the following associated functions:
      TcpStream::connect
      TcpStream::connect_timeout
   --> /home/gh-estebank/rust/library/std/src/net/tcp.rs:156:5
    |
156 |     pub fn connect<A: ToSocketAddrs>(addr: A) -> io::Result<TcpStream> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
172 |     pub fn connect_timeout(addr: &SocketAddr, timeout: Duration) -> io::Result<TcpStream> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
Fix #69512.
2023-11-07 02:05:30 +00:00
Esteban Küber
f926031ea5 When not finding assoc fn on type, look for builder fn
When we have a resolution error when looking at a fully qualified path
on a type, look for all associated functions on inherent impls that
return `Self` and mention them to the user.

Fix #69512.
2023-11-07 00:54:10 +00:00
bors
7b97a5ca84 Auto merge of #117511 - gurry:117406-err-packed-structs, r=compiler-errors
Emit explanatory note for move errors in packed struct derives

Derive expansions for packed structs with non-`Copy` fields cause move errors because they prefer copying over borrowing since borrowing the fields of a packed struct can result in unaligned access.

This underlying cause of the errors, however, is not apparent to the user. This PR adds a diagnostic note to make it clear to the user (the new note is on the second last line):

```
tests/ui/derives/deriving-with-repr-packed-move-errors.rs:13:16
   |
12 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
   |          ----- in this derive macro expansion
13 | struct StructA(String);
   |                ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
   |
   = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
```

Fixes #117406

Partially addresses #110777
2023-11-07 00:03:53 +00:00
Michael Goulet
5a9f07cc97 Build a better MIR body when errors are encountered 2023-11-06 23:54:53 +00:00
Michael Goulet
171d5587ca Don't instantiate the binder twice when assembling object candidate 2023-11-06 23:41:33 +00:00
Michael Goulet
24e14dd8b4 Only check predicates for late-bound non-lifetime vars in object candidate assembly 2023-11-06 23:25:32 +00:00
bors
189d6c71f3 Auto merge of #117641 - matthiaskrgr:rollup-f9c12td, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #117190 (add test for #113381)
 - #117516 (add test for #113375)
 - #117631 (Documentation cleanup for core::error::Request.)
 - #117637 (Check binders with bound vars for global bounds that don't hold)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-06 21:43:55 +00:00
Michael Goulet
c17d33f1df Extend builtin/auto trait args with error when they have >1 argument 2023-11-06 21:29:08 +00:00
Matthias Krüger
9efe60b1eb
Rollup merge of #117637 - lqd:trivial-bounds-with-binder-vars, r=compiler-errors
Check binders with bound vars for global bounds that don't hold

This fixes `soa_derive-0.13.0` from #117589's crater run.

r? `@compiler-errors`
2023-11-06 20:31:56 +01:00
bors
fb61292105 Auto merge of #117292 - estebank:issue-80446, r=davidtwco
Detect misparsed binop caused by missing semi

When encountering

```rust
foo()
*bar = baz;
```

We currently emit potentially two errors, one for the return type of
`foo` not being multiplicative by the type of `bar`, and another for
`foo() * bar` not being assignable.

We now check for this case and suggest adding a semicolon in the right
place and emit only a single error.

Fix #80446.
2023-11-06 18:46:04 +00:00
Esteban Küber
4b7aacaa4f Silence redundant error on typo resulting on binop 2023-11-06 17:38:06 +00:00
Matthew Jasper
868de8e76b Visit patterns in THIR let expressions
This fixes some THIR unsafety checking errors not being emitted for
let expressions in these situations.
2023-11-06 16:23:09 +00:00
Matthew Jasper
2b59992736 Add suggestion to THIR unsafe_op_in_unsafe_fn lint 2023-11-06 16:23:09 +00:00
Matthew Jasper
931692fa13 Recognise thread local statics in THIR unsafeck 2023-11-06 16:23:08 +00:00
bors
aea82b268a Auto merge of #117603 - HKalbasi:make-feature-additive, r=Nilstrieb
Make the randomize feature of rustc_abi additive

The goal here is to make rust-analyzer able to build with the `rustc_private` versions of the rustc crates it depends on. See #116847
2023-11-06 16:17:49 +00:00
Rémy Rakic
2beca157c9 check binders with bound vars for global bounds that don't hold
(instead of just late bound vars)
2023-11-06 15:46:17 +00:00
Nilstrieb
ffffc2038f Update ICU4X
This updates all ICU4X crates and regenerates rustc_baked_icu_data.

Since the new unicode license under which they are licensed does not
have an SPDX identifier yet, we define some exceptions. The license has
to be reviewed to make sure it is still fine to use here, but I assume
that is the case.

I also added an exception for rustc_icu_data to the unexplained ignore
doctest tidy lint. This is a bit hacky but the whole style.rs in tidy is
a mess so I didn't want to touch it more than this small hack.
2023-11-06 13:42:20 +00:00
bors
e1fcecb1b9 Auto merge of #117630 - matthiaskrgr:rollup-v0d5p3f, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #117592 (Use the correct span when emitting the `env!` result)
 - #117613 (Remove from vacation and compiler review group)
 - #117615 (Couple of small changes)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-06 12:08:40 +00:00
Matthias Krüger
b88d62e222
Rollup merge of #117615 - bjorn3:misc_changes, r=davidtwco
Couple of small changes

These are unrelated to each other, but they are each small enough that opening separate PR's doesn't make sense to me either.

* Remove a place where the parse driver query is stolen.
* Update an outdated doc comment
* Use correct crate name in `-Zprint-vtable-sizes` when using `#![crate_name = "..."]`.
2023-11-06 11:28:19 +01:00
Matthias Krüger
60dca87cff
Rollup merge of #117592 - thomcc:env-span-wrong, r=davidtwco
Use the correct span when emitting the `env!` result

The span used for the `env!` resut changed in 1.73, due to 75df62d4a2 (from https://github.com/rust-lang/rust/pull/114014).

This prevents [a lint in `plrustc`](https://github.com/tcdi/plrust/blob/main/plrustc/plrustc/src/lints/builtin_macros.rs#L54-L60)[^1] from working well, because the resulting span is not inside the  region where the lint is `#[deny()]`ed.

[^1]: Perhaps worth noting that the `env_macro` diagnostic item comes from [the std fork used with PL/Rust](https://github.com/tcdi/postgrestd/blob/rust-1.73.0/library/core/src/macros/mod.rs#L944).

Unfortunately, I have no idea how to write a test for this since I don't think we can have a custom lint in a test. A suggestion was made to use a custom proc macro for it, but that seems pretty involved (frankly, I might not have time to do it).

r? ``@davidtwco`` (since they're the author of the PR with the regression)

P.S. We generally try to avoid bothering upstream about PL/Rust-specific stuff (we don't want to nag), but this seems like an actual bug, since the other similar macros, such as `option_env` use the other span (and are lintable as a result).
2023-11-06 11:28:18 +01:00
bors
6bf2fb3679 Auto merge of #117578 - compiler-errors:derive-encode-in-rustc_type_ir, r=davidtwco
Derive `TyEncodable`/`TyDecodable` in `rustc_type_ir`

when `derive(TyEncodable)` or `derive(TyDecodable)` sees an `I` type parameter on a struct that has no `'tcx`, then parameterize the `TyEncoder`/`TyDecoder`'s interner over that variable rather than `TyCtxt<'tcx>`.

Also, emit where clauses for fields rather than generics.
2023-11-06 10:10:52 +00:00
Ralf Jung
b85c6835d0 warn when using an unstable feature with -Ctarget-feature 2023-11-06 09:44:00 +01:00
bors
f9b644636f Auto merge of #117435 - SparrowLii:nightly_parallel, r=oli-obk,davidtwco
enable parallel rustc front end in nightly builds

Refers to the [MCP](https://github.com/rust-lang/compiler-team/issues/681), this pr does:
1. Enable the parallel front end in nightly builds, and keep the default number of threads as 1. Then users can use the parallel rustc front end via -Z threads=n option.

2. Set it up to serial front end for beta/stable builds via bootstrap.

3. Switch over the alt builders from parallel rustc to serial, so we have artifacts without parallel to test against the artifacts with parallel.

r? `@oli-obk`

cc `@cjgillot` `@nnethercote` `@bjorn3` `@Kobzol`
2023-11-06 07:41:22 +00:00
bors
152a4e90d1 Auto merge of #117585 - dnbln:feat/move-kw-span, r=cjgillot
Add the `Span` of the `move` keyword to the HIR.

This is required to implement a lint like the one described here: https://github.com/rust-lang/rust-clippy/issues/11721
2023-11-06 02:07:34 +00:00
SparrowLii
f2a40e99ff use portable AtomicU64 for powerPC and MIPS 2023-11-06 09:58:51 +08:00
hkalbasi
c8a25eddfe Make the randomize feature of rustc_abi additive 2023-11-05 21:51:47 +03:30
bjorn3
ec29a02071 Update doc comment for CodegenBackend::link 2023-11-05 16:29:16 +00:00
bjorn3
ba82056a14 Use the actual computed crate name for -Zprint-vtable-sizes 2023-11-05 16:29:15 +00:00
bjorn3
1a1b10fa63 Don't steal the parse query when using --pretty
This is the only place aside from the global_ctxt query where it is
stolen.
2023-11-05 16:29:15 +00:00
bors
992943dbae Auto merge of #117537 - GKFX:offset-of-enum-feature, r=cjgillot
Feature gate enums in offset_of

As requested at https://github.com/rust-lang/rust/issues/106655#issuecomment-1790815262, put enums in offset_of behind their own feature gate.

`@rustbot` label F-offset_of
2023-11-05 13:44:59 +00:00
Matthias Krüger
629ee74337
Rollup merge of #117588 - bjorn3:remove_unused_error_variant, r=cjgillot
Remove unused LoadResult::DecodeIncrCache variant
2023-11-05 12:41:47 +01:00
bors
f64d028196 Auto merge of #117589 - compiler-errors:global-vars-bug, r=jackh726
Make sure that predicates with unmentioned bound vars are still considered global in the old solver

In the old solver, we consider predicates with late-bound vars to not be "global":
9c8a2694fa/compiler/rustc_trait_selection/src/traits/select/mod.rs (L1840-L1844)

The implementation of `has_late_bound_vars` was modified in #115834 so that we'd properly anonymize binders that had late-bound vars but didn't reference them. This fixed an ICE.

However, this also led to a behavioral change in https://github.com/rust-lang/rust/issues/117056#issuecomment-1775014545 for a couple of crates, which now consider `for<'a> GL33: Shader` (note the binder var that is *not* used in the predicate) to not be "global". This forces associated types to not be normalizable due to the old trait solver being dumb.

This PR distinguishes types which *reference* late-bound vars and binders which *have* late-bound vars. The latter is represented with the new type flag `TypeFlags::HAS_BINDER_VARS`, which is used when we only care about knowing whether binders have vars in their bound var list (even if they're not used, like for binder anonymization).

This should fix (after beta backport) the `luminance-gl` and `luminance-webgl` crates in #117056.

r? types
**(priority is kinda high on a review here given beta becomes stable on November 16.)**
2023-11-05 03:58:09 +00:00
bors
4b85902b43 Auto merge of #117590 - matthiaskrgr:rollup-9cqh1q8, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #110340 (Deref docs: expand and remove "smart pointer" qualifier)
 - #116894 (Guarantee that `char` has the same size and alignment as `u32`)
 - #117534 (clarify that the str invariant is a safety, not validity, invariant)
 - #117562 (triagebot no-merges: exclude different case)
 - #117570 (fallback for `construct_generic_bound_failure`)
 - #117583 (Remove `'tcx` lifetime on `PlaceholderConst`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-04 21:15:09 +00:00
Thom Chiovoloni
86fca873ba
Use the correct span when emitting the env! result 2023-11-04 14:04:01 -07:00
Matthias Krüger
8912a2b551
Rollup merge of #117583 - compiler-errors:placeholderconst-lifetime, r=cjgillot
Remove `'tcx` lifetime on `PlaceholderConst`

The `'tcx` lifetime is not needed for anything, so this is a continuation of #117139.
2023-11-04 21:38:30 +01:00
Matthias Krüger
a47c137f3a
Rollup merge of #117570 - bvanjoi:fix-117547, r=cjgillot
fallback for `construct_generic_bound_failure`

Fixes #117547

This case regressed at #115882.

In this context, `generic_param_scope` is produced by `RPITVisitor` and not included by `hir_owner`. Therefore, I've added a fallback to address this.
2023-11-04 21:38:29 +01:00
Michael Goulet
32294fc0ed Make sure that predicates with unmentioned bound vars are still considered global in the old solver 2023-11-04 20:36:21 +00:00
bjorn3
a3b964b9ea Remove unused LoadResult::DecodeIncrCache variant 2023-11-04 20:16:03 +00:00
Dinu Blanovschi
876f698790 Add the vis.visit_capture_by() in noop_visit_expr 2023-11-04 21:11:03 +01:00
Dinu Blanovschi
54ce0346c0 add fn visit_capture_by to MutVisitor and fix pprust-expr-roundtrip.rs 2023-11-04 21:04:54 +01:00
George Bateman
00a9ed34b1
De-indent closing bracket
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2023-11-04 19:50:21 +00:00
Dinu Blanovschi
df85b28b72 fixes for rustfmt + ast visitor 2023-11-04 20:39:15 +01:00
bors
a42d94ebb8 Auto merge of #113343 - saethlin:looser-alignment, r=RalfJung
Update the alignment checks to match rust-lang/reference#1387

Previously, we had a special case to not check `Rvalue::AddressOf` in this pass because we weren't quite sure if pointers needed to be aligned in the Place passed to it: https://github.com/rust-lang/rust/pull/112026

Since https://github.com/rust-lang/reference/pull/1387 merged, this PR updates this pass to match. The behavior of the check is nearly unchanged, except we also avoid inserting a check for creating references. Most of the changes in this PR are cleanup and new tests.
2023-11-04 19:17:02 +00:00
Dinu Blanovschi
a6b41aa6ba fmt 2023-11-04 20:04:02 +01:00
Dinu Blanovschi
241a654c07 Fix remaining uses of CaptureBy::Value 2023-11-04 19:48:44 +01:00
Dinu Blanovschi
8de489918b feat(hir): Store the Span of the move keyword 2023-11-04 19:39:32 +01:00
Michael Goulet
bcb97ea221 No lifetime on PlaceholderConst 2023-11-04 17:36:44 +00:00
Ben Kimock
f9bd7dabcf Check alignment of pointers only when read/written through 2023-11-04 13:01:32 -04:00
Michael Goulet
bee7b5889e Derive TyEncodable/TyDecodable implementations that are parameterized over interner 2023-11-04 16:44:42 +00:00
bohan
a4768fea35 fallback for construct_generic_bound_failure 2023-11-04 22:15:22 +08:00
Nadrieril
f0e8330879 Suggest to set lint level on whole match 2023-11-04 14:44:00 +01:00
Nadrieril
61d0fc7cf5 Warn when lint level is set on a match arm 2023-11-04 14:44:00 +01:00
Takayuki Maeda
c55bf0e72f
Rollup merge of #117554 - durin42:llvm-delete-dead-zext-code, r=nikic
consts: remove dead code around `i1` constant values

`LLVMConstZext` recently got deleted, and it turns out (thanks to `@nikic` for knowing!) that this is dead code. Tests all pass for me without this logic, and per nikic:

> We always generate constants in "relocatable bag of bytes"
> representation, so you're never going to get a plain bool.

So this should be a safe thing to do.

r? `@nikic`
`@rustbot` label: +llvm-main
2023-11-04 12:44:45 +09:00
Takayuki Maeda
c9c851387e
Rollup merge of #117550 - cuviper:try_par_for_each_in, r=est31
Use `filter_map` in `try_par_for_each_in`

This simplifies the expression, especially for the rayon part, and also
lets us drop the `E: Copy` constraint.
2023-11-04 12:44:44 +09:00
Takayuki Maeda
9b9ea77641
Rollup merge of #117343 - Nadrieril:cleanup_check_match, r=davidtwco
Cleanup `rustc_mir_build/../check_match.rs`

The file had become pretty unwieldy, with a fair amount of duplication. As a bonus, I discovered that we weren't running some pattern checks in if-let chains.

I recommend looking commit-by-commit. The last commit is a whim, I think it makes more sense that way but I don't hold this opinion strongly.
2023-11-04 12:44:44 +09:00
Rémy Rakic
de7a8305ae traverse region graph instead of SCCs to compute polonius loan scopes
By using SCC for better performance, we also have to take into account
SCCs whose representative is an existential region but also contains a
placeholder.

By only checking the representative, we may miss that the loan escapes
the function. This can be fixed by picking a better representative, or
removing placeholders from the main path.

This is the simplest fix: forgo efficiency and traverse the region graph
instead of the SCCs.
2023-11-04 01:04:12 +00:00
bors
f1b104f523 Auto merge of #117540 - matthiaskrgr:baby_dont_clone_me_dont_clone_me_no_more, r=est31
clone less
2023-11-04 00:29:52 +00:00
Nicholas Nethercote
5c462a32bd Remove support for compiler plugins.
They've been deprecated for four years.

This commit includes the following changes.
- It eliminates the `rustc_plugin_impl` crate.
- It changes the language used for lints in
  `compiler/rustc_driver_impl/src/lib.rs` and
  `compiler/rustc_lint/src/context.rs`. External lints are now called
  "loaded" lints, rather than "plugins" to avoid confusion with the old
  plugins. This only has a tiny effect on the output of `-W help`.
- E0457 and E0498 are no longer used.
- E0463 is narrowed, now only relating to unfound crates, not plugins.
- The `plugin` feature was moved from "active" to "removed".
- It removes the entire plugins chapter from the unstable book.
- It removes quite a few tests, mostly all of those in
  `tests/ui-fulldeps/plugin/`.

Closes #29597.
2023-11-04 08:50:46 +11:00
Augie Fackler
f8daa7d4f6 consts: remove dead code around i1 constant values
`LLVMConstZext` recently got deleted, and it turns out (thanks to @nikic
for knowing!) that this is dead code. Tests all pass for me without this
logic, and per nikic:

> We always generate constants in "relocatable bag of bytes"
> representation, so you're never going to get a plain bool.

So this should be a safe thing to do.

r? @nikic
@rustbot label: +llvm-main
2023-11-03 15:40:17 -04:00
John Kåre Alsaker
ff1858e2aa Make FatalErrorMarker lower priority than other panics 2023-11-03 19:46:00 +01:00
Nadrieril
746197c08a Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
Nadrieril
335156ca73 Accumulate let chains alongside the visit 2023-11-03 18:26:16 +01:00
George Bateman
ee3a729cc4
enable feature gate in E0795.md 2023-11-03 17:08:32 +00:00
DaniPopes
27364309a5
compiler: use copied instead of manual map 2023-11-03 17:18:56 +01:00
Josh Stone
3984914aff Use filter_map in try_par_for_each_in
This simplifies the expression, especially for the rayon part, and also
lets us drop the `E: Copy` constraint.
2023-11-03 09:17:16 -07:00
bors
9c20ddd956 Auto merge of #117507 - nnethercote:rustc_span, r=Nilstrieb
`rustc_span` cleanups

Just some things I found while looking over this crate.

r? `@oli-obk`
2023-11-03 14:57:40 +00:00
George Bateman
7c09b99ebb
Feature gate enums in offset_of 2023-11-03 13:16:47 +00:00
Matthias Krüger
1ba97cb1cc clone less 2023-11-03 13:23:26 +01:00
Matthias Krüger
6cb627b681
Rollup merge of #117505 - estebank:issue-117501, r=TaKO8Ki
Fix incorrect trait bound restriction suggestion

Suggest

```
error[E0308]: mismatched types
  --> $DIR/restrict-assoc-type-of-generic-bound.rs:9:12
   |
LL | pub fn foo<A: MyTrait, B>(a: A) -> B {
   |                        -           - expected `B` because of return type
   |                        |
   |                        expected this type parameter
LL |     return a.bar();
   |            ^^^^^^^ expected type parameter `B`, found associated type
   |
   = note: expected type parameter `B`
             found associated type `<A as MyTrait>::T`
help: consider further restricting this bound
   |
LL | pub fn foo<A: MyTrait<T = B>, B>(a: A) -> B {
   |                      +++++++
```

instead of

```
error[E0308]: mismatched types
  --> $DIR/restrict-assoc-type-of-generic-bound.rs:9:12
   |
LL | pub fn foo<A: MyTrait, B>(a: A) -> B {
   |                        -           - expected `B` because of return type
   |                        |
   |                        expected this type parameter
LL |     return a.bar();
   |            ^^^^^^^ expected type parameter `B`, found associated type
   |
   = note: expected type parameter `B`
             found associated type `<A as MyTrait>::T`
help: consider further restricting this bound
   |
LL | pub fn foo<A: MyTrait + <T = B>, B>(a: A) -> B {
   |                      +++++++++
```

Fix #117501.
2023-11-03 12:44:50 +01:00
Ralf Jung
eaaa03faf7 default Aggregate ABI to Indirect, and make sure it's never used for unsized 2023-11-03 07:14:27 +01:00
Ralf Jung
405e4204d0 move ABI sanity check from LLVM codegen backend to ABI computation logic 2023-11-03 07:14:27 +01:00
bors
1d6f05fd37 Auto merge of #116439 - compiler-errors:on-unimplemented, r=davidtwco
Pretty print `Fn` traits in `rustc_on_unimplemented`

I don't think that users really ever should need to think about `Fn*` traits' tupled args for a simple trait error.

r? diagnostics
2023-11-03 06:08:03 +00:00
bors
2429818b20 Auto merge of #117508 - nnethercote:symbols-FxIndexSet, r=cuviper
Use `FxIndexSet` in the symbol interner.

It makes the code a little nicer.

r? `@ghost`
2023-11-03 04:07:42 +00:00
bors
6b9d6dedd0 Auto merge of #117313 - GuillaumeGomez:cg_gcc-tests, r=onur-ozkan
Run part of `rustc_codegen_gcc`'s tests in CI

Thanks to #112701 and `@bjorn3,` it made this much easier.

Also cc `@antoyo.`

r? `@bjorn3`
2023-11-03 02:05:06 +00:00
Gurinder Singh
4b3ece475d Emit explanatory note for move errors in packed struct derives
Derive expansions for packed structs cause move errors because
they prefer copying over borrowing since borrowing the fields of a
packed struct can result in unaligned access and therefore undefined
behaviour.

This underlying cause of the errors, however, is not apparent
to the user. We add a diagnostic note here to remedy that.
2023-11-03 07:32:10 +05:30
ltdk
8337e86b28 Add insta-stable std:#️⃣:{DefaultHasher, RandomState} exports 2023-11-02 20:35:20 -04:00
bors
2520ca8566 Auto merge of #117131 - compiler-errors:projection-oops, r=lcnr
Add all RPITITs when augmenting param-env with GAT bounds in `check_type_bounds`

When checking that associated type definitions actually satisfy their associated type bounds in `check_type_bounds`, we construct a "`normalize_param_env`" which adds a projection predicate that allows us to assume that we can project the GAT to the definition we're checking. For example, in:

```rust
type Foo {
  type Bar: Display = i32;
}
```

We would add `<Self as Foo>::Bar = i32` as a projection predicate when checking that `i32: Display` holds.

That `normalize_param_env` was, for some reason, only being used to normalize the predicate before it was registered. This is sketchy, because a nested obligation may require the GAT bound to hold, and also the projection cache is broken and doesn't differentiate projection cache keys that differ by param-envs 😿.

This `normalize_param_env` is also not sufficient when we have nested RPITITs and default trait methods, since we need to be able to assume we can normalize both the RPITIT and all of its child RPITITs to sufficiently prove all of its bounds. This is the cause of #117104, which only starts to fail for RPITITs that are nested 3 and above due to the projection-cache bug above.[^1]

## First fix

Use the `normalize_param_env` everywhere in `check_type_bounds`. This is reflected in a test I've constructed that fixes a GAT-only failure.

## Second fix

For RPITITs, install projection predicates for each RPITIT in the same function in `check_type_bounds`. This fixes #117104.

not sure who to request, so...
r? `@lcnr` hehe feel free to reassign :3

[^1]: The projection cache bug specifically occurs because we try normalizing the `assumed_wf_types` with the non-normalization param-env. This causes us to insert a projection cache entry that keeps the outermost RPITIT rigid, and it trivially satisifes all its own bounds. Super sketchy![^2]

[^2]: I haven't actually gone and fixed the projection cache bug because it's only marginally related, but I could, and it should no longer be triggered here.
2023-11-03 00:02:44 +00:00
bors
a2f5f9691b Auto merge of #117134 - lcnr:dropck_outlives-coroutine, r=compiler-errors
dropck_outlives check whether generator witness needs_drop

see https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/.23116242.3A.20Code.20no.20longer.20compiles.20after.20-Zdrop-tracking-mir.20.E2.80.A6/near/398311627 for an explanation.

Fixes #116242 (or well, the repro by `@jamuraa` in https://github.com/rust-lang/rust/issues/116242#issuecomment-1739802047). I did not add a regression test as it depends on other crates. We do have 1 test going from fail to pass, showing the intended behavior.

r? types
2023-11-02 22:03:38 +00:00
Michael Goulet
c83f642f12 Pretty print Fn traits in rustc_on_unimplemented 2023-11-02 20:57:05 +00:00
Michael Goulet
dd571e472a Add all RPITITs when augmenting param-env with GAT bounds in check_type_bounds 2023-11-02 20:47:10 +00:00
Michael Goulet
bb74d7e97d Use the normalizing param-env always in check_type_bounds 2023-11-02 20:47:05 +00:00
Nicholas Nethercote
94a36d2ce5 Use FxIndexSet in the symbol interner.
It makes the code a little nicer.

As part of this, the interner's `Default` impl is removed and `prefill`
is used in a test instead.
2023-11-03 07:19:41 +11:00
Guillaume Gomez
43290933a4 Remove libc dependency in cg_gcc alloc_system example 2023-11-02 21:03:27 +01:00
Guillaume Gomez
edfd67b598 Pass --sysroot option 2023-11-02 21:03:27 +01:00
Guillaume Gomez
3c58feaa08 Fix config.sh script 2023-11-02 21:03:27 +01:00
Guillaume Gomez
ded81de066 Fix compilation errors in rustc_codegen_gcc examples 2023-11-02 21:03:27 +01:00
Guillaume Gomez
42bdc873e5 Disable master feature by default when building rustc_codegen_gcc 2023-11-02 21:03:27 +01:00
Esteban Küber
9e7345be1f Fix incorrect trait bound restriction suggestion
Suggest

```
error[E0308]: mismatched types
  --> $DIR/restrict-assoc-type-of-generic-bound.rs:9:12
   |
LL | pub fn foo<A: MyTrait, B>(a: A) -> B {
   |                        -           - expected `B` because of return type
   |                        |
   |                        expected this type parameter
LL |     return a.bar();
   |            ^^^^^^^ expected type parameter `B`, found associated type
   |
   = note: expected type parameter `B`
             found associated type `<A as MyTrait>::T`
help: consider further restricting this bound
   |
LL | pub fn foo<A: MyTrait<T = B>, B>(a: A) -> B {
   |                      +++++++
```

instead of

```
error[E0308]: mismatched types
  --> $DIR/restrict-assoc-type-of-generic-bound.rs:9:12
   |
LL | pub fn foo<A: MyTrait, B>(a: A) -> B {
   |                        -           - expected `B` because of return type
   |                        |
   |                        expected this type parameter
LL |     return a.bar();
   |            ^^^^^^^ expected type parameter `B`, found associated type
   |
   = note: expected type parameter `B`
             found associated type `<A as MyTrait>::T`
help: consider further restricting this bound
   |
LL | pub fn foo<A: MyTrait + <T = B>, B>(a: A) -> B {
   |                      +++++++++
```

Fix #117501.
2023-11-02 18:04:41 +00:00
lcnr
dda5e32ab0 review + add tests 2023-11-02 18:16:37 +01:00
lcnr
a582e9638b only erase param env regions where needed 2023-11-02 17:20:13 +01:00
lcnr
57253552de dropck_outlives check generator witness needs_drop 2023-11-02 17:20:13 +01:00
lcnr
f0df3d2dfb remove outdated comment 2023-11-02 17:20:13 +01:00
bors
c5afe0a61e Auto merge of #117513 - matthiaskrgr:rollup-jvl6y84, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #117394 (use global cache when computing proof trees)
 - #117495 (Clarify `Unsize` documentation)
 - #117509 (Remove support for alias `-Z symbol-mangling-version`)
 - #117512 (Expand mem::offset_of! docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-02 14:46:23 +00:00
Matthias Krüger
67b51879e3
Rollup merge of #117509 - Zalathar:zsymbol, r=petrochenkov
Remove support for alias `-Z symbol-mangling-version`

(This is very similar to the removal of `-Z instrument-coverage` in #117111.)

`-C symbol-mangling-version` was stabilized back in rustc 1.59.0 (2022-02-24) via #90128, with the old unstable flag kept around (with a warning) as an alias to ease migration.
2023-11-02 15:31:21 +01:00
Matthias Krüger
298edd6d46
Rollup merge of #117394 - lcnr:proof-tree-cache4, r=compiler-errors
use global cache when computing proof trees

we're writing the solver while relying on the existence of the global cache to avoid exponential blowup. By disabling the global cache when building proof trees, it is easy to get hangs, e.g. when computing intercrate ambiguity causes.

Removes the unstable `-Zdump_solver_proof_tree_use_cache` option, as we now always return a full proof tree.

r? `@compiler-errors`
2023-11-02 15:31:20 +01:00
bors
b800c30352 Auto merge of #117466 - compiler-errors:alias-bound, r=aliemjay
Don't check for alias bounds in liveness when aliases have escaping bound vars

I actually have no idea how we *should* be treating aliases with escaping bound vars here... but the simplest behavior is just doing what we used to do before.

r? aliemjay

Fixes #117455
2023-11-02 12:47:14 +00:00
Michael Goulet
4d5d763e05 Don't check for alias bounds in liveness when aliases have escaping bound vars 2023-11-02 10:25:57 +00:00
bors
62270fb4d6 Auto merge of #117204 - nnethercote:rustc_ast_passes, r=compiler-errors
Minor improvements to `rustc_ast_passes`

Some improvements I found while looking at this code.

r? `@compiler-errors`
2023-11-02 10:08:53 +00:00
lcnr
15ae59ba03 use global cache when computing proof trees 2023-11-02 10:41:27 +01:00
Nicholas Nethercote
6358411da2 Add a couple of clarifying comments. 2023-11-02 19:35:04 +11:00
Nicholas Nethercote
9893b75e0d Replace two create_default_session_if_not_set_then uses.
With `create_default_session_globals_then`, which is preferable when it
is appropriate.
2023-11-02 19:35:04 +11:00
Nicholas Nethercote
edb357f912 Deinline all session global functions.
These are all called very rarely, so there is no need for them to be
inline.
2023-11-02 19:35:04 +11:00
Nicholas Nethercote
f405ce86c2 Minimize pub usage in source_map.rs.
Most notably, this commit changes the `pub use crate::*;` in that file
to `use crate::*;`. This requires a lot of `use` items in other crates
to be adjusted, because everything defined within `rustc_span::*` was
also available via `rustc_span::source_map::*`, which is bizarre.

The commit also removes `SourceMap::span_to_relative_line_string`, which
is unused.
2023-11-02 19:35:00 +11:00
Zalathar
76103a8f6e Remove support for alias -Z symbol-mangling-version 2023-11-02 18:41:33 +11:00
Nicholas Nethercote
84773b3972 Formatting tweaks. 2023-11-02 17:23:26 +11:00
Nicholas Nethercote
222c22356b Minimize pub usage in hygiene.rs.
And remove dead functions revealed by this.
2023-11-02 17:23:26 +11:00
Nicholas Nethercote
16e9713e60 Tweak use items. 2023-11-02 17:23:26 +11:00
Nicholas Nethercote
1bcb6006ba Fix some comments.
The comment just below the first one describes how the `impl !Send for
FatalError` makes it impossible to `panic!(FatalError)`.

And the second one should be `panic_any` instead of `panic!`.
2023-11-02 17:22:44 +11:00
Nicholas Nethercote
d76661bf25 Explain the () argument to ErrorGuaranteed. 2023-11-02 17:07:07 +11:00
Nadrieril
3760d919d8 Cleanup check_match code paths 2023-11-02 03:19:19 +01:00
Nadrieril
fcd24fbd3c Factor out pointing at ADT definition 2023-11-02 03:19:19 +01:00
Nadrieril
c19856929d Always do all the pattern checks 2023-11-02 03:19:19 +01:00
Nadrieril
d95f6a9532 Tweak diagnostic for consistency 2023-11-02 03:19:19 +01:00
Nadrieril
380c56c6b3 Check pattern error while lowering 2023-11-02 03:19:18 +01:00
Nadrieril
1f9a2f73e1 Uncomplicate check_let_chain 2023-11-02 03:19:18 +01:00
Nadrieril
fedee8d524 Reorder 2023-11-02 03:19:18 +01:00
Matthias Krüger
4e437be044
Rollup merge of #117441 - cjgillot:diag-noassert, r=oli-obk,RalfJung
Do not assert in op_to_const.

`op_to_const` is used in `try_destructure_mir_constant_for_diagnostics`, which may encounter invalid constants created by optimizations and debugging.

r? ``@oli-obk``

Fixes https://github.com/rust-lang/rust/issues/117368
2023-11-01 21:40:06 +01:00
Matthias Krüger
3087b63d1f
Rollup merge of #117373 - saethlin:avoid-ice-lint, r=compiler-errors
Avoid the path trimming ICE lint in error reporting

Types or really anything in MIR should never be formatted without path trimming disabled, because its formatting often tries to construct trimmed paths. In this case, the lint turns a nice error report into an irrelevant ICE.
2023-11-01 21:40:05 +01:00
Matthias Krüger
2b2360abb1
Rollup merge of #117298 - clubby789:fn-missing-params, r=petrochenkov
Recover from missing param list in function definitions

Addresses the other issue mentioned in #108109
2023-11-01 21:40:05 +01:00
Camille GILLOT
f512f91258 Comment for_diagnostics flag. 2023-11-01 19:01:55 +00:00
bors
b0a07595b5 Auto merge of #117289 - estebank:issue-72298, r=cjgillot
Account for `ref` and `mut` in the wrong place for pattern ident renaming

If the user writes `S { ref field: name }` instead of `S { field: ref name }`, we suggest the correct code.

Fix #72298.
2023-11-01 18:39:01 +00:00