Commit Graph

207639 Commits

Author SHA1 Message Date
Yuki Okushi
0db05f16c8
Rollup merge of #102323 - Stoozy:master, r=cjgillot
Trying to suggest additional lifetime parameter

``@cjgillot`` This is what I have so far for #100615
2022-10-10 10:23:04 +09:00
Yuki Okushi
c50e64d872
Rollup merge of #102275 - Urgau:stabilize-half_open_range_patterns, r=cjgillot
Stabilize `half_open_range_patterns`

This PR stabilize `feature(half_open_range_patterns)`:
```
Allows using `..=X` as a pattern.
```

And adds a new `feature(half_open_range_patterns_in_slices)` for the slice part, https://github.com/rust-lang/rust/pull/102275#issuecomment-1267422806.

The FCP was completed in https://github.com/rust-lang/rust/issues/67264.
2022-10-10 10:23:03 +09:00
Scott McMurray
0718aeceb3 From<Alignment> for usize & NonZeroUsize 2022-10-09 15:44:49 -07:00
Guillaume Gomez
550f579816 Add missing documentation for FileNameDisplayPreference variants 2022-10-09 23:32:15 +02:00
bors
1a7c203e7f Auto merge of #89123 - the8472:push_in_capacity, r=amanieu
add Vec::push_within_capacity - fallible, does not allocate

This method can serve several purposes. It

* is fallible
* guarantees that items in Vec aren't moved
* allows loops that do `reserve` and `push` separately to avoid pulling in the allocation machinery a second time in the `push` part which should make things easier on the optimizer
* eases the path towards `ArrayVec` a bit since - compared to `push()` - there are fewer questions around how it should be implemented

I haven't named it `try_push` because that should probably occupy a middle ground that will still try to reserve and only return an error in the unlikely OOM case.

resolves #84649
2022-10-09 21:02:33 +00:00
bors
81f3919303 Auto merge of #102850 - JohnTitor:rollup-lze1w03, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #101118 (fs::get_mode enable getting the data via fcntl/F_GETFL on major BSD)
 - #102072 (Add `ptr::Alignment` type)
 - #102799 (rustdoc: remove hover gap in file picker)
 - #102820 (Show let-else suggestion on stable.)
 - #102829 (rename `ImplItemKind::TyAlias` to `ImplItemKind::Type`)
 - #102831 (Don't use unnormalized type in `Ty::fn_sig` call in rustdoc `clean_middle_ty`)
 - #102834 (Remove unnecessary `lift`/`lift_to_tcx` calls from rustdoc)
 - #102838 (remove cfg(bootstrap) from Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-09 18:15:26 +00:00
Josh Triplett
88bb4e4bda impl AsFd for io::{Stdin, Stdout, Stderr}, not the sys versions
https://github.com/rust-lang/rust/pull/100892 implemented AsFd for the
sys versions, rather than for the public types. Change the
implementations to apply to the public types.
2022-10-09 19:01:56 +01:00
Andres Suarez
a65ddf06e0 update to syn-1.0.102 2022-10-09 13:51:55 -04:00
Sébastien Marie
b3c21efa8a openbsd: don't reallocate a guard page on the stack.
the kernel currently enforce that a stack is immutable. calling mmap(2) or 
mprotect(2) to change it will result in EPERM, which generate a panic!().

so just do like for Linux, and trust the kernel to do the right thing.
2022-10-09 16:45:04 +00:00
Camille GILLOT
e828ce53b9 Skip chained OpaqueCast when building captures. 2022-10-09 16:18:16 +00:00
Yuki Okushi
f59e8afb66
Rollup merge of #102838 - RalfJung:miri-bootstrap, r=oli-obk
remove cfg(bootstrap) from Miri

Looks like this was forgotten in the bootstrap bump.

r? `@oli-obk`
2022-10-10 00:09:43 +09:00
Yuki Okushi
deb93ca060
Rollup merge of #102834 - compiler-errors:unnecessary-lift, r=jyn514
Remove unnecessary `lift`/`lift_to_tcx` calls from rustdoc

Not sure why they were here in the first place
2022-10-10 00:09:43 +09:00
Yuki Okushi
0a9b09f9fd
Rollup merge of #102831 - compiler-errors:rustdoc-norm-oops, r=jyn514
Don't use unnormalized type in `Ty::fn_sig` call in rustdoc `clean_middle_ty`

Self-explanatory

Fixes #102828
2022-10-10 00:09:42 +09:00
Yuki Okushi
24424d0acb
Rollup merge of #102829 - compiler-errors:rename-impl-item-kind, r=TaKO8Ki
rename `ImplItemKind::TyAlias` to `ImplItemKind::Type`

