Commit Graph

247879 Commits

Author SHA1 Message Date
Esteban Küber
f0c93117ed Use root obligation on E0277 for some cases
When encountering trait bound errors that satisfy some heuristics that
tell us that the relevant trait for the user comes from the root
obligation and not the current obligation, we use the root predicate for
the main message.

This allows to talk about "X doesn't implement Pattern<'_>" over the
most specific case that just happened to fail, like  "char doesn't
implement Fn(&mut char)" in
`tests/ui/traits/suggest-dereferences/root-obligation.rs`

The heuristics are:

 - the type of the leaf predicate is (roughly) the same as the type
   from the root predicate, as a proxy for "we care about the root"
 - the leaf trait and the root trait are different, so as to avoid
   talking about `&mut T: Trait` and instead remain talking about
   `T: Trait` instead
 - the root trait is not `Unsize`, as to avoid talking about it in
   `tests/ui/coercion/coerce-issue-49593-box-never.rs`.

```
error[E0277]: the trait bound `&char: Pattern<'_>` is not satisfied
  --> $DIR/root-obligation.rs:6:38
   |
LL |         .filter(|c| "aeiou".contains(c))
   |                             -------- ^ the trait `Fn<(char,)>` is not implemented for `&char`, which is required by `&char: Pattern<'_>`
   |                             |
   |                             required by a bound introduced by this call
   |
   = note: required for `&char` to implement `FnOnce<(char,)>`
   = note: required for `&char` to implement `Pattern<'_>`
note: required by a bound in `core::str::<impl str>::contains`
  --> $SRC_DIR/core/src/str/mod.rs:LL:COL
help: consider dereferencing here
   |
LL |         .filter(|c| "aeiou".contains(*c))
   |                                      +
