Commit Graph

27054 Commits

Author SHA1 Message Date
Matthias Krüger
83d84ffdd5
Rollup merge of #114503 - chenyukang:yukang-fix-114433-unused-qualifications, r=compiler-errors
Remove invalid lint when there is a generic argument in prefix path

Fixes #114433
2023-08-06 03:56:09 +02:00
Matthias Krüger
1305a43d0a
Rollup merge of #114486 - Urgau:const-context-nan-suggestion-114471, r=compiler-errors
Avoid invalid NaN lint machine-applicable suggestion in const context

This PR removes the machine-applicable suggestion in const context for the `invalid_nan_comparision` lint ~~and replace it with a simple help~~.

Fixes https://github.com/rust-lang/rust/issues/114471
2023-08-06 03:56:09 +02:00
bors
8236f63aba Auto merge of #114476 - Urgau:missing-dep-file-112898, r=oli-obk
Fix missing dependency file with `-Zunpretty`

This PR force the `output_filenames` to be run ~~in every early exits like~~ when using `-Zunpretty`, so to respect the `dep-info` flag.

Fixes https://github.com/rust-lang/rust/issues/112898
r? `@oli-obk`
2023-08-06 00:04:52 +00:00
Michael Goulet
3b3e466e36
Add FIXME as reminder to restore suggestion later 2023-08-05 17:04:30 -07:00
Urgau
b71f2becb2 Avoid invalid NaN lint machine-applicable suggestion in const context 2023-08-05 23:54:59 +02:00
Camille GILLOT
7a51b30ebd parent_module_from_def_id does not need to be a query. 2023-08-05 21:23:50 +00:00
Camille GILLOT
02e10a054e Steal MIR for CTFE when possible. 2023-08-05 21:16:55 +00:00
Michael Goulet
55bf810821 Also report when goals go from ok to error 2023-08-05 20:09:31 +00:00
Michael Goulet
169236ec8a a function is just another AnonymousCreateParameter rib 2023-08-05 16:53:13 +00:00
Michael Goulet
57a96893f6 Consolidate opaque ty and async fn lowering code 2023-08-05 16:53:13 +00:00
bors
fbc11e9690 Auto merge of #114514 - matthiaskrgr:rollup-1rv4f3h, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #114029 (Explain more clearly why `fn() -> T` can't be `#[derive(Clone)]`)
 - #114248 (Make lint missing-copy-implementations honor negative `Copy` impls)
 - #114498 (Print tidy command with bless tidy check failure)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-05 13:33:57 +00:00
Matthias Krüger
e722f6f3ac
Rollup merge of #114248 - fmease:neg-copy-rules-out-missing-copy-impl, r=b-naber
Make lint missing-copy-implementations honor negative `Copy` impls

Fixes #101980.

``@rustbot`` label A-lint F-negative_impls
2023-08-05 14:00:17 +02:00
bors
28b6607b5f Auto merge of #109348 - cjgillot:issue-109146, r=petrochenkov
Resolve visibility paths as modules not as types.

Asking for a resolution with `opt_ns = Some(TypeNS)` allows path resolution to look for type-relative paths, leaving unresolved segments behind. However, for visibility paths we really need to look for a module, so we need to pass `opt_ns = None`.

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

r? `@petrochenkov`
2023-08-05 11:52:07 +00:00
Krasimir Georgiev
9941db4512 llvm-wrapper: adapt for LLVM API changes
No functional changes intended.

Adapts llvm-wrapper for 65e57bbed0.

Found by our experimental rust + llvm @ HEAD CI:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/21304#0189c526-86cd-4db9-bdbc-dd0132dfc22b/197-500
2023-08-05 10:54:30 +00:00
bors
1cabb8ed23 Auto merge of #114459 - cjgillot:simplify-ctfe, r=oli-obk
Do not run ConstProp on mir_for_ctfe.

This pass does not seem to be useful any more. The const-prop lints are now run by `tcx.mir_drops_elaborated_and_const_checked`, and the const-prop opt should never emit any diagnostic.
2023-08-05 09:08:34 +00:00
yukang
c9be1a71b6 Remove invalid lint when there is a generic argument in prefix path 2023-08-05 15:58:26 +08:00
bors
67626b8e89 Auto merge of #113734 - cjgillot:no-crate-lint, r=petrochenkov
Convert builtin "global" late lints to run per module

The compiler currently has 4 non-incremental lints:
1. `clashing_extern_declarations`;
2. `missing_debug_implementations`;
3. ~`unnameable_test_items`;~ changed by https://github.com/rust-lang/rust/pull/114414
4. `missing_docs`.

Non-incremental lints get reexecuted for each compilation, which is slow. Moreover, those lints are allow-by-default, so run for nothing most of the time. This PR attempts to make them more incremental-friendly.

`clashing_extern_declarations` is moved to a standalone query.

`missing_debug_implementation` can use `non_blanket_impls_for_ty` instead of recomputing it.

