Commit Graph

221063 Commits

Author SHA1 Message Date
bors
a5a690cf4b Auto merge of #109008 - clubby789:drop-elaborate-array, r=davidtwco
Drop array patterns using subslices

Fixes #109004
Drops contiguous subslices of an array when moving elements out with a pattern, which improves perf for large arrays
r? `@compiler-errors`
2023-04-02 12:17:52 +00:00
bors
11cd4ff34d Auto merge of #109852 - Nilstrieb:rollup-g3mgxxw, r=Nilstrieb
Rollup of 4 pull requests

Successful merges:

 - #109839 (Improve grammar of Iterator.partition_in_place)
 - #109840 (Fix typo in std/src/os/fd/owned.rs)
 - #109844 (a couple clippy::complexity fixes)
 - #109846 (more clippy::complexity fixes (iter_kv_map, map_flatten, nonminimal_bool))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-02 09:39:41 +00:00
Nilstrieb
59f394bf86
Rollup merge of #109846 - matthiaskrgr:clippy2023_04_III, r=Nilstrieb
more clippy::complexity fixes (iter_kv_map, map_flatten, nonminimal_bool)
2023-04-02 10:08:35 +02:00
Nilstrieb
e2ffe151a3
Rollup merge of #109844 - matthiaskrgr:clippy2023_04, r=Nilstrieb
a couple clippy::complexity fixes

map_identity
filter_next
option_as_ref_deref
unnecessary_find_map
redundant_slicing
unnecessary_unwrap
bool_comparison
derivable_impls
manual_flatten
needless_borrowed_reference
2023-04-02 10:08:34 +02:00
Nilstrieb
099f3469a9
Rollup merge of #109840 - taiki-e:typo, r=ChrisDenton
Fix typo in std/src/os/fd/owned.rs
2023-04-02 10:08:34 +02:00
Nilstrieb
a38bdd4439
Rollup merge of #109839 - sartak:iter-grammar, r=scottmcm
Improve grammar of Iterator.partition_in_place