```

Fix #79359, fix #119983, fix #118779, cc #118415 (the suggestion needs
to change).
2024-03-03 18:53:35 +00:00
bors
26907374b9 Auto merge of #121937 - GuillaumeGomez:rollup-9684vg3, r=GuillaumeGomez
Rollup of 3 pull requests

Successful merges:

 - #121917 (Add new `pattern_complexity` attribute to add possibility to limit and check recursion in pattern matching)
 - #121933 (Add missing get_name for wasm::thread.)
 - #121934 (rustc_log: expose tracing-tree "wraparound" in an env var)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-03 14:01:47 +00:00
Guillaume Gomez
e634a0a51b
Rollup merge of #121934 - RalfJung:tree-wraparound, r=oli-obk
rustc_log: expose tracing-tree "wraparound" in an env var

This would be RUSTC_LOG_WRAPTREE, but I am open to other names.

r? `@oli-obk`
2024-03-03 14:07:44 +01:00
Guillaume Gomez
d769aceab6
Rollup merge of #121933 - Iansa9:thread-name-wasm-fix, r=Nilstrieb
Add missing get_name for wasm::thread.

Fixing #121932 by implementing `get_name` in `wasm:🧵:Thread`.
2024-03-03 14:07:43 +01:00
Guillaume Gomez
7d8f74f8b2
Rollup merge of #121917 - GuillaumeGomez:pattern-complexity_limit.rs, r=Nadrieril
Add new `pattern_complexity` attribute to add possibility to limit and check recursion in pattern matching

Needed for https://github.com/rust-lang/rust-analyzer/issues/9528.

This PR adds a new attribute only available when running rust testsuite called `pattern_complexity` which allows to set the maximum recursion for the pattern matching. It is quite useful to ensure the complexity doesn't grow, like in `tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs`.

r? `@Nadrieril`
2024-03-03 14:07:43 +01:00
Guillaume Gomez
f04c5c5112 Add feature gate test for pattern_complexity attribute 2024-03-03 13:10:15 +01:00
Guillaume Gomez
f04b7ee130 Add and update tests to use pattern_complexity 2024-03-03 13:10:15 +01:00
Guillaume Gomez
be31b6b6cd Add new pattern_complexity attribute to add possibility to limit and check recursion in pattern matching 2024-03-03 13:10:15 +01:00
bors
9e73597e5a Auto merge of #121903 - Nilstrieb:rename-qnx-file, r=WaffleLapkin
Remove underscore from QNX target file name

For consistency with the other QNX targets and the actual target names.
2024-03-03 11:34:21 +00:00
Ralf Jung
90162ea7b1 rustc_log: expose tracing-tree "wraparound" in an env var 2024-03-03 12:33:26 +01:00
bors
10902058a9 Auto merge of #121931 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-03-03 09:07:22 +00:00
Ian Neumann
eb5328b721 Add missing get_name for wasm::thread. 2024-03-03 00:25:51 -08:00
Laurențiu Nicola
964e769ffd Merge commit '4ef6a49b44e8aa380da7522442234bfd7a52c55e' into sync-from-ra 2024-03-03 09:17:31 +02:00
bors
a09d91b04a Auto merge of #121877 - estebank:fancy-svg, r=compiler-errors
On tests that specify `--color=always` emit SVG file with stderr output

Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files instead of `.stderr` files for tests that explicitly enable color output. This will make reviewing changes to the graphical output of tests much more human friendly.

<img src="https://raw.githubusercontent.com/rust-lang/rust/b4bdb56f86e136ca63bf71dca3034200c6c25900/tests/ui/error-emitter/highlighting.svg">
2024-03-03 06:40:56 +00:00
bors
3793e5ba23 Auto merge of #121856 - ChrisDenton:abort, r=joboet
Cleanup windows `abort_internal`

As the comments on the functions say, we define abort in both in panic_abort and in libstd. This PR makes the two implementation (mostly) the same.

Additionally it:
* uses `options(noreturn)` on the asm instead of using `core::intrinsics::unreachable`.
* removed unnecessary allow lints
* added `FAST_FAIL_FATAL_APP_EXIT` to our generated Windows API bindings instead of defining it manually (std only)
2024-03-03 04:26:34 +00:00
bors
da02fff3b6 Auto merge of #112865 - rust-lang:cargo_update, r=clubby789
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.

The following is the output from `cargo update`:

```txt
    Updating ahash v0.8.8 -> v0.8.10
    Updating annotate-snippets v0.10.1 -> v0.10.2
    Updating anstream v0.6.11 -> v0.6.13
    Updating anyhow v1.0.79 -> v1.0.80
    Updating bumpalo v3.14.0 -> v3.15.3
    Updating clap v4.5.0 -> v4.5.1
    Updating clap_builder v4.5.0 -> v4.5.1
    Updating clap_complete v4.5.0 -> v4.5.1
    Updating crossbeam-channel v0.5.11 -> v0.5.12
    Updating darling v0.20.6 -> v0.20.8
    Updating darling_core v0.20.6 -> v0.20.8
    Updating darling_macro v0.20.6 -> v0.20.8
    Updating dlmalloc v0.2.5 -> v0.2.6
    Updating indexmap v2.2.3 -> v2.2.5
    Updating libloading v0.8.1 -> v0.8.2
    Updating log v0.4.20 -> v0.4.21
    Updating mio v0.8.10 -> v0.8.11
    Updating normpath v1.1.1 -> v1.2.0
    Updating openssl v0.10.63 -> v0.10.64
    Updating openssl-sys v0.9.99 -> v0.9.101
    Updating pest v2.7.7 -> v2.7.8
    Updating pest_derive v2.7.7 -> v2.7.8
    Updating pest_generator v2.7.7 -> v2.7.8
    Updating pest_meta v2.7.7 -> v2.7.8
    Updating pkg-config v0.3.29 -> v0.3.30
    Updating rayon v1.8.1 -> v1.9.0
 Downgrading regex v1.9.4 -> v1.8.4
    Updating regex-automata v0.3.7 -> v0.3.9
    Updating reqwest v0.11.23 -> v0.11.24
      Adding rustls-pemfile v1.0.4
    Updating ryu v1.0.16 -> v1.0.17
    Updating semver v1.0.21 -> v1.0.22
    Updating serde v1.0.196 -> v1.0.197
    Updating serde_derive v1.0.196 -> v1.0.197
    Updating serde_json v1.0.113 -> v1.0.114
    Updating socket2 v0.5.5 -> v0.5.6
    Updating syn v2.0.48 -> v2.0.52
      Adding sync_wrapper v0.1.2
    Updating sysinfo v0.30.5 -> v0.30.6
    Updating tempfile v3.10.0 -> v3.10.1
    Updating thread_local v1.1.7 -> v1.1.8
    Updating unicode-normalization v0.1.22 -> v0.1.23
    Updating unicode-script v0.5.5 -> v0.5.6
    Updating walkdir v2.4.0 -> v2.5.0
    Updating windows-targets v0.52.0 -> v0.52.4
    Updating windows_aarch64_gnullvm v0.52.0 -> v0.52.4
    Updating windows_aarch64_msvc v0.52.0 -> v0.52.4
    Updating windows_i686_gnu v0.52.0 -> v0.52.4
    Updating windows_i686_msvc v0.52.0 -> v0.52.4
    Updating windows_x86_64_gnu v0.52.0 -> v0.52.4
    Updating windows_x86_64_gnullvm v0.52.0 -> v0.52.4
    Updating windows_x86_64_msvc v0.52.0 -> v0.52.4
