Commit Graph

230751 Commits

Author SHA1 Message Date
bors
d4145eeef4 Auto merge of #112843 - chenyukang:yukang-more-on-backtrace, r=workingjubilee
Print omitted frames count for short backtrace mode

Fixes #111730
2023-07-30 22:31:52 +00:00
bors
a17c7968b7 Auto merge of #114264 - matthiaskrgr:rollup-dfsuu1v, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #98154 (merge functionality of `io::Sink` into `io::Empty`)
 - #102198 (`const`-stablilize `NonNull::as_ref`)
 - #114074 (inline format!() args from rustc_middle up to and including rustc_codegen_llvm (3))
 - #114246 (Weaken unnameable_types lint)
 - #114256 (Fix invalid suggestion for mismatched types in closure arguments)
 - #114258 (Simplify `Span::can_be_used_for_suggestions` a little tiny bit)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-30 19:53:37 +00:00
Matthias Krüger
4916ab5330
Rollup merge of #114258 - WaffleLapkin:reuse_in_derive_expansion, r=petrochenkov
Simplify `Span::can_be_used_for_suggestions` a little tiny bit

Just something I saw randomly.
2023-07-30 20:36:35 +02:00
Matthias Krüger
97bacad9c2
Rollup merge of #114256 - Urgau:fix-issue-114180, r=WaffleLapkin
Fix invalid suggestion for mismatched types in closure arguments

This PR fixes the invalid suggestion for mismatched types in closure arguments.

The invalid suggestion came from a wrongly created span in the parser for closure arguments that don't have a type specified. Specifically, the span in this case was the last token span, but in the case of tuples, the span represented the last parenthesis instead of the whole tuple, which is fixed by taking the more accurate span of the pattern.

There is one unfortunate downside of this fix, it worsens even more the diagnostic for mismatched types in closure args without an explicit type. This happens because there is no correct span for implied inferred type. I tried also fixing this but it's a rabbit hole.

Fixes https://github.com/rust-lang/rust/issues/114180
2023-07-30 20:36:35 +02:00
Matthias Krüger
d113b5b848
Rollup merge of #114246 - Bryanskiy:type-privacy-lints-fixes, r=petrochenkov
Weaken unnameable_types lint

`unnameable_types` lint is no longer emitted for
- associated types
- internal types

r? ``@petrochenkov``
2023-07-30 20:36:34 +02:00
Matthias Krüger
b192576036
Rollup merge of #114074 - matthiaskrgr:fmt_args_rustc_2, r=WaffleLapkin
inline format!() args from rustc_middle up to and including rustc_codegen_llvm (3)

r? `@WaffleLapkin`
2023-07-30 20:36:34 +02:00
Matthias Krüger
e3ca397593
Rollup merge of #102198 - lukas-code:nonnull_as_ref, r=Amanieu
`const`-stablilize `NonNull::as_ref`

A bunch of pointer to reference methods have been made unstably const some time ago in #91823 under the feature gate `const_ptr_as_ref`.
Out of these, `NonNull::as_ref` can be implemented as a `const fn` in stable rust today, so i hereby propose to const stabilize this function only.

Tracking issue: #91822

``@rustbot`` label +T-libs-api -T-libs
2023-07-30 20:36:34 +02:00
Matthias Krüger
27e3a740ae
Rollup merge of #98154 - vidhanio:master, r=workingjubilee
merge functionality of `io::Sink` into `io::Empty`