The naming of this variant seems inconsistent given that this is not really a "type alias", and the associated type variant for `TraitItemKind` is just called `Type`.
2022-10-10 00:09:42 +09:00
Yuki Okushi
c5d4456564
Rollup merge of #102820 - ehuss:let-else-nightly-suggestion, r=petrochenkov
Show let-else suggestion on stable.

The E0005 error message has a suggestion to use let-else. Now that let-else is stabilized, I think this message should be included on non-nightly toolchains. I suspect this was just an oversight from #93628.  [`E0005.stderr`](be1c7aad72/src/test/ui/error-codes/E0005.stderr (L22-L25)) contains an example of what this suggestion looks like.
2022-10-10 00:09:41 +09:00
Yuki Okushi
fb27d01922
Rollup merge of #102799 - rol1510:issue-100421-fix, r=notriddle
rustdoc: remove hover gap in file picker

Fixes #100421

Before:
<img width="385" alt="image" src="https://user-images.githubusercontent.com/29011024/194677087-fda2db3e-126d-47cf-8152-c554e3c25a54.png">

After:
<img width="388" alt="image" src="https://user-images.githubusercontent.com/29011024/194676774-7a50ace9-4060-492e-849a-ad85d9132630.png">

longe module names also wrap nicely:
<img width="389" alt="image" src="https://user-images.githubusercontent.com/29011024/194678516-f2497b3a-8d50-439b-9d69-3fa9fb43b84d.png">

Also if you zoom out very far, the arrows did move to the left, in relation to the text below. This is now also fixed.
<img width="818" alt="image" src="https://user-images.githubusercontent.com/29011024/194677652-cfdf129d-f5db-4f26-ac3c-3d0853e89619.png">

CSS doesn't have a lot of controll over the `::marker` element, so now the `::after` element is used to draw the arrows.

Now the whole line is clickable wihtout gaps.
2022-10-10 00:09:41 +09:00
Yuki Okushi
38db483af7
Rollup merge of #102072 - scottmcm:ptr-alignment-type, r=thomcc
Add `ptr::Alignment` type

Essentially no new code here, just exposing the previously-`pub(crate)` `ValidAlign` type under the name from the ACP.

ACP: https://github.com/rust-lang/libs-team/issues/108
Tracking Issue: https://github.com/rust-lang/rust/issues/102070

r? ``@ghost``
2022-10-10 00:09:40 +09:00
Yuki Okushi
d0f1cf5de7
Rollup merge of #101118 - devnexen:fs_getmode_bsd, r=Mark-Simulacrum
fs::get_mode enable getting the data via fcntl/F_GETFL on major BSD

supporting this flag.
2022-10-10 00:09:39 +09:00
bors
1b225414f3 Auto merge of #93668 - SUPERCILEX:path_alloc, r=joshtriplett
Reduce CString allocations in std as much as possible

Currently, every operation involving paths in `fs` allocates memory to hold the path before sending it through the syscall. This PR instead uses a stack allocation (chosen size is somewhat arbitrary) when the path is short before falling back to heap allocations for long paths.

Benchmarks show that the stack allocation is ~2x faster for short paths:

```
test sys::unix::fd::tests::bench_heap_path_alloc                  ... bench:          34 ns/iter (+/- 2)
test sys::unix::fd::tests::bench_stack_path_alloc                 ... bench:          15 ns/iter (+/- 1)
```

For long paths, I couldn't find any measurable difference.

---

I'd be surprised if I was the first to think of this, so I didn't fully flush out the PR. If this change is desirable, I'll make use of `run_with_cstr` across all platforms in every fs method (currently just unix open for testing). I also added an `impl From<FromBytesWithNulError>` which is presumably a no-no (or at least needs to be done in another PR).

---

