Commit Graph

3000 Commits

Author SHA1 Message Date
Dylan DPC
42cf6da6af
Rollup merge of #112345 - bvanjoi:fix-112342, r=nilstrieb,est31
fix(expand): prevent infinity loop in macro containing only "///"

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

Issue #112342 was caused by an infinity loop in `parse_tt_inner`, and the state of it is as follows:

- `matcher`: `[Sequence, Token(Doc), SequenceKleeneOpNoSep(op: ZeroOrMore), Eof]`

-  loop:

| Iteration | Action |
| - | - |
| 0   |  enter `Sequence`|
| 1    |  enter `Token(Doc)` and `mp.idx += 1` had been executed |
| 2   |  enter `SequenceKleeneOpNoSep` and reset `mp.idx` to `1` |
| 3   | enter `Token(Doc)` again|

To prevent the infinite loop, a check for whether it only contains `DocComment` in `check_lhs_no_empty_seq` had been added.
2023-06-07 18:01:30 +05:30
Dylan DPC
0b002eb906
Rollup merge of #112122 - compiler-errors:next-coherence, r=lcnr
Add `-Ztrait-solver=next-coherence`

Flag that conditionally uses the trait solver *only* during coherence, for more testing and/or eventual partial-migration onto the trait solver (in the medium- to long-term).

* This still uses the selection context in some of the coherence methods I think, so it's not "complete". Putting this up for review and/or for further work in-tree.
* I probably need to spend a bit more time making sure that we don't sneakily create any other infcx's during coherence that also need the new solver enabled.

r? `@lcnr`
2023-06-07 18:01:29 +05:30
Dylan DPC
cbe429c7a5
Rollup merge of #112076 - compiler-errors:bidirectional-alias-eq, r=lcnr
Fall back to bidirectional normalizes-to if no subst-relate candidate in alias-relate goal

Sometimes we get into the case where the choice of normalizes-to branch in alias-relate are both valid, but we cannot make a choice of which one to take because they are different -- either returning equivalent but permuted region constraints, or equivalent opaque type definitions but differing modulo normalization.

In this case, we can make progress by considering a fourth candidate where we compute both normalizes-to branches together and canonicalize that as a response. This is essentially the AND intersection of both normalizes-to branches. In an ideal world, we'd be returning something more like the OR intersection of both branches, but we have no way of representing that either for regions (maybe eventually) or opaques (don't see that happening ever).

This is incomplete, so like the subst-relate fallback it's only considered outside of coherence. But it doesn't seem like a dramatic strengthening of inference or anything, and is useful for helping opaque type inference succeed when the hidden type is a projection.

## Example

Consider the goal - `AliasRelate(Tait, <[i32; 32] as IntoIterator>::IntoIter)`.

We have three ways of currently solving this goal:
1. SubstRelate - fails because we can't directly equate the substs of different alias kinds.
2. NormalizesToRhs - `Tait normalizes-to <[i32; 32] as IntoIterator>::IntoIter`
    * Ends up infering opaque definition - `Tait := <[i32; 32] as IntoIterator>::IntoIter`
3. NormalizesToLhs - `<[i32; 32] as IntoIterator>::IntoIter normalizes-to Tait`
    * Find impl candidate, substitute the associated type - `std::array::IntoIter<i32, 32>`
    * Equate `std::array::IntoIter<i32, 32>` and `Tait`
        * Ends up infering opaque definition - `Tait := std::array::IntoIter<i32, 32>`

The problem here is that 2 and 3 are essentially both valid, since we have aliases that normalize on both sides, but due to lazy norm, they end up inferring different opaque type definitions that are only equal *after* normalizing them further.

---

r? `@lcnr`
2023-06-07 18:01:28 +05:30
bors
e94bda3bf1 Auto merge of #111047 - compiler-errors:rtn-no-ty-ct-params, r=spastorino
Emit an error when return-type-notation is used with type/const params

These are not intended to be supported initially, even though the compiler supports them internally...
2023-06-07 09:03:33 +00:00
bohan
5eafab30ba feat(expand): emit note for doc comment in macro matcher 2023-06-07 10:20:36 +08:00
bors
afab3662eb Auto merge of #112361 - matthiaskrgr:rollup-39zxrw1, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #111250 (Add Terminator conversion from MIR to SMIR, part #2)
 - #112310 (Add new Tier-3 targets: `loongarch64-unknown-none*`)
 - #112334 (Add myself to highfive rotation)
 - #112340 (remove `TyCtxt::has_error_field` helper method)
 - #112343 (Prevent emitting `missing_docs` for `pub extern crate`)
 - #112350 (Avoid duplicate type sanitization of local decls in borrowck)
 - #112356 (Fix comment for `get_region_var_origins`)
 - #112358 (Remove default visitor impl in region constraint generation)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-06 21:28:34 +00:00