```
2024-03-03 01:28:07 +00:00
github-actions
8ef1981716 cargo update
Updating ahash v0.8.8 -> v0.8.10
    Updating annotate-snippets v0.10.1 -> v0.10.2
    Updating anstream v0.6.11 -> v0.6.13
    Updating anyhow v1.0.79 -> v1.0.80
    Updating bumpalo v3.14.0 -> v3.15.3
    Updating clap v4.5.0 -> v4.5.1
    Updating clap_builder v4.5.0 -> v4.5.1
    Updating clap_complete v4.5.0 -> v4.5.1
    Updating crossbeam-channel v0.5.11 -> v0.5.12
    Updating darling v0.20.6 -> v0.20.8
    Updating darling_core v0.20.6 -> v0.20.8
    Updating darling_macro v0.20.6 -> v0.20.8
    Updating dlmalloc v0.2.5 -> v0.2.6
    Updating indexmap v2.2.3 -> v2.2.5
    Updating libloading v0.8.1 -> v0.8.2
    Updating log v0.4.20 -> v0.4.21
    Updating mio v0.8.10 -> v0.8.11
    Updating normpath v1.1.1 -> v1.2.0
    Updating openssl v0.10.63 -> v0.10.64
    Updating openssl-sys v0.9.99 -> v0.9.101
    Updating pest v2.7.7 -> v2.7.8
    Updating pest_derive v2.7.7 -> v2.7.8
    Updating pest_generator v2.7.7 -> v2.7.8
    Updating pest_meta v2.7.7 -> v2.7.8
    Updating pkg-config v0.3.29 -> v0.3.30
    Updating rayon v1.8.1 -> v1.9.0
 Downgrading regex v1.9.4 -> v1.8.4
    Updating regex-automata v0.3.7 -> v0.3.9
    Updating reqwest v0.11.23 -> v0.11.24
      Adding rustls-pemfile v1.0.4
    Updating ryu v1.0.16 -> v1.0.17
    Updating semver v1.0.21 -> v1.0.22
    Updating serde v1.0.196 -> v1.0.197
    Updating serde_derive v1.0.196 -> v1.0.197
    Updating serde_json v1.0.113 -> v1.0.114
    Updating socket2 v0.5.5 -> v0.5.6
    Updating syn v2.0.48 -> v2.0.52
      Adding sync_wrapper v0.1.2
    Updating sysinfo v0.30.5 -> v0.30.6
    Updating tempfile v3.10.0 -> v3.10.1
    Updating thread_local v1.1.7 -> v1.1.8
    Updating unicode-normalization v0.1.22 -> v0.1.23
    Updating unicode-script v0.5.5 -> v0.5.6
    Updating walkdir v2.4.0 -> v2.5.0
    Updating windows-targets v0.52.0 -> v0.52.4
    Updating windows_aarch64_gnullvm v0.52.0 -> v0.52.4
    Updating windows_aarch64_msvc v0.52.0 -> v0.52.4
    Updating windows_i686_gnu v0.52.0 -> v0.52.4
    Updating windows_i686_msvc v0.52.0 -> v0.52.4
    Updating windows_x86_64_gnu v0.52.0 -> v0.52.4
    Updating windows_x86_64_gnullvm v0.52.0 -> v0.52.4
    Updating windows_x86_64_msvc v0.52.0 -> v0.52.4
2024-03-03 00:16:16 +00:00
bors
0decdac390 Auto merge of #121914 - Nadrieril:rollup-ol98ncg, r=Nadrieril
Rollup of 5 pull requests

Successful merges:

 - #120761 (Add initial support for DataFlowSanitizer)
 - #121622 (Preserve same vtable pointer when cloning raw waker, to fix Waker::will_wake)
 - #121716 (match lowering: Lower bindings in a predictable order)
 - #121731 (Now that inlining, mir validation and const eval all use reveal-all, we won't be constraining hidden types here anymore)
 - #121841 (`f16` and `f128` step 2: intrinsics)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-02 22:59:19 +00:00
Esteban Kuber
b4bdb56f86 On tests that specify --color=always emit SVG file with stderr output
Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files
instead of `.stderr` files for tests that explicitly enable color
output. This will make reviewing changes to the graphical output of
tests much more human friendly.
2024-03-02 22:47:17 +00:00
bors
5119208fd7 Auto merge of #121904 - matthiaskrgr:rollup-qcq0d3h, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #121666 (Use the OS thread name by default if `THREAD_INFO` has not been initialized)
 - #121758 (Move thread local implementation to `sys`)
 - #121759 (attempt to further clarify addr_of docs)
 - #121855 (Correctly generate item info of trait items)
 - #121888 (style library/core/src/error.rs)
 - #121892 (The ordinary lowering of `thir::ExprKind::Let` is unreachable)
 - #121895 (avoid collecting into vecs in some places)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-02 20:34:58 +00:00
Guillaume Boisseau
4c65eef269
Rollup merge of #121841 - tgross35:f16-f128-step2-intrinsics, r=compiler-errors
`f16` and `f128` step 2: intrinsics

Continuation of https://github.com/rust-lang/rust/pull/121728, another portion of https://github.com/rust-lang/rust/pull/114607.

This PR adds `f16` and `f128` intrinsics, and hooks them up to both HIR and LLVM. This is all still unexposed to the frontend, which will probably be the next step. Also update itanium mangling per `@rcvalle's` in https://github.com/rust-lang/rust/pull/121728/files#r1506570300, and fix a typo from step 1.