This is my first PR against Rust, please let me know if there's anything I should be providing here! I didn't find any instructions specific to documentation grammar in the [std-dev guide](https://std-dev-guide.rust-lang.org/documentation/summary.html).
2023-04-02 10:08:33 +02:00
bors
637d7fdb23 Auto merge of #109701 - Amanieu:binaryheap_retain, r=ChrisDenton
Stabilize `binary_heap_retain`

FCP finished in tracking issue: #71503
2023-04-02 07:04:01 +00:00
bors
f5f93d0063 Auto merge of #109836 - clubby789:param-non-exhaustive, r=Nilstrieb
Fix `non_exhaustive_omitted_patterns` on arguments and locals

Fixes #99815

r? `@Nilstrieb`
2023-04-02 04:26:05 +00:00
bors
63fdb82c44 Auto merge of #109834 - Nilstrieb:mailmap-myself, r=Mark-Simulacrum
Add Nilstrieb to mailmap

I saw that I'm on https://thanks.rust-lang.org/ twice (once as `Nilstrieb` and once as `nils`).

This is because I've contributed as both `Nilstrieb` (locally) and `nils` (on github). So I've mailmapped them both to `Nilstrieb` (the less ambiguous of the two).

I am not entirely sure whether I've done this correctly.
2023-04-02 01:32:24 +00:00
bors
0f6312f643 Auto merge of #109833 - klensy:bs-tty, r=Mark-Simulacrum
bootstrap: replace `atty` with `is-terminal`, dedupe deps

`atty` reported as [unsound](https://rustsec.org/advisories/RUSTSEC-2021-0145), so replaced with `is-terminal`, also updated few crates to reduce dupes

fd-lock v3.0.8 -> v3.0.11 (https://github.com/yoshuawuyts/fd-lock/compare/v3.0.8...v3.0.11, https://github.com/yoshuawuyts/fd-lock/pull/38)
2023-04-01 22:51:10 +00:00
Matthias Krüger
73bd953dea slighty simplify a few boolean expressions (clippy::nonminimal_bool) 2023-04-01 23:55:22 +02:00
Matthias Krüger
5a07e33d2c use and_then/flat_map for map().flatten() 2023-04-01 23:50:45 +02:00
Matthias Krüger
ac229c2819 fix clippy::iter_kv_map 2023-04-01 23:44:16 +02:00
Matthias Krüger
8ef3bf29fe a couple clippy::complexity fixes
map_identity
filter_next
option_as_ref_deref
unnecessary_find_map
redundant_slicing
unnecessary_unwrap
bool_comparison
derivable_impls
manual_flatten
needless_borrowed_reference
2023-04-01 23:16:33 +02:00
bors
0599b6b931 Auto merge of #109483 - joboet:optimize_lazycell, r=Mark-Simulacrum
Optimize `LazyCell` size

`LazyCell` can only store either the initializing function or the data it produces, so it does not need to reserve the space for both. Similar to #107329, but uses an `enum` instead of a `union`.
2023-04-01 20:11:49 +00:00
clubby789
46f7d3deb7 Fix non_exhaustive_omitted_patterns on arguments 2023-04-01 19:15:24 +01:00
bors
0196c2bd27 Auto merge of #109835 - ehuss:update-cargo, r=ehuss
Update cargo

9 commits in 145219a9f089f8b57c09f40525374fbade1e34ae..0e474cfd7b16b018cf46e95da3f6a5b2f1f6a9e7
2023-03-27 01:56:36 +0000 to 2023-03-31 23:15:58 +0000
- Add delays to network retries. (rust-lang/cargo#11881)
- Add a note to `cargo logout` that it does not revoke the token. (rust-lang/cargo#11919)
- Sync external-tools JSON docs. (rust-lang/cargo#11918)
- Drop derive feature from serde in cargo-platform (rust-lang/cargo#11915)
- Disable test_profile test on windows-gnu (rust-lang/cargo#11916)
- src/doc/src/reference/build-scripts.md: a{n =>} benchmark target (rust-lang/cargo#11908)
- Documented working directory behaviour for `cargo test`, `cargo bench` and `cargo run` (rust-lang/cargo#11901)
- docs(contrib): Link to office hours doc (rust-lang/cargo#11903)
- chore: Upgrade to clap v4.2 (rust-lang/cargo#11904)
2023-04-01 17:37:42 +00:00
Taiki Endo
455a9601da Fix typo in std/src/os/fd/owned.rs 2023-04-02 02:14:37 +09:00
Shawn M Moore
ec71feb984 Improve grammar of Iterator.partition_in_place
b9535c0b7d Auto merge of #109801 - aliemjay:test-implied-normalization, r=petrochenkov
2023-04-01 13:01:00 -04:00
Eric Huss
6e29862fd2 Update cargo 2023-04-01 08:49:20 -07:00
Nilstrieb
fe42150801 Add Nilstrieb to mailmap
I saw that I'm on https://thanks.rust-lang.org/ twice (once as
`Nilstrieb` and once as `nils`).

This is because I've contributed as both `Nilstrieb` (locally) and `nils` (on github).
So I've mailmapped them both to `Nilstrieb` (the less ambiguous of the
two).
2023-04-01 17:16:19 +02:00
klensy
1f3ee276e5 bootstrap replace atty with is-terminal, dedupe few deps 2023-04-01 17:54:52 +03:00
bors
b9535c0b7d Auto merge of #109801 - aliemjay:test-implied-normalization, r=petrochenkov
add test for normalization in implied bounds query

See https://github.com/rust-lang/rust/issues/109799.
2023-04-01 04:29:53 +00:00
bors
87e6b621a2 Auto merge of #109721 - QuinnPainter:armv4t-lld, r=petrochenkov
Switch to LLD as default linker for {arm,thumb}v4t-none-eabi

The LLVM 16 update brought ARMv4t support to LLD. We should use it by default so users don't need to install an external linker.

cc `@Lokathor`
2023-04-01 01:55:16 +00:00
bors
fadf164d8d Auto merge of #109165 - aliemjay:fix-ice-annotation, r=davidtwco
allow ReError in CanonicalUserTypeAnnotation

Why not? we already allow `TyKind::Error`.

Fixes #109072.
2023-03-31 23:15:52 +00:00
bors
5e1d3299a2 Auto merge of #109824 - GuillaumeGomez:rollup-i5r4uts, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #109104 (rustdoc: Fix invalid suggestions on ambiguous intra doc links v2)
 - #109443 (Move `doc(primitive)` future incompat warning to `invalid_doc_attributes`)
 - #109680 (Fix subslice capture in closure)
 - #109798 (fluent_messages macro: don't emit the OS error in a note)
 - #109805 (Source map cleanups)
 - #109818 (rustdoc: Add GUI test for jump to collapsed item)
 - #109820 (rustdoc-search: update docs for comma in `?` help popover)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-31 20:38:06 +00:00
Guillaume Gomez
083c128ae1
Rollup merge of #109820 - notriddle:notriddle/help-comma, r=camelid
rustdoc-search: update docs for comma in `?` help popover
2023-03-31 22:32:51 +02:00
Guillaume Gomez
32842e87b1
Rollup merge of #109818 - GuillaumeGomez:test-collapsed-item, r=notriddle
rustdoc: Add GUI test for jump to collapsed item

Part of https://github.com/rust-lang/rust/issues/66181.

I updated `browser-ui-test` version because I needed to add a new command `property`: https://github.com/GuillaumeGomez/browser-UI-test/pull/452.

r? `@notriddle`
2023-03-31 22:32:51 +02:00
Guillaume Gomez
d732934fa8
Rollup merge of #109805 - nnethercote:source_map-cleanups, r=bjorn3
Source map cleanups

r? `@bjorn3`
2023-03-31 22:32:50 +02:00
Guillaume Gomez
bd4e3f37da
Rollup merge of #109798 - est31:ftl_test_note, r=davidtwco
fluent_messages macro: don't emit the OS error in a note

This makes it possible to make the normalization of the error message precise, allowing us to not normalize all notes away. See https://github.com/rust-lang/rust/pull/109700#discussion_r1152489053
2023-03-31 22:32:50 +02:00
Guillaume Gomez
45fcb6fd7c
Rollup merge of #109680 - clubby789:array-subslice-2229, r=davidtwco
Fix subslice capture in closure

Fixes #109298 by refining captures in the same way for Subslices and Indexes. The comment `// we never capture this` seems to have been inaccurate, as changing it to an assert causes many test failures

`@rustbot` label +A-closures
2023-03-31 22:32:49 +02:00
Guillaume Gomez
6c93c63771
Rollup merge of #109443 - GuillaumeGomez:doc-primitive-hard-error, r=notriddle
Move `doc(primitive)` future incompat warning to `invalid_doc_attributes`

Fixes #88070.

It's been a while since this was turned into a "future incompatible lint" so I think we can now turn it into a hard error without problem.

r? `@jyn514`
2023-03-31 22:32:49 +02:00
Guillaume Gomez
8fe5b56b66
Rollup merge of #109104 - GuillaumeGomez:fix-invalid-suggestion-ambiguous-intra-doc2, r=oli-obk,notriddle
rustdoc: Fix invalid suggestions on ambiguous intra doc links v2

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

This is another approach to fixing the same issue. This time, we keep the computed information around instead of re-computing it.

Strangely enough, the order for ambiguities seem to have been changed. Not an issue but it creates a lot of diff...

So which version do you prefer?

r? `@notriddle`
2023-03-31 22:32:48 +02:00
bors
7402519c63 Auto merge of #109010 - compiler-errors:rtn, r=eholk
Initial support for return type notation (RTN)

See: https://smallcultfollowing.com/babysteps/blog/2023/02/13/return-type-notation-send-bounds-part-2/

1. Only supports `T: Trait<method(): Send>` style bounds, not `<T as Trait>::method(): Send`. Checking validity and injecting an implicit binder for all of the late-bound method generics is harder to do for the latter.
    * I'd add this in a follow-up.
3. ~Doesn't support RTN in general type position, i.e. no `let x: <T as Trait>::method() = ...`~
    * I don't think we actually want this.
5. Doesn't add syntax for "eliding" the function args -- i.e. for now, we write `method(): Send` instead of `method(..): Send`.
    * May be a hazard if we try to add it in the future. I'll probably add it in a follow-up later, with a structured suggestion to change `method()` to `method(..)` once we add it.
7. ~I'm not in love with the feature gate name 😺~
    * I renamed it to `return_type_notation` ✔️

Follow-up PRs will probably add support for `where T::method(): Send` bounds. I'm not sure if we ever want to support return-type-notation in arbitrary type positions. I may also make the bounds require `..` in the args list later.

r? `@ghost`
2023-03-31 18:04:12 +00:00
Michael Howell
54ef3a4786 rustdoc-search: update docs for comma in ? help popover 2023-03-31 10:18:44 -07:00
Ali MJ Al-Nasrawy
a42cbdb165 allow ReError in CanonicalUserTypeAnnotation 2023-03-31 14:53:42 +00:00
Guillaume Gomez
efad057eed Add tests to check that collapsed content is expanded when jumping to it 2023-03-31 16:51:50 +02:00
Guillaume Gomez
aab9e32094 Update browser-ui-test version to 0.14.6 2023-03-31 16:02:22 +02:00
bors
480068c235 Auto merge of #109787 - scottmcm:index-slice, r=cjgillot
Add `IndexSlice` to go with `IndexVec`

Moves the methods that don't need full `IndexVec`-ness over to `IndexSlice`, and have `IndexVec` deref to `IndexSlice` so everything keeps working.

Doing this for later use in https://github.com/rust-lang/compiler-team/issues/606, where I'm hitting a bunch of things that are just slices and thus there's no way to index with the `FieldIdx`.
2023-03-31 11:27:38 +00:00
bors
22a7a19f93 Auto merge of #98112 - saethlin:mir-alignment-checks, r=oli-obk
Insert alignment checks for pointer dereferences when debug assertions are enabled

Closes https://github.com/rust-lang/rust/issues/54915

- [x] Jake tells me this sounds like a place to use `MirPatch`, but I can't figure out how to insert a new basic block with a new terminator in the middle of an existing basic block, using `MirPatch`. (if nobody else backs up this point I'm checking this as "not actually a good idea" because the code looks pretty clean to me after rearranging it a bit)
- [x] Using `CastKind::PointerExposeAddress` is definitely wrong, we don't want to expose. Calling a function to get the pointer address seems quite excessive. ~I'll see if I can add a new `CastKind`.~ `CastKind::Transmute` to the rescue!
- [x] Implement a more helpful panic message like slice bounds checking.

r? `@oli-obk`
2023-03-31 08:50:35 +00:00
bors
ec7bb8da11 Auto merge of #109803 - matthiaskrgr:rollup-mojot7k, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #109598 (Improve documentation for str::replace() and str::replacen())
 - #109779 (Update gccjit and remove libc 0.1 dependency)
 - #109784 (Refactor glibc time64 support, riscv32 always has 64-bit `time_t`)
 - #109793 (add comment to `impl !Error for &str`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-31 06:10:06 +00:00
Matthias Krüger
ec276c7e67
Rollup merge of #109793 - lukas-code:negative-impl-comment, r=scottmcm
add comment to `impl !Error for &str`

I saw this impl in the [standard library docs](https://doc.rust-lang.org/nightly/core/error/trait.Error.html#impl-Error-for-%26str) and wondered why it's needed. This commit adds a comment to explain its existence.
2023-03-31 08:03:15 +02:00
Matthias Krüger
0708fbf5cb
Rollup merge of #109784 - beetrees:riscv32-time64, r=cuviper
Refactor glibc time64 support, riscv32 always has 64-bit `time_t`

Refactor existing support for 64-bit `time_t` on 32-bit glibc platforms, as riscv32 `time_t` is 64-bit by default. Split out of #109773.
2023-03-31 08:03:15 +02:00
Matthias Krüger
3f30b514ab
Rollup merge of #109779 - uweigand:s390x-gccjit-libc, r=WaffleLapkin
Update gccjit and remove libc 0.1 dependency

Fixes https://github.com/rust-lang/rust/issues/109774.
2023-03-31 08:03:14 +02:00
Matthias Krüger
41369b734d
Rollup merge of #109598 - veera-sivarajan:improve-wording, r=thomcc
Improve documentation for str::replace() and str::replacen()

Currently, to know what the function will return when the pattern doesn't match, the docs require the reader to understand the implementation detail and mentally evaluate or run the example code. It is not immediately clear.

This PR makes it more explicit so the reader can quickly find the information.
2023-03-31 08:03:14 +02:00
Nicholas Nethercote
4e63ab6fc1 Improve with_source_map.
Rename `with_source_map` as `set_source_map`. Because `with` functions
(e.g. `with_session_globals`, `scoped_tls::ScopedKey::with`) are for
*getting* a value for the duration of a closure, and `set` functions
(e.g. `set_session_globals_then` `scoped_tls::ScopedKey::with`) are for
*setting* a value for the duration of a closure.

Also fix up the comment, which is wrong:
- The bit about `TyCtxt` is wrong.
- `span_debug1` doesn't exist any more.
- There's only one level of fallback, not two.

(This is effectively a follow-up to the changes in #93936.)

Also add a comment explaining that `SessionGlobals::source_map` should
only be used when absolutely necessary.
2023-03-31 15:57:25 +11:00
Nicholas Nethercote
f049d5df10 Remove an unnecessary use of with_session_globals.
We can easily pass in the source map.
2023-03-31 15:34:00 +11:00
Ben Kimock
750707801b Disable the ui panic test on wasm32-bare 2023-03-30 23:46:44 -04:00
bors
eb3e9c1f45 Auto merge of #109762 - scottmcm:variantdef-indexvec, r=WaffleLapkin
Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>`

And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`.

There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places.

Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-31 03:36:18 +00:00
Ali MJ Al-Nasrawy
1a54144349 add test for normalization in implied bounds query
See https://github.com/rust-lang/rust/issues/109799.
2023-03-31 03:27:51 +00:00