Matthias Krüger
38ddff516c
Rollup merge of #112343 - GuillaumeGomez:extern-crate-missing-docs, r=notriddle
Prevent emitting `missing_docs` for `pub extern crate`

Fixes #112308.

r? `@notriddle`
2023-06-06 22:00:20 +02:00
Michael Goulet
3ea7c512bd Fall back to bidirectional normalizes-to if no subst-eq in alias-eq goal 2023-06-06 18:44:22 +00:00
Michael Goulet
aabdeedc7c bless coherence test 2023-06-06 18:43:20 +00:00
bohan
c927743b7b fix(expand): prevent infinity loop in macro containing only "///" 2023-06-06 23:11:08 +08:00
Matthias Krüger
38c92cca65
Rollup merge of #112325 - notriddle:notriddle/issue-111932, r=compiler-errors
diagnostics: do not suggest type name tweaks on type-inferred closure args

Fixes #111932
2023-06-06 12:00:34 +02:00
Matthias Krüger
71a72ee34a
Rollup merge of #112199 - jieyouxu:issue-112188, r=compiler-errors
Fix suggestion for matching struct with `..` on both ends

### Before This PR

```
error: expected `}`, found `,`
 --> src\main.rs:8:17
  |
8 |         Foo { .., x, .. } => (),
  |               --^
  |               | |
  |               | expected `}`
  |               `..` must be at the end and cannot have a trailing comma
  |
help: move the `..` to the end of the field list
  |
8 -         Foo { .., x, .. } => (),
8 +         Foo { .., x,  , .. } => (),
  |
```

### After This PR

```
error: expected `}`, found `,`
  --> tests/ui/parser/issue-112188.rs:11:17
   |
11 |     let Foo { .., x, .. } = f; //~ ERROR expected `}`, found `,`
   |               --^-
   |               | |
   |               | expected `}`
   |               `..` must be at the end and cannot have a trailing comma
   |               help: remove the starting `..`
```

Fixes #112188.
2023-06-06 12:00:33 +02:00
Matthias Krüger
21e7463bf8
Rollup merge of #112019 - jieyouxu:issue-111554, r=compiler-errors
Don't suggest changing `&self` and `&mut self` in function signature to be mutable when taking `&mut self` in closure