Once these types are usable in code, I will add the codegen tests from #114607 (codegen is passing on that branch)

This does add more `unimplemented!`s to Clippy, but I still don't think we can do better until library support is added.

r? `@compiler-errors`
cc `@Nilstrieb`
`@rustbot` label +T-compiler +F-f16_and_f128
2024-03-02 20:13:24 +01:00
Guillaume Boisseau
200019c199
Rollup merge of #121731 - oli-obk:eager_opaque_checks, r=compiler-errors
Now that inlining, mir validation and const eval all use reveal-all, we won't be constraining hidden types here anymore

r? `@compiler-errors`

one bubble down, two more to go

the test is unrelated, just something I noticed would be good to test in both the old solver and the new.
2024-03-02 20:13:23 +01:00
Guillaume Boisseau
30976fbe2b
Rollup merge of #121716 - Nadrieril:simple-binding-order, r=matthewjasper
match lowering: Lower bindings in a predictable order

After the recent refactorings, we can now lower bindings in a truly predictable order. The order in https://github.com/rust-lang/rust/pull/120214 was an improvement but not very clear. With this PR, we lower bindings from left to right, with the special case that `x @ pat` is traversed as `pat @ x` (i.e. `x` is lowered after any bindings in `pat`).

This description only applies in the absence of or-patterns. Or-patterns make everything complicated, because the binding place depends on the subpattern. Until I have a better idea I leave them to be handled in whatever weird order arises from today's code.