Also see https://github.com/nix-rust/nix/pull/1655 with a bunch of discussion where I'm doing something similar.
2022-10-09 15:07:10 +00:00
Camille GILLOT
f5fd66e0c2 Elaborate trait ref to compute object safety. 2022-10-09 13:44:21 +00:00
Maybe Waffle
9d4edff1b0 adopt to building infcx 2022-10-09 13:07:21 +00:00
Maybe Waffle
5347c81924 deprecate clippy::for_loops_over_fallibles 2022-10-09 13:07:21 +00:00
Maybe Waffle
40f36fac49 adopt to new rustc lint api 2022-10-09 13:07:21 +00:00
Maybe Waffle
7434b9f0d1 fixup lint name 2022-10-09 13:07:21 +00:00
Maybe Waffle
9c64bb1de1 Fix clippy tests that trigger for_loop_over_fallibles lint 2022-10-09 13:07:21 +00:00
Maybe Waffle
98e0c4df73 fix for_loop_over_fallibles lint docs 2022-10-09 13:07:21 +00:00
Maybe Waffle
6766113c87 remove an infinite loop 2022-10-09 13:07:21 +00:00
Maybe Waffle
b9b2059e84 Edit documentation for for_loop_over_fallibles lint 2022-10-09 13:07:20 +00:00
Maybe Waffle
75ae20a42f allow for_loop_over_fallibles in a core test 2022-10-09 13:07:20 +00:00
Maybe Waffle
0250f0244b allow or avoid for loops over option in compiler and tests 2022-10-09 13:07:20 +00:00
Maybe Waffle
8ca57b54c1 for_loop_over_fallibles: don't use MachineApplicable
The loop could contain `break;` that won't work with an `if let`
2022-10-09 13:05:53 +00:00
Maybe Waffle
23a7674e3e for_loop_over_fallibles: fix suggestion for "remove .next()" case
if the iterator is used after the loop, we need to use `.by_ref()`
2022-10-09 13:05:53 +00:00
Maybe Waffle
7308564423 Add a test for the for_loop_over_fallibles lint 2022-10-09 13:05:53 +00:00
Maybe Waffle
dd842ffc3d for_loop_over_fallibles: remove duplication from the message 2022-10-09 13:05:53 +00:00
Maybe Waffle
b2975ee974 for_loop_over_fallibles: suggest using ? in some cases 2022-10-09 13:05:52 +00:00
Maybe Waffle
5dcfdbf31e for_loop_over_fallibles: suggest while let loop 2022-10-09 13:05:52 +00:00
Maybe Waffle
21ec99b6fa for_loop_over_fallibles: Suggest removing .next() 2022-10-09 13:05:52 +00:00
Maybe Waffle
d030ba52e2 Use structured suggestions for for_loop_over_fallibles lint 2022-10-09 13:05:52 +00:00
Maybe Waffle
fa380a82a5 Start uplifting clippy::for_loops_over_fallibles
I refactored the code:
- Removed handling of methods, as it felt entirely unnecessary
- Removed clippy utils (obviously...)
- Used some shiny compiler features
  (let-else is very handy for lints 👀)
- I also renamed the lint to `for_loop_over_fallibles` (note: no `s`).
  I'm not sure what's the naming convention here, so maybe I'm wrong.
2022-10-09 13:05:52 +00:00
bors
79a664d8b0 Auto merge of #102332 - chriswailes:ndk-update, r=chriswailes
Update CI to use Android NDK r25b

This commit updates the CI definitions to use the most recent Android LTS NDK release: r25b.  Changes since the last NDK used by Rust negate the need to generate "standalone toolchains" and newer NDKs can be used in-place.

See https://developer.android.com/ndk/guides/other_build_systems#overview
2022-10-09 11:33:02 +00:00
Ralf Jung
d47d390703 remove cfg(bootstrap) from Miri 2022-10-09 12:16:02 +02:00
Vadim Petrochenkov
28fdcade79 rustc_target: Fix json target specs using LLD linker flavors in link args 2022-10-09 13:34:12 +04:00
Jakub Beránek
cc475f5ef2
Use BOLT in x64 dist CI to optimize LLVM 2022-10-09 11:31:09 +02:00
Michael Goulet
9a4d4d5e6b Remove unnecessary lift calls from rustdoc 2022-10-09 09:07:03 +00:00
Roland Strasser
7fdce6498a rustdoc: fix file picker marker renders twice on ios 2022-10-09 11:02:44 +02:00
bors
c0784109da Auto merge of #102822 - notriddle:rollup-mgfjb62, r=notriddle
Rollup of 8 pull requests

Successful merges:

 - #99818 (don't ICE when normalizing closure input tys)
 - #102514 (Don't repeat lifetime names from outer binder in print)
 - #102661 (rustdoc: Document effect of fundamental types)
 - #102782 (Add regression test for #102124)
 - #102790 (Fix llvm-tblgen for cross compiling)
 - #102807 (Document `rust-docs-json` component)
 - #102812 (Remove empty core::lazy and std::lazy)
 - #102818 (Clean up rustdoc highlight.rs imports a bit)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-09 08:30:14 +00:00
Michael Goulet
7dedb9192d Don't use unnormalized type in Ty::fn_sig 2022-10-09 07:52:33 +00:00
Michael Goulet
70f3c79c50 ImplItemKind::TyAlias => ImplItemKind::Type 2022-10-09 07:09:57 +00:00
Michael Howell
16a1eeacbf
Rollup merge of #102818 - rust-lang:clean-up-highlight-impots, r=Urgau
Clean up rustdoc highlight.rs imports a bit

r? `@Dylan-DPC`
2022-10-08 18:15:02 -07:00
Michael Howell
c58886d428
Rollup merge of #102812 - est31:remove_lazy, r=dtolnay
Remove empty core::lazy and std::lazy

PR #98165 with commits 7c360dc117 and c1a2db3372 has moved all of the components of these modules into different places, namely {std,core}::sync and {std,core}::cell. The empty modules remained. As they are unstable, we can simply remove them.
2022-10-08 18:15:01 -07:00