]> git.lizzy.rs Git - rust.git/log
rust.git
20 months agoRollup merge of #102871 - notriddle:notriddle/trait-impl-anchor, r=GuillaumeGomez
Matthias Krüger [Mon, 10 Oct 2022 18:47:33 +0000 (20:47 +0200)]
Rollup merge of #102871 - notriddle:notriddle/trait-impl-anchor, r=GuillaumeGomez

rustdoc: clean up overly complex `.trait-impl` CSS selectors

When added in 45964368f4a2e31c94e9bcf1cef933c087d21544, these multi-class selectors were present in the initial commit, but no reason was given why the shorter selector wouldn't work.

20 months agoRollup merge of #102846 - zertosh:update-syn, r=dtolnay
Matthias Krüger [Mon, 10 Oct 2022 18:47:33 +0000 (20:47 +0200)]
Rollup merge of #102846 - zertosh:update-syn, r=dtolnay

update to syn-1.0.102

This update removes the only `.gitignore` found in `rustc-src`:

    vendor/syn/tests/.gitignore
    vendor/syn-1.0.91/tests/.gitignore
    vendor/syn-1.0.95/tests/.gitignore

To check-in `rustc-src` for hermetic builds in environments with
restrictive `.gitignore` policies, one has to remove these
`tests/.gitignore` and patch the respective
`.cargo-checksum.json`.`syn` >1.0.101 includes dtolnay/syn@3c49303bed7a,
which removes its `tests/.gitignore`. Now the `syn` crates.io package
has no `.gitignore`.