r? `@matthewjasper`
2024-03-02 20:13:23 +01:00
Guillaume Boisseau
b0ca9b5d44
Rollup merge of #121622 - dtolnay:wake, r=cuviper
Preserve same vtable pointer when cloning raw waker, to fix Waker::will_wake

Fixes #121600.

As `@jkarneges` identified in https://github.com/rust-lang/rust/issues/121600#issuecomment-1963041051, the issue is two different const promotions produce two statics at different addresses, which may or may not later be deduplicated by the linker (in this case not).

Prior to #119863, the content of the statics was compared, and they were equal. After, the address of the statics are compared and they are not equal.

It is documented that `will_wake` _"works on a best-effort basis, and may return false even when the Wakers would awaken the same task"_ so this PR fixes a quality-of-implementation issue, not a correctness issue.
2024-03-02 20:13:22 +01:00
Guillaume Boisseau
8653c09087
Rollup merge of #120761 - rcvalle:rust-dfsan, r=nikic
Add initial support for DataFlowSanitizer

Adds initial support for DataFlowSanitizer to the Rust compiler. It currently supports `-Zsanitizer-dataflow-abilist`. Additional options for it can be passed to LLVM command line argument processor via LLVM arguments using `llvm-args` codegen option (e.g., `-Cllvm-args=-dfsan-combine-pointer-labels-on-load=false`).
2024-03-02 20:13:22 +01:00
Chris Denton
ce26c78820
Cleanup windows abort_internal 2024-03-02 18:22:15 +00:00
Matthias Krüger
fcf58059c2
Rollup merge of #121895 - matthiaskrgr:devec, r=fee1-dead
avoid collecting into vecs in some places
2024-03-02 16:53:17 +01:00
Matthias Krüger
7bacfced95
Rollup merge of #121892 - Zalathar:expr-kind-let, r=Nadrieril
The ordinary lowering of `thir::ExprKind::Let` is unreachable

After desugaring, `let` expressions should only appear inside `if` expressions or `match` guards, possibly nested within a let-chain. In both cases they are specifically handled by the lowerings of those expressions, so this case is currently unreachable.

---

Context: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Lowering.20of.20.60thir.3A.3AExprKind.3A.3ALet.60.20is.20unreachable

My conclusions are partly based on the observation that stubbing out this match arm doesn't cause any test failures. So either this really is unreachable, or it can be reached in some obscure circumstances that our test suite doesn't cover.

If we end up needing this code (or something like it) for an implementation of https://github.com/rust-lang/rfcs/pull/3573, it should be easy enough to pull it back out of version control history.

I looked into having the `if`/`match` lowerings call back into `expr_into_dest`, but from what I can tell that won't work well, because there are extra scoping considerations that require some awareness of the enclosing if/match.

r? ```@Nadrieril```
2024-03-02 16:53:16 +01:00
Matthias Krüger
5b66e008e0
Rollup merge of #121888 - cppcoffee:style, r=Nilstrieb
style library/core/src/error.rs

Add an extra blank line for clarity in distinguishing implementations.
2024-03-02 16:53:16 +01:00
Matthias Krüger
240d0ad67a
Rollup merge of #121855 - GuillaumeGomez:trait-item-info, r=notriddle
Correctly generate item info of trait items

Fixes #121772.

The `document_info` function was wrongly used when documenting a trait item.

r? `@notriddle`
2024-03-02 16:53:15 +01:00
Matthias Krüger
3e59b7834a
Rollup merge of #121759 - RalfJung:addr_of, r=the8472
attempt to further clarify addr_of docs
2024-03-02 16:53:15 +01:00
Matthias Krüger
2f72206b4c
Rollup merge of #121758 - joboet:move_pal_thread_local, r=ChrisDenton
Move thread local implementation to `sys`