`missing_docs` is harder as it needs to track if there is a `doc(hidden)` module surrounding. I hack around this using the lint level engine. That's easy to implement and allows to re-enable the lint for a re-exported module, while a more proper solution would reuse the same device as `unnameable_test_items`.
2023-08-05 07:20:16 +00:00
Taiki Endo
dddd2190b9 Remove arm crypto target feature 2023-08-05 15:23:31 +09:00
Camille GILLOT
e2230985b3 Do not run ConstProp on mir_for_ctfe. 2023-08-05 06:21:33 +00:00
Taiki Endo
b47e4a46c6 Revert "Auto merge of #98333 - SimonSapin:riscv-atomic, r=Amanieu"
This reverts commit 90f0b24ad3, reversing
changes made to e173a8e663.
2023-08-05 13:18:47 +09:00
Taiki Endo
4d4df88934 Set max_atomic_width for sparc-unknown-linux-gnu to 32 2023-08-05 13:01:15 +09:00
Taiki Endo
c9e83c02a2 Set max_atomic_width for AVR to 16 2023-08-05 12:47:46 +09:00
bors
fca59ab5f0 Auto merge of #114492 - compiler-errors:rollup-lp4sfla, r=compiler-errors
Rollup of 5 pull requests

Successful merges:

 - #114287 (update overflow handling in the new trait solver)
 - #114475 (Migrate GUI colors test to original CSS color format)
 - #114482 (Fix ui-fulldeps missing the `internal_features` lint on stage 0)
 - #114490 (Fix a typo in the error reporting for sealed traits.)
 - #114491 (Rename issue #114423 test files to include context)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-05 03:43:08 +00:00
Michael Goulet
c0231962e5
Rollup merge of #114490 - kernelmethod:error-reporting-typos, r=compiler-errors
Fix a typo in the error reporting for sealed traits.

Fixes a typo in error reporting: "implelement" -> "implement"
2023-08-04 19:47:40 -07:00
Michael Goulet
097a49867c
Rollup merge of #114287 - lcnr:overflow, r=compiler-errors
update overflow handling in the new trait solver

implements https://hackmd.io/QY0dfEOgSNWwU4oiGnVRLw?view. I want to clean up this doc and add it to the rustc-dev-guide, but I think this PR is ready for merge as is, even without the dev-guide entry.

r? `@compiler-errors`
2023-08-04 19:47:38 -07:00
bors
90f0b24ad3 Auto merge of #98333 - SimonSapin:riscv-atomic, r=Amanieu
Re-enable atomic loads and stores for all RISC-V targets

This roughly reverts PR https://github.com/rust-lang/rust/pull/66548

Atomic "CAS" are still disabled for targets without the *“A” Standard Extension for Atomic Instructions*. However this extension only adds instructions for operations more complex than simple loads and stores, which are always atomic when aligned.

In the [Unprivileged Spec v. 20191213](https://riscv.org/technical/specifications/) section 2.6 *Load and Store Instructions* of chapter 2 *RV32I Base Integer Instruction Set* (emphasis mine):

> Even when misaligned loads and stores complete successfully, these accesses might run extremely slowly depending on the implementation (e.g., when implemented via an invisible trap). Further-more, whereas **naturally aligned loads and stores are guaranteed to execute atomically**, misaligned loads and stores might not, and hence require additional synchronization to ensure atomicity.

Unfortunately PR https://github.com/rust-lang/rust/pull/66548 did not provide much details on the bug that motivated it, but https://github.com/rust-lang/rust/issues/66240 and https://github.com/rust-lang/rust/issues/85736 appear related and happen with targets that do have the A extension.
2023-08-05 01:53:32 +00:00
kernelmethod
d64968ba30 Fix a typo in the error reporting for sealed traits. 2023-08-05 00:38:52 +00:00
bors
e173a8e663 Auto merge of #112117 - bryangarza:track-caller-feature-gate, r=compiler-errors
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-04 22:17:59 +00:00
bors
e4c1446846 Auto merge of #114481 - matthiaskrgr:rollup-58pczpl, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #113945 (Fix wrong span for trait selection failure error reporting)
 - #114351 ([rustc_span][perf] Remove unnecessary string joins and allocs.)
 - #114418 (bump parking_lot to 0.12)
 - #114434 (Improve spans for indexing expressions)
 - #114450 (Fix ICE failed to get layout for ReferencesError)
 - #114461 (Fix unwrap on None)
 - #114462 (interpret: add mplace_to_ref helper method)
 - #114472 (Reword `confusable_idents` lint)
 - #114477 (Account for `Rc` and `Arc` when suggesting to clone)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-04 20:31:40 +00:00
Matthias Krüger
35b271306f
Rollup merge of #114477 - estebank:arc-clone, r=compiler-errors
Account for `Rc` and `Arc` when suggesting to clone

When suggesting to clone a reference-counted value, be less uncertain.
2023-08-04 21:32:00 +02:00
Matthias Krüger
cd5317a000
Rollup merge of #114472 - estebank:issue-76140, r=compiler-errors
Reword `confusable_idents` lint

Fix #76140.
2023-08-04 21:31:59 +02:00
Matthias Krüger
5e42a2276a
Rollup merge of #114462 - RalfJung:mplace_to_ref, r=oli-obk
interpret: add mplace_to_ref helper method
2023-08-04 21:31:59 +02:00
Matthias Krüger
b7bfffd3d1
Rollup merge of #114461 - sebastiantoh:issue-114423, r=estebank
Fix unwrap on None

Fixes #114423

r? `@estebank`
2023-08-04 21:31:58 +02:00
Matthias Krüger
a0fd747e38
Rollup merge of #114450 - chenyukang:yukang-fix-114435, r=compiler-errors
Fix ICE failed to get layout for ReferencesError

Fixes #114435

r? `@compiler-errors`
2023-08-04 21:31:57 +02:00
Matthias Krüger
99e4127d85
Rollup merge of #114434 - Nilstrieb:indexing-spans, r=est31
Improve spans for indexing expressions

fixes #114388

Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location.

This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR.

r? compiler-errors
2023-08-04 21:31:57 +02:00
Matthias Krüger
4669905ee6
Rollup merge of #114418 - klensy:parking_lot, r=oli-obk
bump parking_lot to 0.12

Bumps parking_lot to 0.12, replaces few explicit uses of parking_lot with rustc_data_structures::sync ones.

<strike>cc `@oli-obk` this touches recent https://github.com/rust-lang/rust/pull/114283</strike>
cc `@SparrowLii` i've checked that this builds with parallel-compiler

measureme's bump https://github.com/rust-lang/measureme/pull/209
fcf3006e01/compiler/rustc_data_structures/src/sync.rs (L18-L34)
2023-08-04 21:31:56 +02:00
Matthias Krüger
23e86f6ef8
Rollup merge of #114351 - ttsugriy:sort-by-words, r=fee1-dead
[rustc_span][perf] Remove unnecessary string joins and allocs.

Comparing vectors of string parts yields the same result but avoids unnecessary `join` and potential allocation for resulting `String`. This code is cold so it's unlikely to have any measurable impact, but considering but since it's also simpler, why not? :)
2023-08-04 21:31:56 +02:00
Matthias Krüger
5054e41b64
Rollup merge of #113945 - chenyukang:yukang-fix-113447-slice-2, r=cjgillot
Fix wrong span for trait selection failure error reporting