[`rustc-src`'s `vendor`][] is produced from the root `Cargo.toml`,
`src/tools/rust-analyzer/Cargo.toml`,
`compiler/rustc_codegen_cranelift/Cargo.toml`, and
`src/bootstrap/Cargo.toml`. `rustc_codegen_cranelift` does not use
`syn`.

[`rustc-src`'s `vendor`]:
  https://github.com/rust-lang/rust/blob/c0784109daa0/src/bootstrap/dist.rs#L934-L940

This was produced with:

    cargo update --package syn --precise 1.0.102 \

    cargo update --package syn --precise 1.0.102 \
        --manifest-path src/tools/rust-analyzer/Cargo.toml

    cargo update --package syn --precise 1.0.102 \
        --manifest-path src/bootstrap/Cargo.toml

20 months agoRollup merge of #101789 - gimbles:let, r=estebank
Matthias Krüger [Mon, 10 Oct 2022 18:47:32 +0000 (20:47 +0200)]
Rollup merge of #101789 - gimbles:let, r=estebank

`let`'s not needed in struct field definitions

Fixes #101683

20 months agoRollup merge of #101360 - compiler-errors:multiple-closure-bounds, r=petrochenkov
Matthias Krüger [Mon, 10 Oct 2022 18:47:31 +0000 (20:47 +0200)]
Rollup merge of #101360 - compiler-errors:multiple-closure-bounds, r=petrochenkov

Point out incompatible closure bounds

Fixes #100295

20 months agoAuto merge of #96711 - emilio:inline-slice-clone, r=nikic
bors [Mon, 10 Oct 2022 12:09:21 +0000 (12:09 +0000)]
Auto merge of #96711 - emilio:inline-slice-clone, r=nikic

slice: #[inline] a couple iterator methods.

The one I care about and actually saw in the wild not getting inlined is
clone(). We ended up doing a whole function call for something that just
copies two pointers.

I ended up marking as_slice / as_ref as well because make_slice is
inline(always) itself, and is also the kind of think that can kill
performance in hot loops if you expect it to get inlined. But happy to
undo those.

20 months ago`let` is not allowed in struct field definitions
gimbles [Mon, 10 Oct 2022 11:23:13 +0000 (16:53 +0530)]
`let` is not allowed in struct field definitions

Co-authored-by: jyn514 <jyn514@gmail.com>
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
20 months agoAuto merge of #102875 - Dylan-DPC:rollup-zwcq8h9, r=Dylan-DPC
bors [Mon, 10 Oct 2022 09:12:06 +0000 (09:12 +0000)]
Auto merge of #102875 - Dylan-DPC:rollup-zwcq8h9, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #99696 (Uplift `clippy::for_loops_over_fallibles` lint into rustc)
 - #102055 (Move some tests to more reasonable directories)
 - #102786 (Remove tuple candidate, nothing special about it)
 - #102794 (Make tests capture the error printed by a Result return)
 - #102853 (Skip chained OpaqueCast when building captures.)
 - #102868 (Rename `AssocItemKind::TyAlias` to `AssocItemKind::Type`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

20 months agoRollup merge of #102868 - compiler-errors:rename-assoc-tyalias-to-ty, r=TaKO8Ki
Dylan DPC [Mon, 10 Oct 2022 08:13:43 +0000 (13:43 +0530)]
Rollup merge of #102868 - compiler-errors:rename-assoc-tyalias-to-ty, r=TaKO8Ki

Rename `AssocItemKind::TyAlias` to `AssocItemKind::Type`

Thanks `@camsteffen` for catching this in ast too, cc https://github.com/rust-lang/rust/pull/102829#issuecomment-1272649247

20 months agoRollup merge of #102853 - cjgillot:skip-opaque-cast, r=jackh726
Dylan DPC [Mon, 10 Oct 2022 08:13:42 +0000 (13:43 +0530)]
Rollup merge of #102853 - cjgillot:skip-opaque-cast, r=jackh726

Skip chained OpaqueCast when building captures.

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

20 months agoRollup merge of #102794 - dtolnay:termination, r=thomcc
Dylan DPC [Mon, 10 Oct 2022 08:13:41 +0000 (13:43 +0530)]
Rollup merge of #102794 - dtolnay:termination, r=thomcc

Make tests capture the error printed by a Result return

An error returned by tests previously would get written directly to stderr, instead of to the capture buffer set up by the test harness. This PR makes it write to the capture buffer so that it can be integrated as part of the test output by build tools such as `buck test`, since being able to read the error message returned by a test is pretty critical to debugging why the test failed.

<br>

**Before:**

```rust
// tests/test.rs

#[test]
fn test() -> Result<(), &'static str> {
    println!("STDOUT");
    eprintln!("STDERR");
    Err("RESULT")
}
```

```console
$ cargo build --test test
$ target/debug/deps/test-???????????????? -Z unstable-options --format=json
{ "type": "suite", "event": "started", "test_count": 1 }
{ "type": "test", "event": "started", "name": "test" }
Error: "RESULT"
{ "type": "test", "name": "test", "event": "failed", "stdout": "STDOUT\nSTDERR\n" }
{ "type": "suite", "event": "failed", "passed": 0, "failed": 1, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": 0.00040313 }
```

**After:**

```console
$ target/debug/deps/test-???????????????? -Z unstable-options --format=json
{ "type": "suite", "event": "started", "test_count": 1 }
{ "type": "test", "event": "started", "name": "test" }
{ "type": "test", "name": "test", "event": "failed", "stdout": "STDOUT\nSTDERR\nError: \"RESULT\"" }
{ "type": "suite", "event": "failed", "passed": 0, "failed": 1, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": 0.000261894 }
```

20 months agoRollup merge of #102786 - compiler-errors:no-tuple-candidate, r=lcnr
Dylan DPC [Mon, 10 Oct 2022 08:13:41 +0000 (13:43 +0530)]
Rollup merge of #102786 - compiler-errors:no-tuple-candidate, r=lcnr

Remove tuple candidate, nothing special about it

r? `@lcnr` you mentioned this during the talk you gave i think

20 months agoRollup merge of #102055 - c410-f3r:moar-errors, r=petrochenkov
Dylan DPC [Mon, 10 Oct 2022 08:13:40 +0000 (13:43 +0530)]
Rollup merge of #102055 - c410-f3r:moar-errors, r=petrochenkov

Move some tests to more reasonable directories

r? ``@petrochenkov``

20 months agoRollup merge of #99696 - WaffleLapkin:uplift, r=fee1-dead
Dylan DPC [Mon, 10 Oct 2022 08:13:40 +0000 (13:43 +0530)]
Rollup merge of #99696 - WaffleLapkin:uplift, r=fee1-dead

Uplift `clippy::for_loops_over_fallibles` lint into rustc

This PR, as the title suggests, uplifts [`clippy::for_loops_over_fallibles`] lint into rustc. This lint warns for code like this:
```rust
for _ in Some(1) {}
for _ in Ok::<_, ()>(1) {}
```
i.e. directly iterating over `Option` and `Result` using `for` loop.

There are a number of suggestions that this PR adds (on top of what clippy suggested):
1. If the argument (? is there a better name for that expression) of a `for` loop is a `.next()` call, then we can suggest removing it (or rather replacing with `.by_ref()` to allow iterator being used later)
   ```rust
    for _ in iter.next() {}
    // turns into
    for _ in iter.by_ref() {}
    ```
2. (otherwise) We can suggest using `while let`, this is useful for non-iterator, iterator-like things like [async] channels
   ```rust
   for _ in rx.recv() {}
   // turns into
   while let Some(_) = rx.recv() {}
   ```
3. If the argument type is `Result<impl IntoIterator, _>` and the body has a `Result<_, _>` type, we can suggest using `?`
   ```rust
   for _ in f() {}
   // turns into
   for _ in f()? {}
   ```
4. To preserve the original behavior and clear intent, we can suggest using `if let`
   ```rust
   for _ in f() {}
   // turns into
   if let Some(_) = f() {}
   ```
(P.S. `Some` and `Ok` are interchangeable depending on the type)

I still feel that the lint wording/look is somewhat off, so I'll be happy to hear suggestions (on how to improve suggestions :D)!

Resolves #99272

[`clippy::for_loops_over_fallibles`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_fallibles

20 months agorustdoc: clean up overly complex `.trait-impl` CSS selectors
Michael Howell [Mon, 10 Oct 2022 06:19:50 +0000 (23:19 -0700)]
rustdoc: clean up overly complex `.trait-impl` CSS selectors

When added in 45964368f4a2e31c94e9bcf1cef933c087d21544, these multi-class
selectors were present in the initial commit, but no reason was given why
the shorter selector wouldn't work.

20 months agoAuto merge of #94381 - Kobzol:llvm-bolt, r=Mark-Simulacrum
bors [Mon, 10 Oct 2022 06:18:58 +0000 (06:18 +0000)]
Auto merge of #94381 - Kobzol:llvm-bolt, r=Mark-Simulacrum

Use BOLT in CI to optimize LLVM

This PR adds an optimization step in the Linux `dist` CI pipeline that uses [BOLT](https://github.com/llvm/llvm-project/tree/main/bolt) to optimize the `libLLVM.so` library built by boostrap.

Steps:
- [x] Use LLVM 15 as a bootstrap compiler and use it to build BOLT
- [x] Compile LLVM with support for relocations (`-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-q"`)
- [x] Gather profile data using instrumented LLVM
- [x] Apply profile to LLVM that has already been PGOfied
- [x] Run with BOLT profiling on more benchmarks
- [x] Decide on the order of optimization (PGO -> BOLT?)
- [x] Decide how we should get `bolt` (currently we use the host `bolt`)
- [x] Clean up

The latest perf results can be found [here](https://github.com/rust-lang/rust/pull/94381#issuecomment-1258269440). The current CI build time with BOLT applied is around 1h 55 minutes.

20 months agoPoint out incompatible closure bounds
Michael Goulet [Sat, 3 Sep 2022 04:57:21 +0000 (04:57 +0000)]
Point out incompatible closure bounds

20 months agoAuto merge of #102867 - JohnTitor:rollup-qnwsajt, r=JohnTitor
bors [Mon, 10 Oct 2022 03:20:03 +0000 (03:20 +0000)]
Auto merge of #102867 - JohnTitor:rollup-qnwsajt, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #102275 (Stabilize `half_open_range_patterns`)
 - #102323 (Trying to suggest additional lifetime parameter)
 - #102345 (Recover from impl Trait in type param bound)
 - #102845 (Elaborate trait ref to compute object safety.)
 - #102860 (Add missing documentation for FileNameDisplayPreference variants)
 - #102862 (From<Alignment> for usize & NonZeroUsize)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

20 months agoRename AssocItemKind::TyAlias to AssocItemKind::Type
Michael Goulet [Mon, 10 Oct 2022 02:05:24 +0000 (02:05 +0000)]
Rename AssocItemKind::TyAlias to AssocItemKind::Type

20 months agoRollup merge of #102862 - scottmcm:more-alignment-traits, r=thomcc
Yuki Okushi [Mon, 10 Oct 2022 01:23:06 +0000 (10:23 +0900)]
Rollup merge of #102862 - scottmcm:more-alignment-traits, r=thomcc

From<Alignment> for usize & NonZeroUsize

Since you mentioned these two in https://github.com/rust-lang/rust/pull/102072#issuecomment-1272390033,
r? ``@thomcc``

Tracking Issue: https://github.com/rust-lang/rust/issues/102070

20 months agoRollup merge of #102860 - GuillaumeGomez:missing-docs-FileNameDisplayPreference,...
Yuki Okushi [Mon, 10 Oct 2022 01:23:05 +0000 (10:23 +0900)]
Rollup merge of #102860 - GuillaumeGomez:missing-docs-FileNameDisplayPreference, r=nagisa

Add missing documentation for FileNameDisplayPreference variants

Took me a while to find the information when I needed it so hopefully it should save some time for the next ones.

r? ``@thomcc``

20 months agoRollup merge of #102845 - cjgillot:gat-object, r=fee1-dead
Yuki Okushi [Mon, 10 Oct 2022 01:23:05 +0000 (10:23 +0900)]
Rollup merge of #102845 - cjgillot:gat-object, r=fee1-dead

Elaborate trait ref to compute object safety.

instead of building them manually from supertraits and associated items.

This allows to have the correct substs for GATs.

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

20 months agoRollup merge of #102345 - chenyukang:fix-102182-impl-trait, r=estebank
Yuki Okushi [Mon, 10 Oct 2022 01:23:04 +0000 (10:23 +0900)]
Rollup merge of #102345 - chenyukang:fix-102182-impl-trait, r=estebank

Recover from impl Trait in type param bound

Fixes #102182
r? ``@estebank``

20 months agoRollup merge of #102323 - Stoozy:master, r=cjgillot
Yuki Okushi [Mon, 10 Oct 2022 01:23:04 +0000 (10:23 +0900)]
Rollup merge of #102323 - Stoozy:master, r=cjgillot

Trying to suggest additional lifetime parameter

``@cjgillot`` This is what I have so far for #100615

20 months agoRollup merge of #102275 - Urgau:stabilize-half_open_range_patterns, r=cjgillot
Yuki Okushi [Mon, 10 Oct 2022 01:23:03 +0000 (10:23 +0900)]
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.

20 months agoFrom<Alignment> for usize & NonZeroUsize
Scott McMurray [Sun, 9 Oct 2022 22:12:43 +0000 (15:12 -0700)]
From<Alignment> for usize & NonZeroUsize

20 months agoAdd missing documentation for FileNameDisplayPreference variants
Guillaume Gomez [Sun, 9 Oct 2022 20:49:23 +0000 (22:49 +0200)]
Add missing documentation for FileNameDisplayPreference variants

20 months agoAuto merge of #89123 - the8472:push_in_capacity, r=amanieu
bors [Sun, 9 Oct 2022 21:02:33 +0000 (21:02 +0000)]
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

20 months agoAuto merge of #102850 - JohnTitor:rollup-lze1w03, r=JohnTitor
bors [Sun, 9 Oct 2022 18:15:26 +0000 (18:15 +0000)]
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

20 months agoupdate to syn-1.0.102
Andres Suarez [Sun, 9 Oct 2022 03:25:40 +0000 (23:25 -0400)]
update to syn-1.0.102

20 months agoSkip chained OpaqueCast when building captures.
Camille GILLOT [Sun, 9 Oct 2022 16:15:16 +0000 (16:15 +0000)]
Skip chained OpaqueCast when building captures.

20 months agoRollup merge of #102838 - RalfJung:miri-bootstrap, r=oli-obk
Yuki Okushi [Sun, 9 Oct 2022 15:09:43 +0000 (00:09 +0900)]
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`

20 months agoRollup merge of #102834 - compiler-errors:unnecessary-lift, r=jyn514
Yuki Okushi [Sun, 9 Oct 2022 15:09:43 +0000 (00:09 +0900)]
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

20 months agoRollup merge of #102831 - compiler-errors:rustdoc-norm-oops, r=jyn514
Yuki Okushi [Sun, 9 Oct 2022 15:09:42 +0000 (00:09 +0900)]
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

20 months agoRollup merge of #102829 - compiler-errors:rename-impl-item-kind, r=TaKO8Ki
Yuki Okushi [Sun, 9 Oct 2022 15:09:42 +0000 (00:09 +0900)]
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`.

20 months agoRollup merge of #102820 - ehuss:let-else-nightly-suggestion, r=petrochenkov
Yuki Okushi [Sun, 9 Oct 2022 15:09:41 +0000 (00:09 +0900)]
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`](https://github.com/ehuss/rust/blob/be1c7aad723126b2ea65543b4ceed54167b841a2/src/test/ui/error-codes/E0005.stderr#L22-L25) contains an example of what this suggestion looks like.

20 months agoRollup merge of #102799 - rol1510:issue-100421-fix, r=notriddle
Yuki Okushi [Sun, 9 Oct 2022 15:09:41 +0000 (00:09 +0900)]
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.

20 months agoRollup merge of #102072 - scottmcm:ptr-alignment-type, r=thomcc
Yuki Okushi [Sun, 9 Oct 2022 15:09:40 +0000 (00:09 +0900)]
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``

20 months agoRollup merge of #101118 - devnexen:fs_getmode_bsd, r=Mark-Simulacrum
Yuki Okushi [Sun, 9 Oct 2022 15:09:39 +0000 (00:09 +0900)]
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.

20 months agoAuto merge of #93668 - SUPERCILEX:path_alloc, r=joshtriplett
bors [Sun, 9 Oct 2022 15:07:10 +0000 (15:07 +0000)]
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.

20 months agoElaborate trait ref to compute object safety.
Camille GILLOT [Sun, 9 Oct 2022 13:34:42 +0000 (13:34 +0000)]
Elaborate trait ref to compute object safety.

20 months agoadopt to building infcx
Maybe Waffle [Fri, 7 Oct 2022 18:21:32 +0000 (18:21 +0000)]
adopt to building infcx

20 months agodeprecate `clippy::for_loops_over_fallibles`
Maybe Waffle [Fri, 7 Oct 2022 17:08:29 +0000 (17:08 +0000)]
deprecate `clippy::for_loops_over_fallibles`

20 months agoadopt to new rustc lint api
Maybe Waffle [Fri, 7 Oct 2022 16:52:41 +0000 (16:52 +0000)]
adopt to new rustc lint api

20 months agofixup lint name
Maybe Waffle [Fri, 7 Oct 2022 15:59:39 +0000 (15:59 +0000)]
fixup lint name

20 months agoFix clippy tests that trigger `for_loop_over_fallibles` lint
Maybe Waffle [Thu, 25 Aug 2022 10:03:13 +0000 (14:03 +0400)]
Fix clippy tests that trigger `for_loop_over_fallibles` lint

20 months agofix `for_loop_over_fallibles` lint docs
Maybe Waffle [Thu, 18 Aug 2022 07:43:10 +0000 (11:43 +0400)]
fix `for_loop_over_fallibles` lint docs

20 months agoremove an infinite loop
Maybe Waffle [Mon, 15 Aug 2022 01:22:00 +0000 (05:22 +0400)]
remove an infinite loop

20 months agoEdit documentation for `for_loop_over_fallibles` lint
Maybe Waffle [Sun, 14 Aug 2022 17:42:29 +0000 (21:42 +0400)]
Edit documentation for `for_loop_over_fallibles` lint

20 months agoallow `for_loop_over_fallibles` in a `core` test
Maybe Waffle [Tue, 26 Jul 2022 12:19:58 +0000 (16:19 +0400)]
allow `for_loop_over_fallibles` in a `core` test

20 months agoallow or avoid for loops over option in compiler and tests
Maybe Waffle [Tue, 26 Jul 2022 10:17:15 +0000 (14:17 +0400)]
allow or avoid for loops over option in compiler and tests

20 months ago`for_loop_over_fallibles`: don't use `MachineApplicable`
Maybe Waffle [Sun, 24 Jul 2022 21:04:27 +0000 (01:04 +0400)]
`for_loop_over_fallibles`: don't use `MachineApplicable`

The loop could contain `break;` that won't work with an `if let`

20 months ago`for_loop_over_fallibles`: fix suggestion for "remove `.next()`" case
Maybe Waffle [Sun, 24 Jul 2022 20:58:04 +0000 (00:58 +0400)]
`for_loop_over_fallibles`: fix suggestion for "remove `.next()`" case

if the iterator is used after the loop, we need to use `.by_ref()`

20 months agoAdd a test for the `for_loop_over_fallibles` lint
Maybe Waffle [Sun, 24 Jul 2022 20:37:11 +0000 (00:37 +0400)]
Add a test for the `for_loop_over_fallibles` lint

20 months ago`for_loop_over_fallibles`: remove duplication from the message
Maybe Waffle [Sun, 24 Jul 2022 20:17:18 +0000 (00:17 +0400)]
`for_loop_over_fallibles`: remove duplication from the message

20 months ago`for_loop_over_fallibles`: suggest using `?` in some cases
Maybe Waffle [Sun, 24 Jul 2022 19:46:04 +0000 (23:46 +0400)]
`for_loop_over_fallibles`: suggest using `?` in some cases

20 months ago`for_loop_over_fallibles`: suggest `while let` loop
Maybe Waffle [Sun, 24 Jul 2022 17:16:44 +0000 (21:16 +0400)]
`for_loop_over_fallibles`: suggest `while let` loop

20 months ago`for_loop_over_fallibles`: Suggest removing `.next()`
Maybe Waffle [Sun, 24 Jul 2022 17:07:23 +0000 (21:07 +0400)]
`for_loop_over_fallibles`: Suggest removing `.next()`

20 months agoUse structured suggestions for `for_loop_over_fallibles` lint
Maybe Waffle [Mon, 18 Jul 2022 17:08:59 +0000 (21:08 +0400)]
Use structured suggestions for `for_loop_over_fallibles` lint

20 months agoStart uplifting `clippy::for_loops_over_fallibles`
Maybe Waffle [Sun, 17 Jul 2022 22:58:59 +0000 (02:58 +0400)]
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 :eyes:)
- 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.

20 months agoAuto merge of #102332 - chriswailes:ndk-update, r=chriswailes
bors [Sun, 9 Oct 2022 11:33:02 +0000 (11:33 +0000)]
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

20 months agoremove cfg(bootstrap) from Miri
Ralf Jung [Sun, 9 Oct 2022 10:16:02 +0000 (12:16 +0200)]
remove cfg(bootstrap) from Miri

20 months agoUse BOLT in x64 dist CI to optimize LLVM
Jakub Beránek [Sun, 2 Oct 2022 07:44:04 +0000 (09:44 +0200)]
Use BOLT in x64 dist CI to optimize LLVM

20 months agoRemove unnecessary lift calls from rustdoc
Michael Goulet [Sun, 9 Oct 2022 09:07:03 +0000 (09:07 +0000)]
Remove unnecessary lift calls from rustdoc

20 months agorustdoc: fix file picker marker renders twice on ios
Roland Strasser [Sat, 8 Oct 2022 13:26:06 +0000 (15:26 +0200)]
rustdoc: fix file picker marker renders twice on ios

20 months agoAuto merge of #102822 - notriddle:rollup-mgfjb62, r=notriddle
bors [Sun, 9 Oct 2022 08:30:14 +0000 (08:30 +0000)]
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

20 months agoDon't use unnormalized type in Ty::fn_sig
Michael Goulet [Sun, 9 Oct 2022 07:52:15 +0000 (07:52 +0000)]
Don't use unnormalized type in Ty::fn_sig

20 months agoImplItemKind::TyAlias => ImplItemKind::Type
Michael Goulet [Sun, 9 Oct 2022 07:09:57 +0000 (07:09 +0000)]
ImplItemKind::TyAlias => ImplItemKind::Type

20 months agoRollup merge of #102818 - rust-lang:clean-up-highlight-impots, r=Urgau
Michael Howell [Sun, 9 Oct 2022 01:15:02 +0000 (18:15 -0700)]
Rollup merge of #102818 - rust-lang:clean-up-highlight-impots, r=Urgau

Clean up rustdoc highlight.rs imports a bit

r? `@Dylan-DPC`

20 months agoRollup merge of #102812 - est31:remove_lazy, r=dtolnay
Michael Howell [Sun, 9 Oct 2022 01:15:01 +0000 (18:15 -0700)]
Rollup merge of #102812 - est31:remove_lazy, r=dtolnay

Remove empty core::lazy and std::lazy

PR #98165 with commits 7c360dc117d554a11f7193505da0835c4b890c6f and c1a2db3372a4d6896744919284f3287650a38ab7 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.

20 months agoRollup merge of #102807 - aDotInTheVoid:rdj-rustup-docs, r=jyn514
Michael Howell [Sun, 9 Oct 2022 01:15:01 +0000 (18:15 -0700)]
Rollup merge of #102807 - aDotInTheVoid:rdj-rustup-docs, r=jyn514

Document `rust-docs-json` component

Follow up to #102241

r? ````@jyn514````

20 months agoRollup merge of #102790 - cuviper:llvm-tblgen, r=jyn514
Michael Howell [Sun, 9 Oct 2022 01:15:01 +0000 (18:15 -0700)]
Rollup merge of #102790 - cuviper:llvm-tblgen, r=jyn514

Fix llvm-tblgen for cross compiling

- Let llvm-config tell us where to find its tools
- Add llvm-tblgen to rust-dev for cross-compiling

Fixes #86890.
r? ````@jyn514````

20 months agoRollup merge of #102782 - Hosshii:issue-102124, r=Mark-Simulacrum
Michael Howell [Sun, 9 Oct 2022 01:15:00 +0000 (18:15 -0700)]
Rollup merge of #102782 - Hosshii:issue-102124, r=Mark-Simulacrum

Add regression test for #102124

closes #102124, which was already fixed on nightly.

20 months agoRollup merge of #102661 - chrysn-pull-requests:rustdoc-effect-of-fundamental, r=notriddle
Michael Howell [Sun, 9 Oct 2022 01:15:00 +0000 (18:15 -0700)]
Rollup merge of #102661 - chrysn-pull-requests:rustdoc-effect-of-fundamental, r=notriddle

rustdoc: Document effect of fundamental types

This was implemented in https://github.com/rust-lang/rust/pull/96565, but not documented. But it's a useful feature for everyone who implements own wrapper (especially wrappers-around-pointers) types, so that they can behave like pointers (and stdlib wrappers) do -- so here goes a mention in the unstable section of the rustdoc book.

(That is where I initially looked to find tricks for making my own wrapper types be transparent to documentation).

20 months agoRollup merge of #102514 - b-naber:binder-print-fixes, r=jackh726
Michael Howell [Sun, 9 Oct 2022 01:14:59 +0000 (18:14 -0700)]
Rollup merge of #102514 - b-naber:binder-print-fixes, r=jackh726

Don't repeat lifetime names from outer binder in print

Fixes https://github.com/rust-lang/rust/issues/102392
Fixes https://github.com/rust-lang/rust/issues/102414

r? ```@lcnr```

20 months agoRollup merge of #99818 - aliemjay:fix-closure-normalize, r=jackh726
Michael Howell [Sun, 9 Oct 2022 01:14:59 +0000 (18:14 -0700)]
Rollup merge of #99818 - aliemjay:fix-closure-normalize, r=jackh726

don't ICE when normalizing closure input tys

We were ICEing while rendering diagnostics because `universe_causes` is expected to track every universe created in the typeck's infcx.

`normalize_and_add_constraints` doesn't update `universe_causes`
when creating new universes, causing an ICE. Remove it!

Add spans to better track normalization constraints.

Fix couple places where `universe_causes` is not updated correctly to
track newly added universes.

Fixes #102800

~Fixess #99665~ (UPDATE: no longer true; the issue has a different failure path than when this PR was created and should be fixed by #101708, but the changes in this PR are still correct and should prevent potential future ICEs)

20 months agoAuto merge of #102819 - matthiaskrgr:rollup-xwnvofc, r=matthiaskrgr
bors [Sat, 8 Oct 2022 21:43:25 +0000 (21:43 +0000)]
Auto merge of #102819 - matthiaskrgr:rollup-xwnvofc, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #99194 (Fix gdb-cmd for rust-gdbgui)
 - #99880 (`EscapeAscii` is not an `ExactSizeIterator`)
 - #102524 (rustdoc: remove weird `<a href="#">` wrapper around unsafe triangle)
 - #102581 (Make the `config.src` handling for downloadable bootstrap more conservative)
 - #102604 (Improve readability of bootstrap's README)
 - #102723 (test: run-make: skip when cross-compiling)
 - #102815 (rustdoc: remove mobile topbar from source pages instead of hiding it)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

20 months agoShow let-else suggestion on stable.
Eric Huss [Sat, 8 Oct 2022 21:39:25 +0000 (14:39 -0700)]
Show let-else suggestion on stable.

20 months agoRollup merge of #102815 - notriddle:notriddle/mobile-topbar, r=GuillaumeGomez
Matthias Krüger [Sat, 8 Oct 2022 21:32:05 +0000 (23:32 +0200)]
Rollup merge of #102815 - notriddle:notriddle/mobile-topbar, r=GuillaumeGomez

rustdoc: remove mobile topbar from source pages instead of hiding it

20 months agoRollup merge of #102723 - pcc:run-make-cc, r=Mark-Simulacrum
Matthias Krüger [Sat, 8 Oct 2022 21:32:04 +0000 (23:32 +0200)]
Rollup merge of #102723 - pcc:run-make-cc, r=Mark-Simulacrum

test: run-make: skip when cross-compiling

This test fails when targeting aarch64 Android. Instead of adding yet another architecture here (and one that's increasingly more common as the host), let's replace the growing list of architectures with ignore-cross-compile.

20 months agoRollup merge of #102604 - anirudh24seven:anirudh_improve_bootrap_readme_readability...
Matthias Krüger [Sat, 8 Oct 2022 21:32:04 +0000 (23:32 +0200)]
Rollup merge of #102604 - anirudh24seven:anirudh_improve_bootrap_readme_readability, r=Mark-Simulacrum

Improve readability of bootstrap's README

Improve readability of bootstrap's README by adding commas & minor changes

20 months agoRollup merge of #102581 - jyn514:src-detection, r=Mark-Simulacrum
Matthias Krüger [Sat, 8 Oct 2022 21:32:03 +0000 (23:32 +0200)]
Rollup merge of #102581 - jyn514:src-detection, r=Mark-Simulacrum

Make the `config.src` handling for downloadable bootstrap more conservative

In particular, this supports build directories within an unrelated git repository. Fixes https://github.com/rust-lang/rust/issues/102562.

As a side effect, it will fall back to the old logic when the source directory is being built from a tarball within an unrelated git repository. However, that second case is unsupported and untested; we reserve the right to break it in the future.

`@cr1901` can you confirm this fixes your problem?
cc `@kleisauke,` I believe this will also fix your issue (although your use case still isn't supported).

r? `@Mark-Simulacrum`

20 months agoRollup merge of #102524 - notriddle:notriddle/unsafe-function, r=GuillaumeGomez
Matthias Krüger [Sat, 8 Oct 2022 21:32:03 +0000 (23:32 +0200)]
Rollup merge of #102524 - notriddle:notriddle/unsafe-function, r=GuillaumeGomez

rustdoc: remove weird `<a href="#">` wrapper around unsafe triangle

This DOM cleanup changes the color of the triangle, from blue to black, but since it's still a different color from the link it's next to, it should still be noticeable.

# Before

![image](https://user-images.githubusercontent.com/1593513/193352428-929b3026-acc3-448e-9bac-44dddf206b1d.png)

# After

![image](https://user-images.githubusercontent.com/1593513/193352500-2f7a0112-b478-4cc4-9ddb-32ba11575530.png)

20 months agoRollup merge of #99880 - compiler-errors:escape-ascii-is-not-exact-size-iterator...
Matthias Krüger [Sat, 8 Oct 2022 21:32:02 +0000 (23:32 +0200)]
Rollup merge of #99880 - compiler-errors:escape-ascii-is-not-exact-size-iterator, r=thomcc

`EscapeAscii` is not an `ExactSizeIterator`

Fixes #99878

Do we want/need `EscapeAscii` to be an `ExactSizeIterator`? I guess we could precompute the length of the output if so?

20 months agoRollup merge of #99194 - simlay:simlay/update-rust-gdbgui-gdb-args-to-gdb-cmd, r...
Matthias Krüger [Sat, 8 Oct 2022 21:32:01 +0000 (23:32 +0200)]
Rollup merge of #99194 - simlay:simlay/update-rust-gdbgui-gdb-args-to-gdb-cmd, r=Mark-Simulacrum

Fix gdb-cmd for rust-gdbgui

With https://github.com/cs01/gdbgui/pull/198, the way that gdbgui arguments were specified changed. I've tested this with program generated from `cargo new --bin` and it worked as gdbgui should.

Closes #76383.

20 months agoClean up rustdoc highlight.rs imports a bit
Guillaume Gomez [Sat, 8 Oct 2022 20:09:51 +0000 (22:09 +0200)]
Clean up rustdoc highlight.rs imports a bit

20 months agoAuto merge of #102315 - RalfJung:assert_unsafe_precondition, r=thomcc
bors [Sat, 8 Oct 2022 17:59:45 +0000 (17:59 +0000)]
Auto merge of #102315 - RalfJung:assert_unsafe_precondition, r=thomcc

add a few more assert_unsafe_precondition

Add debug-assertion checking for `ptr.read()`, `ptr.write(_)`, and `unreachable_unchecked.`

This is quite useful for [cargo-careful](https://github.com/RalfJung/cargo-careful).

20 months agorustdoc: add test case for dimensions and color of unsafe `<sup>`
Michael Howell [Sat, 8 Oct 2022 16:36:37 +0000 (09:36 -0700)]
rustdoc: add test case for dimensions and color of unsafe `<sup>`

20 months agorustdoc: remove weird `<a href="#">` wrapper around unsafe triangle
Michael Howell [Fri, 30 Sep 2022 20:32:33 +0000 (13:32 -0700)]
rustdoc: remove weird `<a href="#">` wrapper around unsafe triangle

This DOM cleanup changes the color of the triangle, from blue to black, but
since it's still a different color from the link it's next to, it should
still be noticeable.

20 months agorustdoc: remove mobile topbar from source pages instead of hiding it
Michael Howell [Sat, 8 Oct 2022 17:43:23 +0000 (10:43 -0700)]
rustdoc: remove mobile topbar from source pages instead of hiding it

20 months agohandle late-bound vars from inner binders correctly and add test
b-naber [Sat, 8 Oct 2022 13:52:59 +0000 (15:52 +0200)]
handle late-bound vars from inner binders correctly and add test

20 months agoAuto merge of #102809 - matthiaskrgr:rollup-qq62vuv, r=matthiaskrgr
bors [Sat, 8 Oct 2022 14:58:11 +0000 (14:58 +0000)]
Auto merge of #102809 - matthiaskrgr:rollup-qq62vuv, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #101520 (Allow transmutes between the same types after erasing lifetimes)
 - #102675 (Remove `mir::CastKind::Misc`)
 - #102778 (Fix MIR inlining of asm_unwind)
 - #102785 (Remove `DefId` from some `SelectionCandidate` variants)
 - #102788 (Update rustc-dev-guide)
 - #102789 (Update browser UI test version)
 - #102797 (rustdoc: remove no-op CSS `.rightside { position: initial }`)
 - #102798 (rustdoc: add main-heading and example-wrap link CSS to big selector)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

20 months agoRemove empty core::lazy and std::lazy
est31 [Sat, 8 Oct 2022 13:55:15 +0000 (15:55 +0200)]
Remove empty core::lazy and std::lazy

PR #98165 with commits 7c360dc117d554a11f7193505da0835c4b890c6f and c1a2db3372a4d6896744919284f3287650a38ab7
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.

20 months agoRollup merge of #102798 - notriddle:notriddle/text-decoration-underline, r=GuillaumeGomez
Matthias Krüger [Sat, 8 Oct 2022 12:38:21 +0000 (14:38 +0200)]
Rollup merge of #102798 - notriddle:notriddle/text-decoration-underline, r=GuillaumeGomez

rustdoc: add main-heading and example-wrap link CSS to big selector

This makes the stylesheet more consistent about how it handles link hover.

20 months agoRollup merge of #102797 - notriddle:notriddle/rightside-position, r=GuillaumeGomez
Matthias Krüger [Sat, 8 Oct 2022 12:38:21 +0000 (14:38 +0200)]
Rollup merge of #102797 - notriddle:notriddle/rightside-position, r=GuillaumeGomez

rustdoc: remove no-op CSS `.rightside { position: initial }`

This CSS, added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, overrode CSS that was applied to the `.since` class:

https://github.com/rust-lang/rust/blob/34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9/src/librustdoc/html/static/rustdoc.css#L782-L795

The absolute positioning for `.since` was abandoned in favor of always floating it, so this is no longer needed:

https://github.com/rust-lang/rust/commit/5de1391b88007a1d4f7b1517657a86aae352af1e#diff-7dc22a0530802d77c2f2ec9e834024a5657b6eab4055520fca46edc99a544413L902-L904

20 months agoRollup merge of #102789 - GuillaumeGomez:update-browser-ui-test-version, r=notriddle
Matthias Krüger [Sat, 8 Oct 2022 12:38:20 +0000 (14:38 +0200)]
Rollup merge of #102789 - GuillaumeGomez:update-browser-ui-test-version, r=notriddle

Update browser UI test version

It added the possibility to concatenate strings and numbers and updated the `goto` command so it doesn't stand on its own anymore.

r? ````@notriddle````

20 months agoRollup merge of #102788 - joshtriplett:bump-rustc-dev-guide, r=ehuss
Matthias Krüger [Sat, 8 Oct 2022 12:38:20 +0000 (14:38 +0200)]
Rollup merge of #102788 - joshtriplett:bump-rustc-dev-guide, r=ehuss

Update rustc-dev-guide

- .gitattributes: Mark minified javascript as binary to filter greps
- fix very minor punctuation typo
- diagnostic structs: derive on enum (#1477)
- Update running tests with the new flags (#1476)
- Rename typeck to hir_analysis (#1475)
- fix typo and make paragraph consistent (#1474)
- Update about-this-guide.md
- Link to the correct page in "about this guide"
- Update r-a config suggestions
- don't refer to the compile-time interpreter as "Miri" (#1471)
- UPDATE - Diagnostic docs to reflect renamed traits and macros in rustc PR#101558
- Update mdbook and its extensions versions
- Remove unmaintained action
- Update some actions versions
- Fix some typos

Update motivated in large part by the most recent commit, to fix `git
grep`.

20 months agoRollup merge of #102785 - fee1-dead-contrib:rm_autoimpl_defid, r=compiler-errors
Matthias Krüger [Sat, 8 Oct 2022 12:38:19 +0000 (14:38 +0200)]
Rollup merge of #102785 - fee1-dead-contrib:rm_autoimpl_defid, r=compiler-errors

Remove `DefId` from some `SelectionCandidate` variants

They are both from `obligation.predicate.def_id()`, which do not need to be on the `SelectionCandidate`.

cc ````@lcnr```` ````@compiler-errors````

20 months agoRollup merge of #102778 - nbdd0121:mir, r=tmiasko
Matthias Krüger [Sat, 8 Oct 2022 12:38:19 +0000 (14:38 +0200)]
Rollup merge of #102778 - nbdd0121:mir, r=tmiasko

Fix MIR inlining of asm_unwind

The MIR inlining currently doesn't handle inline asm's unwind edge correctly.

This code will cause ICE:
```rust
struct D;

impl Drop for D {
    fn drop(&mut self) {}
}

#[inline(always)]
fn foo() {
    let _d = D;
    unsafe { std::arch::asm!("", options(may_unwind)) };
}

pub fn main() {
    foo();
}
```

This PR fixes this issue. I also take the opportunity to extract common code into a method.

20 months agoRollup merge of #102675 - ouz-a:mir-technical-debt, r=oli-obk
Matthias Krüger [Sat, 8 Oct 2022 12:38:18 +0000 (14:38 +0200)]
Rollup merge of #102675 - ouz-a:mir-technical-debt, r=oli-obk

Remove `mir::CastKind::Misc`

As discussed in #97649 `mir::CastKind::Misc` is not clear, this PR addresses that by creating a new enum variant for every valid cast.

r? ````@oli-obk````

20 months agoRollup merge of #101520 - oli-obk:transmute_lifetimes, r=compiler-errors
Matthias Krüger [Sat, 8 Oct 2022 12:38:18 +0000 (14:38 +0200)]
Rollup merge of #101520 - oli-obk:transmute_lifetimes, r=compiler-errors

Allow transmutes between the same types after erasing lifetimes

r? ````@compiler-errors````  on the impl

fixes #101081

See discussion in the issue and at https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/.23101081.3A.20Regression.20transmuting.20.60RwLockReadGuard.3CT.3A.20.3FSized.3E.E2.80.A6

I think this may need lang team signoff as its implications may go beyond the jurisdiction of T-types

I'll write up a proper summary later