Part of #117276.
2024-03-02 16:53:14 +01:00
Matthias Krüger
0f544f280a
Rollup merge of #121666 - ChrisDenton:thread-name, r=cuviper
Use the OS thread name by default if `THREAD_INFO` has not been initialized

Currently if `THREAD_INFO` hasn't been initialized then the name will be set to `None`.  This PR changes it to use the OS thread name by default. This mostly affects foreign threads at the moment but we could expand this to make more use of the OS thread name in the future.

Note: I've only implemented `Thread::get_name` for windows, linux and macos (and macos adjacent) targets. The rest just return `None`.
2024-03-02 16:53:14 +01:00
Nilstrieb
8ca9b8dbf7 Remove underscore from QNX target file name
For consistency with the other QNX targets and the actual target names.
2024-03-02 16:50:03 +01:00
Matthias Krüger
7a48987006 avoid collecting into vecs in some places 2024-03-02 14:18:47 +01:00
bors
5257aee7dd Auto merge of #121890 - matthiaskrgr:rollup-mv26uwt, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #109263 (fix typo in documentation for std::fs::Permissions)
 - #120684 (Update E0716.md for clarity)
 - #121715 (match lowering: pre-simplify or-patterns too)
 - #121739 (Display short types for unimplemented trait)
 - #121815 (Move `gather_comments`.)
 - #121835 (Move `HandleStore` into `server.rs`.)
 - #121847 (Remove hidden use of Global)
 - #121861 (Use the guaranteed precision of a couple of float functions in docs)
 - #121875 ( Account for unmet T: !Copy in E0277 message)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-02 11:21:44 +00:00
bors
4ef6a49b44 Auto merge of #16702 - Veykril:intra-doc-links-generic, r=Veykril
fix: Ignore generic arguments in intra doc link path resolution

Fixes https://github.com/rust-lang/rust-analyzer/issues/16699
2024-03-02 09:51:16 +00:00
Zalathar
972d8daf47 The ordinary lowering of thir::ExprKind::Let is unreachable
After desugaring, `let` expressions should only appear inside `if` expressions
or `match` guards, possibly nested within a let-chain. In both cases they are
specifically handled by the lowerings of those expressions, so this case is
currently unreachable.
2024-03-02 20:49:29 +11:00
bors
5c4c126832 Auto merge of #16704 - Veykril:stuff, r=Veykril
internal: Simplify
2024-03-02 09:37:26 +00:00
Ralf Jung
ec5e2dc241 attempt to further clarify addr_of docs 2024-03-02 10:12:02 +01:00
Matthias Krüger
07bd4590fb
Rollup merge of #121875 - estebank:e0277-drive-by, r=compiler-errors
Account for unmet T: !Copy in E0277 message

```
error[E0277]: the trait bound `T: !Copy` is not satisfied
  --> $DIR/simple.rs:10:16
   |
LL |     not_copy::<T>();
   |                ^ the trait bound `T: !Copy` is not satisfied
```
instead of the current

```
error[E0277]: the trait bound `T: !Copy` is not satisfied
  --> $DIR/simple.rs:10:16
   |
LL |     not_copy::<T>();
   |                ^ the trait `!Copy` is not implemented for `T`
```
2024-03-02 10:09:38 +01:00
Matthias Krüger
c95f485744
Rollup merge of #121861 - tbu-:pr_floating_point_exact_examples, r=workingjubilee
Use the guaranteed precision of a couple of float functions in docs
2024-03-02 10:09:37 +01:00
Matthias Krüger
78249a6790
Rollup merge of #121847 - shamatar:btreemap_fix_implicits, r=cuviper
Remove hidden use of Global

Fixes #121797
2024-03-02 10:09:37 +01:00
Matthias Krüger
4f3d7e2d11
Rollup merge of #121835 - nnethercote:mv-HandleStore, r=bjorn3
Move `HandleStore` into `server.rs`.