Fixes #113447
2023-08-04 21:31:55 +02:00
bors
fe896efa97 Auto merge of #114104 - oli-obk:syn2, r=compiler-errors
Lots of tiny incremental simplifications of `EmitterWriter` internals

ignore the first commit, it's https://github.com/rust-lang/rust/pull/114088 squashed and rebased, but it's needed to use to use `derive_setters`, as they need a newer `syn` version.

Then this PR starts out with removing many arguments that are almost always defaulted to `None` or `false` and replace them with builder methods that can set these fields in the few cases that want to set them.

After that it's one commit after the other that removes or merges things until everything becomes some very simple trait objects
2023-08-04 18:46:19 +00:00
Urgau
8229d8e251 Fix missing dependency file with -Zunpretty 2023-08-04 20:13:40 +02:00
Esteban Küber
edc3e26773 Account for Rc and Arc when suggesting to clone
When suggesting to clone a reference-counted value, be less uncertain.
2023-08-04 17:50:12 +00:00
yukang
3d25b5c7e8 Fix ICE failed to get layout for ReferencesError 2023-08-05 01:38:14 +08:00
bors
03181e0547 Auto merge of #113575 - aliemjay:opaque-hrtb-ice, r=lcnr
don't ICE on higher ranked hidden types

This shouldn't allow more code to compile, only replaces the ICE with a nicer error message.

Fixes https://github.com/rust-lang/rust/issues/97098.
Fixes https://github.com/rust-lang/rust/issues/97099.
Fixes #108399
Fixes #104196
Fixes #113481
Fixes #103186
Fixes #100818