Many times, there is a need for a simple dummy `io::Read`er + `io::Write`r, but currently the only options are `io::Empty` and `io::Sink` respectively. Having both of their functionality together requires writing your own boilerplate for something that makes sense to have in the standard library. This PR adds the functionality of `io::Sink` to `io::Empty`, making `io::Empty` be able to perform the tasks of both of the previous structs. (This idea was first mentioned in #24235)

Note: I also updated some doc comments in `io::utils` in this pull request to fix inconsistencies between `io::Sink` and `io::Empty`.

API Change Proposal: https://github.com/rust-lang/libs-team/issues/49
2023-07-30 20:36:33 +02:00
bors
a8be6e070f Auto merge of #114204 - GuillaumeGomez:remove-unneeded-clone-calls, r=notriddle
[rustdoc] Remove unneeded `clone()` calls for `derive_id`

I realized we were cloning values before passing them to `derive_id` where they are cloned again, which isn't great. Since they'll be cloned anyway, let's allow to pass both by reference and by value.

r? `@notriddle`
2023-07-30 18:11:08 +00:00
yukang
7b3d1b775f normalize backtrace error messages 2023-07-31 01:19:02 +08:00
Maybe Waffle
a3838780f2 Simplify Span::can_be_used_for_suggestions a little tiny bit 2023-07-30 15:37:39 +00:00
Urgau
8ea7e45e44 Fix invalid suggestion for mismatched types in closure arguments
The invalid suggestion came from a wrongly created span in `rustc_parse'
for closure arguments that didn't have a type specified. Specifically,
the span in this case was the last token span, but in the case of
tuples, the span represented the last parenthesis instead of the whole
tuple, which is fixed by taking the more accurate span of the pattern.
2023-07-30 17:15:55 +02:00
bors
89acdae9f2 Auto merge of #114250 - matthiaskrgr:rollup-0r0dhrr, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #110056 (Fix the example in document for WaitTimeoutResult::timed_out)
 - #112655 (Mark `map_or` as `#[must_use]`)
 - #114018 (Make `--error-format human-annotate-rs` handle multiple files)
 - #114068 (inline format!() args up to and including rustc_middle (2))
 - #114223 (Documentation: Fix Stilted Language in Vec->Indexing)
 - #114227 (Add tidy check for stray rustfix files)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-30 13:59:25 +00:00
Matthias Krüger
b9f17f1e78
Rollup merge of #114227 - asquared31415:tidy_check_fixed, r=albertlarsan68
Add tidy check for stray rustfix files

`x.fixed` files that don't correspond to a test file now emit a tidy error.
2023-07-30 14:25:10 +02:00
Matthias Krüger
de6caffe3a
Rollup merge of #114223 - ryanoneill:vec-indexing-doc-language, r=workingjubilee
Documentation: Fix Stilted Language in Vec->Indexing

Problem

Language in the Vec->Indexing documentation sounds stilted due to incorrect word ordering: "... type allows to access values by index."

Solution

Reorder words in the Vec->Indexing documentation to flow better: "... type allows access to values by index." The phrase "allows access to" also matches other existing documentation.
2023-07-30 14:25:10 +02:00
Matthias Krüger
a964f948d5
Rollup merge of #114068 - matthiaskrgr:fmt_args_rustc_1, r=WaffleLapkin
inline format!() args up to and including rustc_middle (2)

r? `@WaffleLapkin`
2023-07-30 14:25:09 +02:00
Matthias Krüger
427f3d3266
Rollup merge of #114018 - Enselic:multi-annotation, r=b-naber
Make `--error-format human-annotate-rs` handle multiple files

Closes #64205 which is E-help-wanted
2023-07-30 14:25:09 +02:00
Matthias Krüger
e3bf088fb5
Rollup merge of #112655 - WaffleLapkin:must_use_map_or, r=workingjubilee
Mark `map_or` as `#[must_use]`

I don't know what else to say.

r? libs
2023-07-30 14:25:08 +02:00
Matthias Krüger
e517ee02b2
Rollup merge of #110056 - chenyukang:yukang/fix-110045, r=workingjubilee
Fix the example in document for WaitTimeoutResult::timed_out

Fixes #110045
2023-07-30 14:25:08 +02:00
Matthias Krüger
3ce90b1649 inline format!() args up to and including rustc_codegen_llvm 2023-07-30 14:22:50 +02:00
bors
483ef5f4d8 Auto merge of #114066 - matthiaskrgr:fmt_args_inline_bootstrap, r=WaffleLapkin
bootstrap: inline format!() args (0)

r? `@WaffleLapkin`
2023-07-30 12:14:04 +00:00
Guillaume Gomez
148a0c1673 Remove some unneeded clone() calls 2023-07-30 13:26:36 +02:00
Matthias Krüger
23815467a2 inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
Bryanskiy
8203d1ddf6 Weaken unnameable_types lint 2023-07-30 14:02:21 +03:00
Maybe Waffle
90f9640528 Mark map_or as #[must_use] 2023-07-30 10:22:23 +00:00
Matthias Krüger
a0503a83d0 bootstrap: inline format!() args 2023-07-30 11:46:14 +02:00
yukang
d67d9890ae Fix the example in document for WaitTimeoutResult::timed_out 2023-07-30 16:39:33 +08:00
bors
4c9ac1e93b Auto merge of #114236 - fee1-dead-contrib:rollup-m92j7q1, r=fee1-dead
Rollup of 3 pull requests

Successful merges:

 - #112151 (Clarify behavior of inclusive bounds in BTreeMap::{lower,upper}_bound)
 - #113512 (Updated lines doc to include trailing carriage return note)
 - #114203 (Effects: don't print `host` param in diagnostics)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-30 07:57:13 +00:00
fee1-dead
7b4bfd640d
Rollup merge of #114203 - fee1-dead-contrib:effects/pp-no-host, r=oli-obk
Effects: don't print `host` param in diagnostics

r? ``@oli-obk``
2023-07-30 07:13:03 +00:00
fee1-dead
b97da75156
Rollup merge of #113512 - vallentin:lines-doc, r=workingjubilee
Updated lines doc to include trailing carriage return note

Updated `str::lines` doc to include explicit info about (trailing) carriage returns.

Reference: #100311
2023-07-30 07:13:02 +00:00
fee1-dead
3143030cda
Rollup merge of #112151 - chloekek:patch-1, r=workingjubilee
Clarify behavior of inclusive bounds in BTreeMap::{lower,upper}_bound

It wasn’t quite clear to me how these methods would interpret inclusive bounds so I added examples for those.
2023-07-30 07:13:01 +00:00
bors
2e0136a131 Auto merge of #112280 - zica87:master, r=workingjubilee
Remove redundant example of `BTreeSet::iter`

The usage and that `Values returned by the iterator are returned in ascending order` are already demonstrated by the other example and the description, so I removed the useless one.
2023-07-30 06:12:03 +00:00
bors
fb53384c94 Auto merge of #114226 - matthiaskrgr:rollup-wxdudsm, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #114129 (Rustdoc small cleanups)
 - #114152 ([rustc][data_structures] Simplify binary_search_slice.)
 - #114222 (Mark `lazy_type_alias` as incomplete)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-30 00:41:35 +00:00
asquared31415
6850a00bd0 add tidy check for stray rustfix files 2023-07-29 23:49:04 +00:00
Matthias Krüger
d4926b13aa
Rollup merge of #114222 - compiler-errors:lazy-type-alias-is-incomplete, r=oli-obk
Mark `lazy_type_alias` as incomplete

This feature is very not complete: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AF-lazy_type_alias

r? types
2023-07-30 01:22:43 +02:00
Matthias Krüger
b8895980bc
Rollup merge of #114152 - ttsugriy:master, r=WaffleLapkin
[rustc][data_structures] Simplify binary_search_slice.

Instead of using `binary_search_by_key`, it's possible to use `partition_point` to find the lower bound. This avoids the need to locate the leftmost matching entry separately.

It's also possible to use `partition_point` to find the upper bound, so I plan to send a separate PR for your consideration.
2023-07-30 01:22:42 +02:00
Matthias Krüger
fa94851b07
Rollup merge of #114129 - GuillaumeGomez:rustdoc-cleanup, r=notriddle
Rustdoc small cleanups

Each commit does some little cleanups:

 * We had some `Res` comparisons in multiple places (and still do, but unless we use a macro, it's not possible to "merge" any further) so I moved it into a function.
 * It was weird to have some utils function used everywhere in `visit_ast` so I instead moved it into `clean/utils.rs`.
 * In HTML rendering, we had some write "issues":
   * Multiple calls that could be merged into one.
   * Some `write!` that could be `write_str`.
   * We didn't use the new `format!` args much.

r? `@notriddle`
2023-07-30 01:22:42 +02:00
bors
b969b830aa Auto merge of #113704 - compiler-errors:rpitit-assumed-wf-inherit, r=spastorino
Make RPITITs inherit the `assumed_wf_types` of their parent method

... and then move the RPITIT well-formedness check to just use the regular logic of wfchecking an associated type.

---

We need to inherit the `assumed_wf_types` of the RPITIT's parent function in order for the given code to be considered well-formed:

```rust
trait Foo {
  fn bar<'a, T>(_: &'a T) -> impl Iterator<Output = &'a T>;
}
```

Since for `&'a T` to be WF, we need `T: 'a`.

In order for this to work for late-bound lifetimes, we need to do some additional mapping of any late-bound lifetimes captured by these assumed wf types. This is because within the body of the function (and thus in the `assumed_wf_types`), they're represented as `ReFree` variants of the original late-bound lifetimes declared in the function's generics, but in the RPITIT's GAT, they're represented as "reified" `ReEarlyBound` vars (duplicated during opaque type lowering). Luckily, the mapping between these two is already [stored in the opaque](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.OpaqueTy.html#structfield.lifetime_mapping).

Fixes #113796
2023-07-29 22:58:21 +00:00
Michael Goulet
744e770939 some nits, bless test 2023-07-29 21:29:03 +00:00
Michael Goulet
50d21091ee Implement assumed_wf_types for RPITITs' implementations 2023-07-29 21:19:33 +00:00
Michael Goulet
349a2372ed Take RPITITs inherit the assumed_wf_types of their parent fn 2023-07-29 21:19:33 +00:00
bors
32303b219d Auto merge of #114211 - RalfJung:miri, r=RalfJung
update Miri

r? `@ghost`
2023-07-29 20:41:45 +00:00
Ryan O'Neill
9a01a23b9c Documentation: Fix Stilted Language in Vec->Indexing
Problem

Language in the Vec->Indexing documentation sounds stilted due to
incorrect word ordering: "... type allows to access values by index."

Solution

Reorder words in the Vec->Indexing documentation to flow better:
"... type allows access to values by index." The phrase "allows access to"
also matches other existing documentation.
2023-07-29 13:20:45 -07:00
Michael Goulet
4b58ae0bb8 Mark lazy_type_alias as incomplete 2023-07-29 19:47:15 +00:00
bors
03a57254b5 Auto merge of #114156 - calebzulawski:simd-bswap, r=compiler-errors
Add simd_bswap, simd_bitreverse, simd_ctlz, and simd_cttz intrinsics

cc `@workingjubilee`
2023-07-29 18:51:45 +00:00
bors
70757fbdd7 Auto merge of #2993 - Vanille-N:tb-protector, r=RalfJung
TB: Redefine trigger condition for protectors

The Coq formalization revealed that as currently implemented, read accesses did not always commute.
Indeed starting from a lazily initialized `Active` protected tag, applying a foreign read then a child read produces `Frozen`, but child read then foreign read triggers UB (because the child read initializes _before_ the `Active -> Frozen`).

This reformulation of when protectors trigger fixes that issue:
- instead of `Active + foreign read -> Frozen` and `Active -> Frozen` when protected is UB
- we do `Active + foreign read -> if protected { Disabled } else { Frozen }`

There is already precedent for transitions being dependent on the presence of a protector (`Reserved + foreign read -> if protected { Frozen } else { Reserved }`), and this has the nice side-effect of simplifying the protector trigger condition to just an equality check against `Disabled` since now there is protector UB iff a protected tag becomes `Disabled`.

In order not to introduce an extra `if`, it was decided that `Disabled -> Disabled` would be UB when protected, which was not the case previously. This is merely a theoretical for now because a protected `Disabled` is unreachable in the first place.

The extra test is not directly related to this modification, but also checks things related to protectors and lazy initialization.
2023-07-29 16:59:45 +00:00
bors
a04e649c09 Auto merge of #114028 - Centri3:ternary-operator, r=compiler-errors
Gracefully handle ternary operator

Fixes #112578

~~May not be the best way to do this as it doesn't check for a single `:`, so it could perhaps appear even when the actual issue is just a missing semicolon. May not be the biggest deal, though?~~

Nevermind, got it working properly now ^^
2023-07-29 16:45:29 +00:00
Neven Villani
53f0cb4b8a
doc comment suggestions 2023-07-29 18:17:34 +02:00
bors
4c96822796 Auto merge of #114148 - cuviper:drop-llvm-14, r=nikic
Update the minimum external LLVM to 15

With this change, we'll have stable support for LLVM 15 through 17 (pending release).
For reference, the previous increase to LLVM 14 was #107573.
2023-07-29 14:57:47 +00:00
Deadbeef
df3f9fdf5a Effects: don't print host param in diagnostics 2023-07-29 14:55:35 +00:00