This just moves the server-relevant parts of handles into `server.rs`. It introduces a new higher-order macro `with_api_handle_types` to avoid some duplication.

This fixes two `FIXME` comments, and makes things clearer, by not having server code in `client.rs`.

r? ```@bjorn3```
2024-03-02 10:09:36 +01:00
Matthias Krüger
9b2644030a
Rollup merge of #121815 - nnethercote:mv-gather_comments, r=est31
Move `gather_comments`.

To the module where it is used, so it doesn't have to be `pub`.

r? ```@est31```
2024-03-02 10:09:36 +01:00
Matthias Krüger
3432d1b087
Rollup merge of #121739 - jieyouxu:loooong-typename, r=estebank
Display short types for unimplemented trait

Shortens unimplemented trait diagnostics. Now shows:

```
error[E0277]: `Option<Option<Option<...>>>` doesn't implement `std::fmt::Display`
  --> $DIR/on_unimplemented_long_types.rs:4:17
   |
LL |   pub fn foo() -> impl std::fmt::Display {
   |                   ^^^^^^^^^^^^^^^^^^^^^^ `Option<Option<Option<...>>>` cannot be formatted with the default formatter
LL |
LL | /     Some(Some(Some(Some(Some(Some(Some(Some(Some(S...
LL | |         Some(Some(Some(Some(Some(Some(Some(Some(So...
LL | |             Some(Some(Some(Some(Some(Some(Some(Som...
LL | |                 Some(Some(Some(Some(Some(Some(Some...
...  |
LL | |         ))))))))))),
LL | |     )))))))))))
   | |_______________- return type was inferred to be `Option<Option<Option<...>>>` here
   |
   = help: the trait `std::fmt::Display` is not implemented for `Option<Option<Option<...>>>`
   = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.
```

I'm not 100% sure if this is desirable, or if we should just let the long types remain long. This is also kinda a short-term bandaid solution. The real long term solution is to properly migrate `rustc_trait_selection`'s error reporting to use translatable diagnostics and then properly handle type name printing.

Fixes #121687.
2024-03-02 10:09:36 +01:00
Matthias Krüger
b2c933a1b9
Rollup merge of #121715 - Nadrieril:testcase-or, r=matthewjasper
match lowering: pre-simplify or-patterns too

This is the final part of my work to simplify match pairs early: now we do it for or-patterns too. This makes it possible to collect fake borrows separately from the main match lowering algorithm. That'll enable more simplifications of or-pattern handling.

Note: I was tempted to have `Candidate` contain a `FlatPat`, but there are so many places that use `candidate.match_pairs` etc directly that I chose not to.

r? `@matthewjasper`
2024-03-02 10:09:35 +01:00
Matthias Krüger
1c724ee110
Rollup merge of #120684 - carschandler:patch-1, r=nnethercote
Update E0716.md for clarity

When reading through this, I got slightly hung up thinking the `let` it was referring to was the `let tmp` on line 25, which was confusing considering the comment states that the temporary is freed at the end of the block. I think adding this clarification could potentially help some beginners like myself without being overly verbose.
2024-03-02 10:09:35 +01:00
Matthias Krüger
d0e5431eb0
Rollup merge of #109263 - squell:master, r=cuviper
fix typo in documentation for std::fs::Permissions

Please check and re-check this PR carefully to see if I got this right.

But by my logic, if the `read_only` function returns `true`, I would not expect be able to write to the file (it being read only); so this text is meant to clarify that `read_only` being `false` doesn't mean *you* can actually write to the file, just that "in general" someone is able to.
2024-03-02 10:09:34 +01:00
bors
6cb576a137 Auto merge of #16735 - lnicola:smolstr-new-static, r=lnicola
minor: Remove outdated comment about static SmolStrs

Closes https://github.com/rust-lang/rust-analyzer/issues/16734
2024-03-02 08:57:47 +00:00