r? `@lcnr` (because you showed interest in #100503 :)
2023-08-04 16:56:37 +00:00
Esteban Küber
553508c22e Reword confusable idents lint
Fix #76140.
2023-08-04 16:46:08 +00:00
Camille GILLOT
905b63d64f Fetch diagnostic item later. 2023-08-04 16:09:14 +00:00
Camille GILLOT
c0a683ab14 Make rustc internal lints per module. 2023-08-04 16:09:14 +00:00
Camille GILLOT
7c34f1a8d8 Make MissingDoc a module lint. 2023-08-04 16:09:14 +00:00
Camille GILLOT
53e5fd6a61 Make MissingDebugImplementation a module lint. 2023-08-04 16:09:14 +00:00
Camille GILLOT
56063ff2fb Simplify clashing_extern_declarations. 2023-08-04 16:09:13 +00:00
Camille GILLOT
817f45f7bf Querify clashing_extern_declarations lint. 2023-08-04 16:09:13 +00:00
Esteban Küber
6d11b2f2af Detect method not found on arbitrary self type with different mutability
```
error[E0599]: no method named `x` found for struct `Pin<&S>` in the current scope
  --> $DIR/arbitrary_self_type_mut_difference.rs:11:18
   |
LL |     Pin::new(&S).x();
   |                  ^ help: there is a method with a similar name: `y`
   |
note: method is available for `Pin<&mut S>`
  --> $DIR/arbitrary_self_type_mut_difference.rs:6:5
   |
LL |     fn x(self: Pin<&mut Self>) {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
```

Related to #57994, as one of the presented cases can lead to code like
this.
2023-08-04 16:05:59 +00:00
klensy
e3700953c1 replace few explicit use of parking_lot with rustc_data_structures::sync onces 2023-08-04 18:41:56 +03:00
Felix S. Klock II
3000c24afc special-case proc-macro crates in rustc_codegen_ssa:🔙:linker::exported_symbols to only export the two symbols that proc-macros need. 2023-08-04 11:29:01 -04:00
Ali MJ Al-Nasrawy
d55522aad8 don't ICE on higher ranked hidden types 2023-08-04 15:11:09 +00:00
bors
ec5b882c2f Auto merge of #114414 - cjgillot:early-unnameable-test, r=petrochenkov
Make test harness lint about unnnameable tests.

Implementation of https://github.com/rust-lang/rust/pull/113734#discussion_r1283073418

About the options suggested in https://github.com/rust-lang/rust/issues/36629#issuecomment-404753945: adding this case to unused_attribute was just more complicated. I'll try to understand a bit more what you had in mind in https://github.com/rust-lang/rfcs/pull/2471#issuecomment-397241123

This was just simpler to do in a standalone PR. I'll remove the corresponding changes from https://github.com/rust-lang/rust/pull/113734 later.

r? `@petrochenkov`
2023-08-04 14:13:11 +00:00
Ralf Jung
3345077b42 interpret: add mplace_to_ref helper method 2023-08-04 15:00:57 +02:00
Sebastian Toh
97aa4ba171 Fix unwrap on None 2023-08-04 20:12:20 +08:00
Nilstrieb
5706be1854 Improve spans for indexing expressions
Indexing is similar to method calls in having an arbitrary
left-hand-side and then something on the right, which is the main part
of the expression. Method calls already have a span for that right part,
but indexing does not. This means that long method chains that use
indexing have really bad spans, especially when the indexing panics and
that span in coverted into a panic location.

This does the same thing as method calls for the AST and HIR, storing an
extra span which is then put into the `fn_span` field in THIR.
2023-08-04 13:17:39 +02:00
bors
4f7bb9890c Auto merge of #114036 - compiler-errors:upcast-to-fewer-assocs, r=lcnr
Rework upcasting confirmation to support upcasting to fewer projections in target bounds

This PR implements a modified trait upcasting algorithm that is resilient to changes in the number of associated types in the bounds of the source and target trait objects.

It does this by equating each bound of the target trait ref individually against the bounds of the source trait ref, rather than doing them all together by constructing a new trait object.

#### The new way we do trait upcasting confirmation

1. Equate the target trait object's principal trait ref with one of the supertraits of the source trait object's principal.
fdcab310b2/compiler/rustc_trait_selection/src/traits/select/mod.rs (L2509-L2525)

2. Make sure that every auto trait in the *target* trait object is present in the source trait ref's bounds.
fdcab310b2/compiler/rustc_trait_selection/src/traits/select/mod.rs (L2559-L2562)

3. For each projection in the *target* trait object, make sure there is exactly one projection that equates with it in the source trait ref's bound. If there is more than one, bail with ambiguity.
fdcab310b2/compiler/rustc_trait_selection/src/traits/select/mod.rs (L2526-L2557)
    * Since there may be more than one that applies, we probe first to check that there is exactly one, then we equate it outside of a probe once we know that it's unique.

4. Make sure the lifetime of the source trait object outlives the lifetime of the target.

<details>
<summary>Meanwhile, this is how we used to do upcasting:</summary>

1. For each supertrait of the source trait object, take that supertrait, append the source object's projection bounds, and the *target* trait object's auto trait bounds, and make this into a new object type:
d12c6e947c/compiler/rustc_trait_selection/src/traits/select/confirmation.rs (L915-L929)

2. Then equate it with the target trait object:
d12c6e947c/compiler/rustc_trait_selection/src/traits/select/confirmation.rs (L936)

This will be a type mismatch if the target trait object has fewer projection bounds, since we compare the bounds structurally in relate:
d12c6e947c/compiler/rustc_middle/src/ty/relate.rs (L696-L698)

</details>

Fixes #114035
Also fixes #114113, because I added a normalize call in the old solver.

r? types
2023-08-04 10:55:22 +00:00
bors
34ccd04859 Auto merge of #114451 - matthiaskrgr:rollup-37qmv19, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #114022 (Perform OpaqueCast field projection on HIR, too.)
 - #114253 (Compute variances for lazy type aliases)
 - #114355 (resolve before canonicalization in new solver, ICE if unresolved)
 - #114427 (Handle non-utf8 rpaths (fix FIXME))
 - #114440 (bootstrap: config: fix version comparison bug)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-04 09:05:59 +00:00
Jakub Beránek
93bdc01adf
Add hotness data to LLVM remarks
This makes sure that if PGO is used, remarks generated using `-Zremark-dir` will include the `Hotness` attribute.
2023-08-04 10:31:00 +02:00
Matthias Krüger
4fb44e59c4
Rollup merge of #114427 - Enselic:rustc_codegen_ssa-fixme, r=Nilstrieb
Handle non-utf8 rpaths (fix FIXME)

Removes a FIXME for #9639 which is closed since long ago.

Part of #44366 which is E-help-wanted.

(Also see https://github.com/rust-lang/rust/pull/114377)
2023-08-04 09:18:59 +02:00
Matthias Krüger
d6f714e44f
Rollup merge of #114355 - compiler-errors:resolve_vars_early, r=lcnr
resolve before canonicalization in new solver, ICE if unresolved

Fold the values with a resolver before canonicalization instead of making it happen within canonicalization.

This allows us to filter trivial region constraints from the external constraints.

r? ``@lcnr``
2023-08-04 09:18:59 +02:00
Matthias Krüger
5ea536b35f
Rollup merge of #114253 - fmease:compute-variances-for-lazy-ty-aliases, r=oli-obk
Compute variances for lazy type aliases

Fixes #114221.

CC ``@oli-obk``
r? types
2023-08-04 09:18:58 +02:00
Matthias Krüger
576bf82702
Rollup merge of #114022 - oli-obk:tait_ice_alias_field_projection, r=cjgillot
Perform OpaqueCast field projection on HIR, too.

fixes #105819

This is necessary for closure captures in 2021 edition, as they capture individual fields, not the full mentioned variables. So it may try to capture a field of an opaque (because the hidden type is known to be something with a field).

See https://github.com/rust-lang/rust/pull/99806 for when and why we added OpaqueCast to MIR.
2023-08-04 09:18:58 +02:00
bors
73dc6f03a2 Auto merge of #114350 - erikdesjardins:ident, r=tmiasko
cg_llvm: stop identifying ADTs in LLVM IR

This is an extension of https://github.com/rust-lang/rust/pull/94107. It may be a minor perf win.

Fixes #96242.

Now that we use opaque pointers, ADTs can no longer be recursive, so we
do not need to name them. Previously, this would be necessary if you had
a struct like

```rs
struct Foo(Box<Foo>, u64, u64);
```

which would be represented with something like

```ll
%Foo = type { %Foo*, i64, i64 }
```

which is now just

```ll
{ ptr, i64, i64 }
```

r? `@tmiasko`
2023-08-04 07:17:02 +00:00
Matthias Krüger
353e26869f
Rollup merge of #114431 - ehuss:ssa-test, r=est31
Enable tests on rustc_codegen_ssa

This enables unittests in rustc_codegen_ssa. There are some tests, primarily in [`back/rpath/tests.rs`](https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_codegen_ssa/src/back/rpath/tests.rs) that haven't ever been running since the unittests are disabled. From what I can tell, this was just a consequence of how things evolved. When testing was initially added in https://github.com/rust-lang/rust/pull/33282, `librustc_trans` had test=false because it didn't have any tests. `rustc_codegen_ssa` eventually split off from that (https://github.com/rust-lang/rust/pull/55627), and the rpath module eventually got merged in too (from `librustc_back` where it used to live). That migration didn't enable the tests.

This also includes some fluent diagnostic tests, though I'm not sure what exactly they are testing.
2023-08-04 07:25:48 +02:00
Matthias Krüger
eb19abfc47
Rollup merge of #114409 - lcnr:confirmation, r=compiler-errors
builtin impl confirmation wuhu
2023-08-04 07:25:47 +02:00
Matthias Krüger
1f076fe1d8
Rollup merge of #113999 - Centri3:macro-arm-expand, r=wesleywiser
Specify macro is invalid in certain contexts

Adds a note when a macro is used where it really shouldn't be.

Closes #113766
2023-08-04 07:25:45 +02:00
Matthias Krüger
f36a9b5e18
Rollup merge of #113534 - oli-obk:simd_shuffle_dehackify, r=workingjubilee
Forbid old-style `simd_shuffleN` intrinsics

Don't merge before https://github.com/rust-lang/packed_simd/pull/350 has made its way to crates.io

We used to support specifying the lane length of simd_shuffle ops by attaching the lane length to the name of the intrinsic (like `simd_shuffle16`). After this PR, you cannot do that anymore, and need to instead either rely on inference of the `idx` argument type or specify it as `simd_shuffle::<_, [u32; 16], _>`.

r? `@workingjubilee`
2023-08-04 07:25:45 +02:00
bors
60fa393490 Auto merge of #110833 - compiler-errors:rustc-call-inliner-ice, r=cjgillot
Only unpack tupled args in inliner if we expect args to be unpacked

`"rust-call"` is a strange function abi. sometimes, it expects the arguments to be unpacked by the caller and passed as individual args (closure bodies), and sometimes it does not (user functions annotated with the `"rust-call"` abi).

make sure the mir inliner respects this difference when checking that arguments are compatible, and doesn't try to ICE when we call a `extern "rust-call"` function in a generic context.

fixes #110829
2023-08-04 00:45:24 +00:00
bors
1fe384649a Auto merge of #108955 - Nilstrieb:dont-use-me-pls, r=oli-obk
Add `internal_features` lint

Implements https://github.com/rust-lang/compiler-team/issues/596

Also requires some more test blessing for codegen tests etc

`@jyn514` had the idea of just `allow`ing the lint by default in the test suite. I'm not sure whether this is a good idea, but it's definitely one worth considering. Additional input encouraged.
2023-08-03 22:58:02 +00:00
Michael Goulet
d87f4a6dc1 Placeholder nit 2023-08-03 20:05:40 +00:00
Michael Goulet
f848fd3ae3 Remove trivial region constraints 2023-08-03 20:05:40 +00:00
Michael Goulet
eaf8af5de8 resolve before canonicalization, ICE if unresolved 2023-08-03 20:05:40 +00:00
Michael Goulet
5bea48ba18 separate calculation and interning of external query constraints 2023-08-03 20:05:40 +00:00
Eric Huss
40729bcb69 Enable tests on rustc_codegen_ssa 2023-08-03 12:48:55 -07:00
Michael Goulet
3c9549b349 Explicitly don't inline user-written rust-call fns 2023-08-03 18:35:56 +00:00
Michael Goulet
0391af0e1f Only unpack tupled args in inliner if we expect args to be unpacked 2023-08-03 18:35:56 +00:00
Michael Goulet
7c942ccb0c Don't be incomplete 2023-08-03 18:21:11 +00:00
Michael Goulet
238beae5e5 Fix upcasting with normalization in old solver, add a test 2023-08-03 18:21:11 +00:00
Michael Goulet
4cc659eb3f short-circuit when proj def ids differ 2023-08-03 18:21:11 +00:00
Michael Goulet
1bb6ae5874 Rework upcasting 2023-08-03 18:21:11 +00:00
Martin Nordholts
ea3b49f2f1 Handle non-utf8 rpaths (fix FIXME) 2023-08-03 20:04:18 +02:00
yukang
cde8f06503 enable suggest convert to slice for binary operation 2023-08-04 00:14:13 +08:00
yukang
3635b48973 Fix wrong span for trait selection failure error reporting 2023-08-03 23:47:57 +08:00
Matthias Krüger
284f176bbd
Rollup merge of #114403 - bvanjoi:fix-114392, r=estebank
fix the span in the suggestion of remove question mark

Fixes #114392

Use a more precise span.
2023-08-03 17:29:09 +02:00
Matthias Krüger
2413f50a0b
Rollup merge of #114395 - ttsugriy:hoist-lookup, r=lqd
[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-03 17:29:08 +02:00
Matthias Krüger
00dcc7b97c
Rollup merge of #114372 - RalfJung:const-pointer-as-int, r=oli-obk
const validation: point at where we found a pointer but expected an integer

Instead of validation just printing "unable to turn pointer into bytes", make this a regular validation error that says where in the value the bad pointer was found. Also distinguish "expected integer, got pointer" from "expected pointer, got partial pointer or mix of pointers".

To avoid duplicating things too much I refactored the diagnostics for validity a bit, so that "got uninit, expected X" and "got pointer, expected X" can share the "X" part. Also all the errors emitted for validation are now grouped under `const_eval_validation` so that they are in a single group in the ftl file.

r? `@oli-obk`
2023-08-03 17:29:08 +02:00
Matthias Krüger
51d1dacdc2
Rollup merge of #114300 - MU001999:fix/turbofish-pat, r=estebank
Suggests turbofish in patterns

Fixes #114112

r? ```@estebank```
2023-08-03 17:29:07 +02:00
Matthias Krüger
649d0a9525
Rollup merge of #114237 - bvanjoi:fix-114219, r=cjgillot
parser: more friendly hints for handling `async move` in the 2015 edition

Fixes #114219

An error is emitted when encountering an async move block in the 2015 edition.

Another appropriate location to raise an error is after executing [let path = this.parse_path(PathStyle::Expr)?](https://github.com/rust-lang/rust/blob/master/compiler/rustc_parse/src/parser/stmt.rs#L152), but it seems somewhat premature to invoke `create_err` at that stage.
2023-08-03 17:29:07 +02:00
Matthias Krüger
7518ae566e
Rollup merge of #113657 - Urgau:expand-incorrect_fn_null_check-lint, r=cjgillot
Expand, rename and improve `incorrect_fn_null_checks` lint

This PR,

 - firstly, expand the lint by now linting on references
 - secondly, it renames the lint `incorrect_fn_null_checks` -> `useless_ptr_null_checks`
 - and thirdly it improves the lint by catching `ptr::from_mut`, `ptr::from_ref`, as well as `<*mut _>::cast` and `<*const _>::cast_mut`

Fixes https://github.com/rust-lang/rust/issues/113601
cc ```@est31```
2023-08-03 17:29:06 +02:00
lcnr
baf076825c inline helper methods into with_new_goal 2023-08-03 15:15:48 +02:00
lcnr
8aca388af8 rewrite stack dependent overflow handling 2023-08-03 15:12:43 +02:00
Camille GILLOT
2a0a1f918d Make test harness lint about unnnameable tests. 2023-08-03 13:07:30 +00:00
klensy
383b715163 bump parking_lot 0.11 to 0.12 2023-08-03 16:05:26 +03:00
Nilstrieb
5830ca216d Add internal_features lint
It lints against features that are inteded to be internal to the
compiler and standard library. Implements MCP #596.

We allow `internal_features` in the standard library and compiler as those
use many features and this _is_ the standard library from the "internal to the compiler and
standard library" after all.

Marking some features as internal wasn't exactly the most scientific approach, I just marked some
mostly obvious features. While there is a categorization in the macro,
it's not very well upheld (should probably be fixed in another PR).

We always pass `-Ainternal_features` in the testsuite
About 400 UI tests and several other tests use internal features.
Instead of throwing the attribute on each one, just always allow them.
There's nothing wrong with testing internal features^^
2023-08-03 14:50:50 +02:00
lcnr
a745cbb042 handle overflow in the EvalCtxt separately 2023-08-03 14:41:44 +02:00
lcnr
c0468313cb add ensure_sufficient_stack to the new solver 2023-08-03 14:32:56 +02:00
lcnr
ae3c353067 fix make_ambiguous_response_no_constraints
we previously had incorrect universes in the query response.
2023-08-03 14:30:13 +02:00
lcnr
a090b4548d avoid more ty::Binder:dummy 2023-08-03 14:16:26 +02:00
lcnr
5992e9b2fe builtin impl confirmation wuhu 2023-08-03 14:08:50 +02:00
bors
fcf3006e01 Auto merge of #113199 - b-naber:slice-pattern-type-inference, r=lcnr
Infer type in irrefutable slice patterns with fixed length as array

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

In irrefutable slice patterns with a fixed length, we can infer the type as an array type. We now choose to prefer some implementations over others, e.g. in:

```
struct Zeroes;

const ARR: [usize; 2] = [0; 2];
const ARR2: [usize; 2] = [2; 2];

impl Into<&'static [usize; 2]> for Zeroes {
    fn into(self) -> &'static [usize; 2] {
        &ARR
    }
}

impl Into<&'static [usize]> for Zeroes {
    fn into(self) -> &'static [usize] {
        &ARR2
    }
}

fn main() {
    let &[a, b] = Zeroes.into();
}
```

We now prefer the impl candidate `impl Into<&'static [usize; 2]> for Zeroes`, it's not entirely clear to me that this is correct, but given that the slice impl would require a type annotation anyway, this doesn't seem unreasonable.

r? `@lcnr`
2023-08-03 11:48:33 +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
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
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
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
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
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
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
Alex Zepeda
2e29d85f7e Avoid exporting symbols more than once.
Exporting `__rust_alloc_error_handler_should_panic` multiple times
causes ld.gold to balk with: `error: version script assignment of  to
symbol __rust_alloc_error_handler_should_panic failed: symbol not
defined`

Specifically this breaks builds on DragonFly and YoctoProject with
ld.gold.  Builds with ld.bfd should be unaffected.
2023-08-02 11:02:23 -07: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
Mu001999
89b2fe7750 Keep the suggestion for wrong arbitrary self types 2023-08-03 00:00:56 +08:00
Deadbeef
4fec845c3f Remove constness from TraitPredicate 2023-08-02 15:38:00 +00:00
Camille GILLOT
69ea85da02 Adapt error code doc. 2023-08-02 15:30:29 +00:00
Camille GILLOT
2faa2626cc Resolve visibility paths as modules not as types. 2023-08-02 15:30:24 +00:00
Ralf Jung
2984670cea avoid 'miri' when refering to the shared interpreter 2023-08-02 16:52:03 +02:00
bors
7637653b9f Auto merge of #114368 - Nilstrieb:rollup-pgvm9cf, r=Nilstrieb
Rollup of 5 pull requests

Successful merges:

 - #114079 (Use `upvar_tys` in more places, make it return a list)
 - #114166 (Add regression test for resolving `--extern libc=test.rlib`)
 - #114321 (get auto traits for parallel rustc)
 - #114335 (fix and extend ptr_comparison test)
 - #114347 (x.py print more detailed format files and untracked files count)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-02 13:38:36 +00:00
Nilstrieb
0475873813
Rollup merge of #114321 - SparrowLii:parallel_test, r=oli-obk
get auto traits for parallel rustc

test for #106930
#[Edit] Since this doesn't block try build now, we can close https://github.com/rust-lang/rust/issues/106930

fixes #106930
2023-08-02 13:46:55 +02:00
Nilstrieb
46f6b05eb7
Rollup merge of #114079 - compiler-errors:closure-upvars, r=oli-obk
Use `upvar_tys` in more places, make it return a list

Just a cleanup that fell out of a PR that I was gonna write, but that PR kinda got stuck.
2023-08-02 13:46:54 +02:00
bors
d170833431 Auto merge of #112431 - Urgau:cast_ref_to_mut_improvments, r=Nilstrieb
Improve `invalid_reference_casting` lint

This PR is a follow-up to https://github.com/rust-lang/rust/pull/111567 and https://github.com/rust-lang/rust/pull/113422.

This PR does multiple things:
 - First it adds support for deferred de-reference, the goal is to support code like this, where the casting and de-reference are not done on the same expression
    ```rust
    let myself = self as *const Self as *mut Self;
    *myself = Self::Ready(value);
    ```
 - Second it does not lint anymore on SB/TB UB code by only checking assignments (`=`, `+=`, ...) and creation of mutable references `&mut *`
 - Thirdly it greatly improves the diagnostics in particular for cast from `&mut` to `&mut` or assignments
 - ~~And lastly it renames the lint from `cast_ref_to_mut` to `invalid_reference_casting` which is more consistent with the ["rules"](https://github.com/rust-lang/rust-clippy/issues/2845) and also more consistent with what the lint checks~~ *https://github.com/rust-lang/rust/pull/113422*

This PR is best reviewed commit by commit.

r? compiler
2023-08-02 11:25:13 +00:00
bors
64ad036307 Auto merge of #114333 - RalfJung:dangling-ptr-offset, r=oli-obk
Miri: fix error on dangling pointer inbounds offset

We used to claim that the pointer was "dereferenced", but that is just not true.

Can be reviewed commit-by-commit. The first commit is an unrelated rename that didn't seem worth splitting into its own PR.

r? `@oli-obk`
2023-08-02 09:12:32 +00:00
yukang
ac25636a8f fix RedundantLocals clippy caused by async and await 2023-08-02 16:32:49 +08:00
SparrowLii
90db1132c7 get auto traits for parallel rustc
Signed-off-by: SparrowLii <liyuan179@huawei.com>
2023-08-02 16:21:45 +08:00
bors
5cbfee5455 Auto merge of #114360 - Zalathar:ffi-types, r=oli-obk
coverage: Consolidate FFI types into one module

Coverage FFI types were historically split across two modules, because some of them were needed by code in `rustc_codegen_ssa`.

Now that all of the coverage codegen code has been moved into `rustc_codegen_llvm` (#113355), it's possible to move all of the FFI types into a single module, making it easier to see all of them at once.

---

This PR only moves code and adjusts imports; there should be no functional changes.
2023-08-02 07:23:57 +00:00
yukang
75b9f53e47 Fix #107113, avoid suggest for macro attributes 2023-08-02 14:54:37 +08:00
Zalathar
d6ed6e3904 coverage: Consolidate FFI types into one module
Coverage FFI types were historically split across two modules, because some of
them were needed by code in `rustc_codegen_ssa`.

Now that all of the coverage codegen code has been moved into
`rustc_codegen_llvm` (#113355), it's possible to move all of the FFI types into
a single module, making it easier to see all of them at once.
2023-08-02 15:26:47 +10:00
bors
7a5d2d0138 Auto merge of #114358 - matthiaskrgr:rollup-d810m9e, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #114178 (Account for macros when suggesting a new let binding)
 - #114199 (Don't unsize coerce infer vars in select in new solver)
 - #114301 (Don't check unnecessarily that impl trait is RPIT)
 - #114314 (Tweaks to `adt_sized_constraint`)
 - #114322 (Fix invalid slice coercion suggestion reported in turbofish)
 - #114340 ([rustc_attr][nit] Replace `filter` + `is_some` with `map_or`.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-02 04:30:51 +00:00
Matthias Krüger
4876afba38
Rollup merge of #114340 - ttsugriy:rustc-attr, r=lqd
[rustc_attr][nit] Replace `filter` + `is_some` with `map_or`.

It's slightly shorter and better communicates the intent.
2023-08-02 06:22:50 +02:00
Matthias Krüger
1778c58905
Rollup merge of #114322 - Urgau:fix-issue-110063, r=compiler-errors
Fix invalid slice coercion suggestion reported in turbofish

This PR fixes the invalid slice coercion suggestion reported in turbofish and inferred generics by not emitting them.

Fixes https://github.com/rust-lang/rust/issues/110063
2023-08-02 06:22:49 +02:00
Matthias Krüger
3d29ce7484
Rollup merge of #114314 - compiler-errors:sized-crit, r=lcnr
Tweaks to `adt_sized_constraint`

fixes a comment, but also some other nits.

r? lcnr
2023-08-02 06:22:49 +02:00
Matthias Krüger
f338a1f7ee
Rollup merge of #114301 - compiler-errors:dont-error-on-missing-region-outlives, r=spastorino
Don't check unnecessarily that impl trait is RPIT

We have this random `return_type_impl_trait` function to detect if a function returns an RPIT which is used in outlives suggestions, but removing it doesn't actually change any diagnostics. Let's just remove it.

Also, suppress a spurious outlives error from a ReError.

Fixes #114274
2023-08-02 06:22:48 +02:00
Matthias Krüger
bb3dee1a8a
Rollup merge of #114199 - compiler-errors:dont-select-unsize-infer, r=lcnr
Don't unsize coerce infer vars in select in new solver

Otherwise we're too eagerly preferring the `T -> dyn Trait` branch during coercion.

r? `@lcnr`
2023-08-02 06:22:48 +02:00