Current suggestion for when taking a mutable reference to `self` in a closure (as an upvar) will produce a machine-applicable suggestion to change the `self` in the function signature to `mut self`, but does not account for the specialness of implicit self in that it can already have `&` and `&mut` (see #111554). This causes the function signature to become `test(&mut mut self)` which does not seem desirable.

```
error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
   --> src/sound_player.rs:870:11
    |
869 |     pub fn test(&mut self) {
    |                      ---- help: consider changing this to be mutable: `mut self`
870 |     || test2(&mut self);
    |              ^^^^^^^^^ cannot borrow as mutable
```

This PR suppresses the "changing this to be mutable" suggestion if the implicit self is either `ImplicitSelfKind::ImmRef` or `ImplicitSelfKind::MutRef`.

Fixes #111554.
2023-06-06 12:00:33 +02:00
Matthias Krüger
92327c05f1
Rollup merge of #111058 - fortanix:raoul/fix_lvi_mitigations, r=cuviper
Correct fortanix LVI test print function

A recent change resulted in a different machine code for the `print` function. This caused the LVI test for this function to fail. This PR:

- Fixes the test for the `print` function
- Simplified the test a bit so future modifications are more unlikely

cc: ``@jethrogb``
2023-06-06 12:00:31 +02:00
Guillaume Gomez
550fe634bf Add regression test for #112308 2023-06-06 11:50:24 +02:00
lcnr
01aaad3f1f remove has_error_field helper method 2023-06-06 09:37:30 +02:00
Michael Howell
467bc9ffd5 diagnostics: do not suggest type name tweaks on type-inferred closure args
Fixes #111932
2023-06-05 19:05:15 -07:00
bors
fd9bf59436 Auto merge of #111999 - scottmcm:codegen-less-memcpy, r=compiler-errors
Use `load`+`store` instead of `memcpy` for small integer arrays

I was inspired by #98892 to see whether, rather than making `mem::swap` do something smart in the library, we could update MIR assignments like `*_1 = *_2` to do something smarter than `memcpy` for sufficiently-small types that doing it inline is going to be better than a `memcpy` call in assembly anyway.  After all, special code may help `mem::swap`, but if the "obvious" MIR can just result in the correct thing that helps everything -- other code like `mem::replace`, people doing it manually, and just passing around by value in general -- as well as makes MIR inlining happier since it doesn't need to deal with all the complicated library code if it just sees a couple assignments.

LLVM will turn the short, known-length `memcpy`s into direct instructions in the backend, but that's too late for it to be able to remove `alloca`s.  In general, replacing `memcpy`s with typed instructions is hard in the middle-end -- even for `memcpy.inline` where it knows it won't be a function call -- is hard [due to poison propagation issues](https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/memcpy.20vs.20load-store.20for.20MIR.20assignments/near/360376712).  So because we know more about the type invariants -- these are typed copies -- rustc can emit something more specific, allowing LLVM to `mem2reg` away the `alloca`s in some situations.

#52051 previously did something like this in the library for `mem::swap`, but it ended up regressing during enabling mir inlining (cbbf06b0cd), so this has been suboptimal on stable for ≈5 releases now.

The code in this PR is narrowly targeted at just integer arrays in LLVM, but works via a new method on the [`LayoutTypeMethods`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/traits/trait.LayoutTypeMethods.html) trait, so specific backends based on cg_ssa can enable this for more situations over time, as we find them.  I don't want to try to bite off too much in this PR, though.  (Transparent newtypes and simple things like the 3×usize `String` would be obvious candidates for a follow-up.)

Codegen demonstrations: <https://llvm.godbolt.org/z/fK8hT9aqv>

Before:
```llvm
define void `@swap_rgb48_old(ptr` noalias nocapture noundef align 2 dereferenceable(6) %x, ptr noalias nocapture noundef align 2 dereferenceable(6) %y) unnamed_addr #1 {
  %a.i = alloca [3 x i16], align 2
  call void `@llvm.lifetime.start.p0(i64` 6, ptr nonnull %a.i)
  call void `@llvm.memcpy.p0.p0.i64(ptr` noundef nonnull align 2 dereferenceable(6) %a.i, ptr noundef nonnull align 2 dereferenceable(6) %x, i64 6, i1 false)
  tail call void `@llvm.memcpy.p0.p0.i64(ptr` noundef nonnull align 2 dereferenceable(6) %x, ptr noundef nonnull align 2 dereferenceable(6) %y, i64 6, i1 false)
  call void `@llvm.memcpy.p0.p0.i64(ptr` noundef nonnull align 2 dereferenceable(6) %y, ptr noundef nonnull align 2 dereferenceable(6) %a.i, i64 6, i1 false)
  call void `@llvm.lifetime.end.p0(i64` 6, ptr nonnull %a.i)
  ret void
}
```
Note it going to stack:
```nasm
swap_rgb48_old:                         # `@swap_rgb48_old`
        movzx   eax, word ptr [rdi + 4]
        mov     word ptr [rsp - 4], ax
        mov     eax, dword ptr [rdi]
        mov     dword ptr [rsp - 8], eax
        movzx   eax, word ptr [rsi + 4]
        mov     word ptr [rdi + 4], ax
        mov     eax, dword ptr [rsi]
        mov     dword ptr [rdi], eax
        movzx   eax, word ptr [rsp - 4]
        mov     word ptr [rsi + 4], ax
        mov     eax, dword ptr [rsp - 8]
        mov     dword ptr [rsi], eax
        ret
```

Now:
```llvm
define void `@swap_rgb48(ptr` noalias nocapture noundef align 2 dereferenceable(6) %x, ptr noalias nocapture noundef align 2 dereferenceable(6) %y) unnamed_addr #0 {
start:
  %0 = load <3 x i16>, ptr %x, align 2
  %1 = load <3 x i16>, ptr %y, align 2
  store <3 x i16> %1, ptr %x, align 2
  store <3 x i16> %0, ptr %y, align 2
  ret void
}
```
still lowers to `dword`+`word` operations, but has no stack traffic:
```nasm
swap_rgb48:                             # `@swap_rgb48`
        mov     eax, dword ptr [rdi]
        movzx   ecx, word ptr [rdi + 4]
        movzx   edx, word ptr [rsi + 4]
        mov     r8d, dword ptr [rsi]
        mov     dword ptr [rdi], r8d
        mov     word ptr [rdi + 4], dx
        mov     word ptr [rsi + 4], cx
        mov     dword ptr [rsi], eax
        ret
```

And as a demonstration that this isn't just `mem::swap`, a `mem::replace` on a small array (since replace doesn't use swap since #83022), which used to be `memcpy`s in LLVM changes in IR
```llvm
define void `@replace_short_array(ptr` noalias nocapture noundef sret([3 x i32]) dereferenceable(12) %0, ptr noalias noundef align 4 dereferenceable(12) %r, ptr noalias nocapture noundef readonly dereferenceable(12) %v) unnamed_addr #0 {
start:
  %1 = load <3 x i32>, ptr %r, align 4
  store <3 x i32> %1, ptr %0, align 4
  %2 = load <3 x i32>, ptr %v, align 4
  store <3 x i32> %2, ptr %r, align 4
  ret void
}
```
but that lowers to reasonable `dword`+`qword` instructions still
```nasm
replace_short_array:                    # `@replace_short_array`
        mov     rax, rdi
        mov     rcx, qword ptr [rsi]
        mov     edi, dword ptr [rsi + 8]
        mov     dword ptr [rax + 8], edi
        mov     qword ptr [rax], rcx
        mov     rcx, qword ptr [rdx]
        mov     edx, dword ptr [rdx + 8]
        mov     dword ptr [rsi + 8], edx
        mov     qword ptr [rsi], rcx
        ret
```
2023-06-06 01:50:28 +00:00
bors
adc719d714 Auto merge of #112324 - matthiaskrgr:rollup-qscmi3c, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #112081 (Avoid ICE on `#![doc(test(...)]` with literal parameter)
 - #112196 (Resolve vars in result from `scrape_region_constraints`)
 - #112303 (Normalize in infcx instead of globally for `Option::as_deref` suggestion)
 - #112316 (Ensure space is inserted after keyword in `unused_delims`)
 - #112318 (Merge method, type and const object safety checks)
 - #112322 (Don't mention `IMPLIED_BOUNDS_ENTAILMENT` if signatures reference error)

Failed merges:

 - #112251 (rustdoc: convert `if let Some()` that always matches to variable)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-05 22:44:59 +00:00
Matthias Krüger
dcdd867a52
Rollup merge of #112322 - compiler-errors:no-IMPLIED_BOUNDS_ENTAILMENT-if-errs, r=eholk
Don't mention `IMPLIED_BOUNDS_ENTAILMENT` if signatures reference error

Fixes #112321
2023-06-05 23:48:00 +02:00
Matthias Krüger
0ff5a6ee57
Rollup merge of #112316 - clubby789:unused-parens-space, r=compiler-errors
Ensure space is inserted after keyword in `unused_delims`

Fixes #112276
2023-06-05 23:47:59 +02:00
Matthias Krüger
ff43249b0e
Rollup merge of #112303 - Nilstrieb:as-deref, r=compiler-errors
Normalize in infcx instead of globally for `Option::as_deref` suggestion

fixes #112293

The projection may contain inference variables. These inference variables are local to the local inference context. Using `tcx.normalize_erasing_regions` doesn't work here because this method is global and does not have access to the inference context. It's therefore unable to deal with the inference variables. We normalize in the local inference context instead, which knowns about the inference variables.

The test looks a little different than the issue example, I made it more minimal and verified that it still ICEs on nightly.

Also contains a drive-by fix to properly compare the types.

r? `@compiler-errors`
2023-06-05 23:47:59 +02:00
Matthias Krüger
9ce0c7951c
Rollup merge of #112196 - compiler-errors:new-solver-resolv, r=lcnr
Resolve vars in result from `scrape_region_constraints`

Since we perform `type_op::Normalize` in the local infcx when the new solver is enabled, vars aren't necessarily resolved, which triggers this ICE:

f85ab544df/compiler/rustc_infer/src/infer/nll_relate/mod.rs (L481)

There are more tests that go from ICE -> pass due to this change, but I just added revisions to a few for CI.

r? `@lcnr`
2023-06-05 23:47:58 +02:00
Matthias Krüger
129a57a9f6
Rollup merge of #112081 - obeis:doc-test-literal, r=compiler-errors
Avoid ICE on `#![doc(test(...)]` with literal parameter

Close #109066

r? `@compiler-errors`
2023-06-05 23:47:57 +02:00
Michael Goulet
0e9e91a95a Don't mention IMPLIED_BOUNDS_ENTAILMENT if signatures reference error 2023-06-05 21:20:51 +00:00
Michael Goulet
bbc536d3ac Emit an error when RTN is used with ty/ct params 2023-06-05 19:52:04 +00:00
Michael Goulet
979379aff7 Resolve vars in result from scrape_region_constraints 2023-06-05 19:40:30 +00:00
Maybe Waffle
9d3482c403 Better group RFC ui tests together 2023-06-05 16:09:46 +00:00
Raoul Strackx
b35f243c89 Verify that (almost) all ret instructions have been replaced 2023-06-05 17:33:26 +02:00
clubby789
1fa769234e Ensure space is inserted after keyword in unused_delims 2023-06-05 14:25:00 +00:00
Raoul Strackx
62c8c7cca8 Correct LVI print function test 2023-06-05 14:03:36 +02:00
Nilstrieb
c12575d317 Normalize in infcx instead of globally for Option::as_deref suggestion
The projection may contain inference variables. These inference
variables are local to the local inference context. Using
`tcx.normalize_erasing_regions` doesn't work here because this method is
global and does not have access to the inference context. It's therefore
unable to deal with the inference variables. We normalize in the local
inference context instead, which knowns about the inference variables.
2023-06-05 08:34:06 +00:00
Nilstrieb
896ccb9606 Properly compare types for Option::as_deref suggestion 2023-06-05 08:26:53 +00:00
bors
51f714c8c5 Auto merge of #110945 - wackbyte:doc-vis-on-inherent-assoc-types, r=jsha
rustdoc: render visibility on associated types

This should only affect inherent associated types (#8995).
2023-06-05 04:54:21 +00:00
bors
e4106065bf Auto merge of #112272 - jieyouxu:issue-112269, r=compiler-errors
Show note for type ascription on a local binding interpreted as a constant pattern and not a new variable

Given the code

```rust
pub fn main() {
    const y: i32 = 4;
    let y: i32 = 3;
}
```

`y` in the let binding is actually interpreted as a constant pattern and is not a new variable, causing confusing diagnostics about refutable patterns in local binding.

This PR extends the note for type ascription of a constant pattern to `AscribeUserType` patterns which have `Constant` subpatterns.

Fixes #112269.
2023-06-05 01:33:58 +00:00
bors
dcf3571c51 Auto merge of #112266 - Swatinem:fix-async-block-inference, r=compiler-errors
Fix type-inference regression in #112225

The type inference of argument-position closures and async blocks regressed in 1.70 as the evaluation order of async blocks changed, as they are not implicitly wrapped in an identity-function anymore.

Fixes #112225 by making sure the evaluation order stays the same as it used to.

r? `@compiler-errors`

As this was a stable-to-stable regression, it might be worth to consider backporting. Although the workaround for this is trivial as well: Just wrap the async block in another block.
2023-06-04 22:21:42 +00:00
Matthias Krüger
97b702fda9
Rollup merge of #112274 - GuillaumeGomez:migrate-gui-test-color-11, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

The update for `browser-ui-test` version is because for hex color conversions, it used a precision of 1 instead of 2, which was problematic.

r? `@notriddle`
2023-06-04 19:41:15 +02:00
Guillaume Gomez
d67e00eb26 Migrate GUI colors test to original CSS color format 2023-06-04 15:55:30 +02:00
许杰友 Jieyou Xu (Joe)
55b4549602
Show note for type ascription interpreted as a constant pattern, not a new variable
Given the code

```rust
pub fn main() {
    const y: i32 = 4;
    let y: i32 = 3;
}
```

`y` in the let binding is actually interpreted as a constant pattern
and is not a new variable, causing confusing diagnostics about
refutable patterns in local binding.

This commit extends the note for type ascription as a constant pattern
to `AscribeUserType` patterns as well.
2023-06-04 20:49:30 +08:00
Matthias Krüger
0d6749c2af
Rollup merge of #112178 - GuillaumeGomez:fix-inline-private-intermediate, r=notriddle
Fix bug where private item with intermediate doc hidden re-export was not inlined

This fixes this bug:

```rust
mod private {
    /// Original.
    pub struct Bar3;
}

/// Hidden.
#[doc(hidden)]
pub use crate::private::Bar3;
/// Visible.
pub use self::Bar3 as Reexport;
```

In this case, `private::Bar3` should be inlined and renamed `Reexport` but instead we have:

```
pub use self::Bar3 as Reexport;
```

and no links.

There were actually two issues: the first one is that we forgot to check if the next intermediate re-export was doc hidden. The second was that we made the `#[doc(hidden)]` attribute inheritable, which shouldn't be possible.

r? `@notriddle`
2023-06-04 13:21:28 +02:00
Arpad Borsos
75b557a2c4
Fix type-inference regression in #112225
The type inference of argument-position closures and async blocks
regressed in 1.70 as the evaluation order of async blocks changed, as
they are not implicitly wrapped in an identity-function anymore.

Fixes #112225 by making sure the evaluation order stays the same as it
used to.
2023-06-04 10:56:00 +02:00
Scott McMurray
e1b020df9f Use load-store instead of memcpy for short integer arrays 2023-06-04 00:51:49 -07:00
Scott McMurray
cce0b52e7b Add a codegen test for manually swapping a small Copy type
To confirm we're not just helping `mem::swap`
2023-06-04 00:50:55 -07:00
bors
9eee230cd0 Auto merge of #112240 - cjgillot:recurse-inline, r=scottmcm
Only check inlining counter after recursing.

This PR aims to reduce the strength of https://github.com/rust-lang/rust/pull/105119 even more.

In the current implementation, we check the inline count before recursing. This means that we never actually reach inlining depth 3.

This PR checks the counter after recursion, to give a chance to inline at depth >= 3.

r? `@scottmcm`
cc `@JakobDegen`
2023-06-04 03:39:24 +00:00
Matthias Krüger
20cbbbb977
Rollup merge of #112215 - compiler-errors:check-sized-better, r=cjgillot
only suppress coercion error if type is definitely unsized

we previously suppressed coercion errors when the return type was `dyn Trait` because we expect a far more descriptive `Sized` trait error to be emitted instead, however the code that does this suppression does not consider where-clause predicates since it just looked at the HIR. let's do that instead by creating an obligation and checking if it may hold.

fixes #110683
fixes #112208
2023-06-03 20:38:12 +02:00
Matthias Krüger
bdf9ed497a
Rollup merge of #111878 - ferrocene:pa-codegen-tests, r=Mark-Simulacrum
Fix codegen test suite for bare-metal-like targets

For Ferrocene I needed to run the test suite for custom target with no unwinding and static relocation. Running the tests uncovered ~20 failures due to the test suite not accounting for these options. This PR fixes them by:

* Fixing `CHECK`s to account for functions having extra LLVM IR attributes (in this case `nounwind`).
* Fixing `CHECK`s to account for the `dso_local` LLVM IR modifier, which is [added to every item when relocation is static](f3d597b31c/compiler/rustc_codegen_llvm/src/mono_item.rs (L139-L142)).
* Fixing `CHECK`s to account for missing `uwtables` attributes.
* Added the `needs-unwind` attributes for tests that are designed to check unwinding.

There is no part of Rust CI that checks this unfortunately, and testing whether the PR works locally is kinda hard because you need a target with std enabled but no unwinding and static relocations. Still, this works in my local testing, and if future PRs accidentally break this Ferrocene will take care of sending followup PRs.
2023-06-03 20:38:11 +02:00
Matthias Krüger
91f222f931
Rollup merge of #111659 - y21:suggest-as-deref, r=cjgillot
suggest `Option::as_deref(_mut)` on type mismatch in option combinator if it passes typeck

Fixes #106342.
This adds a suggestion to call `.as_deref()` (or `.as_deref_mut()` resp.) if typeck fails due to a type mismatch in the function passed to an `Option` combinator such as `.map()` or `.and_then()`.
For example:
```rs
fn foo(_: &str) {}
Some(String::new()).map(foo);
```
The `.map()` method requires its argument to satisfy `F: FnOnce(String)`, but it received `fn(&str)`, which won't pass. However, placing a `.as_deref()` before the `.map()` call fixes this since `&str == &<String as Deref>::Target`
2023-06-03 20:38:10 +02:00
Guillaume Gomez
d029800992 Update reexport-attr-merge rustdoc test 2023-06-03 19:57:17 +02:00
Camille GILLOT
9e683442a9 Only check inlining counter after recusing. 2023-06-03 12:29:49 +00:00
bors
8177591aec Auto merge of #111516 - compiler-errors:issue-111500, r=jackh726
Don't use `can_eq` in `derive(..)` suggestion for missing method

Unsatisfied predicates returned from method probe may reference inference vars from that probe, so drop this extra check I added in #110877 for more accurate derive suggestions...

Fixes #111500
2023-06-03 07:25:40 +00:00